Fix formatting
This commit is contained in:
parent
cd06fbecc8
commit
4338ff2c0c
18
src/lib.rs
18
src/lib.rs
|
@ -58,11 +58,7 @@ impl Segmenter {
|
||||||
/// segmentation; passing it in allows the callers to reuse the cache allocations.
|
/// segmentation; passing it in allows the callers to reuse the cache allocations.
|
||||||
///
|
///
|
||||||
/// The segmentation result can be retrieved through the `Search::split()` method.
|
/// The segmentation result can be retrieved through the `Search::split()` method.
|
||||||
pub fn segment(
|
pub fn segment(&self, input: &str, search: &mut Search) -> Result<(), InvalidCharacter> {
|
||||||
&self,
|
|
||||||
input: &str,
|
|
||||||
search: &mut Search,
|
|
||||||
) -> Result<(), InvalidCharacter> {
|
|
||||||
SegmentState::new(Ascii::new(input)?, &self, search).run();
|
SegmentState::new(Ascii::new(input)?, &self, search).run();
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
@ -106,17 +102,9 @@ struct SegmentState<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'a> SegmentState<'a> {
|
impl<'a> SegmentState<'a> {
|
||||||
fn new(
|
fn new(text: Ascii<'a>, data: &'a Segmenter, search: &'a mut Search) -> Self {
|
||||||
text: Ascii<'a>,
|
|
||||||
data: &'a Segmenter,
|
|
||||||
search: &'a mut Search,
|
|
||||||
) -> Self {
|
|
||||||
search.clear();
|
search.clear();
|
||||||
Self {
|
Self { data, text, search }
|
||||||
data,
|
|
||||||
text,
|
|
||||||
search,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a list of words that is the best segmentation of `text`
|
/// Returns a list of words that is the best segmentation of `text`
|
||||||
|
|
Loading…
Reference in New Issue