Spam filter performance and accuracy improvements (part 5)

This commit is contained in:
mdecimus
2025-12-04 17:46:38 +01:00
parent 50dce48a85
commit c467ce07f1
34 changed files with 967 additions and 484 deletions

View File

@@ -78,6 +78,15 @@ impl FeatureBuilder {
}
}
impl Sample {
pub fn new(features: Features, class: bool) -> Self {
Self {
features,
class: if class { 1.0 } else { 0.0 },
}
}
}
impl AsRef<Sample> for Sample {
fn as_ref(&self) -> &Sample {
self

View File

@@ -2837,6 +2837,25 @@ mod test {
TokenType::Punctuation('!'),
],
),
(
"v𝔂 𝔽𝕌Ňℕy ţ乇𝕏𝓣 wWiIiIIttHh l133t5p3/-\\|<",
vec![
TokenType::Alphabetic("v𝔂"),
TokenType::Space,
TokenType::Alphabetic("𝔽𝕌Ňℕy"),
TokenType::Space,
TokenType::Alphabetic("ţ乇𝕏𝓣"),
TokenType::Space,
TokenType::Alphabetic("wWiIiIIttHh"),
TokenType::Space,
TokenType::Alphanumeric("l133t5p3"),
TokenType::Punctuation('/'),
TokenType::Punctuation('-'),
TokenType::Punctuation('\\'),
TokenType::Punctuation('|'),
TokenType::Punctuation('<'),
],
),
] {
let result = TypesTokenizer::new(text)
.map(|t| t.word)