Struct TokenFrequency

Source
pub struct TokenFrequency {
    pub token_count: HashMap<String, u32>,
    pub total_token_count: u64,
}
Expand description

TokenFrequency 構造体

Fields§

§token_count: HashMap<String, u32>§total_token_count: u64

Implementations§

Source§

impl TokenFrequency

Source

pub fn new() -> Self

Source

pub fn add_token(&mut self, token: &str) -> &mut Self

Source

pub fn add_token_n(&mut self, token: &str, n: u32) -> &mut Self

Source

pub fn add_tokens(&mut self, tokens: &[&str]) -> &mut Self

Source

pub fn add_tokens_string(&mut self, tokens: &[String]) -> &mut Self

Source

pub fn sub_token(&mut self, token: &str) -> &mut Self

Source

pub fn sub_token_n(&mut self, token: &str, n: u32) -> &mut Self

Source

pub fn sub_tokens(&mut self, tokens: &[&str]) -> &mut Self

Source

pub fn sub_tokens_string(&mut self, tokens: &[String]) -> &mut Self

Source

pub fn tf_calc(max_count: u32, count: u32) -> f64

Source

pub fn tf_calc_as_u16(max_count: u32, count: u32) -> u16

Source

pub fn tf_calc_as_u32(max_count: u32, count: u32) -> u32

Source

pub fn get_tf_vector(&self) -> Vec<(String, u16)>

Source

pub fn get_tf_vector_parallel(&self) -> Vec<(String, u16)>

Source

pub fn get_tf_vector_ref(&self) -> Vec<(&str, u16)>

Source

pub fn get_tf_vector_ref_parallel(&self) -> Vec<(&str, u16)>

Source

pub fn get_tf_hashmap(&self) -> HashMap<String, u16>

Source

pub fn get_tf_hashmap_parallel(&self) -> HashMap<String, u16>

Source

pub fn get_tf_hashmap_ref(&self) -> HashMap<&str, u16>

Source

pub fn get_tf_hashmap_ref_parallel(&self) -> HashMap<&str, u16>

Source

pub fn get_token_tf(&self, token: &str) -> u16

Source

pub fn idf_max(&self, total_doc_count: u64) -> f64

Source

pub fn idf_calc(total_doc_count: u64, max_idf: f64, doc_count: u32) -> f64

Source

pub fn idf_calc_as_u16( total_doc_count: u64, max_idf: f64, doc_count: u32, ) -> u16

Source

pub fn idf_calc_as_u32( total_doc_count: u64, max_idf: f64, doc_count: u32, ) -> u32

Source

pub fn get_idf_vector(&self, total_doc_count: u64) -> Vec<(String, u16)>

Source

pub fn get_idf_vector_ref(&self, total_doc_count: u64) -> Vec<(&str, u16)>

Source

pub fn get_idf_vector_parallel( &self, total_doc_count: u64, ) -> Vec<(String, u16)>

Source

pub fn get_idf_vector_ref_parallel( &self, total_doc_count: u64, ) -> Vec<(&str, u16)>

Source

pub fn get_idf_hashmap(&self, total_doc_count: u64) -> HashMap<String, u16>

Source

pub fn get_idf_hashmap_ref(&self, total_doc_count: u64) -> HashMap<&str, u16>

Source

pub fn get_idf_hashmap_parallel( &self, total_doc_count: u64, ) -> HashMap<String, u16>

Source

pub fn get_idf_hashmap_ref_parallel( &self, total_doc_count: u64, ) -> HashMap<&str, u16>

Source

pub fn get_token_count_vector(&self) -> Vec<(String, u32)>

Source

pub fn get_token_count_hashmap(&self) -> HashMap<String, u32>

Source

pub fn get_token_count_hashmap_ref(&self) -> HashMap<&str, u32>

Source

pub fn get_total_token_count(&self) -> u64

Source

pub fn get_total_token_count_ref(&self) -> &u64

Source

pub fn get_token_count(&self, token: &str) -> u32

Source

pub fn get_token_count_ref(&self, token: &str) -> &u32

Source

pub fn get_most_frequent_tokens(&self) -> Vec<(String, u32)>

Source

pub fn get_most_frequent_token_count(&self) -> u32

Source

