![]() |
LIMA
Libre Multilingual Analyzer — C++ API
|
Word list for the segmenter's lexicon feature (ngram_descr_t::lexicon_ngram). More...
#include <deeplima/segmentation/impl/segm_lexicon.h>
Public Member Functions | |
| SegmLexicon ()=default | |
| SegmLexicon (const std::string &fn) | |
| void | load (const std::string &fn) |
| size_t | size () const |
| uint32_t | mask (const char32_t *history, size_t n) const |
Static Public Member Functions | |
| static std::u32string | utf8_to_u32 (const std::string &s) |
Static Public Attributes | |
| static constexpr size_t | MAX_LEN = 8 |
| static constexpr uint8_t | BITS = 6 |
Word list for the segmenter's lexicon feature (ngram_descr_t::lexicon_ngram).
For each character, the feature is a 6-bit mask: bit k (k = 0..4) is set when a word of the list of length k + 2 ends at this character, bit 5 when one of length 7 or 8 does. It only looks back (at most MAX_LEN characters), so the streaming reader computes it when it reads the character, with no lookahead; the segmenter's backward RNN carries it to the word's start. Meant for scripts written without spaces (Chinese, Japanese) and for Vietnamese: an external dictionary (CC-CEDICT for Chinese) gives the segmenter the words its treebank lacks (Chinese GSDSimp, a prototype: word F1 89 -> 93).
File: UTF-8, one word per line, the first tab-separated field (a count or other columns may follow); words shorter than 2 or longer than MAX_LEN characters are ignored. Words are matched as written, spaces included (the reader sees every character): a Vietnamese "bắt chuyện" matches its text.
Definition at line 39 of file segm_lexicon.h.
|
default |
|
inlineexplicit |
Definition at line 47 of file segm_lexicon.h.
|
inline |
Definition at line 52 of file segm_lexicon.h.
|
inline |
Definition at line 82 of file segm_lexicon.h.
|
inline |
Definition at line 75 of file segm_lexicon.h.
|
inlinestatic |
Definition at line 98 of file segm_lexicon.h.
|
staticconstexpr |
Definition at line 43 of file segm_lexicon.h.
|
staticconstexpr |
Definition at line 42 of file segm_lexicon.h.