pub struct HmmModel { /* private fields */ }Expand description
A trained BMES Hidden Markov Model for segmenting clusters the dictionary has no match for at all.
Ships with no built-in parameters: like
with_frequencies, training
needs a segmented corpus, and no bundleable, commercially-clean one has
been found (see docs/ROADMAP.md Phase 4). Build one with
HmmModel::from_counts from BMES tag counts gathered over a corpus
you’re licensed to use, then attach it with
KhmerTokenizer::with_hmm.
Implementations§
Source§impl HmmModel
impl HmmModel
Sourcepub fn from_counts(
start_counts: [u64; 4],
trans_counts: [[u64; 4]; 4],
emit_counts: HashMap<String, [u64; 4]>,
) -> Self
pub fn from_counts( start_counts: [u64; 4], trans_counts: [[u64; 4]; 4], emit_counts: HashMap<String, [u64; 4]>, ) -> Self
Build a model from raw BMES tag counts: start_counts[state] is how
often a Khmer run began tagged state; trans_counts[i][j] is how
often a cluster tagged i was immediately followed by one tagged
j; emit_counts[cluster][state] is how often cluster was tagged
state. All three are add-one smoothed, so an unseen transition or
start state is merely unlikely, never impossible.