The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Search::Tools::SpellCheck - offer spelling suggestions

SYNOPSIS

 use Search::Tools::Keywords;
 use Search::Tools::SpellCheck;
 
 my $query = 'the quick fox color:brown and "lazy dog" not jumped';
 
 my $kw = 
    Search::Tools::Keywords->new;
 
 my $spellcheck = 
    Search::Tools::SpellCheck->new(
                        dict        => 'path/to/my/dictionary',
                        max_suggest => 4,
                        kw          => $kw
                        
                        );
                        
 my $suggestions = $spellcheck->suggest($query);
 
 

DESCRIPTION

This module offers suggestions for alternate spellings using Text::Aspell.

METHODS

new( %opts )

Create a new SpellCheck object. %opts should include:

dict

Path(s) to your dictionary.

lang

Language to use. Default is en_US.

max_suggest

Maximum number of suggested spellings to return. Default is 4.

suggest( @keywords )

Returns an arrayref of hashrefs. Each hashref is composed of the following key/value pairs:

word

The keyword used.

suggestions

If value is 0 (zero) then the word was found in the dictionary and is spelling correctly.

If value is an arrayref, the array contains a list of suggested spellings.

aspell

If you need access to the Text::Aspell object used internally, this accessor will get/set it.

AUTHOR

Peter Karman perl@peknet.com

Thanks to Atomic Learning www.atomiclearning.com for sponsoring the development of this module.

Thanks to Bill Moseley, Text::Aspell maintainer, for the API suggestions for this module.

COPYRIGHT

Copyright 2006 by Peter Karman. This package is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Search::Tools::Keywords, Text::Aspell