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).
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]
fn load_str<T>(raw: T) -> Self where
T: AsRef<str>,
[src]
T: AsRef<str>,
Load dict from string
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.
fn load<T>(reader: T) -> Self where
T: Read,
[src]
T: Read,
Load dict file. Unrecognizable data will be silently ignored.
fn replace_all(&self, text: &str) -> String
[src]
Use this dict to convert string. Return converted text.