Struct simplecc::Dict
[−]
[src]
pub struct Dict { /* fields omitted */ }Dictionary to convert text.
This library doesn't contain dictionary file. You may download them from OpenCC's repo.
For chaining multiple dicts, just concat all to one file (in any order).
Built-in dictionaries
The library includes optional dictionaries when builtin_dicts
feature is on. Disabled by default.
File Format
The format is the same as text format (not the compiled binary one) in OpenCC project.
Specifically, one rule per line, two columns per rule splitted by a TAB
(\t). First column is original word/phrase, the other is converted one,
which may contains multiples word/phrase splitted by a space (), but
only the first one is used, others will be ignored.
Methods
impl Dict[src]
pub fn load_str<T>(raw: T) -> Self where
T: AsRef<str>, [src]
T: AsRef<str>,
Load dict from string
pub fn load_lines<T, S>(lines: T) -> Self where
T: Iterator<Item = S>,
S: AsRef<str>, [src]
T: Iterator<Item = S>,
S: AsRef<str>,
Load dict from lines of string.
pub fn load<T>(reader: T) -> Self where
T: Read, [src]
T: Read,
Load dict file. Unrecognizable data will be silently ignored.
pub fn chain(self, other: Dict) -> Self[src]
Return the new dict that chained together.
pub fn replace_all(&self, text: &str) -> String[src]
Use this dict to convert string. Return converted text.
Trait Implementations
impl Debug for Dict[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
Formats the value using the given formatter. Read more