Re: Robust Anti-Swear script
by Cubes (Pilgrim) on Jul 31, 2001 at 01:28 UTC
|
A couple of things to think about...
First, people *will* find ways around whatever filters
you put in place. If you just want to stop the worst
of the nasty words from showing up, you'll probably
do OK at that, but your users will undoubtedly come up
with new ways to say the same thing that won't be caught
by your filter.
What are you really trying to accomplish here? If it's
a "letter of the law" situation, you've got
half a chance. If you're trying to stop participants
from communicating naughty ideas, you will fail.
Then, to make matters worse, the more words and permutations
you try to filter out, the more false negatives you'll
catch.
Context is everything -- several years ago, AOL drew some
bad publicity when breast cancer survivors were repeatedly
dinged for using bad language in chat rooms and user
profiles.
That's one example.
George Carlin sets forth several more in his "Seven
Dirty Words" bit, like "You can prick your finger,
but don't finger your prick"
The more questionable words you try to block, the more
legitimate conversation you will block unintentionally.
And the more clever your users will get in their attempts
to sidestep your bot.
Automating analysis of the English language is not
something that can be done with a few perl regexps.
Work on your bot, sure, but consider using it to
alert a human who can read the questionable content in
context and take action, rather than having the bot
take action all by itself.
| [reply] |
|
|
And once users realize that they are being filtered, some of them will find it a challange to get past the filter and so the filter may actually result in an increase in offensive chatting.
I recall a case where the source of the filter was identified and chat like "Bob, that is a big, stinky pile of Azhrarn and you know it" started showing up.
So one should probably make the filter very specific and rather simple so that it isn't much of an interesting challenge to get past and just catches the casual first use of a forbidden word as a reminder that such is not appreciated. This will catch the occasional "slip" by a well-meaning user while being less likely to inflame much of a response to the filter itself.
Though even that has a good chance of being more of a problem than it is worth.
-
tye
(but my friends call me "Tye")
| [reply] |
|
|
Tye has some very good points.
I run a couple of forums on which I've implemented a simple word list filter.
I find that I've backed off to just a few very obvious words. If one of these words show in text I replace with the Times Newspaper approved sustitute
and also send myself a message.
Usually the substitution is enough to handle the immediate situation. If when the human (or semi-human) moi reviews the alerts a further action is required then further action is taken.
But at this point the permutations of okay versus not okay are too complex for a simple bot to handle.
I've found that the simple substitution has sent a gentle message that certain language is not approved and most folks have either backed off or found a new and less offensive means of responding to each other.
In the few cases where the user was obviously way over the line I chose to implement a ban filter on that user. This was decided and implemented by the semi-human.
Claude
| [reply] |
Re: Robust Anti-Swear script
by VSarkiss (Monsignor) on Jul 31, 2001 at 00:33 UTC
|
You could try "laundering" the text on its way in, rather than writing really complicated regexps. In other words, first render it in lowercase, remove all whitespace and punctuation, make substitions for l337 speak, then look for the nasties. It's fairly easy with tr:
$message = uc $message; # uppercasify
$message =~ tr/ .;,/d; # remove spaces and punctuation
$message =~ tr/13457/least/; # un-1337
(Warning, this is untested.) Of course you could combine those into a single statement. I just broke it up for clarity.
Do realize that the more munging you do in this fashion, the more prone your code will be to false positives. For example, the sample lines I wrote above would trigger on "I had amnesia" and "45 sweaters". | [reply] [d/l] [select] |
|
|
There are many issues with censorship, that'll try to avoid here, and I'd liek to extend the ideas already discussed in how to remove profanity
I think you'd get a lot of false matches on perfectly harmless language, so you need to gaurd against a lot of these without annoying people (IMHO, you'd annoy more people by punishing innocent than not stopping profanity)
The classic example I always use is my friend Dick from Scunthorpe. He has a pet Ass (as in donkey).
Now there are (at least) three false trigers in that paragraph (although some things like "c ex" might trigger more), and leads on to dialect; In UK English, an Ass is nothing but a donkey. You sit on your Arse, but getting drunk is being rat-arsed.
Perhaps on alternative is to match against bad, then match against that bad word's "safe" list (with words like Scunthorpe)
Ultimately there are going to be mistakes, and the only perfect way to do it would be human; although I'd be interested in developing an AI engine that could be taught...
--
RatArsed
| [reply] |
|
|
Yeah, that was something like my second idea. If I washed the text, it would be a bit easier to match against a wordlist.
I don't really need to look for case though as //i gets rid of that. Also, I just thought of cases like multiple letters being substituted for one. Like "Ph" for "f." Would (ph|f) work on that for a word with the letter f in it? OR tr/(ph)/f/ ?
Hopefully not to many people have 45 sweaters. ;)
| [reply] |
|
|
You just need a bigger wordlist. Since you're already going to need a list of bad words, why not put your leet speak words in there. Then you'll have fewer false matches on translated words like 45sweaters.
Anything that is suspect (isn't found in wordlist but contains numbers) could then be translated and run through a second matching.
It's all in your approach.
| [reply] |
|
|
|
|
Re: Robust Anti-Swear script
by spudzeppelin (Pilgrim) on Jul 31, 2001 at 01:31 UTC
|
Check out the new Regexp::Common module that Damian Conway released, and IIRC japhy is now maintaining. It contains a built-in $RE{profanity} that you can match against without having to put the terminology in your script (and without having to try to define your own canon for what is "profane"). If you really wanted to, you could craft an extension (based on the way it's written) to the tree to implement the degree of comprehensiveness you desire. The paper describing it in detail is actually in the proceedings of TPC (which just ended Friday).
You may also want to watch how comprehensive you are trying to make this. Otherwise, you could find yourself filtering out things like i18n n d4m n l10n (for some legitimate use of "d4m").
Spud Zeppelin * spud@spudzeppelin.com
| [reply] [d/l] [select] |
Re: Robust Anti-Swear script
by mikfire (Deacon) on Jul 31, 2001 at 01:29 UTC
|
Warning: This answer may well be off topic
<soapbox=on mode="free speech">
Umm, are you sure about this? What if somebody says
"I had to brush it off"? Will your software filter that? If you
code it to avoid phrases like this, will
you allow the "tithe"? How about "Shiite"?
I could likely sit here all day and come up with silly
examples as to how this filtering scheme will filter more than you intended.
I could also show clever ways to still swear that most
people would understand. I will not, however, profane
the Monastery in that fashion.
What about historical references? How many of us, as we get ready to press the rest button and reinstall the server have shouted "damn the torpedoes, men!"? okay,
I will admit I am likely to be in a minority on that one :)
My understanding is that most languages are far to context dependant for this kind of filter to work. I also freely admit this in no way helps answer your question, but I firmly believe there is no solution beyond compiling a list of Carlin's Seven Dirty Words and using a word boundary regex - like
/\bdamn\b/
Sorry 'bout that. We now return you to our regularly scheduled Monastery.
</soapbox>
Update: I really must stop trying to respond using Opera.
mikfire | [reply] [d/l] [select] |
Re: Robust Anti-Swear script
by Starky (Chaplain) on Jul 31, 2001 at 03:59 UTC
|
The only workable idea I've known about for filtering content for profanity and vulgarity is none other than a pair of human eyes.
Beware trying to automate any solution to the problems. Humans are simply too creative, and human language is simply too ambiguous.
I think your best bet is to monitor what your script considers to be the worst potential offenders, then have a pair of human eyeballs peruse the transcripts and take action when necessary.
I speak from experience: A dot-com I worked for tried to automatically filter user content on a site, and it monumentally backfired. There were so many embarrassing and problematic false positives that the filters were eventually removed.
(I should point out that the site wasn't even the kind one would think would generate such problems: It was a recreational sports site! As it turns out, alot of people like to include double entendres or clever wordplay when naming their sports teams ;-)
Hope this helps! | [reply] |
More clarification
by Azhrarn (Friar) on Jul 31, 2001 at 04:09 UTC
|
Well... This is really just a base script that will be included with the bot distribution. So I want people to be able to modify it with as little hassle as possible. And as far as I'm concerned, if it filters out most stuff that resembles the word, it is doing its job.
When people start making up their own terminology (One example is "ffs" for "for f***s sake ;) ), as far as I am concerned it is an inside joke at that point. And it only really has meaning to the people who made it up. If whoever is running the bot wants to filter it, so be it. I am just making a core regexp/function that will be fairly easy to add to.
The main use I would have for it is protecting against spam advertisements. I would put in the names of other sites that people like to spam my channel with ( I mod an IRC channel for a browser game and people like to come in and spam a different game's website. If I make it so they have to sufficiently mangle the site's name, then I am happy. It isn't meant to be perfect, but it is sufficient for my needs, and as a general example script.
As far as the free speech issues, I share your views and don't really care personally one way or the other what language people use. I swear plenty myself sometimes. But as I said, it's there for other people if they want it. | [reply] |
Re: Robust Anti-Swear script
by petdance (Parson) on Jul 31, 2001 at 07:32 UTC
|
It's an anal bot
Interesting choice of terms considering what you want it
to do. Some people could easily see "anal" as being offensive.
I suggest that you need to do some serious thinking about how much bang for the buck you need. As others have said, you're never going to get it worked out. Lord knows that on ddials years ago, it was easy to write "sh1t" and voila, you're past the filters.
How far are you willing to go here? How about spelling? Can your users discuss the song "If You See Kay" by
Poster Children? (There was also a song with that title by April Wine)
How about the classic song from the Dr. Demento show
"Polka Dot Undies"?
How small are you willing to chase your diminishing returns?
xoxo,
Andy
--
<megaphone>
Throw down the gun and tiara and come out of the float!
</megaphone>
| [reply] |
Re: Robust Anti-Swear script
by seanbo (Chaplain) on Jul 31, 2001 at 03:33 UTC
|
I wouldn't try to be too clever. You will end up filtering out valid conversation. let's say you have two geoligist chatting about *schist*, which is a type of stone, do they get filtered because you think they are talking about something they aren't?
Another example, what if I was talking about the Hoover *Dam*, would I get filtered? What about a *flock* of geese, or validly referring to a female dog as a *bitch* (obviously this should be filtered, but could be used as a non-profane word).
<point>Irregardless of what you try to filter, some people will get ar
+ound it, some will get filtered erroneously. I would keep the list o
+f filtered words concise.
</point>
seanbo
Ahh..the odd dog is a strange beast indeed, nobody wants him, but he always seems to be there. | [reply] [d/l] |
Re: Robust Anti-Swear script
by tadman (Prior) on Jul 31, 2001 at 16:24 UTC
|
There is no perfect solution, as the kiddies will always
find ways around them. Let's face it, if it takes you 10
hours to think up something, it may take them 1000 hours
to figure out a way around it, but if there's 10,000
people banging away at it, then it's over in 6 minutes.
Think of the problems you have with: shittake mushrooms,
Fucking, Austria,
"I scraped my knee", hockey players named Satan, and so many more that it makes
conversation quite awkward.
If you want to do the "right" thing, then make sure you
match on word-breaks (i.e. /\bcrap\b/) and that your
list is fairly extensive. Even then, the context often
determines the meaning of words. | [reply] |
|
|
I probably will make it use word breaks, (but as far as I'm concerned Fucking, Austria would be a match ;) ) I'll have to see how sensitive word breaks are. As I would want punctuation to count, but wouldn't want it to trigger on any shroom discussions. ;)
Thanks for all the moral issues, but I will leave those dillemas up to the end users. I could also modify this once it is done to take ANY action, not just hostile.
I could make it trigger on key words like "Azhrarn" or "help" to alert me, and have it work out bad spellers and such. ;) This can be expanded quite a bit once it is completed, but it will be nice to have a base word-matching script that I can feed a list into. You guys just can't get past the basic premise of the script to other uses can you? :p
| [reply] |
|
|
For me, at least, the issues I raised have less to do with morality than practicality (sorry to all you upvoters
who thought I was making a grand anti-censorship
speech :-)
Parsing the English language is an
extremely difficult task to automate,
regardless of your motive or objective.
Unless you are using key words that are
unlikely to be used in conversation unrelated to what
you're trying to capture, you'll end up with bogus
results unless you can also analyze and interpret context.
Even humans don't do so well at that -- hence the use of
"magic words" like "mayday" or
"I am declaring an emergency" instead of
"help" in situations where it really matters.
Trying to code this sort of understanding into a perl
regex without resorting to predefined magic words would
be quite a trick.
Automating action based on anything a perl regex could
identify simply won't do you much good in the long run.
| [reply] |
|
|
Re: Robust Anti-Swear script
by mr_mischief (Monsignor) on Aug 02, 2001 at 01:26 UTC
|
I often play craps. I also often use shittake mushrooms in dishes I prepare. I often invite people to come into a room when I am already inside. I often notice people succumbing to a force, such as the heat that's prevalent in central Illinois right now (as almost every summer). A vaccuum cleaner clearly sucks. 'Piss', 'pissing' and 'pissy' is a set of words with many slang uses between the US and the UK - drunk, angry, complaining... Some filters like this forget that 'pink' is a color, that 'crabs' are food (or pets), that you can surpass a limit or expectaion, and that a breast can be a source of illness, a source of food, or food by itself (chicken or turkey, for example).
The best suggestion I can make is that your system keeps some form of state. A tally (not tallywhacker, mind you) of words that match your list as a percentage of overall text is probably a good indicator of someone being libidinous or offensive. Perhaps somewhere between 10% and 25% of a user's sentences containing such borderline words might be a good cue to flag it for action. Also, I'd recommend having such records log the number of total lines submitted with questionable words, the user's overall submissions, and the actual text of the lines found to be questionable for administrative review.
All that said, there are a few words I can't see entering normal conversation, and those words I'd be happy to email to anyone requesting them via my email (mischief@inkless.net), but i won't put such words here.
Chris | [reply] |
|
|
This has been bugging me through the entire thread here. It could be that american chefs have managed to change the spelling we use to shittake, but the Japanese word is definatly shiitake, which is pronounced quite differently from shittake, now depending upon the way you want to romanize the word, shitake could be acceptable. I'm not personally familiar with all of the different romanization systems, but most of them romanize the japanese "‚µ‚¢‚½‚¯" as shiitake. As I said, I come at this as someone with a very basic understanding of the Japanese language, not as a chef. I'll stop rambiling now.
-Ted
| [reply] |
Re: Robust Anti-Swear script
by bastard (Hermit) on Jul 31, 2001 at 23:02 UTC
|
| [reply] |
|
|
Heh, why didn't I think of that? :p Actually, even the words it does filter, will still be seen by the channel. It will just be a trigger for the bot to take action. There is no way to pass the text through the bot before it reaches the channel (unless you are using a botnet, but that is a different story).
Basically the bot will see someone say something it doesn't like and kick them off the channel as a warning. Although you can set a flag so it bans them instead. Or, as I said before, make it do just about anything.
| [reply] |
Re: Robust Anti-Swear script
by buckaduck (Chaplain) on Aug 01, 2001 at 22:48 UTC
|
This reminds me of a web-based bulletin board system that
was implemented where I work. It was set up so that
analytical chemists could share their results.
The server automatically rejected any message which
included the apparently profane phrase "Mass Spectrometry".
Unfortunately, that's a pretty common phrase in analytical
chemistry, and the site's maintainers never fixed the
problem, so nobody ever used it. A sad waste of some poor
programmer's time...
buckaduck | [reply] |