pub struct Morpheme<'a, D> { /* private fields */ }Expand description
A morpheme as a part of an analysis result.
Implementations§
Source§impl<D: DictionaryAccess + Clone> Morpheme<'_, D>
impl<D: DictionaryAccess + Clone> Morpheme<'_, D>
Sourcepub fn split(&self, mode: Mode) -> SudachiResult<MorphemeList<D>>
👎Deprecated since 0.6.1: use split_into
pub fn split(&self, mode: Mode) -> SudachiResult<MorphemeList<D>>
use split_into
Returns new morpheme list splitting the morpheme with given mode.
Source§impl<'a, D: DictionaryAccess> Morpheme<'a, D>
impl<'a, D: DictionaryAccess> Morpheme<'a, D>
Sourcepub fn part_of_speech(&self) -> &[String]
pub fn part_of_speech(&self) -> &[String]
Returns the part of speech.
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 end(&self) -> usize
pub fn end(&self) -> usize
Returns the end 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 end 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 dictionary_form_morpheme(&self) -> SudachiResult<MorphemeRef<'_, D>>where
D: Clone,
pub fn dictionary_form_morpheme(&self) -> SudachiResult<MorphemeRef<'_, D>>where
D: Clone,
Returns the morpheme corresponding to this morpheme’s dictionary form.
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 normalized_form_morpheme(&self) -> SudachiResult<MorphemeRef<'_, D>>where
D: Clone,
pub fn normalized_form_morpheme(&self) -> SudachiResult<MorphemeRef<'_, D>>where
D: Clone,
Returns the morpheme corresponding to this morpheme’s normalized form.
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) -> &[i32]
pub fn get_word_info(&self) -> &WordInfo
Sourcepub fn split_into(
&self,
mode: Mode,
out: &mut MorphemeList<D>,
) -> SudachiResult<bool>
pub fn split_into( &self, mode: Mode, out: &mut MorphemeList<D>, ) -> 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§
impl<D> Copy for Morpheme<'_, D>
Source§impl<D: DictionaryAccess> Debug for Morpheme<'_, D>
impl<D: DictionaryAccess> Debug for Morpheme<'_, D>
Source§impl<D: DictionaryAccess> MorphemeView for Morpheme<'_, D>
impl<D: DictionaryAccess> MorphemeView for Morpheme<'_, D>
type Dictionary = D
Source§fn surface(&self) -> MorphemeSurface<'_>
fn surface(&self) -> MorphemeSurface<'_>
Source§fn get_word_info(&self) -> &WordInfo
fn get_word_info(&self) -> &WordInfo
fn self_morpheme(&self) -> MorphemeRef<'_, D>
Source§fn part_of_speech_id(&self) -> u16
fn part_of_speech_id(&self) -> u16
fn resolver<'a>(&'a self) -> &'a dyn WordInfoResolverwhere
Self::Dictionary: 'a,
Source§fn 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,
Source§fn dictionary_form<'a>(&'a self) -> &'a strwhere
Self::Dictionary: 'a,
fn dictionary_form<'a>(&'a self) -> &'a strwhere
Self::Dictionary: 'a,
Source§fn 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,
Source§fn normalized_form<'a>(&'a self) -> &'a strwhere
Self::Dictionary: 'a,
fn normalized_form<'a>(&'a self) -> &'a strwhere
Self::Dictionary: 'a,
Source§fn 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,
Source§fn reading_form<'a>(&'a self) -> &'a strwhere
Self::Dictionary: 'a,
fn reading_form<'a>(&'a self) -> &'a strwhere
Self::Dictionary: 'a,
Source§fn dictionary_id(&self) -> i32
fn dictionary_id(&self) -> i32
fn synonym_group_ids(&self) -> &[i32]
Auto Trait Implementations§
impl<'a, D> !RefUnwindSafe for Morpheme<'a, D>
impl<'a, D> !Send for Morpheme<'a, D>
impl<'a, D> !Sync for Morpheme<'a, D>
impl<'a, D> !UnwindSafe for Morpheme<'a, D>
impl<'a, D> Freeze for Morpheme<'a, D>
impl<'a, D> Unpin for Morpheme<'a, D>
impl<'a, D> UnsafeUnpin for Morpheme<'a, D>
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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