Skip to content

Commit

Permalink
Fixed build warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
apathism committed Oct 7, 2019
1 parent 79998e0 commit f538be9
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 20 deletions.
4 changes: 2 additions & 2 deletions core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 2.6)
project(LSPL_CORE)

include(../common/CMakeCommon.cmake)
find_package(Boost COMPONENTS system)
find_package(Boost COMPONENTS system timer)

if(WIN32)
else(WIN32)
Expand Down Expand Up @@ -156,7 +156,7 @@ set(LSPL_BENCHMARK_SOURCES

add_executable(lspl-benchmark ${LSPL_BENCHMARK_SOURCES})

target_link_libraries(lspl-benchmark lspl)
target_link_libraries(lspl-benchmark lspl ${Boost_TIMER_LIBRARY})

# Flags for effective error parsing

Expand Down
24 changes: 12 additions & 12 deletions core/src/test/LsplBenchmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <iostream>
#include <fstream>

#include <boost/timer.hpp>
#include <boost/timer/timer.hpp>

#include <lspl/Namespace.h>
#include <lspl/patterns/Pattern.h>
Expand All @@ -15,6 +15,9 @@
using namespace lspl;
using lspl::uint;
using lspl::morphology::Morphology;
using boost::timer::cpu_timer;

const uint DEFAULT_TIMER_PLACES = 3;

text::TextRef loadTextFromFile( const char * fileName ) {
std::ifstream textStream( fileName );
Expand All @@ -23,9 +26,9 @@ text::TextRef loadTextFromFile( const char * fileName ) {
std::cout << "Loading text from file " << fileName << "... ";
std::cout.flush();

boost::timer tm;
cpu_timer tm;
text::TextRef text = reader.readFromStream( textStream );
std::cout << "Done in " << tm.elapsed() << " seconds" << std::endl;
std::cout << tm.format(DEFAULT_TIMER_PLACES, "Done in %t seconds.") << std::endl;

return text;
}
Expand All @@ -36,7 +39,7 @@ void definePatterns( NamespaceRef ns ) {
std::cout << "Building patterns... ";
std::cout.flush();

boost::timer tm;
cpu_timer tm;

builder->build( "Pact = N V" ); // 5582 [v]
builder->build( "Act = N V <<N=V>>" ); // 4505 [v]
Expand All @@ -47,7 +50,7 @@ void definePatterns( NamespaceRef ns ) {
builder->build( "AEE = N \"è\" N" ); // 446 [v]
builder->build( "ANom = N<c=nom> V" ); // 4199 [v]
builder->build( "AGen = N<c=gen> V" ); // 1373 [v]
std::cout << "Done in " << tm.elapsed() << " seconds." << std::endl;
std::cout << tm.format(DEFAULT_TIMER_PLACES, "Done in %t seconds.") << std::endl;
}

void findPatterns() {
Expand All @@ -58,16 +61,13 @@ void findPatterns() {

for ( uint i = 0; i < ns->getPatternCount(); ++ i ) {
patterns::PatternRef pt = ns->getPatternByIndex( i );
std::cout << "Dumping: ";
pt->dump(std::cout);
std::cout << std::endl << std::endl;

std::cout << "Matching " << pt->getSource() << "... ";
std::cout.flush();

boost::timer tm;
cpu_timer tm;
uint count = text->getMatches( *pt ).size();
std::cout << "Done in " << tm.elapsed() << " seconds, " << count << " matches found"<< std::endl;
std::cout << tm.format(DEFAULT_TIMER_PLACES, "Done in %t seconds, ") << count << " matches found" << std::endl;
}

std::cout << text->getWords( text::attributes::SpeechPart::NOUN ).size() << std::endl;
Expand All @@ -77,9 +77,9 @@ void loadMorphology() {
std::cout << "Loading morphology system... ";
std::cout.flush();

boost::timer tm;
cpu_timer tm;
Morphology::instance();
std::cout << "Done in " << tm.elapsed() << " seconds." << std::endl;
std::cout << tm.format(DEFAULT_TIMER_PLACES, "Done in %t seconds.") << std::endl;
}

int main() {
Expand Down
6 changes: 3 additions & 3 deletions tools/src/RangeSetDecartTreeElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,15 @@ namespace lspl {
RangeSetDecartTreeElement *element) {
_parent_node = element;
}
int RangeSetDecartTreeElement::set_subtree_max_right_part_of_ranges(
void RangeSetDecartTreeElement::set_subtree_max_right_part_of_ranges(
const Range *subtree_max_right_part_of_ranges) {
_subtree_max_right_part_of_ranges = subtree_max_right_part_of_ranges;
}
int RangeSetDecartTreeElement::set_subtree_height(
void RangeSetDecartTreeElement::set_subtree_height(
const int &subtree_height) {
_subtree_height = subtree_height;
}
int RangeSetDecartTreeElement::set_subtree_size(const int &subtree_size) {
void RangeSetDecartTreeElement::set_subtree_size(const int &subtree_size) {
_subtree_size = subtree_size;
}

Expand Down
6 changes: 3 additions & 3 deletions tools/src/RangeSetDecartTreeElement.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ namespace lspl {
void set_left_child(RangeSetDecartTreeElement *element);
void set_right_child(RangeSetDecartTreeElement *element);
void set_parent_node(RangeSetDecartTreeElement *element);
int set_subtree_max_right_part_of_ranges(const Range *subtree_max_right_part_of_ranges);
int set_subtree_height(const int &subtree_height);
int set_subtree_size(const int &subtree_size);
void set_subtree_max_right_part_of_ranges(const Range *subtree_max_right_part_of_ranges);
void set_subtree_height(const int &subtree_height);
void set_subtree_size(const int &subtree_size);

// Returns true, if the element is a left child.
bool IsLeftChild() const;
Expand Down

0 comments on commit f538be9

Please sign in to comment.