Skip to main content

Module encode

Module encode 

Source
Expand description

Reverse lookup — char → Vec<pinyin>.

Powered by traversing the embedded dict on-demand. v0.1 builds the reverse index lazily on first call (small bootstrap → cheap); v0.2 will materialize it at compile time once the dict grows.

Functions§

char_to_pinyin
Pinyin readings for a single Han character. Returns an empty Vec if the character isn’t in the bootstrap dict (most chars won’t be in v0.1; v0.2 expands coverage to ~67k via Unihan + corpus pipeline).
covered_char_count
Number of Han characters with at least one reading in the reverse index. Useful for sanity checks; not a meaningful coverage metric in v0.1.