Permutations Problem
- From: "Honest John" <Hon.JW.Foulfellow@xxxxxxxxx>
- Date: 31 May 2006 00:09:51 -0700
I am trying to filter every combination of ten letters through a spell
checker, and so find valid english words. I have a problem in that ten
factorial, is over three point-six million words to filter, and
results in the computer crashing. (The computer is an old 2.66GHz P4
and just not up to the task).
Any suggestions how I can save computer resources?
#--------%<--------%<-----------------------------------------------------------------------------
use Algorithm::Combinatorics qw(permutations);
use Text::Aspell;
my $speller = Text::Aspell->new; die unless $speller;
# Set some options
$speller->set_option('lang','en_US');
$speller->set_option('sug-mode','fast'); # check a word
my @data = qw(s f e e r t v c o h);
my @words = grep $speller->check ( join '', @$_ ),
permutations(\@data);
print "\nSolution\n";
print map "@$_\n", @words;
.
- Follow-Ups:
- Re: Permutations Problem
- From: Christian Winter
- Re: Permutations Problem
- Prev by Date: FAQ 4.29 How can I count the number of occurrences of a substring within a string?
- Next by Date: Re: Date format conversion
- Previous by thread: FAQ 4.29 How can I count the number of occurrences of a substring within a string?
- Next by thread: Re: Permutations Problem
- Index(es):
Relevant Pages
|