pub trait MorphemeView: Sealed {
type Dictionary: DictionaryAccess;
Show 20 methods
// Required methods
fn begin(&self) -> usize;
fn end(&self) -> usize;
fn begin_c(&self) -> usize;
fn end_c(&self) -> usize;
fn surface(&self) -> MorphemeSurface<'_>;
fn word_id(&self) -> WordId;
fn get_word_info(&self) -> &WordInfo;
fn self_morpheme(&self) -> MorphemeRef<'_, Self::Dictionary>;
// Provided methods
fn part_of_speech_id(&self) -> u16 { ... }
fn resolver<'a>(&'a self) -> &'a dyn WordInfoResolver
where Self::Dictionary: 'a { ... }
fn part_of_speech<'a>(&'a self) -> &'a [String]
where Self::Dictionary: 'a { ... }
fn dictionary_form<'a>(&'a self) -> &'a str
where Self::Dictionary: 'a { ... }
fn dictionary_form_morpheme(
&self,
) -> SudachiResult<MorphemeRef<'_, Self::Dictionary>>
where Self::Dictionary: Clone { ... }
fn normalized_form<'a>(&'a self) -> &'a str
where Self::Dictionary: 'a { ... }
fn normalized_form_morpheme(
&self,
) -> SudachiResult<MorphemeRef<'_, Self::Dictionary>>
where Self::Dictionary: Clone { ... }
fn reading_form<'a>(&'a self) -> &'a str
where Self::Dictionary: 'a { ... }
fn is_oov(&self) -> bool { ... }
fn dictionary_id(&self) -> i32 { ... }
fn synonym_group_ids(&self) -> &[i32] { ... }
fn user_data(&self) -> &str { ... }
}Expand description
Common accessor interface for morphemes.
This trait is implemented by morphemes that are part of an analysis result
(Morpheme) and by standalone morphemes materialized from a
dictionary entry (SingleMorpheme).
Required Associated Types§
Required Methods§
Sourcefn surface(&self) -> MorphemeSurface<'_>
fn surface(&self) -> MorphemeSurface<'_>
Returns text corresponding to the morpheme.
Sourcefn get_word_info(&self) -> &WordInfo
fn get_word_info(&self) -> &WordInfo
Returns the dictionary information for this morpheme.
fn self_morpheme(&self) -> MorphemeRef<'_, Self::Dictionary>
Provided Methods§
Sourcefn part_of_speech_id(&self) -> u16
fn part_of_speech_id(&self) -> u16
Returns the ID of part of speech of the morpheme.
fn resolver<'a>(&'a self) -> &'a dyn WordInfoResolverwhere
Self::Dictionary: 'a,
Sourcefn part_of_speech<'a>(&'a self) -> &'a [String]where
Self::Dictionary: 'a,
fn part_of_speech<'a>(&'a self) -> &'a [String]where
Self::Dictionary: 'a,
Returns the part of speech.
Sourcefn dictionary_form<'a>(&'a self) -> &'a strwhere
Self::Dictionary: 'a,
fn dictionary_form<'a>(&'a self) -> &'a strwhere
Self::Dictionary: 'a,
Returns the dictionary form of morpheme.
“Dictionary form” means a word’s lemma and “終止形” in Japanese.
Sourcefn dictionary_form_morpheme(
&self,
) -> SudachiResult<MorphemeRef<'_, Self::Dictionary>>where
Self::Dictionary: Clone,
fn dictionary_form_morpheme(
&self,
) -> SudachiResult<MorphemeRef<'_, Self::Dictionary>>where
Self::Dictionary: Clone,
Returns the morpheme corresponding to this morpheme’s dictionary form.
For OOV morphemes, invalid references, and references to the same
dictionary entry, returns a morpheme equivalent to self. For a
distinct referenced entry, returns a standalone morpheme whose offsets
are 0..surface.len() in bytes and 0..surface.chars().count() in
codepoints.
Sourcefn normalized_form<'a>(&'a self) -> &'a strwhere
Self::Dictionary: 'a,
fn normalized_form<'a>(&'a self) -> &'a strwhere
Self::Dictionary: 'a,
Returns the normalized form of morpheme.
This method returns the form normalizing inconsistent spellings and inflected forms.
Sourcefn normalized_form_morpheme(
&self,
) -> SudachiResult<MorphemeRef<'_, Self::Dictionary>>where
Self::Dictionary: Clone,
fn normalized_form_morpheme(
&self,
) -> SudachiResult<MorphemeRef<'_, Self::Dictionary>>where
Self::Dictionary: Clone,
Returns the morpheme corresponding to this morpheme’s normalized form.
For OOV morphemes, invalid references, and references to the same
dictionary entry, returns a morpheme equivalent to self. For a
distinct referenced entry, returns a standalone morpheme whose offsets
are 0..surface.len() in bytes and 0..surface.chars().count() in
codepoints.
Sourcefn reading_form<'a>(&'a self) -> &'a strwhere
Self::Dictionary: 'a,
fn reading_form<'a>(&'a self) -> &'a strwhere
Self::Dictionary: 'a,
Returns the reading form of morpheme.
Returns Japanese syllabaries ‘フリガナ’ in katakana.
Sourcefn dictionary_id(&self) -> i32
fn dictionary_id(&self) -> i32
Returns the dictionary id where the morpheme belongs.
Returns -1 if the morpheme is oov.
fn synonym_group_ids(&self) -> &[i32]
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".