pub struct TextPreprocessor { /* private fields */ }Expand description
Text preprocessor that combines tokenization, stop word removal, and stemming
§Examples
use sklears_feature_extraction::text::preprocessing::TextPreprocessor;
let preprocessor = TextPreprocessor::new()
.enable_stemming(true)
.enable_stop_word_removal(true);
let processed = preprocessor.preprocess("The running dogs are playing");
// Result will be stemmed and stop words removedImplementations§
Source§impl TextPreprocessor
impl TextPreprocessor
Sourcepub fn enable_stemming(self, enable: bool) -> Self
pub fn enable_stemming(self, enable: bool) -> Self
Enable or disable stemming
Sourcepub fn enable_stop_word_removal(self, enable: bool) -> Self
pub fn enable_stop_word_removal(self, enable: bool) -> Self
Enable or disable stop word removal
Sourcepub fn stop_words(self, stop_words: HashSet<String>) -> Self
pub fn stop_words(self, stop_words: HashSet<String>) -> Self
Set custom stop words
Sourcepub fn tokenizer(self, tokenizer: SimpleTokenizer) -> Self
pub fn tokenizer(self, tokenizer: SimpleTokenizer) -> Self
Configure the tokenizer
Sourcepub fn preprocess(&self, text: &str) -> Vec<String>
pub fn preprocess(&self, text: &str) -> Vec<String>
Preprocess text through the configured pipeline
Trait Implementations§
Source§impl Clone for TextPreprocessor
impl Clone for TextPreprocessor
Source§impl Debug for TextPreprocessor
impl Debug for TextPreprocessor
Auto Trait Implementations§
impl Freeze for TextPreprocessor
impl RefUnwindSafe for TextPreprocessor
impl Send for TextPreprocessor
impl Sync for TextPreprocessor
impl Unpin for TextPreprocessor
impl UnsafeUnpin for TextPreprocessor
impl UnwindSafe for TextPreprocessor
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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