cygwinでspellのインプリメント
cygwin環境下だとスペル訂正コマンドがaspellしかなく、Test::Spellingがとおらず結果module-setupのdefaultのflavorが作成できなかったので書いたTest::Spellingを通すためのspellコマンドインプリメントを書きます。これを/usr/local/binに置いたら01_podspell.tが通るようになりました。spellコマンドの出力は、標準入力の間違った単語をダーっと表示するのだと思ってます。除外単語の取り扱いはTest::Spelling自身で行っているのでこれで良いのかなと思ってます。が、確認するにもspellコマンドがなく恥しいのですがコードをさらします。
間違いがあったら教えてください。以下書いたspellの中身です。
#!/usr/bin/perl use strict; use File::Temp ; my $fh = File::Temp->new; my $fname = $fh->filename; while(<>){ chomp; $fh->print("$_" ."\n"); } for (qx /aspell -a < $fname/){ if (/^&/){ my @words = split; print "$words[1]\n"; } } __END__
以下実行結果です。
yumino@yoshfront ~/work/2010-01-08 % cat data hello good bye I am hoge. foo bar baz yesyesyseys yes yumino@yoshfront ~/work/2010-01-08 % cat data|spell hoge baz yesyesyseys
以下、参考にしたサイト
・The "spell" command is a simple and convenient spelling checker for Linux and other Unix-like operating systems.
http://www.linfo.org/spell.html
・GNU Aspell 0.60.6
http://aspell.net/man-html/index.html