For AI agents: the complete documentation index is available at https://canary.gukhanmun.org/llms.txt, the full documentation bundle is available at https://canary.gukhanmun.org/llms-full.txt, and this page is available as Markdown at https://canary.gukhanmun.org/api/js/types/_gukhanmun_napi.Segmentation.md.

Type Alias: Segmentation

Segmentation = "lattice" | "eager"

Controls how the engine segments a hanja-containing span into dictionary words and fallback fragments. Corresponds to Rust SegmentationStrategy.

  • "lattice" — Dynamic programming over all possible dictionary matches at each position; selects the segmentation that maximises dictionary coverage and then prefers fewer segments. This is the default and produces better results than greedy approaches when a longer prefix would leave a suffix uncovered by the dictionary. Corresponds to Rust SegmentationStrategy::Lattice.
  • "eager" — Left-to-right longest-match (greedy). Lower overhead per span at the cost of occasional mis-segmentation. Corresponds to Rust SegmentationStrategy::Eager.