Game::WordBrain::Speller - Spell Checks Words
# Create new Spell Checker my $speller = Game::WordBrain::Speller->new({ word_list => '/path/to/wordlist', # Optional }); # Test if a word is valid my $word = 'nerds'; if( $speller->is_valid_word( $word ) ) { print "Looks like a valid word"; } else { print "Nope, not a real word"; }
Originally Game::WordBrain made use of Text::Aspell as a speller. The problem was that Text:Aspell provided much more functionalty (and many more dependencies) then what Game::WordBrain really needed. Hence, Game::WordBrain::Speller was born.
This module loads a wordlist into memory and exposes a method to spellcheck words.
Path to a new line delimited word list. If not provided, the wordlist provided with this distrubtion will be used.
my $speller = Game::WordBrain::Speller->new({ word_list => '/path/to/wordlist', # Optional });
If the word_list is not specified the bundled wordlist will be used.
Returns an instance of Game::WordBrain::Speller.
my $speller = Game::WordBrain::Speller->...; if( $speller->is_valid_word( 'nerds' ) ) { print 'This is a real word'; } else { print 'Nope, not really a word.'; }
Spell checks a word. Returns a truthy value if the provided word is valid, falsey if it does not.
To install Game::WordBrain, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Game::WordBrain
CPAN shell
perl -MCPAN -e shell install Game::WordBrain
For more information on module installation, please visit the detailed CPAN module installation guide.