in reply to Spell Check
my @words = split(" ", "Hello, I live in a blue hoose."); for (@words) { my @spell = `echo $_ | ispell -a -S`; if (grep /^\*/, @spell) { next; }else{ @spell = grep /^\s*&/, @spell; chomp $spell[0]; my @rest = split(/\ |\,\ /,$spell[0]); @rest = splice(@rest,4); if (scalar(@rest) != 0) { print "Alternate spellings for $_: @rest\n"; } } }
Milage may vary, change as needed.
This did bring up something I would like to see in Perl (I need to check p5p). I think it would be useful to do:
my @rest = splice((my @tmp = split(/\ |\,\ /,$spell[0])),4);
or
my @rest = splice(split(/\ |\,\ /,$spell[0]),4);
But, splice() doesn't accept a split() or list assignment as it's first argument. I think it should. But, that is likely more of a discussion for elsewhere.
Cheers,
KM
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
RE: Re: Spell Check
by swiftone (Curate) on May 30, 2000 at 20:19 UTC |