pub enum TfIdfMethod {
Smooth,
NonSmooth,
Textbook,
}
Expand description
Methods for computing the inverse document frequency of a vocabulary entry
Variants§
Smooth
Computes the idf as log(1+n/1+document_frequency) + 1
. The “plus ones” inside the log
add an artificial document containing every vocabulary entry, preventing divisions by zero.
The “plus one” after the log allows vocabulary entries that appear in every document to still be considered with
a weight of one instead of being completely discarded.
NonSmooth
Computes the idf as log(n/document_frequency) +1
. The “plus one” after the log allows vocabulary entries that appear in every document to still be considered with
a weight of one instead of being completely discarded. If a vocabulary entry has zero document frequency this will produce a division by zero.
Textbook
Textbook definition of idf, computed as log(n/ 1 + document_frequency)
which prevents divisions by zero and discards entries that appear in every document.
Implementations§
Source§impl TfIdfMethod
impl TfIdfMethod
pub fn compute_idf(&self, n: usize, df: usize) -> f64
Trait Implementations§
Source§impl Clone for TfIdfMethod
impl Clone for TfIdfMethod
Source§fn clone(&self) -> TfIdfMethod
fn clone(&self) -> TfIdfMethod
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for TfIdfMethod
impl Debug for TfIdfMethod
Source§impl Hash for TfIdfMethod
impl Hash for TfIdfMethod
Source§impl PartialEq for TfIdfMethod
impl PartialEq for TfIdfMethod
impl Eq for TfIdfMethod
impl StructuralPartialEq for TfIdfMethod
Auto Trait Implementations§
impl Freeze for TfIdfMethod
impl RefUnwindSafe for TfIdfMethod
impl Send for TfIdfMethod
impl Sync for TfIdfMethod
impl Unpin for TfIdfMethod
impl UnwindSafe for TfIdfMethod
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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>
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>
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.