Struct instant_segment::Segmenter [−][src]
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]
U: Iterator<Item = (String, f64)>,
B: Iterator<Item = ((String, String), f64)>,
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]
unigrams: HashMap<String, f64, RandomState>,
bigrams: HashMap<(String, String), f64, RandomState>
) -> Self
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<'a>(
&self,
input: &str,
search: &'a mut Search
) -> Result<impl Iterator<Item = &'a str> + ExactSizeIterator, InvalidCharacter>
[src]
&self,
input: &str,
search: &'a mut Search
) -> Result<impl Iterator<Item = &'a str> + ExactSizeIterator, InvalidCharacter>
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.
pub fn set_limit(&mut self, limit: usize)
[src]
Customize the word length limit
Auto Trait Implementations
impl RefUnwindSafe for Segmenter
impl Send for Segmenter
impl Sync for Segmenter
impl Unpin for Segmenter
impl UnwindSafe for Segmenter
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,