pub struct SingleMorpheme<D> { /* private fields */ }Expand description
A standalone morpheme materialized from a single dictionary entry.
Implementations§
Source§impl<D: DictionaryAccess> SingleMorpheme<D>
impl<D: DictionaryAccess> SingleMorpheme<D>
Sourcepub fn from_word_id(
dict: D,
word_id: WordId,
subset: InfoSubset,
) -> SudachiResult<Self>
pub fn from_word_id( dict: D, word_id: WordId, subset: InfoSubset, ) -> SudachiResult<Self>
Creates a standalone morpheme for the exact dictionary entry.
The entry is resolved by WordId, not by surface lookup, so homograph
identity is preserved. HEADWORD is always loaded because standalone
offsets and surface are based on the dictionary headword.
pub fn oov( dict: D, pos_id: u16, surface: String, reading: String, normalized_form: String, dictionary_form: String, ) -> SudachiResult<Self>
pub fn get_word_info(&self) -> &WordInfo
Source§impl<D: DictionaryAccess + Clone> SingleMorpheme<D>
impl<D: DictionaryAccess + Clone> SingleMorpheme<D>
Sourcepub fn part_of_speech(&self) -> &[String]
pub fn part_of_speech(&self) -> &[String]
Returns the part of speech.
Sourcepub fn split(&self, mode: Mode) -> SudachiResult<Vec<SingleMorpheme<D>>>
pub fn split(&self, mode: Mode) -> SudachiResult<Vec<SingleMorpheme<D>>>
Returns standalone sub-morphemes for the requested split mode.
When the dictionary entry has no splits for the mode, returns a clone of this morpheme. Offsets match Java’s standalone morpheme behavior: a single replacement split preserves this morpheme’s span, while multi-splits advance over each split surface.
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.
Sourcepub fn dictionary_form_morpheme(&self) -> SudachiResult<MorphemeRef<'_, D>>
pub fn dictionary_form_morpheme(&self) -> SudachiResult<MorphemeRef<'_, D>>
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.
Sourcepub fn normalized_form_morpheme(&self) -> SudachiResult<MorphemeRef<'_, D>>
pub fn normalized_form_morpheme(&self) -> SudachiResult<MorphemeRef<'_, D>>
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.
Sourcepub fn dictionary_id(&self) -> i32
pub fn dictionary_id(&self) -> i32
Returns the dictionary id where the morpheme belongs.
pub fn synonym_group_ids(&self) -> &[i32]
Trait Implementations§
Source§impl<D: Clone> Clone for SingleMorpheme<D>
impl<D: Clone> Clone for SingleMorpheme<D>
Source§impl<D: DictionaryAccess + Clone> Debug for SingleMorpheme<D>
impl<D: DictionaryAccess + Clone> Debug for SingleMorpheme<D>
Source§impl<D: DictionaryAccess + Clone> MorphemeView for SingleMorpheme<D>
impl<D: DictionaryAccess + Clone> MorphemeView for SingleMorpheme<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<D> !Freeze for SingleMorpheme<D>
impl<D> RefUnwindSafe for SingleMorpheme<D>where
D: RefUnwindSafe,
impl<D> Send for SingleMorpheme<D>where
D: Send,
impl<D> Sync for SingleMorpheme<D>where
D: Sync,
impl<D> Unpin for SingleMorpheme<D>where
D: Unpin,
impl<D> UnsafeUnpin for SingleMorpheme<D>where
D: UnsafeUnpin,
impl<D> UnwindSafe for SingleMorpheme<D>where
D: UnwindSafe,
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