pub struct Segmenter { /* private fields */ }
Expand description

Central data structure used to calculate word probabilities

Implementations

Create Segmenter from the given iterators

Note: the String types used in this API are defined in the smartstring crate. Any &str or String can be converted into the String used here by calling into() on it.

Create Segmenter from the given hashmaps (using ahash)

Note: the String types used in this API are defined in the smartstring crate. Any &str or String can be converted into the String used here by calling into() on it. The HashMap type here refers to std::collections::HashMap parametrized with the ahash::RandomState.

Segment the text in input

Requires that the input text consists of lowercase ASCII characters only. Otherwise, returns Err(InvalidCharacter). The search parameter contains caches that are used segmentation; passing it in allows the callers to reuse the cache allocations.

Returns the sentence’s score

Returns the relative probability for the given sentence in the the corpus represented by this Segmenter. Will return None iff given an empty iterator argument.

Customize the word length limit

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.