remove spell
parent
daff0a57d9
commit
4a8a988dbd
1
dist.ini
1
dist.ini
|
@ -30,7 +30,6 @@ Convert::Color::Library = 0.03
|
|||
Math::Round = 0.06
|
||||
Convert::Morse = 0.05
|
||||
Net::IDN::Encode = 2.003
|
||||
Text::Aspell = 0.09
|
||||
|
||||
[Prereqs / TestRequires]
|
||||
Test::More = 0.98
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
package DDG::Goodie::Spell;
|
||||
|
||||
use DDG::Goodie;
|
||||
use Text::Aspell;
|
||||
|
||||
triggers start => "spell", "how to spell", "how do i spell", "spellcheck";
|
||||
|
||||
zci is_cached => 1;
|
||||
|
||||
my $speller = Text::Aspell->new;
|
||||
$speller->set_option('lang','en_US');
|
||||
$speller->set_option('sug-mode','fast');
|
||||
|
||||
attribution
|
||||
twitter => 'crazedpsyc',
|
||||
cpan => 'CRZEDPSYC'
|
||||
;
|
||||
|
||||
handle remainder => sub {
|
||||
return unless /^[\w']+$/; # only accept letters and ' (aspell handles contractions)
|
||||
my $correct = $speller->check($_) ? "'\u$_' appears to be spelled right!" : "'\u$_' does not appear to be spelled correctly.";
|
||||
my @suggestions = $speller->suggest($_);
|
||||
my $sug = @suggestions ? "Suggestions: " . join(', ', @suggestions[0..5]) : "No suggestions.";
|
||||
return "$correct $sug", html => "$correct<br/>$sug";
|
||||
};
|
||||
|
||||
1;
|
21
t/Spell.t
21
t/Spell.t
|
@ -1,21 +0,0 @@
|
|||
#!/usr/bin/env perl
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Test::More;
|
||||
use DDG::Test::Goodie;
|
||||
|
||||
zci answer_type => 'spell';
|
||||
zci is_cached => 1;
|
||||
|
||||
ddg_goodie_test(
|
||||
[qw(
|
||||
DDG::Goodie::Spell
|
||||
)],
|
||||
'spell foo' => test_zci("'Foo' appears to be spelled right! Suggestions: foo, FPO, food, fool, foot, fop", html => "'Foo' appears to be spelled right!<br/>Suggestions: foo, FPO, food, fool, foot, fop"),
|
||||
'how do I spell foo' => test_zci("'Foo' appears to be spelled right! Suggestions: foo, FPO, food, fool, foot, fop", html => "'Foo' appears to be spelled right!<br/>Suggestions: foo, FPO, food, fool, foot, fop"),
|
||||
'spellcheck hllo' => test_zci("'Hllo' does not appear to be spelled correctly. Suggestions: hello, halo, halloo, hallow, hollow, Hall", html => "'Hllo' does not appear to be spelled correctly.<br/>Suggestions: hello, halo, halloo, hallow, hollow, Hall"),
|
||||
);
|
||||
|
||||
done_testing;
|
||||
|
Loading…
Reference in New Issue