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
17 if ($query =~ m/[^[:alpha:]]/) {
18 return("only one word of alphabetic characters supported");
36 return("no binary found.");
39 if (!&::validExec($query)) {
40 return("argument appears to be fuzzy.");
43 my $reply = "I can't find alternate spellings for '$query'";
45 foreach (`/bin/echo '$query' | $binary -a -S`) {
47 last if !length; # end of query.
49 if (/^\@/) { # intro line.
51 } elsif (/^\*/) { # possibly correct.
52 $reply = "'$query' may be spelled correctly";
54 } elsif (/^\&/) { # possible correction(s).
55 s/^\& (\S+) \d+ \d+: //;
56 my @array = split(/,? /);
58 $reply = "possible spellings for $query: @array";
61 &::DEBUG("spell: '+' found => '$_'.");
63 } elsif (/^# (.*?) 0$/) {
67 &::DEBUG("spell: unknown: '$_'.");
75 &::performStrictReply(&spell(@_));