Search::Tools::SpellCheck - offer spelling suggestions
use Search::Tools::SpellCheck; my $query = 'the quick fox color:brown and "lazy dog" not jumped'; my $spellcheck = Search::Tools::SpellCheck->new( dict => 'path/to/my/dictionary', max_suggest => 4, ); my $suggestions = $spellcheck->suggest($query);
This module offers suggestions for alternate spellings using Text::Aspell.
Create a new SpellCheck object. %opts should include:
Path(s) to your dictionary.
Language to use. Default is en_US.
en_US
Maximum number of suggested spellings to return. Default is 4.
4
A Search::Tools::QueryParser object.
Called internally by new().
Returns an arrayref of hashrefs. Each hashref is composed of the following key/value pairs:
The keyword used.
If value is 0 (zero) then the word was found in the dictionary and is spelled correctly.
0
If value is an arrayref, the array contains a list of suggested spellings.
If you need access to the Text::Aspell object used internally, this accessor will get/set it.
__END__
Peter Karman <karman@cpan.org>
<karman@cpan.org>
Thanks to Atomic Learning www.atomiclearning.com for sponsoring the development of this module.
www.atomiclearning.com
Thanks to Bill Moseley, Text::Aspell maintainer, for the API suggestions for this module.
Please report any bugs or feature requests to bug-search-tools at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Search-Tools. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-search-tools at rt.cpan.org
You can find documentation for this module with the perldoc command.
perldoc Search::Tools
You can also look for information at:
RT: CPAN's request tracker
http://rt.cpan.org/NoAuth/Bugs.html?Dist=Search-Tools
AnnoCPAN: Annotated CPAN documentation
http://annocpan.org/dist/Search-Tools
CPAN Ratings
http://cpanratings.perl.org/d/Search-Tools
Search CPAN
http://search.cpan.org/dist/Search-Tools/
Copyright 2009 by Peter Karman.
This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
Search::Tools::QueryParser, Text::Aspell
To install Search::Tools, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Search::Tools
CPAN shell
perl -MCPAN -e shell install Search::Tools
For more information on module installation, please visit the detailed CPAN module installation guide.