mirror of
https://github.com/moses-smt/mosesdecoder.git
synced 2024-09-11 19:27:11 +03:00
.. | ||
bhiksha.cc | ||
bhiksha.hh | ||
binary_format.cc | ||
binary_format.hh | ||
blank.hh | ||
build_binary.cc | ||
clean.sh | ||
compile.sh | ||
config.cc | ||
config.hh | ||
COPYING | ||
COPYING.LESSER | ||
enumerate_vocab.hh | ||
facade.hh | ||
Jamfile | ||
left_test.cc | ||
left.hh | ||
LICENSE | ||
lm_exception.cc | ||
lm_exception.hh | ||
max_order.hh | ||
model_test.cc | ||
model_type.hh | ||
model.cc | ||
model.hh | ||
ngram_query.cc | ||
ngram_query.hh | ||
quantize.cc | ||
quantize.hh | ||
read_arpa.cc | ||
read_arpa.hh | ||
README | ||
return.hh | ||
search_hashed.cc | ||
search_hashed.hh | ||
search_trie.cc | ||
search_trie.hh | ||
test_nounk.arpa | ||
test.arpa | ||
test.sh | ||
trie_sort.cc | ||
trie_sort.hh | ||
trie.cc | ||
trie.hh | ||
virtual_interface.cc | ||
virtual_interface.hh | ||
vocab.cc | ||
vocab.hh | ||
weights.hh | ||
word_index.hh |
Language model inference code by Kenneth Heafield <kenlm at kheafield.com> THE GIT REPOSITORY https://github.com/kpu/kenlm IS WHERE ACTIVE DEVELOPMENT HAPPENS. IT MAY RETURN SILENTLY WRONG ANSWERS OR BE SILENTLY BINARY-INCOMPATIBLE WITH STABLE RELEASES. The website http://kheafield.com/code/kenlm/ has more documentation. If you're a decoder developer, please download the latest version from there instead of copying from another decoder. Two data structures are supported: probing and trie. Probing is a probing hash table with keys that ere 64-bit hashes of n-grams and floats as values. Trie is a fairly standard trie but with bit-level packing so it uses the minimum number of bits to store word indices and pointers. The trie node entries are sorted by word index. Probing is the fastest and uses the most memory. Trie uses the least memory and a bit slower. With trie, resident memory is 58% of IRST's smallest version and 21% of SRI's compact version. Simultaneously, trie CPU's use is 81% of IRST's fastest version and 84% of SRI's fast version. KenLM's probing hash table implementation goes even faster at the expense of using more memory. See http://kheafield.com/code/kenlm/benchmark/. Binary format via mmap is supported. Run ./build_binary to make one then pass the binary file name to the appropriate Model constructor. PLATFORMS murmur_hash.cc and bit_packing.hh perform unaligned reads and writes that make the code architecture-dependent. It has been sucessfully tested on x86_64, x86, and PPC64. ARM support is reportedly working, at least on the iphone, but I cannot test this. Runs on Linux, OS X, Cygwin, and MinGW. Hideo Okuma and Tomoyuki Yoshimura from NICT contributed ports to ARM and MinGW. Hieu Hoang is working on a native Windows port. DECODER DEVELOPERS - I recommend copying the code and distributing it with your decoder. However, please send improvements upstream as indicated in CONTRIBUTORS. - It does not depend on Boost or ICU. If you use ICU, define HAVE_ICU in util/have.hh (uncomment the line) to avoid a name conflict. Defining HAVE_BOOST will let you hash StringPiece. - Most people have zlib. If you don't want to depend on that, comment out #define HAVE_ZLIB in util/have.hh. This will disable loading gzipped ARPA files. - There are two build systems: compile.sh and Jamroot+Jamfile. They're pretty simple and are intended to be reimplemented in your build system. - Use either the interface in lm/model.hh or lm/virtual_interface.hh. Interface documentation is in comments of lm/virtual_interface.hh and lm/model.hh. - There are several possible data structures in model.hh. Use RecognizeBinary in binary_format.hh to determine which one a user has provided. You probably already implement feature functions as an abstract virtual base class with several children. I suggest you co-opt this existing virtual dispatch by templatizing the language model feature implementation on the KenLM model identified by RecognizeBinary. This is the strategy used in Moses and cdec. - See lm/config.hh for tuning options. CONTRIBUTORS Contributions to KenLM are welcome. Please base your contributions on https://github.com/kpu/kenlm and send pull requests (or I might give you commit access). Downstream copies in Moses and cdec are maintained by overwriting them so do not make changes there. The name was Hieu Hoang's idea, not mine.