pub struct Dictionary { /* private fields */ }
Expand description

Dictionary for tokenization.

Implementations

Creates a new instance from readers in the MeCab format.

Arguments
  • system_lexicon_rdr: A reader of a lexicon file *.csv.
  • connector_rdr: A reader of matrix file matrix.def.
  • char_prop_rdr: A reader of character definition file char.def.
  • unk_handler: A reader of unknown definition file unk.def.
Errors

VibratoError is returned when an input format is invalid.

Resets the user dictionary from a reader.

Arguments
  • user_lexicon_rdr: A reader of a lexicon file *.csv in the MeCab format. If None, clear the current user dictionary.
Errors

VibratoError is returned when an input format is invalid.

Edits connection ids with the given mappings.

Arguments
  • lmap/rmap: An iterator of mappings of left/right ids, where the i-th item (1-origin) indicates a new id mapped from id i.
Errors

VibratoError is returned when

  • a new id of BOS_EOS_CONNECTION_ID is included,
  • new ids are duplicated, or
  • the set of new ids are not same as that of old ids.

Exports the dictionary data.

Errors

When bincode generates an error, it will be returned as is.

Creates a dictionary from a reader.

Errors

When bincode generates an error, it will be returned as is.

Creates a dictionary from a reader.

Safety

The given reader must be a correct file exported by Dictionary::write().

Errors

When bincode generates an error, it will be returned as is.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.