in reply to Spell Check

You could also use ispell to find out what possible spellings of the word are available:

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
    Thank You

    You have no idea how long I've tried to discover how to get ispell to read from stdin. I've read the man pages ten times (funny though, now that I know the flag is -a, I can look in the man and find it right away.) Sigh.