Add explicit sexual language typos rule
This commit is contained in:
Generated
+1
-1
@@ -1431,7 +1431,7 @@ checksum = "df94ce210e5bc13cb6651479fa48d14f601d9858cfe0467f43ae157023b938d3"
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "payphone"
|
name = "payphone"
|
||||||
version = "4.0.11"
|
version = "4.0.12"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"axum",
|
"axum",
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "payphone"
|
name = "payphone"
|
||||||
version = "4.0.11"
|
version = "4.0.12"
|
||||||
edition = "2024"
|
edition = "2024"
|
||||||
default-run = "payphone"
|
default-run = "payphone"
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
ho
|
||||||
@@ -53,8 +53,9 @@ squirts
|
|||||||
bitch
|
bitch
|
||||||
bih
|
bih
|
||||||
bich
|
bich
|
||||||
ho
|
|
||||||
hoe
|
hoe
|
||||||
|
// ho is in "explicit sexual language typos" because it's usually also a typo of "hi". it gets
|
||||||
|
// censored instead of banned.
|
||||||
huz
|
huz
|
||||||
slut
|
slut
|
||||||
dldo
|
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 {
|
struct SuggestiveLanguageRule {
|
||||||
pattern: Regex,
|
pattern: Regex,
|
||||||
exceptions: Vec<String>,
|
exceptions: Vec<String>,
|
||||||
@@ -759,6 +795,7 @@ pub static RULES: Lazy<Vec<Arc<dyn Rule>>> = Lazy::new(|| {
|
|||||||
Arc::new(HateSpeechAndSlursRule::new()),
|
Arc::new(HateSpeechAndSlursRule::new()),
|
||||||
Arc::new(ThreatsAndSelfHarmRule::new()),
|
Arc::new(ThreatsAndSelfHarmRule::new()),
|
||||||
Arc::new(ExplicitSexualLanguageRule::new()),
|
Arc::new(ExplicitSexualLanguageRule::new()),
|
||||||
|
Arc::new(ExplicitSexualLanguageTypoRule::new()),
|
||||||
Arc::new(SuggestiveLanguageRule::new()),
|
Arc::new(SuggestiveLanguageRule::new()),
|
||||||
Arc::new(AdvertisingRule),
|
Arc::new(AdvertisingRule),
|
||||||
Arc::new(SensitiveTopicsAndTriggeringContentRule::new()),
|
Arc::new(SensitiveTopicsAndTriggeringContentRule::new()),
|
||||||
|
|||||||
Reference in New Issue
Block a user