Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
31 lines
944 B
Bash
Executable File
31 lines
944 B
Bash
Executable File
#!/bin/bash
|
|
# Check common misspellings
|
|
# input file format:
|
|
# word->word1, ...
|
|
# Source: http://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
|
|
|
|
hunspell=../../src/tools/hunspell
|
|
hlang=${HUNSPELL:-en_US}
|
|
input=${INPUT:-List_of_common_misspellings.txt}
|
|
|
|
# remove bad words recognised by Hunspell as good
|
|
cat $input | sed 's/[-]>/ /' | $hunspell -d $hlang -1 -L |
|
|
|
|
# remove spaces from end of lines
|
|
sed 's/ *$//' >$input.1
|
|
|
|
# change commas with tabs
|
|
cat $input.1 | sed 's/, */ /g' >$input.2
|
|
|
|
# remove lines with unrecognised suggestions (except suggestion with spaces)
|
|
cut -d ' ' -f 2- $input.2 | tr "\t" "\n" | grep -v ' ' >x.1
|
|
cat x.1 | $hunspell -l -d $hlang >x.2
|
|
cat x.2 | awk 'BEGIN{FS="\t"}
|
|
FILENAME=="-"{a[$1]=1;next}a[$2]!=1 && a[$3]!=1{print $0}' - $input.2 >$input.3
|
|
|
|
test -f $input.4 && rm $input.4
|
|
|
|
cat $input.3 | $hunspell -d $hlang -a -1 | grep -v ^$ | sed -n '2,$p' |
|
|
sed 's/^.*: //;s/, / /g' >$input.5
|
|
|