OLD | NEW |
| (Empty) |
1 #!/bin/bash | |
2 # Check common misspellings | |
3 # input file format: | |
4 # word->word1, ... | |
5 # Source: http://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/Fo
r_machines | |
6 | |
7 input=${INPUT:-List_of_common_misspellings.txt} | |
8 | |
9 function check() { | |
10 cat $1 | awk 'BEGIN{maxord=0;FS="\t"}FILENAME=="-"{for (i=1; i<=NF; i++){a[NR,$(
i)]=i};max=NR;next}{x1=a[NR-max,$2];x2=a[NR-max,$3];sug++;if($3)sug++;if (!x1&&!
x2){mis2++;misrow=misrow"\n"$0};if(!x1||($3 && !x2))mis++;ord+=x1+x2;}END{ | |
11 print "Missed rows", misrow; | |
12 print "=======================================" | |
13 print maxord, "max. suggestion for a word"; | |
14 print max, "input rows"; | |
15 print mis2, "missing rows"; | |
16 print sug, "expected suggestions"; | |
17 print mis, "missing suggestions"; | |
18 print ord/(sug-mis), "average ranking"; | |
19 }' - $2 | |
20 } | |
21 | |
22 test -f $input.4 && check $input.4 $input.3 >result.aspell | |
23 check $input.5 $input.3 >result.hunspell | |
24 test -f result.aspell && tail -6 result.aspell | |
25 tail -6 result.hunspell | |
OLD | NEW |