Add explicit sexual language typos rule
This commit is contained in:
Generated
+1
-1
@@ -1431,7 +1431,7 @@ checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
|
||||
|
||||
[[package]]
|
||||
name = "payphone"
|
||||
version = "4.0.11"
|
||||
version = "4.0.12"
|
||||
dependencies = [
|
||||
"async-trait",
|
||||
"axum",
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "payphone"
|
||||
version = "4.0.11"
|
||||
version = "4.0.12"
|
||||
edition = "2024"
|
||||
default-run = "payphone"
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
ho
|
||||
@@ -53,8 +53,9 @@ squirts
|
||||
bitch
|
||||
bih
|
||||
bich
|
||||
ho
|
||||
hoe
|
||||
// ho is in "explicit sexual language typos" because it's usually also a typo of "hi". it gets
|
||||
// censored instead of banned.
|
||||
huz
|
||||
slut
|
||||
dldo
|
||||
|
||||
@@ -555,6 +555,42 @@ impl Rule for ExplicitSexualLanguageRule {
|
||||
}
|
||||
}
|
||||
|
||||
struct ExplicitSexualLanguageTypoRule {
|
||||
pattern: Regex,
|
||||
exceptions: Vec<String>,
|
||||
}
|
||||
|
||||
impl ExplicitSexualLanguageTypoRule {
|
||||
fn new() -> Self {
|
||||
let (phrases, exceptions) =
|
||||
parse_phrases_file(include_str!("lists/explicit-sexual-language-typos.txt"));
|
||||
|
||||
let regex = regex_from_phrases_list(&phrases);
|
||||
|
||||
Self {
|
||||
pattern: regex,
|
||||
exceptions,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Rule for ExplicitSexualLanguageTypoRule {
|
||||
fn action(&self) -> &'static Action {
|
||||
&Action::SoftCensorAndWarn
|
||||
}
|
||||
|
||||
fn name(&self) -> &'static str {
|
||||
"Explicit Sexual Language Typo"
|
||||
}
|
||||
|
||||
fn detect(&self, _original: &str, normalized: &str) -> (Vec<String>, Vec<String>) {
|
||||
(
|
||||
vec![],
|
||||
find_with_exceptions(normalized, &self.pattern, &self.exceptions),
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
struct SuggestiveLanguageRule {
|
||||
pattern: Regex,
|
||||
exceptions: Vec<String>,
|
||||
@@ -759,6 +795,7 @@ pub static RULES: Lazy<Vec<Arc<dyn Rule>>> = Lazy::new(|| {
|
||||
Arc::new(HateSpeechAndSlursRule::new()),
|
||||
Arc::new(ThreatsAndSelfHarmRule::new()),
|
||||
Arc::new(ExplicitSexualLanguageRule::new()),
|
||||
Arc::new(ExplicitSexualLanguageTypoRule::new()),
|
||||
Arc::new(SuggestiveLanguageRule::new()),
|
||||
Arc::new(AdvertisingRule),
|
||||
Arc::new(SensitiveTopicsAndTriggeringContentRule::new()),
|
||||
|
||||
Reference in New Issue
Block a user