# Usage: # /load spell.pl # 23:19 -!- Irssi: Loaded script spell # As you type, if you hit it will complete the current word # with the best suggestion, and also print the top 5 matches in the # scroll buffer use strict; use vars qw($VERSION %IRSSI); use Text::Aspell; use Irssi; $VERSION = '1.00'; %IRSSI = ( authors => 'core', contact => 'core', name => 'aspell spell check', description => 'spell checker', license => 'Public Domain', ); #Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'spell_loaded', $IRSSI{name}, $VERSION, $IRSSI{authors}); my $speller = Text::Aspell->new; Irssi::signal_add_last 'complete word' => \&spell; sub spell { my $out = ""; my ($complist, $window, $word, $linestart, $want_space) = @_; if (!$speller->check($word)){ my @suggestions = $speller->suggest($word); if (@suggestions){ push @$complist, $suggestions[0]; for (my $i=0;$i<8;$i++){ $out .= $suggestions[$i] . " "; } $window->print("$out"); } } }