2 # spell.pl: interface to aspell/ispell/spell
3 # Author: Tim Riker <Tim@Rikers.org>
4 # Source: extracted from UserExtra
5 # Licensing: Artistic License (as perl itself)
8 # Copyright (c) 2005 Tim Riker
32 return("no binary found.");
35 if (!&::validExec($query)) {
36 return("argument appears to be fuzzy.");
39 my $reply = "I can't find alternate spellings for '$query'";
41 foreach (`/bin/echo '$query' | $binary -a -S`) {
43 last if !length; # end of query.
45 if (/^\@/) { # intro line.
47 } elsif (/^\*/) { # possibly correct.
48 $reply = "'$query' may be spelled correctly";
50 } elsif (/^\&/) { # possible correction(s).
51 s/^\& (\S+) \d+ \d+: //;
52 my @array = split(/,? /);
54 $reply = "possible spellings for $query: @array";
57 &::DEBUG("spell: '+' found => '$_'.");
59 } elsif (/^# (.*?) 0$/) {
63 &::DEBUG("spell: unknown: '$_'.");
71 &::performStrictReply(&spell(@_));