pub struct Worker<'t> { /* private fields */ }
Expand description

Provider of a routine for tokenization.

It holds the internal data structures used in tokenization, which can be reused to avoid unnecessary memory reallocation.

Implementations§

source§

impl<'t> Worker<'t>

source

pub fn reset_sentence<S>(&mut self, input: S)where S: AsRef<str>,

Resets the input sentence to be tokenized.

source

pub fn tokenize(&mut self)

Tokenizes the input sentence set in state, returning the result through state.

source

pub fn num_tokens(&self) -> usize

Gets the number of resultant tokens.

source

pub fn token<'w>(&'w self, i: usize) -> Token<'w, 't>

Gets the i-th resultant token.

source

pub const fn token_iter<'w>(&'w self) -> TokenIter<'w, 't>

Creates an iterator of resultant tokens.

source

pub fn init_connid_counter(&mut self)

Initializes a counter to compute occurrence probabilities of connection ids.

source

pub fn update_connid_counts(&mut self)

Updates frequencies of connection ids at the last tokenization.

Panics

It will panic when Self::init_connid_counter() has never been called.

source

pub fn compute_connid_probs(&self) -> (Vec<(usize, f64)>, Vec<(usize, f64)>)

Computes the computed occurrence probabilities of connection ids, returning those for left- and right-ids.

Panics

It will panic when Self::init_connid_counter() has never been called.

Auto Trait Implementations§

§

impl<'t> RefUnwindSafe for Worker<'t>

§

impl<'t> Send for Worker<'t>

§

impl<'t> Sync for Worker<'t>

§

impl<'t> Unpin for Worker<'t>

§

impl<'t> UnwindSafe for Worker<'t>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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, U> TryFrom<U> for Twhere U: Into<T>,

§

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 Twhere U: TryFrom<T>,

§

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.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> SendAlias for T

§

impl<T> SendSyncUnwindSafe for Twhere T: Send + Sync + UnwindSafe + ?Sized,

§

impl<T> SyncAlias for T