Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Re: Depth First Search and Boggle

by Sifmole (Chaplain)
on Aug 15, 2002 at 17:07 UTC ( #190459=note: print w/ replies, xml ) Need Help??


in reply to Re: Depth First Search and Boggle
in thread Depth First Search and Boggle

It would be even better if there was a way to make it do plurals.


Comment on Re: Re: Depth First Search and Boggle
Re: Depth First Search and Boggle
by Abigail-II (Bishop) on Aug 15, 2002 at 17:23 UTC
    Either use a dictionary that already has plurals in it, or use the following preprocess function:
    use Lingua::EN::Inflect qw /PL/; sub preprocess { my $file = shift; open my $fh => $file or die "Failed to open $file: $!\n"; local $_; LINE: while (<$fh>) { chomp; $_ = lc; next if /[^a-z]/; WORD: foreach ($_, PL ($_)) { $valid {$_} = 1; while (length) { next WORD if $prefix {$_} ++; chop; } } } }
    Abigail

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2015-07-04 05:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (57 votes), past polls