Dictionaries
Gukhanmun looks up hanja readings from one or more HanjaDictionary
implementations. The gukhanmun crate ships with FST and CDB backends and
a bundled Standard Korean Dictionary.
Using the bundled dictionary
The bundled dictionary is included automatically when the stdict feature is
enabled (the default). To disable it:
To re-enable it explicitly after calling no_bundled_stdict:
Loading a dictionary from a file
Requires the fst or cdb feature.
Dictionaries added with push_dictionary are consulted before the bundled
dictionary. The first match across the chain wins.
Zero-copy static dictionaries
Embed a dictionary directly in your binary with include_bytes! and load it
without any file I/O:
from_static_bytes does not copy the data; it creates a zero-copy view
backed by the static slice.
Loading from owned bytes
When the bytes come from a runtime source (network, database, etc.) wrap them
in an Arc<[u8]>:
Chaining multiple dictionaries
ChainDictionary lets you compose several dictionaries with explicit priority
ordering. The first dictionary in the chain that has a match wins:
Alternatively, call push_dictionary multiple times; dictionaries are probed
in the order they were pushed, before the bundled dictionary.