From 6a5fdda14c1dccca4e002618cc8a428b1dc163bd Mon Sep 17 00:00:00 2001 From: Dirk Koopman Date: Wed, 23 Nov 2022 15:32:52 +0000 Subject: [PATCH] add some extra default badwords --- cmd/Commands_en.hlp | 15 ++++++++++++--- data/badword.new.issue | 2 ++ perl/BadWords.pm | 4 ++-- 3 files changed, 16 insertions(+), 5 deletions(-) diff --git a/cmd/Commands_en.hlp b/cmd/Commands_en.hlp index 7f5f3dbb..3bef48cd 100644 --- a/cmd/Commands_en.hlp +++ b/cmd/Commands_en.hlp @@ -1660,14 +1660,18 @@ like this: but it will also stop things like this: - anihilate annni11ihhh ii lllattt eee ddd + anihilate annni11ihhh ii lllattt eee A few common 'leet' substitutions are automatically matched: - b0ll0cks bo0lll0ccckks fr1iig + b0ll0cks bo0lll0ccckks fr1iigging and so on +It will not stop some things like: + + The base word FRIG will stop 'friiigging' but not 'friiig ging' + === 6^UNSET/BADWORD ..^Propagate things like this word again This is the opposite of set/badword @@ -2173,10 +2177,15 @@ for more information. Display all the bad spotter's callsigns in the system, see SET/BADSPOTTER for more information. -=== 1^SHOW/BADWORD^Show all the bad words in the system +=== 6^SHOW/BADWORD^Show all the bad words in the system +=== 6^SHOW/BADWORD full^Show all badwords with their Regex Display all the bad words in the system, see SET/BADWORD for more information. +The first form shows all the base words that are stored in a simple list. + +The second form show each word with its associated perl regex. + === 0^SHOW/BANDS [band|region names]^Show the list of bands and regions Display the bands and regions (collections of bands) known to the system. If you supply band or region names to SHOW/BANDS, diff --git a/data/badword.new.issue b/data/badword.new.issue index a0d897d8..ee9f23e9 100644 --- a/data/badword.new.issue +++ b/data/badword.new.issue @@ -46,6 +46,7 @@ ENVIDIOSO ESTUPIDO EXPLOSIVE FOLA +FRIG FUCK FUK FUNKER @@ -107,6 +108,7 @@ SHIT SLAG SLAUGHTER SLAVE +SLUT SOD SPOTWAR STOPUTIN diff --git a/perl/BadWords.pm b/perl/BadWords.pm index 09911b4a..446bcf1e 100644 --- a/perl/BadWords.pm +++ b/perl/BadWords.pm @@ -135,7 +135,7 @@ sub generate_regex my $res; @relist = sort {$a->[0] cmp $b->[0]} @relist; for (@relist) { - $res .= qq{(?:$_->[1]) |\n}; + $res .= qq{\\b(?:$_->[1]) |\n}; } $res =~ s/\s*\|\s*$//; $regex = qr/\b($res)/x; @@ -211,7 +211,7 @@ sub check if ($regex) { my %uniq; - @out = grep {++$uniq{$_}; $uniq{$_} == 1 ? $_ : undef }($s =~ /\b($regex)/g); + @out = grep {++$uniq{$_}; $uniq{$_} == 1 ? $_ : undef }($s =~ /($regex)/g); dbg("BadWords: check '$s' = '" . join(', ', @out) . "'") if isdbg('badword'); return @out; } -- 2.34.1