Expand description
Language-agnostic text primitives, ported from addok.helpers.text.
Country or language specific processing lives in crate::profile.
Structs§
- Synonyms
- Synonym table in addok’s file format:
a, b, c => wanted words,#for comments. Applied on index and query tokens alike (synonymize). - Token
addok.helpers.text.Token: a normalized word with the metadata the pipeline and the collectors rely on.
Enums§
Functions§
- ascii
addok.helpers.text.ascii: lowercase, transliterate, replace every non-word character by a space, collapse runs of spaces and trim.- compare_
ngrams addok.helpers.text.compare_ngrams(left, right, N=2, pad_len=0), i.e.NGram.compare: shared bigrams (with multiplicity) over the bigrams of both strings minus the shared ones.- edge_
ngrams addok.helpers.text.compute_edge_ngrams: prefixes fromminchars up to, but excluding, the token itself, on the token cut tomax + 1chars.- is_
digit - Python’s
str.isdigit()for the ASCII strings we deal with. - normalize
addok.helpers.text.normalize:unidecode(s.lower()).- tokenize
addok.helpers.text.tokenizefollowed bynormalize.