in reply to Match typo
There's even a way to specify a word list of your own choice to serve as the "dictionary" -- there's some info about this in the Text::Aspell manual.use strict; use Text::Aspell; my $suggest = ( @ARGV and $ARGV[0] eq '-s' ) ? shift : ''; my $speller = Text::Aspell->new or die "dang it\n"; while (<>) { for my $word ( grep /^[a-z]+$/i, split ) { next if ( $speller->check( $word )); # skip if word is in dic +tionary print "misspelled word: $word\n"; if ( $suggest ) { my @suggestions = $speller->suggest( $word ); my $advice = ( @suggestions ) ? join( " ", "Might be one of:", @suggestions ) : "No idea what that should be."; print " $advice\n\n"; } } }
|
|---|