pub struct VectorizerParams { /* private fields */ }Expand description
Configuration parameters for text vectorization.
Controls n-gram extraction, vocabulary filtering, and term frequency scaling.
Implementations§
Source§impl VectorizerParams
impl VectorizerParams
Sourcepub fn new(
ngram_range: impl Into<RangeInclusive<usize>>,
min_df: f32,
max_df: f32,
sublinear_tf: bool,
) -> Self
pub fn new( ngram_range: impl Into<RangeInclusive<usize>>, min_df: f32, max_df: f32, sublinear_tf: bool, ) -> Self
Create new vectorizer parameters.
§Arguments
ngram_range- Range of n-gram sizes (e.g.,3..=5for trigrams to 5-grams)min_df- Minimum document frequency (proportion or count)max_df- Maximum document frequency (proportion or count)sublinear_tf- Whether to apply log scaling to term frequencies
§Panics
Panics if min_df or max_df are not positive, or if ngram_range is empty.
Sourcepub fn ngram_counts(&self) -> &[usize]
pub fn ngram_counts(&self) -> &[usize]
Get all n-gram sizes as a slice.
Sourcepub fn ngram_range(&self) -> (usize, usize)
pub fn ngram_range(&self) -> (usize, usize)
Get the n-gram range as a tuple (min, max).
Sourcepub fn sublinear_tf(&self) -> bool
pub fn sublinear_tf(&self) -> bool
Get whether sublinear TF scaling is enabled.
Trait Implementations§
Source§impl<'__de, __Context> BorrowDecode<'__de, __Context> for VectorizerParams
impl<'__de, __Context> BorrowDecode<'__de, __Context> for VectorizerParams
Source§fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>(
decoder: &mut __D,
) -> Result<Self, DecodeError>
fn borrow_decode<__D: BorrowDecoder<'__de, Context = __Context>>( decoder: &mut __D, ) -> Result<Self, DecodeError>
Attempt to decode this type with the given BorrowDecode.
Source§impl Clone for VectorizerParams
impl Clone for VectorizerParams
Source§fn clone(&self) -> VectorizerParams
fn clone(&self) -> VectorizerParams
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for VectorizerParams
impl Debug for VectorizerParams
Source§impl<__Context> Decode<__Context> for VectorizerParams
impl<__Context> Decode<__Context> for VectorizerParams
Source§impl Default for VectorizerParams
impl Default for VectorizerParams
Source§impl Encode for VectorizerParams
impl Encode for VectorizerParams
Auto Trait Implementations§
impl Freeze for VectorizerParams
impl RefUnwindSafe for VectorizerParams
impl Send for VectorizerParams
impl Sync for VectorizerParams
impl Unpin for VectorizerParams
impl UnwindSafe for VectorizerParams
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.