l i n u x - u s e r s - g r o u p - o f - d a v i s
L U G O D
 
Next Meeting:
December 2: Social gathering
Next Installfest:
TBD
Latest News:
Nov. 18: Club officer elections
Page last updated:
2002 Apr 23 16:39

The following is an archive of a post made to our 'vox mailing list' by one of its subscribers.

Report this post as spam:

(Enter your email address)
Re: [vox] the lugod faq
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [vox] the lugod faq



I should start running my slashdot comments through that.

On Tuesday 23 April 2002 10:28 am, ME wrote:
> On Mon, 22 Apr 2002, Mark K. Kim wrote:
> > Mike Egan's postings always needs to be trimmed before being made public.
> > Always.  No exceptions.  Same with Mike Simon's postings.
>
> Oh yes, and one more thing. You want to have some fun? Take any of the
> long posts here and pass them through "travesty"
>
> (Taken from the older Oreily perl book)
>
> #!/usr/bin/perl
>
> # Usage: travesty [files]
>
> # First analyze the input.
>
> while (<>) {
>
>     # Handle article headers and ">>>" quotes.
>
>     next if /^\./;
>     next if /^From / .. /^$/;
>     next if /^Path: / .. /^$/;
>     s/^\W+//;
>
>     # Do each word.
>
>     push(@ary,split(' '));
>     while ($#ary > 1) {
> 	$a = $p;
> 	$p = $n;
> 	$w = shift(@ary);
> 	$n = $num{$w};
> 	if ($n eq '') {
> 	    push(@word,$w);
> 	    $n = pack('S',$#word);
> 	    $num{$w} = $n;
> 	}
> 	$lookup{$a . $p} .= $n;
>     }
> }
>
> # Now spew out the words, based on the frequencies.  If there
> # is more than one possibility to choose from, choose one
> # randomly.
>
> for (;;) {
>     $n = $lookup{$a . $p};
>     ($foo,$n) = each(lookup) if $n eq '';       # A bootstrap.
>     $n = substr($n,int(rand(length($n))) & 0177776,2);
>     $a = $p;
>     $p = $n;
>     ($w) = unpack('S',$n);
>     $w = $word[$w];
>
>     # See if word fits on line.
>
>     $col += length($w) + 1;
>     if ($col >= 65) {
> 	$col = 0;
> 	print "\n";
>     }
>     else {
> 	print ' ';
>     }
>     print $w;
>
>     # Paragraph every 10 sentences or so.
>
>     if ($w =~ /\.$/) {
> 	if (rand() < .1) {
> 	    print "\n";
> 	    $col = 80;
> 	}
>     }
> }
>
> _______________________________________________
> vox mailing list
> vox@lists.lugod.org
> http://lists.lugod.org/mailman/listinfo/vox
_______________________________________________
vox mailing list
vox@lists.lugod.org
http://lists.lugod.org/mailman/listinfo/vox



LinkedIn
LUGOD Group on LinkedIn
Sign up for LUGOD event announcements
Your email address:
facebook
LUGOD Group on Facebook
'Like' LUGOD on Facebook:

Hosting provided by:
Sunset Systems
Sunset Systems offers preconfigured Linux systems, remote system administration and custom software development.

LUGOD: Linux Users' Group of Davis
PO Box 2082, Davis, CA 95617
Contact Us

LUGOD is a 501(c)7 non-profit organization
based in Davis, California
and serving the Sacramento area.
"Linux" is a trademark of Linus Torvalds.

Sponsored in part by:
Sunset Systems
Who graciously hosts our website & mailing lists!