diff --git a/Makefile.am b/Makefile.am index 298f4384d4..2e45f6b40c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,4 +11,4 @@ endif if WITH_SERVER SERVER = server endif -SUBDIRS = moses/src moses-chart/src OnDiskPt/src kenlm/lm moses-cmd/src misc moses-chart-cmd/src CreateOnDisk/src $(MERT) $(SERVER) +SUBDIRS = moses/src moses-chart/src OnDiskPt/src kenlm moses-cmd/src misc moses-chart-cmd/src CreateOnDisk/src $(MERT) $(SERVER) diff --git a/configure.in b/configure.in index 57cbeadf5a..d838c8c6af 100644 --- a/configure.in +++ b/configure.in @@ -174,14 +174,14 @@ fi if test "x$with_kenlm" != 'xno' then SAVE_CPPFLAGS="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -I${with_kenlm}/lm" + CPPFLAGS="$CPPFLAGS -I${with_kenlm}" - AC_CHECK_HEADER(ngram.hh, + AC_CHECK_HEADER(lm/ngram.hh, [AC_DEFINE([HAVE_KENLM], [], [flag for KENLM])], [AC_MSG_ERROR([Cannot find KEN-LM in ${with_kenlm}])]) LIB_KENLM="-lkenlm" - LDFLAGS="$LDFLAGS -L${with_kenlm}/lm" + LDFLAGS="$LDFLAGS -L${with_kenlm}" LIBS="$LIBS $LIB_KENLM" FMTLIBS="$FMTLIBS libkenlm.a" AM_CONDITIONAL([KEN_LM], true) @@ -228,6 +228,6 @@ fi LIBS="$LIBS -lz" -AC_CONFIG_FILES(Makefile OnDiskPt/src/Makefile moses/src/Makefile moses-chart/src/Makefile moses-cmd/src/Makefile moses-chart-cmd/src/Makefile misc/Makefile mert/Makefile server/Makefile CreateOnDisk/src/Makefile kenlm/lm/Makefile) +AC_CONFIG_FILES(Makefile OnDiskPt/src/Makefile moses/src/Makefile moses-chart/src/Makefile moses-cmd/src/Makefile moses-chart-cmd/src/Makefile misc/Makefile mert/Makefile server/Makefile CreateOnDisk/src/Makefile kenlm/Makefile) AC_OUTPUT() diff --git a/kenlm/Makefile.am b/kenlm/Makefile.am new file mode 100644 index 0000000000..0dc8c90b80 --- /dev/null +++ b/kenlm/Makefile.am @@ -0,0 +1,27 @@ +lib_LIBRARIES = libkenlm.a +bin_PROGRAMS = query build_binary + +AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES $(BOOST_CPPFLAGS) +libkenlm_a_SOURCES = \ + lm/lm_exception.cc \ + lm/ngram.cc \ + lm/read_arpa.cc \ + lm/virtual_interface.cc \ + lm/vocab.cc \ + util/string_piece.cc \ + util/scoped.cc \ + util/murmur_hash.cc \ + util/mmap.cc \ + util/file_piece.cc \ + util/ersatz_progress.cc \ + util/exception.cc \ + util/string_piece.cc + +query_SOURCES = lm/ngram_query.cc +query_DEPENDENCIES = libkenlm.a +query_LDADD = -L$(top_srcdir)/kenlm -lkenlm + +build_binary_SOURCES = lm/ngram_build_binary.cc +build_binary_DEPENDENCIES = libkenlm.a +build_binary_LDADD = -L$(top_srcdir)/kenlm -lkenlm + diff --git a/kenlm/lm/Makefile.am b/kenlm/lm/Makefile.am deleted file mode 100644 index 66c080981c..0000000000 --- a/kenlm/lm/Makefile.am +++ /dev/null @@ -1,27 +0,0 @@ -lib_LIBRARIES = libkenlm.a -bin_PROGRAMS = query build_binary - -AM_CPPFLAGS = -W -Wall -ffor-scope -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES $(BOOST_CPPFLAGS) -libkenlm_a_SOURCES = \ - virtual_interface.cc \ - ngram.cc \ - exception.cc \ - read_arpa.cc \ - vocab.cc \ - ../util/string_piece.cc \ - ../util/scoped.cc \ - ../util/murmur_hash.cc \ - ../util/mmap.cc \ - ../util/file_piece.cc \ - ../util/ersatz_progress.cc \ - ../util/exception_util.cc \ - ../util/string_piece.cc - -query_SOURCES = ngram_query.cc -query_DEPENDENCIES = libkenlm.a -query_LDADD = -L$(top_srcdir)/kenlm/lm -lkenlm - -build_binary_SOURCES = ngram_build_binary.cc -build_binary_DEPENDENCIES = libkenlm.a -build_binary_LDADD = -L$(top_srcdir)/kenlm/lm -lkenlm - diff --git a/kenlm/lm/facade.hh b/kenlm/lm/facade.hh index aae3d6f5c7..8b18601764 100644 --- a/kenlm/lm/facade.hh +++ b/kenlm/lm/facade.hh @@ -1,8 +1,8 @@ #ifndef LM_FACADE__ #define LM_FACADE__ -#include "virtual_interface.hh" -#include "../util/string_piece.hh" +#include "lm/virtual_interface.hh" +#include "util/string_piece.hh" #include diff --git a/kenlm/lm/exception.cc b/kenlm/lm/lm_exception.cc similarity index 95% rename from kenlm/lm/exception.cc rename to kenlm/lm/lm_exception.cc index 80a780c8ce..ab2ec52fc0 100644 --- a/kenlm/lm/exception.cc +++ b/kenlm/lm/lm_exception.cc @@ -1,4 +1,4 @@ -#include "exception.hh" +#include "lm/lm_exception.hh" #include #include diff --git a/kenlm/lm/exception.hh b/kenlm/lm/lm_exception.hh similarity index 91% rename from kenlm/lm/exception.hh rename to kenlm/lm/lm_exception.hh index b77739e4cb..9510901260 100644 --- a/kenlm/lm/exception.hh +++ b/kenlm/lm/lm_exception.hh @@ -1,8 +1,8 @@ #ifndef LM_EXCEPTION__ #define LM_EXCEPTION__ -#include "../util/exception_util.hh" -#include "../util/string_piece.hh" +#include "util/exception.hh" +#include "util/string_piece.hh" #include #include diff --git a/kenlm/lm/ngram.cc b/kenlm/lm/ngram.cc index 006b21fcda..c1eb1e74a9 100644 --- a/kenlm/lm/ngram.cc +++ b/kenlm/lm/ngram.cc @@ -1,11 +1,11 @@ #include "ngram.hh" -#include "exception.hh" -#include "read_arpa.hh" -#include "../util/file_piece.hh" -#include "../util/joint_sort.hh" -#include "../util/murmur_hash.hh" -#include "../util/probing_hash_table.hh" +#include "lm/lm_exception.hh" +#include "lm/read_arpa.hh" +#include "util/file_piece.hh" +#include "util/joint_sort.hh" +#include "util/murmur_hash.hh" +#include "util/probing_hash_table.hh" #include #include diff --git a/kenlm/lm/ngram.hh b/kenlm/lm/ngram.hh index ceca07189c..3c4135e7dc 100644 --- a/kenlm/lm/ngram.hh +++ b/kenlm/lm/ngram.hh @@ -1,16 +1,16 @@ #ifndef LM_NGRAM__ #define LM_NGRAM__ -#include "facade.hh" -#include "ngram_config.hh" -#include "vocab.hh" -#include "weights.hh" -#include "../util/key_value_packing.hh" -#include "../util/mmap.hh" -#include "../util/probing_hash_table.hh" -#include "../util/scoped.hh" -#include "../util/sorted_uniform.hh" -#include "../util/string_piece.hh" +#include "lm/facade.hh" +#include "lm/ngram_config.hh" +#include "lm/vocab.hh" +#include "lm/weights.hh" +#include "util/key_value_packing.hh" +#include "util/mmap.hh" +#include "util/probing_hash_table.hh" +#include "util/scoped.hh" +#include "util/sorted_uniform.hh" +#include "util/string_piece.hh" #include #include diff --git a/kenlm/lm/ngram_build_binary.cc b/kenlm/lm/ngram_build_binary.cc index 98d38ab203..9dab30a1c5 100644 --- a/kenlm/lm/ngram_build_binary.cc +++ b/kenlm/lm/ngram_build_binary.cc @@ -1,4 +1,4 @@ -#include "ngram.hh" +#include "lm/ngram.hh" #include diff --git a/kenlm/lm/ngram_query.cc b/kenlm/lm/ngram_query.cc index 4d36af25d7..d197026018 100644 --- a/kenlm/lm/ngram_query.cc +++ b/kenlm/lm/ngram_query.cc @@ -1,4 +1,4 @@ -#include "ngram.hh" +#include "lm/ngram.hh" #include #include diff --git a/kenlm/lm/read_arpa.cc b/kenlm/lm/read_arpa.cc index 32fa422cd5..a1c3d886aa 100644 --- a/kenlm/lm/read_arpa.cc +++ b/kenlm/lm/read_arpa.cc @@ -1,4 +1,4 @@ -#include "read_arpa.hh" +#include "lm/read_arpa.hh" #include #include diff --git a/kenlm/lm/read_arpa.hh b/kenlm/lm/read_arpa.hh index 7b0c7aaa61..4d54a39d9b 100644 --- a/kenlm/lm/read_arpa.hh +++ b/kenlm/lm/read_arpa.hh @@ -1,10 +1,10 @@ #ifndef LM_READ_ARPA__ #define LM_READ_ARPA__ -#include "exception.hh" -#include "weights.hh" -#include "word_index.hh" -#include "../util/file_piece.hh" +#include "lm/lm_exception.hh" +#include "lm/weights.hh" +#include "lm/word_index.hh" +#include "util/file_piece.hh" #include #include diff --git a/kenlm/lm/sri.cc b/kenlm/lm/sri.cc index 3b7496b4cb..a0c83ba1c1 100644 --- a/kenlm/lm/sri.cc +++ b/kenlm/lm/sri.cc @@ -1,5 +1,5 @@ -#include "exception.hh" -#include "sri.hh" +#include "lm/lm_exception.hh" +#include "lm/sri.hh" #include #include diff --git a/kenlm/lm/sri.hh b/kenlm/lm/sri.hh index 3ac4d81e47..b57e9b73a9 100644 --- a/kenlm/lm/sri.hh +++ b/kenlm/lm/sri.hh @@ -1,8 +1,8 @@ #ifndef LM_SRI__ #define LM_SRI__ -#include "facade.hh" -#include "../util/murmur_hash.hh" +#include "lm/facade.hh" +#include "util/murmur_hash.hh" #include #include diff --git a/kenlm/lm/sri_test.cc b/kenlm/lm/sri_test.cc index b142debfb0..e697d7225c 100644 --- a/kenlm/lm/sri_test.cc +++ b/kenlm/lm/sri_test.cc @@ -1,4 +1,4 @@ -#include "sri.hh" +#include "lm/sri.hh" #include diff --git a/kenlm/lm/virtual_interface.cc b/kenlm/lm/virtual_interface.cc index 02469a54c7..2fd17d1383 100644 --- a/kenlm/lm/virtual_interface.cc +++ b/kenlm/lm/virtual_interface.cc @@ -1,5 +1,5 @@ -#include "virtual_interface.hh" -#include "exception.hh" +#include "lm/virtual_interface.hh" +#include "lm/lm_exception.hh" namespace lm { namespace base { diff --git a/kenlm/lm/virtual_interface.hh b/kenlm/lm/virtual_interface.hh index 4d8eedb111..621a129e2a 100644 --- a/kenlm/lm/virtual_interface.hh +++ b/kenlm/lm/virtual_interface.hh @@ -1,8 +1,8 @@ #ifndef LM_VIRTUAL_INTERFACE__ #define LM_VIRTUAL_INTERFACE__ -#include "word_index.hh" -#include "../util/string_piece.hh" +#include "lm/word_index.hh" +#include "util/string_piece.hh" #include diff --git a/kenlm/lm/vocab.cc b/kenlm/lm/vocab.cc index 2aee10d568..0498be3d52 100644 --- a/kenlm/lm/vocab.cc +++ b/kenlm/lm/vocab.cc @@ -1,9 +1,9 @@ -#include "vocab.hh" +#include "lm/vocab.hh" -#include "weights.hh" -#include "../util/joint_sort.hh" -#include "../util/murmur_hash.hh" -#include "../util/probing_hash_table.hh" +#include "lm/weights.hh" +#include "util/joint_sort.hh" +#include "util/murmur_hash.hh" +#include "util/probing_hash_table.hh" #include diff --git a/kenlm/lm/vocab.hh b/kenlm/lm/vocab.hh index 842b2670c8..ff14454d58 100644 --- a/kenlm/lm/vocab.hh +++ b/kenlm/lm/vocab.hh @@ -1,11 +1,11 @@ #ifndef LM_VOCAB__ #define LM_VOCAB__ -#include "virtual_interface.hh" -#include "../util/key_value_packing.hh" -#include "../util/probing_hash_table.hh" -#include "../util/sorted_uniform.hh" -#include "../util/string_piece.hh" +#include "lm/virtual_interface.hh" +#include "util/key_value_packing.hh" +#include "util/probing_hash_table.hh" +#include "util/sorted_uniform.hh" +#include "util/string_piece.hh" namespace lm { diff --git a/kenlm/util/ersatz_progress.cc b/kenlm/util/ersatz_progress.cc index bacb6893de..09e3a106c0 100644 --- a/kenlm/util/ersatz_progress.cc +++ b/kenlm/util/ersatz_progress.cc @@ -1,4 +1,4 @@ -#include "ersatz_progress.hh" +#include "util/ersatz_progress.hh" #include #include diff --git a/kenlm/util/exception_util.cc b/kenlm/util/exception.cc similarity index 95% rename from kenlm/util/exception_util.cc rename to kenlm/util/exception.cc index b41d0b96da..53dbbc4c5f 100644 --- a/kenlm/util/exception_util.cc +++ b/kenlm/util/exception.cc @@ -1,4 +1,4 @@ -#include "exception_util.hh" +#include "util/exception.hh" #include #include diff --git a/kenlm/util/exception_util.hh b/kenlm/util/exception.hh similarity index 98% rename from kenlm/util/exception_util.hh rename to kenlm/util/exception.hh index 40ce896b9f..124689cf52 100644 --- a/kenlm/util/exception_util.hh +++ b/kenlm/util/exception.hh @@ -1,7 +1,7 @@ #ifndef UTIL_EXCEPTION__ #define UTIL_EXCEPTION__ -#include "string_piece.hh" +#include "util/string_piece.hh" #include #include diff --git a/kenlm/util/file_piece.cc b/kenlm/util/file_piece.cc index a11b741294..2b4394992f 100644 --- a/kenlm/util/file_piece.cc +++ b/kenlm/util/file_piece.cc @@ -1,6 +1,6 @@ -#include "file_piece.hh" +#include "util/file_piece.hh" -#include "exception.hh" +#include "util/exception.hh" #include #include diff --git a/kenlm/util/file_piece.hh b/kenlm/util/file_piece.hh index 71406cb2eb..704f0ac602 100644 --- a/kenlm/util/file_piece.hh +++ b/kenlm/util/file_piece.hh @@ -1,11 +1,11 @@ #ifndef UTIL_FILE_PIECE__ #define UTIL_FILE_PIECE__ -#include "ersatz_progress.hh" -#include "exception.hh" -#include "mmap.hh" -#include "scoped.hh" -#include "string_piece.hh" +#include "util/ersatz_progress.hh" +#include "util/exception.hh" +#include "util/mmap.hh" +#include "util/scoped.hh" +#include "util/string_piece.hh" #include diff --git a/kenlm/util/file_piece_test.cc b/kenlm/util/file_piece_test.cc index 3e2e09a759..befb786699 100644 --- a/kenlm/util/file_piece_test.cc +++ b/kenlm/util/file_piece_test.cc @@ -1,4 +1,4 @@ -#include "file_piece.hh" +#include "util/file_piece.hh" #define BOOST_TEST_MODULE FilePieceTest #include diff --git a/kenlm/util/joint_sort.hh b/kenlm/util/joint_sort.hh index a4b8053f50..a2f1c01da4 100644 --- a/kenlm/util/joint_sort.hh +++ b/kenlm/util/joint_sort.hh @@ -5,7 +5,7 @@ * also permuting another range the same way. */ -#include "proxy_iterator.hh" +#include "util/proxy_iterator.hh" #include #include diff --git a/kenlm/util/joint_sort_test.cc b/kenlm/util/joint_sort_test.cc index 5804d109a4..4dc859164d 100644 --- a/kenlm/util/joint_sort_test.cc +++ b/kenlm/util/joint_sort_test.cc @@ -1,4 +1,4 @@ -#include "joint_sort.hh" +#include "util/joint_sort.hh" #define BOOST_TEST_MODULE JointSortTest #include diff --git a/kenlm/util/key_value_packing_test.cc b/kenlm/util/key_value_packing_test.cc index 77716cb831..a0d33fd767 100644 --- a/kenlm/util/key_value_packing_test.cc +++ b/kenlm/util/key_value_packing_test.cc @@ -1,4 +1,4 @@ -#include "key_value_packing.hh" +#include "util/key_value_packing.hh" #include #include diff --git a/kenlm/util/mmap.cc b/kenlm/util/mmap.cc index 0d3d0b0f22..cb19b8ac95 100644 --- a/kenlm/util/mmap.cc +++ b/kenlm/util/mmap.cc @@ -1,6 +1,6 @@ -#include "exception.hh" -#include "mmap.hh" -#include "scoped.hh" +#include "util/exception.hh" +#include "util/mmap.hh" +#include "util/scoped.hh" #include #include diff --git a/kenlm/util/mmap.hh b/kenlm/util/mmap.hh index 1b167a8325..c9068ec9c2 100644 --- a/kenlm/util/mmap.hh +++ b/kenlm/util/mmap.hh @@ -2,7 +2,7 @@ #define UTIL_MMAP__ // Utilities for mmaped files. -#include "scoped.hh" +#include "util/scoped.hh" #include diff --git a/kenlm/util/murmur_hash.cc b/kenlm/util/murmur_hash.cc index 7c51fa44c0..d58a072745 100644 --- a/kenlm/util/murmur_hash.cc +++ b/kenlm/util/murmur_hash.cc @@ -9,7 +9,7 @@ * default option = 0 for seed */ -#include "murmur_hash.hh" +#include "util/murmur_hash.hh" namespace util { diff --git a/kenlm/util/probing_hash_table_test.cc b/kenlm/util/probing_hash_table_test.cc index d61c41fdd4..ff2f5af314 100644 --- a/kenlm/util/probing_hash_table_test.cc +++ b/kenlm/util/probing_hash_table_test.cc @@ -1,6 +1,6 @@ -#include "probing_hash_table.hh" +#include "util/probing_hash_table.hh" -#include "key_value_packing.hh" +#include "util/key_value_packing.hh" #define BOOST_TEST_MODULE ProbingHashTableTest #include diff --git a/kenlm/util/scoped.cc b/kenlm/util/scoped.cc index ba1e273b6d..61394ffc29 100644 --- a/kenlm/util/scoped.cc +++ b/kenlm/util/scoped.cc @@ -1,4 +1,4 @@ -#include "scoped.hh" +#include "util/scoped.hh" #include #include diff --git a/kenlm/util/sorted_uniform_test.cc b/kenlm/util/sorted_uniform_test.cc index ddc1ae0909..4aa4c8aade 100644 --- a/kenlm/util/sorted_uniform_test.cc +++ b/kenlm/util/sorted_uniform_test.cc @@ -1,6 +1,6 @@ -#include "sorted_uniform.hh" +#include "util/sorted_uniform.hh" -#include "key_value_packing.hh" +#include "util/key_value_packing.hh" #include #include diff --git a/kenlm/util/string_piece.cc b/kenlm/util/string_piece.cc index 7f1b54d3ad..6917a6bc19 100644 --- a/kenlm/util/string_piece.cc +++ b/kenlm/util/string_piece.cc @@ -28,7 +28,7 @@ // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. // Copied from strings/stringpiece.cc with modifications -#include "../util/string_piece.hh" +#include "util/string_piece.hh" #ifdef USE_BOOST #include diff --git a/moses/src/LanguageModelKen.cpp b/moses/src/LanguageModelKen.cpp index 741bcb26a9..dd52487e9c 100644 --- a/moses/src/LanguageModelKen.cpp +++ b/moses/src/LanguageModelKen.cpp @@ -23,7 +23,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA #include #include #include -#include "ngram.hh" +#include "lm/ngram.hh" #include "LanguageModelKen.h" #include "TypeDef.h"