pub struct SentenceDetector { /* private fields */ }
Expand description
A sentence boundary detector
Implementations§
source§impl SentenceDetector
impl SentenceDetector
pub fn new() -> Self
pub fn with_limit(limit: usize) -> Self
sourcepub fn get_eos(
&self,
input: &str,
checker: Option<&NonBreakChecker<'_>>,
) -> SudachiResult<isize>
pub fn get_eos( &self, input: &str, checker: Option<&NonBreakChecker<'_>>, ) -> SudachiResult<isize>
Returns the byte index of the detected end of the sentence.
If NonBreakChecker is given, it is used to determine if there is a word that crosses the detected boundary, and if so, the next boundary is returned.
If there is no boundary, this returns a relatively harmles boundary as a negative value.
§Examples
let sd = sudachi::sentence_detector::SentenceDetector::new();
assert_eq!(12, sd.get_eos("あいう。えお", None).unwrap());
assert_eq!(-15, sd.get_eos("あいうえお", None).unwrap());
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SentenceDetector
impl RefUnwindSafe for SentenceDetector
impl Send for SentenceDetector
impl Sync for SentenceDetector
impl Unpin for SentenceDetector
impl UnwindSafe for SentenceDetector
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more