pub struct TokenizerConfig {
pub profile: Profile,
pub segmenter: Segmenter,
pub folding: FoldingForm,
pub stopwords: StopwordList,
pub stemmer: Stemmer,
pub decompose_words: bool,
pub emit_catenation: bool,
pub number_words: bool,
pub drop_single_char_parts: bool,
pub vocabulary: Vocabulary,
}Expand description
The complete analysis configuration.
Every field is an epoch-digest input. Changing any one of them produces a different epoch and therefore a different index meaning.
Fields§
§profile: ProfileThe named profile this configuration started from.
segmenter: SegmenterWord segmentation strategy.
folding: FoldingFormCharacter folding form.
stopwords: StopwordListStopword list.
stemmer: StemmerStemming algorithm.
decompose_words: boolSplit words at joiners, case changes, and letter/digit transitions.
emit_catenation: boolEmit the joiner-free catenation of a decomposed word.
number_words: boolEmit digit and word variants for spelled numbers.
drop_single_char_parts: boolDrop single-LETTER decomposition parts.
The k of 401k, the t of don't, the s of investor's:
one-letter parts of a decomposed word are stop-level noise in
linguistic text — they carry no identity the whole word and the
catenation do not already carry, and they pollute document length
and document frequency. One-DIGIT parts are kept: type-2 and
SARS-CoV-2 are discriminated by exactly that digit. Dropping a
part leaves its position spent, exactly as a removed stopword
does, so phrase adjacency and the analyzed length are unchanged.
Identifier-heavy profiles keep every part: the x of x_max is
a real search target in code.
vocabulary: VocabularyUser vocabulary and synonyms.
Implementations§
Source§impl TokenizerConfig
impl TokenizerConfig
Sourcepub fn text_default() -> Self
pub fn text_default() -> Self
The general-purpose text profile.
Sourcepub fn with_vocabulary(self, vocabulary: Vocabulary) -> Self
pub fn with_vocabulary(self, vocabulary: Vocabulary) -> Self
Replaces the user vocabulary.
Sourcepub fn epoch(&self) -> TokenizerEpoch
pub fn epoch(&self) -> TokenizerEpoch
Computes the epoch digest for this configuration.