Update mojo sdk to rev 1dc8a9a5db73d3718d99917fadf31f5fb2ebad4f
[chromium-blink-merge.git] / third_party / hunspell / tests / suggestiontest / test
blob8e6c1cc1ff38bc60e852ee2f0ed4e775d69bb649
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/For_machines
7 input=${INPUT:-List_of_common_misspellings.txt}
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
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