[][src]Struct simplecc::Dict

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]

Load dict from string

pub fn load_lines<T, S>(lines: T) -> Self where
    T: Iterator<Item = S>,
    S: AsRef<str>, 
[src]

Load dict from lines of string.

pub fn load<T>(reader: T) -> Self where
    T: Read
[src]

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 Clone for Dict
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Dict
[src]

Auto Trait Implementations

impl Send for Dict

impl Sync for Dict

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]