pub struct TFIDFData<N = f32, K = String, E = DefaultTFIDFEngine>{
pub documents: IndexMap<KeyRc<K>, TFVector<N>>,
pub term_dim_sample: Vec<Box<str>>,
pub idf: Option<IDFVector>,
/* private fields */
}Expand description
TF-IDF Vectorizer Data Structure (Corpus-free)
A compact, serializable representation of a TF-IDF vectorizer.
Unlike TFIDFVectorizer, this struct does not hold a Corpus reference.
It can be converted back into a TFIDFVectorizer by providing an Arc<Corpus>.
§Use Cases
- Persistent storage
- Network transfer
- Memory-efficient snapshots
§Serialization
Supported.
§Deserialization
Supported, including internal data expansion.
Fields§
§documents: IndexMap<KeyRc<K>, TFVector<N>>TF vectors for documents
term_dim_sample: Vec<Box<str>>term dimension sample for TF vectors
idf: Option<IDFVector>IDF vector
Implementations§
Source§impl<N, K, E> TFIDFData<N, K, E>
impl<N, K, E> TFIDFData<N, K, E>
Sourcepub fn into_tf_idf_vectorizer(
self,
corpus_ref: Arc<Corpus>,
) -> TFIDFVectorizer<N, K, E>
pub fn into_tf_idf_vectorizer( self, corpus_ref: Arc<Corpus>, ) -> TFIDFVectorizer<N, K, E>
Convert TFIDFData into TFIDFVectorizer.
corpus_ref is a reference to the corpus.
Trait Implementations§
Source§impl<'de, N, K, E> Deserialize<'de> for TFIDFData<N, K, E>
impl<'de, N, K, E> Deserialize<'de> for TFIDFData<N, K, E>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl<N, K, E> Freeze for TFIDFData<N, K, E>
impl<N, K, E> RefUnwindSafe for TFIDFData<N, K, E>
impl<N = f32, K = String, E = DefaultTFIDFEngine> !Send for TFIDFData<N, K, E>
impl<N = f32, K = String, E = DefaultTFIDFEngine> !Sync for TFIDFData<N, K, E>
impl<N, K, E> Unpin for TFIDFData<N, K, E>where
E: Unpin,
impl<N, K, E> UnwindSafe for TFIDFData<N, K, E>
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