Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Language Filter

by elusion (Curate)
on Jan 13, 2001 at 08:59 UTC ( #51561=monkdiscuss: print w/replies, xml ) Need Help??

I think that it would be a good idea to add a filter for bad language, for all us good little boys/girls. I realize there's freedom of speech and all, but there's always freedom of selective hearing too. It shouldn't be too hard to implement. I have realized a bit more swearing lately (for an example check the keyword nodelet on newest nodes)... just an idea, and my $.02

- p u n k k i d
"Reality is merely an illusion, albeit a very persistent one." -Albert Einstein

Replies are listed 'Best First'.
(kudra: what's the real problem?) Re: Language Filter
by kudra (Vicar) on Jan 13, 2001 at 16:54 UTC
    I question the assumption that youth requires blinders, but have no problem with self-inflicted censorship. I'm opposed to the idea of any form of filtering that isn't opt-in.

    Not that I'm fond of reading a lot of cursing, but at the moment, I don't think there is a lot. When we start seeing a lot in posts, it probably means there are a lot of other problems, where profanity is merely a symptom.

    True, one place where there is swearing is in the keyword nodelet. I usually ignore it with the intention of removing it next time I edit my preferences because it just makes pages longer. Re-reading the intention of the nodelet, I think it's failing to fulfil its purpose. I think fixing it is a much better alternative than filtering it. As a temporary measure, people who are bothered by it could always remove it from their nodelets without losing any functionality.

Re: Language Filter
by ichimunki (Priest) on Jan 13, 2001 at 17:25 UTC

    I agree. I'd like a "bad language" filter that corrects poor spelling, uncapitalized "i" for first person singular pronouns, and cleans up your grammar.

    Where did you get this "selective hearing"? That option was not offered to me when my ears were installed. I think I'd like to use it in business meetings to help block out words like "proactive", "customer-focused", "shareholder value", and "team member".

    Honestly. When I first saw the node title Language Filter, I thought we were finally going to be rid of JavaScript at the Monastery.

      Ha! When I saw the node title, I thought it would be something on language *detection* when reading in an unknown text file! I was sort of looking forward to see how that trick was accomplished. Oh, well...
(silly) Re: Language Filter
by mirod (Canon) on Jan 13, 2001 at 15:17 UTC

    I agree with you. The only problem, as already mentionned in the previous anwers is that regexps do a terrible job at matching curse words. They are inneficient and not accurate at all.

    I guess the only efficient solution here is that curse words should be tagged as such, then a quick XML filter would get rid of then easily. The author could even provide for milder alternatives, so the filter could accuratelly replace the bad language with a nicer version.

    <p>Go <curse level="very offensive" cats="sexual contorsionnism" alt=" +play with your toys">f**k yourself</curse> you <curse level="quite offensive" cats="body_part" alt="bad person +">a*sh**e</curse>!

    Easy isn't it?

    Seriously filters don't work, be they for URL's or for words, so please let's not go there. I haven't seen much cursing around here anyway so why bother?

Re: Language Filter
by turnstep (Parson) on Jan 14, 2001 at 20:13 UTC
    Besides the example on the keywords for the Newest Nodes page, has this really been a problem yet? There have been some posts (and I am not going to link to them :) that could be considered offensive to some, but they have all been voted down and forgotten about. I think the current moderation system is probably sufficient, combined with a timely Editor Requests petition for the truly offensive nodes.

    And of course, some keyword editing would be nice. :)

Re: Language Filter
by zencrypt (Novice) on Jan 13, 2001 at 09:34 UTC
    I agree, but i think there should be an option in one's preferences to turn filtering on or off, perhaps even allow different users to choose their own filtered words, and what they would like them to be replaced with (F-word with F***, or F!!!, or !!!, or F!CK, etc..).. just another $.02 :)

      Well, I would say let each user make their own filter. Start off with simple regex s/\sf[u*][c*]k\s/[censored]/i if you want to just get that first bad word on each line. Build from there until satisfied.

      Another thought that this would allow is you could censor whatever you wanted. Maybe I spaz out whenever I see the terms "mission statement", "paradigm", or "win-win" mentioned.

      Now the question is, should we make the filters public knowledge so that the more knowledgeable monks could suggest improvements? This would have the benefit of the regexes being clean enough to not swamp the server with useless spinning. Of course that might increase the amount of harsh language to get by most regexes. I think tone is a lot more important than the use of "restricted" language.

        There is a good solution, make sensitive people type in their own personal list of bad words. If enough sites make them do that, after a while laziness will crush any sense of "bad-word-ness" that exists in society.

        On a more serious note, you likely wanted "\b" rather than "\s" at the beginning and no \s at the end either. Your way used on "go f**k yourself you f**ker" yields "go[censored]yourself you f**ker", which isn't likely to be the result you want.

        Worse, people like me will delight in finding new variations that get by your current filters. Like pr0n and fsck and "fock cucker" or even "Kcuf!". L33t speak became a real benefit to society when it helped AOLers get around useless filters.

        Oh yeah, I won't even get into the problem of regex dealing with the difference between embedded sequences vs. prefixes and suffixes and grammatical declension. "Skys[censored]per".

        Filtering is a Tar-Baby. It looks easy to beat-up but every attack you make just gets you in deeper. And, now that I've made that analogy, I might start calling you Brer-lemming just to be mean. =)

        Finally; If you want to see cussing, start censoring people.

        $you = new YOU;
        honk() if $you->love(perl)

Re: Language Filter
by PipTigger (Hermit) on Jan 14, 2001 at 16:37 UTC
    I thinq your answer is at your fingertips. Allowing each Monk to specify their own filtration regexes could wreak havoc upon the PM server's efficiency... back-tracking in particular can be devastating. Your mission (should you choose to accept it) is to write your own filter. You're welcome to my piece of insanity if it will serve you. I wrote it for a similar purpose. I'm a pretty inexperienced Perl hacker but I like to make anything useful.

    You can check out the code && node for PPMT && see it running here on my cheesy server. If only it could handle a cookie for my login to fully pretend to transparently be me, I'd use it exclusively. Well I hope this helps if you're still even interested in filtering content. It's good to solve the problem yourself rather than impose possibly extraordinary code && load on the host server. I'd be glad to help you in any way I can if you'd like me to. TTFN.

    p.s. Initiate Nail Removal Immediately!
Re: Language Filter
by ambrus (Abbot) on Mar 17, 2010 at 10:59 UTC

    Try adding the following code to your Free Nodelet Settings, and enable your Free Nodelet in Nodelet Settings. Then you'll have a link in your Free Nodelet that filters language on the current page when you clikc on it.

    One could also set this to run after every page load, but note that this may break things, because it filters text inside script or style tags too.

    <p> <script type="text/javascript" defer><!-- function langfilter() { function r(x) { if(Node.TEXT_NODE == x.nodeType){ var s=x.nodeValue; v +ar n=s.replace(/\b(f)u(?:c)k/ig, function(c0,c1){return c1+"---"}); i +f(s!=n){ x.nodeValue=n; } }; var t; if(t=x.firstChild)r(t); if( +xtSibling)r(t); }; r(document.documentElement) }; //--></script> <a href="javascript:langfilter()">Watch your tongue!</a>

    Below is some dirty words so that you can easily test that this feature works.

Re: Language Filter
by ambrus (Abbot) on Mar 17, 2010 at 11:09 UTC

    Could you just buy one of those antivirus products with parental control features, and crank up its controls? Or perhaps some browser plugin? Filtering bad words is probably not something you should trust an individual site to do, but instead do it on your computer to make it work the same on sites, using your preferred settings. (For the same reason why individual sites should not implement those stupid unusable javascript popdown menus and crazy css-forced layouts with unreadable overlapping text lines and fancy hypertext editors, but should instead leave these features to the browsers so each individual user can set them up to how they like to use it; and for the same reason why text configuration files you can edit with your favourite editor are better than messed up custom configuration dialog boxes in every application.)

Re: Language Filter
by jdporter (Chancellor) on Mar 17, 2010 at 15:27 UTC

    How about a language filter which converts English into Hungarian?

    Or — even better — a filter which converts Perl into Ruby?







    Oh, that's not what we meant by "language" in this thread?

    What is the sound of Windows? Is it not the sound of a wall upon which people have smashed their heads... all the way through?
      Interesting answers ...

      ... did any of you already realize that this thread is from 2001 and not 2010? : )

      Cheers Rolf

        I did and I still *barely* stopped myself from adding some profanity to it.

Re: Language Filter
by jfreger (Initiate) on Mar 16, 2010 at 00:36 UTC

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: monkdiscuss [id://51561]
Approved by root
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2023-12-01 18:47 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (4 votes). Check out past polls.