sudachi::analysis::stateful_tokenizer

Struct StatefulTokenizer

source
pub struct StatefulTokenizer<D> { /* private fields */ }

Implementations§

source§

impl<D: DictionaryAccess + Clone> StatefulTokenizer<D>

source

pub fn dict_clone(&self) -> D

Get a clone of current dictionary

source§

impl<D: DictionaryAccess> StatefulTokenizer<D>

source

pub fn new(dic: D, mode: Mode) -> Self

Create a new non-debug stateful tokenizer

source

pub fn create(dic: D, debug: bool, mode: Mode) -> Self

Create a new debug stateful tokenizer with the following options

source

pub fn set_debug(&mut self, debug: bool) -> bool

Set debug flag and returns the current one

source

pub fn set_mode(&mut self, mode: Mode) -> Mode

Set the analysis mode and returns the current one

source

pub fn mode(&self) -> Mode

Return current analysis mode

source

pub fn set_subset(&mut self, subset: InfoSubset) -> InfoSubset

Analyzer will read only following [WordInfo] field subset

source

pub fn reset(&mut self) -> &mut String

Prepare StatefulTokenizer for the next data. Data must be written in the returned reference.

source

pub fn dict(&self) -> &D

Borrow current dictionary

source

pub fn do_tokenize(&mut self) -> SudachiResult<()>

Perform the actual tokenization so the analysis result will be available for consumption

source

pub fn swap_result( &mut self, input: &mut InputBuffer, result: &mut Vec<ResultNode>, subset: &mut InfoSubset, )

Swap result data with the current analyzer

source

pub fn into_morpheme_list(self) -> SudachiResult<MorphemeList<D>>

Consume the Tokenizer and produce MorphemeList

Auto Trait Implementations§

§

impl<D> Freeze for StatefulTokenizer<D>
where D: Freeze,

§

impl<D> RefUnwindSafe for StatefulTokenizer<D>
where D: RefUnwindSafe,

§

impl<D> Send for StatefulTokenizer<D>
where D: Send,

§

impl<D> Sync for StatefulTokenizer<D>
where D: Sync,

§

impl<D> Unpin for StatefulTokenizer<D>
where D: Unpin,

§

impl<D> UnwindSafe for StatefulTokenizer<D>
where D: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.