pub trait HanjaDictionary {
// Required method
fn matches_at<'a>(
&'a self,
s: &'a str,
) -> Box<dyn Iterator<Item = Match> + 'a>;
// Provided methods
fn max_word_chars(&self) -> Option<usize> { ... }
fn entries<'a>(
&'a self,
) -> Option<Box<dyn Iterator<Item = DictionaryRecord> + 'a>> { ... }
fn has_homophone(&self, hanja: &str, reading: &str) -> bool { ... }
}Expand description
A hanja dictionary queried by the conversion engine.
The key operation returns every entry that starts at the beginning of the supplied string. This shape supports lattice segmentation because the engine must consider every candidate path through a hanja run.
Required Methods§
Provided Methods§
Sourcefn max_word_chars(&self) -> Option<usize>
fn max_word_chars(&self) -> Option<usize>
Returns the greatest dictionary entry length in Unicode scalar values.
Sourcefn entries<'a>(
&'a self,
) -> Option<Box<dyn Iterator<Item = DictionaryRecord> + 'a>>
fn entries<'a>( &'a self, ) -> Option<Box<dyn Iterator<Item = DictionaryRecord> + 'a>>
Enumerates complete dictionary entries when the backend supports it.
The default returns None, which keeps custom lookup-only dictionaries
valid. Homophone-aware middlewares use this as an optional batch path so
built-in backends can avoid per-token full-dictionary scans.
Sourcefn has_homophone(&self, hanja: &str, reading: &str) -> bool
fn has_homophone(&self, hanja: &str, reading: &str) -> bool
Returns whether another hanja spelling has the same hangul reading.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".