1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//! TF-IDF vectorization with token n-grams.
//!
//! This module implements sparse TF-IDF (Term Frequency-Inverse Document Frequency)
//! vectorization using token-level n-grams. The implementation follows sklearn's
//! `TfidfVectorizer` API and parameters for compatibility with Python training workflows.
//!
//! # Pipeline
//!
//! 1. **Counting** ([`CountVectorizer`]): Build vocabulary and count term frequencies
//! 2. **Weighting** ([`TfidfVectorizer`]): Apply IDF weights and L2 normalization
//!
//! # Features
//!
//! - **Sparse matrices**: Memory-efficient CSR format via `sprs` crate
//! - **Parallel processing**: Automatic parallelization for large datasets
//! - **sklearn-compatible**: IDF formula matches sklearn: `log((n+1)/(df+1)) + 1`
//! - **Sublinear TF**: Optional `log(tf + 1)` scaling
//! - **Vocabulary filtering**: `min_df` and `max_df` thresholds
//!
//! # Example
//!
//! ```rust
//! use is_it_slop_preprocessing::pre_processor::{TfidfVectorizer, VectorizerParams};
//!
//! let texts = vec!["first document", "second document"];
//! let params = VectorizerParams::new(5.0, 0.9, true); // min_df, max_df, sublinear_tf
//! let (vectorizer, matrix) = TfidfVectorizer::fit_transform(&texts, params);
//! // Uses fixed n-gram range 2-4 (bigrams through 4-grams)
//! ```
pub use CountVectorizer;
pub use ;
pub use TfidfVectorizer;