| 1 | package Bot::BasicBot::Pluggable::Module::Spell; | ||||||||||
| 2 | |||||||||||
| 3 | 1 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 1 | ▶ | use Bot::BasicBot::Pluggable::Module; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 1 | ▶ | use base qw(Bot::BasicBot::Pluggable::Module); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | |||||||||||
| 8 | 0 | ▶ | sub said { | ||||||||
|
Subroutine
said: not called CC=9 SCAR=42.6
Pod
documented
| |||||||||||
| 9 | 0 | my ($self, $mess, $pri) = @_; | |||||||||
| 10 | |||||||||||
| 11 | 0 | my $body = $mess->{body}; | |||||||||
| 12 | 0 | my $who = $mess->{who}; | |||||||||
| 13 | |||||||||||
| 14 | 0 | ▶ | return unless ($pri == 2); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 0 | ▶ | return unless $body =~ s/^spell(ing)?\s+(?:of |for )?\s+//i; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 16 | |||||||||||
| 17 | # h-h-h-hack | ||||||||||
| 18 | 1 | ▶ | use Lingua::Ispell qw( :all ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 19 | 0 | Lingua::Ispell::allow_compounds(1); | |||||||||
| 20 | |||||||||||
| 21 | 0 | my ($r) = spellcheck($body); | |||||||||
| 22 | |||||||||||
| 23 | 0 | ▶ | return "$body is probably spelt correctly" unless $r; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 24 | |||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | return "$1 is spelt correctly" if ($r->{type} eq 'ok'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 27 | 0 | ▶ | return "$1 can be formed from the root ".$r->{'root'} if ($r->{type} eq 'root'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | 0 | ▶ | return "$1 is a valid compund word" if ($r->{'type'} eq 'compound' ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 29 | 0 | ▶ | return "Near misses: ".join(", ",@{$r->{'misses'}}) if ($r->{'type'} eq 'miss' ); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 30 | 0 | ▶ | return "Suggestions: ".join(", ", @{$r->{'guesses'}}) if ($r->{type} eq 'guess'); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | |||||||||||
| 32 | 0 | return "I have no idea, sorry"; | |||||||||
| 33 | } | ||||||||||
| 34 | |||||||||||
| 35 | 0 | ▶ | sub help { | ||||||||
|
Subroutine
help: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||
| 36 | 0 | return "Commands: 'spell <word>'"; | |||||||||
| 37 | } | ||||||||||
| 38 | |||||||||||
| 39 | 1 | 1; | |||||||||
| 40 | |||||||||||
| 41 | __END__ | ||||||||||