Skip to content

Commit

Permalink
fixed compilation for '--with-folia=yes' No clue if it really works ok
Browse files Browse the repository at this point in the history
  • Loading branch information
kosloot committed Dec 12, 2024
1 parent 9de6b67 commit a49cadc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ AC_ARG_WITH([folia], AS_HELP_STRING([--with-folia], [Build with FoLiA support (d

AS_IF([test "x$with_folia" = "xyes"], [
AC_MSG_NOTICE( [pkg-config search path: $PKG_CONFIG_PATH] )
PKG_CHECK_MODULES([folia],[folia >= 0.10])
PKG_CHECK_MODULES([folia],[folia >= 2.17])
CXXFLAGS="$CXXFLAGS $folia_CFLAGS"
LIBS="$folia_LIBS $LIBS"
AC_DEFINE([WITHFOLIA],[1],[Compile with libfolia support])
Expand Down
1 change: 0 additions & 1 deletion include/classencoder.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
#include <common.h>

#ifdef WITHFOLIA
#include "libfolia/document.h"
#include "libfolia/folia.h"
#endif

Expand Down
10 changes: 5 additions & 5 deletions src/classencoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ void ClassEncoder::processcorpus( istream& IN , unordered_map<string,unsigned in
#ifdef WITHFOLIA
void ClassEncoder::processfoliacorpus(const string & filename, unordered_map<string,unsigned int> & freqlist, unordered_set<string> * vocab) {
folia::Document doc;
doc.readFromFile(filename);
doc.read_from_file(filename);

vector<folia::Word*> words = doc.words();
for (vector<folia::Word*>::iterator iterw = words.begin(); iterw != words.end(); ++iterw) {
folia::Word * word = *iterw;
const folia::Word * word = *iterw;
const string wordtext = word->str();
if ((vocab == NULL) || (vocab->find(word) != vocab->end()) ) {
if ((vocab == NULL) || (vocab->find(wordtext) != vocab->end()) ) {
if ((minlength > 0) || (maxlength > 0)) {
const int l = utf8_strlen(wordtext);
const unsigned int l = utf8_strlen(wordtext);
if (((minlength == 0) || (l >= minlength)) && ((maxlength == 0) || (l <= maxlength))) {
freqlist[wordtext]++;
}
Expand Down Expand Up @@ -467,7 +467,7 @@ void ClassEncoder::encodefile(const std::string & inputfilename, const std::stri
const char zero = 0;
//FoLiA
folia::Document doc;
doc.readFromFile(inputfilename);
doc.read_from_file(inputfilename);

ofstream OUT;
if (append) {
Expand Down

0 comments on commit a49cadc

Please sign in to comment.