pub struct Parser<C> { /* private fields */ }Expand description
Finds the head of each bunsetsu of a sentence.
A parser is made once and used from any number of threads: parsing takes
&self and keeps no state.
Implementations§
Source§impl<C: Classifier> Parser<C>
impl<C: Classifier> Parser<C>
Sourcepub fn new(schema: Schema, features: FeatureSet, classifier: C) -> Self
pub fn new(schema: Schema, features: FeatureSet, classifier: C) -> Self
Sourcepub fn feature_set(&self) -> &FeatureSet
pub fn feature_set(&self) -> &FeatureSet
Sourcepub fn classifier(&self) -> &C
pub fn classifier(&self) -> &C
Sourcepub fn parse<M: Morpheme>(
&self,
morphemes: &[M],
bunsetsu: &[Range<usize>],
) -> Result<Vec<Bunsetsu>>
pub fn parse<M: Morpheme>( &self, morphemes: &[M], bunsetsu: &[Range<usize>], ) -> Result<Vec<Bunsetsu>>
Parses a sentence.
§Arguments
morphemes- The morphemes of the sentence.bunsetsu- Its bunsetsu from left to right, as ranges of indices intomorphemes: whatChunker::chunkgives.
§Returns
The bunsetsu with their heads; the last one is the root. Each has
the positions of its head word and of its function word, from the
schema, and the score of the decision that attached it: 0 for the
root and for a bunsetsu attached to the root, which is not asked.
The result can be given to Sentence::new.
Error::Structure when the bunsetsu do
not cover the morphemes from the first to the last without a gap, or
one of them is empty. Error::Dictionary
for a morpheme with fewer feature columns than the schema reads
(Schema::check).
Trait Implementations§
impl<C: PartialEq> StructuralPartialEq for Parser<C>
Auto Trait Implementations§
impl<C> Forget for Parser<C>
impl<C> Freeze for Parser<C>where
*const u8 is !null: Freeze,
PhantomData<Pattern>: Freeze,
PhantomData<Vec<String>>: Freeze,
PhantomData<u8>: Freeze,
PhantomData<(String, String)>: Freeze,
PhantomData<Group>: Freeze,
C: Freeze,
impl<C> Move for Parser<C>
impl<C> RefUnwindSafe for Parser<C>where
C: RefUnwindSafe,
impl<C> Send for Parser<C>
impl<C> Sync for Parser<C>
impl<C> Unpin for Parser<C>
impl<C> UnsafeUnpin for Parser<C>where
*const u8 is !null: UnsafeUnpin,
PhantomData<Pattern>: UnsafeUnpin,
PhantomData<Vec<String>>: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<(String, String)>: UnsafeUnpin,
PhantomData<Group>: UnsafeUnpin,
C: UnsafeUnpin,
impl<C> UnwindSafe for Parser<C>
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
Mutably borrows from an owned value. Read more