pub struct Morpheme<'a, T> { /* private fields */ }
Expand description
A morpheme (basic semantic unit of language)
Implementations§
source§impl<T: DictionaryAccess> Morpheme<'_, T>
impl<T: DictionaryAccess> Morpheme<'_, T>
sourcepub fn part_of_speech(&self) -> &[String]
pub fn part_of_speech(&self) -> &[String]
Returns the part of speech
source§impl<T: DictionaryAccess + Clone> Morpheme<'_, T>
impl<T: DictionaryAccess + Clone> Morpheme<'_, T>
sourcepub fn split(&self, mode: Mode) -> SudachiResult<MorphemeList<T>>
👎Deprecated since 0.6.1: use split_into
pub fn split(&self, mode: Mode) -> SudachiResult<MorphemeList<T>>
Returns new morpheme list splitting the morpheme with given mode.
source§impl<'a, T: DictionaryAccess> Morpheme<'a, T>
impl<'a, T: DictionaryAccess> Morpheme<'a, T>
sourcepub fn begin(&self) -> usize
pub fn begin(&self) -> usize
Returns the begin index in bytes of the morpheme in the original text
sourcepub fn begin_c(&self) -> usize
pub fn begin_c(&self) -> usize
Returns the codepoint offset of the morpheme begin in the original text
sourcepub fn end_c(&self) -> usize
pub fn end_c(&self) -> usize
Returns the codepoint offset of the morpheme begin in the original text
sourcepub fn surface(&self) -> Ref<'_, str>
pub fn surface(&self) -> Ref<'_, str>
Returns a substring of the original text which corresponds to the morpheme
pub fn part_of_speech_id(&self) -> u16
sourcepub fn dictionary_form(&self) -> &str
pub fn dictionary_form(&self) -> &str
Returns the dictionary form of morpheme
“Dictionary form” means a word’s lemma and “終止形” in Japanese.
sourcepub fn normalized_form(&self) -> &str
pub fn normalized_form(&self) -> &str
Returns the normalized form of morpheme
This method returns the form normalizing inconsistent spellings and inflected forms
sourcepub fn reading_form(&self) -> &str
pub fn reading_form(&self) -> &str
Returns the reading form of morpheme.
Returns Japanese syllabaries ‘フリガナ’ in katakana.
sourcepub fn dictionary_id(&self) -> i32
pub fn dictionary_id(&self) -> i32
Returns the dictionary id where the morpheme belongs
Returns -1 if the morpheme is oov
pub fn synonym_group_ids(&self) -> &[u32]
pub fn get_word_info(&self) -> &WordInfo
sourcepub fn split_into(
&self,
mode: Mode,
out: &mut MorphemeList<T>,
) -> SudachiResult<bool>
pub fn split_into( &self, mode: Mode, out: &mut MorphemeList<T>, ) -> SudachiResult<bool>
Splits morpheme and writes sub-morphemes into the provided list. The resulting list is not cleared before that. Returns true if split has produced any elements.
sourcepub fn total_cost(&self) -> i32
pub fn total_cost(&self) -> i32
Returns total cost from the beginning of the path
Trait Implementations§
Auto Trait Implementations§
impl<'a, T> Freeze for Morpheme<'a, T>
impl<'a, T> !RefUnwindSafe for Morpheme<'a, T>
impl<'a, T> !Send for Morpheme<'a, T>
impl<'a, T> !Sync for Morpheme<'a, T>
impl<'a, T> Unpin for Morpheme<'a, T>
impl<'a, T> !UnwindSafe for Morpheme<'a, T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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