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(
&self,
input: &str,
search: &mut Search
) -> Result<(), InvalidCharacter>
[src]
&self,
input: &str,
search: &mut Search
) -> Result<(), 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.
The segmentation result can be retrieved through the Search::split()
method.
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
impl RefUnwindSafe for Segmenter
[src]
impl Send for Segmenter
[src]
impl Sync for Segmenter
[src]
impl Unpin for Segmenter
[src]
impl UnwindSafe for Segmenter
[src]
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>,