Text::Hunspell - Perl interface to the GNU Hunspell library
use Text::Hunspell; my $speller = Text::Hunspell->new("/../language.aff","/../language.dic"); die unless $speller; # Set some words my $word = "lótól"; my $word1 = "lóotól"; my $misspelled = "lóo"; # check a word print $speller->check( $word ) ? "$word found\n" : "$word not found!\n"; # check a word print $speller->check( $word ) ? "$word found\n" : "$word not found!\n"; print $speller->check( $word1 ) ? "$word1 found\n" : "$word1 not found!\n"; # lookup up words my @suggestions; @suggestions = $speller->suggest( $misspelled ); print Data::Dumper::Dumper( \@suggestions ); # delete speller class $speller->delete($speller);
This module provides a Perl interface to the Oo Hunspell library. This module is to meet the need of looking up many words, one at a time, in a single session, such as spell-checking a document in memory.
The example code describes the interface on http://hunspell.sf.net
You MUST have installed GNU Hunspell library version 1.0 or higher on your system before installing this Text::Hunspell Perl module.
hunspell location is:
There have been a number of bug reports because people failed to install hunspell before installing this module. This is an interface to the hunspell library installed on your system, not a replacement for hunspell.
You must also have one hunspell dictionary installed when running the module's test suite.
Also, please see the README and Changes files. README may have specific information about your platform.
The following methods are available:
- $speller = Text::Hunspell->new(full_path_to_affix, full_path_to_dic);
Creates a new speller object. New takes the parameters full_path_of_affix file and full_path_of_dic file Returns
undefif the object could not be created, which is unlikely.
Internally, new() creates the hunspell class.
- $speller->check($word); check the word. Passes back 1, if the word found, 0 otherwise.
Passes back the list of suggestions for the misspelled word.
- $string = $speller->delete($speller);
deletes the speller class.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This module is based on a perl module (Text::Aspell) written by Bill Moseley email@example.com.
Hunspell is written as myspell by Kevin B. Hendricks, hunspell is maintained by Németh László
http://hunspell.sf.net for the dictionaries: http://lingucomponent.openoffice.org/spell_dic.html
2 POD Errors
The following errors were encountered while parsing the POD:
- Around line 32:
Non-ASCII character seen before =encoding in '"lótól";'. Assuming ISO8859-1
- Around line 113:
You forgot a '=back' before '=head1'