Skip to main content

JapaneseDictionary

Struct JapaneseDictionary 

Source
pub struct JapaneseDictionary { /* private fields */ }

Implementations§

Source§

impl JapaneseDictionary

Source

pub fn from_cfg(cfg: &Config) -> SudachiResult<JapaneseDictionary>

Creates a dictionary from the specified configuration Dictionaries will be read from disk

Source

pub fn from_cfg_storage( cfg: &Config, storage: SudachiDicData, ) -> SudachiResult<JapaneseDictionary>

Creates a dictionary from the specified configuration and storage

Source

pub fn from_cfg_storage_with_embedded_chardef( cfg: &Config, storage: SudachiDicData, ) -> SudachiResult<JapaneseDictionary>

👎Deprecated since 0.7.0:

embedded resources are now resolved through Config; use from_cfg_storage instead

Creates a dictionary from the specified configuration and storage, with embedded character definition

Source

pub fn from_cfg_storage_chardef( cfg: &Config, storage: SudachiDicData, chardef: CharacterCategory, ) -> SudachiResult<JapaneseDictionary>

Source

pub fn grammar(&self) -> &Grammar<'_>

Returns grammar with the correct lifetime

Source

pub fn lexicon(&self) -> &LexiconSet<'_>

Returns lexicon with the correct lifetime

Source

pub fn description(&self) -> &Description

Source

pub fn entries( &self, ) -> impl Iterator<Item = SudachiResult<SingleMorpheme<&Self>>> + '_

Iterates over dictionary entries as standalone morphemes.

This corresponds to public lexicon CSV rows. It includes entries that are referred to from other entries, such as split or constituent units, even when they are not indexed for normal lookup. Internal entries automatically generated for literal normalized forms are not exposed. The iteration order is not part of the public contract.

Source

pub fn entries_subset( &self, subset: InfoSubset, ) -> impl Iterator<Item = SudachiResult<SingleMorpheme<&Self>>> + '_

Iterates over dictionary entries, loading only the requested word-info fields.

Source

pub fn lookup_all_entries( &self, surface: &str, ) -> SudachiResult<Vec<SingleMorpheme<&Self>>>

Looks up all dictionary entries whose normalized surface matches surface.

This normalizes the query using dictionary input-text plugins and scans every public lexicon entry. It can find entries that are not indexed for normal lookup. Use lookup for normal indexed lookup.

Source

pub fn lookup_all_entries_subset( &self, surface: &str, subset: InfoSubset, ) -> SudachiResult<Vec<SingleMorpheme<&Self>>>

Looks up all matching dictionary entries, loading only requested fields.

Source

pub fn oov_morpheme( &self, pos_id: u16, surface: &str, ) -> SudachiResult<SingleMorpheme<&Self>>

Creates an out-of-vocabulary standalone morpheme from the pos id and the surface.

Uses the surface for reading, normalized, and dictionary forms.

Source

pub fn oov_morpheme_with_forms( &self, pos_id: u16, surface: &str, reading: &str, normalized_form: &str, dictionary_form: &str, ) -> SudachiResult<SingleMorpheme<&Self>>

Creates an out-of-vocabulary standalone morpheme from the pos id and string forms.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WordInfoResolver for T
where T: LexiconAccess,