pub fn get_most_frequent_tokens_parallel(&self) -> Vec<(String, u32)>

Source

pub fn tfidf_calc(tf: f64, idf: f64) -> f64

Source

pub fn tfidf_calc_as_u16(tf: u16, idf: u16) -> u16

Source

pub fn tfidf_calc_as_u32(tf: u32, idf: u32) -> u32

Source

pub fn get_tfidf_vector( &self, idf_map: &HashMap<String, u16>, ) -> Vec<(String, u16)>

Source

pub fn get_tfidf_vector_fst(&self, idf_map: &Map<Vec<u8>>) -> Vec<(String, u16)>

Source

pub fn get_tfidf_hashmap( &self, idf_map: &HashMap<String, u16>, ) -> HashMap<String, u16>

Source

pub fn get_tfidf_hashmap_fst( &self, idf_map: &Map<Vec<u8>>, ) -> HashMap<String, u16>

Source

pub fn get_tfidf_vector_parallel( &self, idf_map: &HashMap<String, u16>, ) -> Vec<(String, u16)>

Source

pub fn get_tfidf_vector_fst_parallel( &self, idf_map: &Map<Vec<u8>>, ) -> Vec<(String, u16)>

Source

pub fn get_tfidf_hashmap_parallel( &self, idf_map: &HashMap<String, u16>, ) -> HashMap<String, u16>

Source

pub fn get_tfidf_hashmap_fst_parallel( &self, idf_map: &Map<Vec<u8>>, ) -> HashMap<String, u16>

Source

pub fn contains_token(&self, token: &str) -> bool

Source

pub fn get_token_set(&self) -> Vec<String>

Source

pub fn get_token_set_ref(&self) -> Vec<&str>

Source

pub fn get_token_hashset(&self) -> HashSet<String>

Source

pub fn get_token_hashset_ref(&self) -> HashSet<&str>

Source

pub fn get_token_set_len(&self) -> usize

Source

pub fn get_token_set_iter(&self) -> Keys<'_, String, u32>

Source

pub fn get_token_set_iter_ref(&self) -> impl Iterator<Item = &str>

Source

pub fn get_token_length_stats(&self) -> Option<(usize, usize, f64)>

Source

pub fn get_token_length_stats_ref(&self) -> Option<(usize, usize, f64)>

Source

pub fn get_token_length_stats_parallel(&self) -> Option<(usize, usize, f64)>

Source

pub fn remove_stop_tokens(&mut self, stop_tokens: &[&str])

Source

pub fn remove_stop_tokens_parallel(&mut self, stop_tokens: &[&str])

Source

pub fn remove_tokens_by_condition<F>(&mut self, condition: F) -> u64
where F: Fn(&str, &u32) -> bool,

Source

pub fn get_sorted_by_frequency_desc(&self) -> Vec<(String, u32)>

Source

pub fn get_sorted_by_frequency_desc_parallel(&self) -> Vec<(String, u32)>

Source

pub fn get_sorted_by_frequency_asc(&self) -> Vec<(String, u32)>

Source

pub fn get_sorted_by_frequency_asc_parallel(&self) -> Vec<(String, u32)>

Source

pub fn get_sorted_by_alphabetical_asc(&self) -> Vec<(String, u32)>

Source

pub fn get_sorted_by_alphabetical_asc_parallel(&self) -> Vec<(String, u32)>

Source

pub fn get_sorted_by_alphabetical_desc(&self) -> Vec<(String, u32)>

Source

pub fn get_sorted_by_alphabetical_desc_parallel(&self) -> Vec<(String, u32)>

Source

pub fn get_sorted_by_length_desc(&self) -> Vec<(String, u32)>

Source

pub fn get_sorted_by_length_desc_parallel(&self) -> Vec<(String, u32)>

Source

pub fn get_sorted_by_length_asc(&self) -> Vec<(String, u32)>

Source

pub fn get_sorted_by_length_asc_parallel(&self) -> Vec<(String, u32)>

Source

pub fn get_unique_token_ratio(&self) -> f64

Source

pub fn reset(&mut self)

Trait Implementations§

Source§

impl Clone for TokenFrequency

Source§

fn clone(&self) -> TokenFrequency

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for TokenFrequency

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for TokenFrequency

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for TokenFrequency

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,