Linux 居然也有spell check 的工具,请看如下的tutorial.
GNU aspell 的官方文档:脚本是我在wicked cool shell scripts 上看到的,原始脚本调用ispell 来对于单词来做拼写检查,我用了aspell 代替。
-
shopt -s -o nounset
-
spell="aspell list"
-
-
if [ $# -lt 1 ];then
-
echo "Usage: $0 word or words">&2; exit 1
-
fi
-
-
for word
-
do
-
if [ -z $(echo $word | $spell ) ];then
-
echo "$word: spelled correctly."
-
else
-
echo "$word: misspelled."
-
fi
-
done
-
-
exit 0
书本上的示例如下:
-
./checkspelling.sh thier their
-
thier: misspelled.
-
their: spelled correctly.
如何使用aspell.
这是星际上的话,it's a good day to die.
-
echo "it's a goooooo day to diea" |aspell list
-
goooooo
-
diea
-
echo "it's a goooooo day to diea" |aspell -a
-
@(#) International Ispell Version 3.1.20 (but really Aspell 0.60.7-20110707)
-
*
-
*
-
& goooooo 22 7: goo, gooier, gooey, goop, go, GAO, Geo, Goa, coo, Good, good, goof, gook, goon, Giotto, goer, goo's, goody, goofy, goose, goofier, goober
-
*
-
*
-
& diea 10 22: idea, DEA, die, dies, Diem, Dina, died, diet, diva, die's
对文件做编辑:
-
echo "it's a goooooo day to diea" > spell1.txt
-
aspell check spell1.txt
-
#看到如下这么多的选项,出错的单词被反白处理,修改后可以直接修改保存到原始文件,厉害啊。
-
it's a goooooo day to diea
1) Good 6) go
2) goo 7) GAO
3) gooier 8) Geo
4) gooey 9) Goa
5) goop 0) coo
i) Ignore I) Ignore all
r) Replace R) Replace all
a) Add l) Add Lower
b) Abort x) Exit
阅读(1152) | 评论(0) | 转发(0) |