Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

on my desk, as far as I can see

3 views
Skip to first unread message

Beable van Polasm

unread,
Dec 1, 2003, 4:51:50 PM12/1/03
to
dogsnus <dog...@micron.net> writes:

> The Avocado Avenger <sta...@io.com> wrote in news:3FC8DD72...@io.com:
> >
> > I would just like to thank you for not mentioning "turducken".
>
> You're most welcome. Especially since I don't know what that means
> any more than I know what FNARR means.

Fondling Nougatty Ayn Rand Readers.

> Don't tell me, don't tell me!

OOOPS! SORRY!

-----begin deacronymiser.pl---------------------
#!/usr/bin/perl

use strict;
use warnings;

my $acronym = $ARGV[0];
if (not defined $acronym)
{
die "usage: deacronymiser <ACRONYM>";
}
run($acronym);

sub run
{
my $acronym = shift;

$acronym = lc $acronym;
my @letters = split //, $acronym;
my $words_file = "/usr/dict/words";
my @words = ();
open WORDS, "<$words_file" or die "can't open $words_file: $!";
while(my $line = <WORDS>)
{
chomp $line;
$line = lc $line;
push @words, $line;
}
close WORDS or die "can't close $words_file: $!";

print uc $acronym, " = ";
while (my $letter = shift @letters)
{
next if $letter !~ m/[a-z]/;

my @match_words = grep {/^$letter/} @words;
my $word = @match_words[rand(@match_words)];
print ucfirst $word, " ";
}
print "\n";
}

__END__
-----end deacronymiser.pl---------------------


--
"I hate leonardo dacapprio I thin he is a little bitch and a whiner.
I would pay my life savinge to beable to kick his
ass!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" -- Mark Sharpe
http://beable.com/

revjack

unread,
Dec 2, 2003, 11:16:10 AM12/2/03
to
In alt.religion.kibology Beable van Polasm <beable+...@beable.com.invalid> wrote:

: use strict;

Pussy.


--
___________________
rev...@revjack.net

Adam Funk

unread,
May 31, 2007, 12:42:23 PM5/31/07
to
On 2003-12-02, Beable van Polasm wrote:

> OOOPS! SORRY!
>
> -----begin deacronymiser.pl---------------------

I hope Beable doesn't mind, but I've modified the program so it will
load the dictionary and split it up once, then process more than one
acronym in the same command, with an option to generate multiple
expansions per acronym, without reloading or resegmenting the
dictionary.

--- begin example ---
$ deacronymiser.pl -n 3 ark perl
ARK = Ablution's Recipe Kiloton's
ARK = Aplenty Radiogram Kooking
ARK = Announcer's Rejoinder Kazoo
PERL = Pygmies Eve's Romano's Loped
PERL = Philanderer Enhance Rusting Loader
PERL = Pudgy Enthusiasm Reps Lifeworks
--- end example ---

--- begin code ---
#!/usr/bin/perl

use strict;
use warnings;
use Getopt::Std ;

my (%option, $i, $acronym);
getopts("n:", \%option) ;

my $count = $option{n} || 1;
my %keyed_words = ();

load();

while (@ARGV > 0) {
$acronym = shift(@ARGV);
for ($i=0 ; $i < $count ; $i++) {
run($acronym);
}
}

sub load {


my $words_file = "/usr/dict/words";
my @words = ();
open WORDS, "<$words_file" or die "can't open $words_file: $!";
while(my $line = <WORDS>)
{
chomp $line;
$line = lc $line;
push @words, $line;
}
close WORDS or die "can't close $words_file: $!";

my ($word, $letter);
while(@words) {
$word = shift(@words);
$letter = lc(substr($word, 0, 1));
push( @{$keyed_words{$letter}}, $word );
}
}


sub run
{
my $acronym = shift;

$acronym = lc $acronym;
my @letters = split //, $acronym;

print uc $acronym, " = ";


while (my $letter = shift @letters)
{
next if $letter !~ m/[a-z]/;

my @match_words = @{$keyed_words{$letter}};


my $word = @match_words[rand(@match_words)];
print ucfirst $word, " ";
}
print "\n";
}

--- end code ---

0 new messages