Skip to content

Commit

Permalink
make it build with newer ucto version too
Browse files Browse the repository at this point in the history
  • Loading branch information
Ko van der Sloot authored and Ko van der Sloot committed Feb 28, 2019
1 parent ca4735f commit 60d80ad
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
7 changes: 7 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,13 @@ PKG_CHECK_MODULES([ucto], [ucto >= 0.13] )
CXXFLAGS="$CXXFLAGS $ucto_CFLAGS"
LIBS="$ucto_LIBS $LIBS"

UCTO_VERSION=`pkg-config --modversion ucto`
UCTO_INT="${UCTO_VERSION//.}" # no dots
UCTO_INT=$((10#$UCTO_INT)) # no leading 0 (that's octal)
AC_DEFINE_UNQUOTED( [UCTO_INT_VERSION],
[${UCTO_INT}],
[The integer representation of the ucto version])

PKG_CHECK_MODULES([frogdata], [frogdata >= 0.15] )


Expand Down
22 changes: 22 additions & 0 deletions src/ucto_tokenizer_mod.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "ticcutils/Configuration.h"
#include "ticcutils/FileUtils.h"
#include "ticcutils/PrettyPrint.h"
#include "config.h"

using namespace std;
using TiCC::operator<<;
Expand Down Expand Up @@ -220,6 +221,7 @@ bool UctoTokenizer::getPassThru() const {
throw runtime_error( "ucto tokenizer not initialized" );
}

#if UCTO_INT_VERSION < 15
vector<string> UctoTokenizer::tokenize( const string& line ){
if ( tokenizer ){
tokenizer->reset();
Expand All @@ -243,6 +245,26 @@ string UctoTokenizer::tokenizeStream( istream& is ){
else
throw runtime_error( "ucto tokenizer not initialized" );
}
#else
vector<string> UctoTokenizer::tokenize( const string& line ){
if ( tokenizer ){
tokenizer->reset();
tokenizer->tokenizeLine( line );
return tokenizer->getSentences();
}
else
throw runtime_error( "ucto tokenizer not initialized" );
}

string UctoTokenizer::tokenizeStream( istream& is ){
if ( tokenizer ){
vector<Tokenizer::Token> toks = tokenizer->tokenizeOneSentence( is );
return tokenizer->getString( toks );
}
else
throw runtime_error( "ucto tokenizer not initialized" );
}
#endif

folia::Document *UctoTokenizer::tokenize( istream& is ){
if ( tokenizer )
Expand Down

0 comments on commit 60d80ad

Please sign in to comment.