pub struct SentenceTokenizer {}Expand description
Sentence Tokenizer.
For now this is stateless. This library is in a very early state, but I intend to add preferences and dictionary lookup callback support. (“Intend to come back” are famous last words.)
Implementations§
Source§impl SentenceTokenizer
impl SentenceTokenizer
Sourcepub fn tokenize(&self, sequence: &str) -> Vec<Token>
pub fn tokenize(&self, sequence: &str) -> Vec<Token>
Turn a text sequence into a series of tokens.
use sentence::{SentenceTokenizer, Token, Punctuation};
let tokenizer = SentenceTokenizer::new();
let tokens = tokenizer.tokenize("Hello, world!");
assert_eq!(tokens, vec![
Token::Word("Hello".into()),
Token::Punctuation(Punctuation::Comma),
Token::Word("world".into()),
Token::Punctuation(Punctuation::Exclamation),
]);Auto Trait Implementations§
impl Freeze for SentenceTokenizer
impl RefUnwindSafe for SentenceTokenizer
impl Send for SentenceTokenizer
impl Sync for SentenceTokenizer
impl Unpin for SentenceTokenizer
impl UnsafeUnpin for SentenceTokenizer
impl UnwindSafe for SentenceTokenizer
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