Expand description
Synonym expansion for Thai full-text search.
SynonymMap maps a canonical form to a list of equivalent terms. During
FTS indexing, each matched canonical token is expanded to its synonyms so
that queries on any variant find the document.
§Data format
A tab-separated text file, one rule per line:
# canonical<TAB>syn1<TAB>syn2 ...
คอม<TAB>คอมพิวเตอร์<TAB>computer
รถไฟฟ้า<TAB>BTS<TAB>MRT<TAB>รถไฟใต้ดินLines beginning with # and blank lines are ignored.
§Example
use kham_core::synonym::SynonymMap;
let map = SynonymMap::from_tsv("คอม\tคอมพิวเตอร์\tcomputer\n");
let expansions = map.expand("คอม").unwrap_or_default();
assert!(expansions.contains(&"คอมพิวเตอร์".to_string()));Structs§
- Synonym
Map - A canonical-form → synonym-list lookup table.