Struct instant_segment::Segmenter[][src]

pub struct Segmenter { /* fields omitted */ }

Central data structure used to calculate word probabilities

Implementations

impl Segmenter[src]

pub fn from_iters<U, B>(unigrams: U, bigrams: B) -> Self where
    U: Iterator<Item = (String, f64)>,
    B: Iterator<Item = ((String, String), f64)>, 
[src]

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.

pub fn from_maps(
    unigrams: HashMap<String, f64, RandomState>,
    bigrams: HashMap<(String, String), f64, RandomState>
) -> Self
[src]

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.

pub fn segment(
    &self,
    text: &str,
    out: &mut Vec<String>,
    search: &mut Search
) -> Result<(), InvalidCharacter>
[src]

Appends list of words that is the best segmentation of text to out

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.

pub fn set_limit(&mut self, limit: usize)[src]

Customize the word length limit

pub fn set_total(&mut self, total: f64)[src]

Customize the relative score by setting the total

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.