[Zope] Dirty Word Filter

Ben Ocean zope@thewebsons.com
Fri, 16 Feb 2001 14:30:49 -0800


At 08:44 PM 2/16/2001 +0100, you wrote:
>[Ben Ocean]
>
>| Has anyone developed a Zope dirty word filter?
>
>How do you define filter?  And how would you use it?  F ex when
>displaying content?  Or when adding content?

I'm thinking of when someone adds to a job or classifieds board or some 
other means of posting, such as SquishDot.
BenO

>For ZCatalog searches there is a stop-word list, I don't know too much
>about it, but for searches, that could be used I guess (albeit, it is
>a very ugly solution).
>
>Maybe (untested!):
>
>aString = 'you <dirty word1> bastard!'
>DirtyWords = [<dirty word1>, <dirty word2>]
>
>
>for word in string.split(aString, ' '):
>         if word in DirtyWords:
>                 aString = string.replace(aString, word, '*bleep*')
>
>I guess that would work.  If you combine that, with soundex and
>ZCatalog you could get a nice filter.
>
>Create it as a python module in the Extensions/ directory and let
>everything you want to check have a run through that script first.