Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Re: Re: Front Paging Profanity

by ignatz (Vicar)
on Oct 16, 2002 at 11:30 UTC ( #205674=note: print w/ replies, xml ) Need Help??


in reply to Re: Re: Front Paging Profanity
in thread Front Paging Profanity

WARNING: You must be at least 21 years old or authorized by a guardian to read this post.

Well Fuck!

Serves me right for breaking my first rule of posting: Never recommend a module that you've never used. I love Regex::Common but haven't tried Regex::Common::profanity. Here's my super duper profanity test suite:

#!/usr/bin/perl use Regexp::Common qw /profanity/; # http://staff.dstc.edu.au/bill/carlin.html @dirty7 = qw|Shit Piss Fuck Cunt Cocksucker Motherfucker Tits|; foreach (@dirty7) { print; /$RE{profanity}/ and print " contains profanity"; print "\n"; }
Looks like another bug report to the maintainer.

To be honest, I scratched my head for a while trying to figure out what the fuck the code for that module was doing:

package Regexp::Common::profanity; { use strict; local $^W = 1; use Regexp::Common qw /pattern clean no_defaults/; my $profanity = '(?:cvff(?:\\ gnxr|\\-gnxr|gnxr|r(?:ef|[feq])|vat|l)?| +dhvzf?|fuvg(?:g(?:r(?:ef|[qe])|vat|l)|r(?:ef|[fqel])|vat|[fr])?|g(?:h +eqf?|jngf?)|jnax(?:r(?:ef|[eq])|vat|f)?|n(?:ef(?:r(?:\\ ubyr|\\-ubyr| +ubyr|[fq])|vat|r)|ff(?:\\ ubyrf?|\\-ubyrf?|rq|ubyrf?|vat))|o(?:hyy(?: +\\ fuvg(?:g(?:r(?:ef|[qe])|vat)|f)?|\\-fuvg(?:g(?:r(?:ef|[qe])|vat)|f +)?|fuvg(?:g(?:r(?:ef|[qe])|vat)|f)?)|ybj(?:\\ wbof?|\\-wbof?|wbof?))| +p(?:bpx(?:\\ fhpx(?:ref?|vat)|\\-fhpx(?:ref?|vat)|fhpx(?:ref?|vat))|e +nc(?:c(?:r(?:ef|[eq])|vat|l)|f)?|h(?:agf?|z(?:vat|zvat|f)))|qvpx(?:\\ + urnq|\\-urnq|rq|urnq|vat|yrff|f)|s(?:hpx(?:rq|vat|f)?|neg(?:r[eq]|va +t|[fl])?|rygpu(?:r(?:ef|[efq])|vat)?)|un(?:eq[\\-\\ ]?ba|ys(?:\\ n[fe +]|\\-n[fe]|n[fe])frq)|z(?:bgure(?:\\ shpx(?:ref?|vat)|\\-shpx(?:ref?| +vat)|shpx(?:ref?|vat))|hgu(?:n(?:\\ shpx(?:ref?|vat|[nnn])|\\-shpx(?: +ref?|vat|[nnn])|shpx(?:ref?|vat|[nnn]))|re(?:\\ shpx(?:ref?|vat)|\\-s +hpx(?:ref?|vat)|shpx(?:ref?|vat)))|reqr?))'; my $contextual = '(?:c(?:bex|e(?:bax|vpxf?)|hff(?:vrf|l)|vff(?:\\ gnxr +|\\-gnxr|gnxr|r(?:ef|[feq])|vat|l)?)|dhvzf?|ebbg(?:r(?:ef|[eq])|vat|f +)?|f(?:bq(?:q(?:rq|vat)|f)?|chax|perj(?:rq|vat|f)?|u(?:nt(?:t(?:r(?:e +f|[qe])|vat)|f)?|vg(?:g(?:r(?:ef|[qe])|vat|l)|r(?:ef|[fqel])|vat|[fr] +)?))|g(?:heqf?|jngf?|vgf?)|jnax(?:r(?:ef|[eq])|vat|f)?|n(?:ef(?:r(?:\ +\ ubyr|\\-ubyr|ubyr|[fq])|vat|r)|ff(?:\\ ubyrf?|\\-ubyrf?|rq|ubyrf?|v +at))|o(?:ba(?:r(?:ef|[fe])|vat|r)|h(?:ttre|yy(?:\\ fuvg(?:g(?:r(?:ef| +[qe])|vat)|f)?|\\-fuvg(?:g(?:r(?:ef|[qe])|vat)|f)?|fuvg(?:g(?:r(?:ef| +[qe])|vat)|f)?))|n(?:fgneq|yy(?:r(?:ef|[qe])|vat|f)?)|yb(?:bql|j(?:\\ + wbof?|\\-wbof?|wbof?)))|p(?:bpx(?:\\ fhpx(?:ref?|vat)|\\-fhpx(?:ref? +|vat)|fhpx(?:ref?|vat)|f)?|enc(?:c(?:r(?:ef|[eq])|vat|l)|f)?|h(?:agf? +|z(?:vat|zvat|f)))|q(?:batf?|vpx(?:\\ urnq|\\-urnq|rq|urnq|vat|yrff|f +)?)|s(?:hpx(?:rq|vat|f)?|neg(?:r[eq]|vat|[fl])?|rygpu(?:r(?:ef|[efq]) +|vat)?)|u(?:hzc(?:r(?:ef|[eq])|vat|f)?|n(?:eq[\\-\\ ]?ba|ys(?:\\ n[fe +]|\\-n[fe]|n[fe])frq))|z(?:bgure(?:\\ shpx(?:ref?|vat)|\\-shpx(?:ref? +|vat)|shpx(?:ref?|vat))|hgu(?:n(?:\\ shpx(?:ref?|vat|[nnn])|\\-shpx(? +:ref?|vat|[nnn])|shpx(?:ref?|vat|[nnn]))|re(?:\\ shpx(?:ref?|vat)|\\- +shpx(?:ref?|vat)|shpx(?:ref?|vat)))|reqr?))'; tr/A-Za-z/N-ZA-Mn-za-m/ foreach $profanity, $contextual; pattern name => [qw (profanity)], create => '(?:\b(?k:' . $profanity . ')\b)', ; pattern name => [qw (profanity contextual)], create => '(?:\b(?k:' . $contextual . ')\b)', ; } 1; #... # Better include the copyright notice =head1 COPYRIGHT Copyright (c) 2001 - 2002, Damian Conway. All Rights Reserved. This module is free software. It may be used, redistributed and/or modified under the terms of the Perl Artistic License (see http://www.perl.com/perl/misc/Artistic.html) =cut
I mean shit! Talk about fucking Rosetta Stone code there. I figured that it must be good since I don't know what the fuck it's doing. It did seem impressive that it could filter out cussing withouth having any of the cuss words that it's filtering out in the code. Me and my motherfucking inferiority complex.

Personally, I could care less. Hells bells, our tax money funds genocidal dictators around the globe and agencies that sell crack cocaine to their own citizens and we're worried about a little cussing. But heck, if people don't like it, it's easily solved. Make a nice project for some young PMDEV wannabe.

(updated once twice three times shortly after post.)

()-()
 \"/
  `                                                     
p.s. The real profanity in this post is that I didn't use strict in my code. As Bugs Bunny would say, "Ain't I a stinker?"


Comment on Re: Re: Re: Front Paging Profanity
Select or Download Code
Re: Re: Re: Re: Front Paging Profanity
by TheDamian (Priest) on Oct 20, 2002 at 06:22 UTC
    Sigh. There's nothing wrong with the module. Try using case insensitivity:
    /$RE{profanity}/i and print " contains profanity";
    And you'll need $RE{profanity}{contextual} to catch that seventh word, since there is nothing profane about members of the avian family Paridae.

    Oh, and the test will work better if you don't try to import the non-existent profanity subroutine.

      Well, Fudge. I knew that I was inferior. Thanks for reaffirming.

      The code was ripped directly from the POD:

      use Regexp::Common qw /profanity/; while (<>) { /$RE{profanity}/ and print "Contains profanity\n"; } ... =head2 $RE{profanity} Returns a pattern matching words -- such as Carlin's "big seven"
      I will respectfully disagree with your statement that there is nothing "wrong" with the module, since Fu**, FU** and fu** are profanity. It would be clearer to indicate the need for the /i in the modules POD. It was my mistake to not use the /i switch, but it is easy to see that I could make it since I am using the module as instructed expecting what it says will result... a case where Perl's rules of case sensitivity don't match up with the FCC's for what is profane. Yes, it is just the documentation, but for me documentation is just as important as any other aspect of code.

      I should add that I am impressed as hell that this module works. I am even more impressed that I have no f___ing clue as to how it works. I am not worthy.

      BTW, I am deeply sorry to have earned one of your sighs. I have the deepest respect for your work and the last thing I want to be is another one of the FUD Meisters that nitpick your contributions. In truth my comments were little more than an excuse for levity on what to me was a non-issue. I'm sorry that your hard work was used as fodder for what I sometimes mistake as humor.

      ()-()
       \"/
        `                                                     
      
        The $profanity and $contextual variables are ROT-13ed so that the module could pass its own filter :)
        Your point about the need for case-insensitivity is well-taken. Perhaps you ought to send a patch to Abigail (who now maintains the module).

        As for eliciting a sigh, don't sweat it. There's absolutely nothing wrong with pointing out inadequacies in my work -- in fact, I always appreciate it. Just don't write off an entire module because of a small bug, eh?

        And yes, the magic that allows a non-profane regex to match profanity is just rot13'ing.

        With regard to the topic of this thread, when it comes to coarse language, I try to follow Oscar Wilde's dictum: "A true gentleman is one who is never unintentionally rude". I cannot know who will read my public messages (or my code), so I find it appropriate to avoid profanity, lest I inadvertently offend someone.

        I would rather forgo that small element of my freedom of expression, so as not to infringe upon the community's collective right to comfort. To me, swearing in a public forum is like smoking in an enclosed space, or passing wind in an elevator, or playing a Mariah Carey song out loud. One person's valid form of self-expression is another person's unprovoked assault.

        No individual "freedom" is ever absolute. It must always be weighed against the public good. And it's hard to see how this community benefits by front-paging profanity.

        Besides, I find it very rare that profanity adds vigour or weight to an argument. Indeed, I usually discount any message that contains crudity ipso facto. And in my own messages, I would rather write well and argue cogently than resort to the convenient bludgeon of rough language.

Re: Re: Re: Re: Front Paging Profanity
by cciulla (Friar) on Oct 21, 2002 at 18:48 UTC
    Surely, I can't be the only one who recognized the "seven dirty words..."

    ...it sounds like a snack. You could have "tater tits" and "taco tits." Betcha can't eat just one!
    --- George Carlin

    ...and don't call me 'Shirley.'

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://205674]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2014-10-24 20:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (137 votes), past polls