Debian Codegraph @

speller/make-hunspell-dict

raw ◀ ▶
2 Debian patches touch this file
1 #!/usr/bin/env bash
2
3 ASPELL=aspell
4 HUNSPELL=hunspell
5 : ${SCOWL:=..}
6 SPELLER="$SCOWL/speller"
7 : ${UNIX2DOS:=unix2dos}
8
9 set -e
10
11 export LANG=C
12 export LC_ALL=C
13 export LC_CTYPE=C
14 export LC_COLLATE=C
15
•16 SIZE=70
17
18 mk-list() { $SCOWL/mk-list -d $SCOWL/final "$@"; }
19
20 prep() {
21 echo prep
22
23 cat $SCOWL/misc/{offensive.1,offensive.2,profane.1} | sort -u > nosug
24 }
25
26 doit() {
27 echo creating $1.dic
28
29 eval $2 | sort -u > $1.0
30
31 comm -12 $1.0 nosug > $1-nosug.1
32
33 comm -23 $1.0 nosug > $1.1
34
35 $SPELLER/munch-list munch $SPELLER/en.aff < $1-nosug.1 | $SPELLER/add-no-suggest > $1.2
36
37 $SPELLER/munch-list munch $SPELLER/en.aff < $1.1 >> $1.2
38
39 cat $SPELLER/en.dic.supp >> $1.2
40
41 wc -l < $1.2 | tr -d '[:blank:]' > $1.dic
42 cat $1.2 | sort | iconv -f iso-8859-1 -t utf-8 >> $1.dic
43
44 cp $SPELLER/en.aff $1.aff
45
46 if [ "$SCOWL_VERSION" ]; then
47 fn="$1-$SCOWL_VERSION"
48 else
49 fn="$1"
50 fi
51
52 WHAT="$1 Hunspell Dictionary" sh $SPELLER/README_en.txt.sh > README_$1.txt
53 if [ -z "$3" ]; then
54 echo "Wordlist Command: $2" >> README_$1.txt
55 else
56 cat $3 >> README_$1.txt
57 fi
58
59 if [ -z "$3" ]; then
60 mkdir -p hunspell
61
62 #echo check
63
64 cat $1-nosug.1 $1.1 | sort -u > $1.tocheck
65
66 #hunspell -l -d ./$1 < $1.dic.tocheck > misspelled
67
68 cat $1.tocheck | iconv -f iso-8859-1 -t utf-8 | $UNIX2DOS > $1.txt
69 fi
70 }
71
72 prep
73
74 if [ "$1" = "-all" ]
75 then
76
77 doit en_US "mk-list --accents=strip en_US $SIZE"
78 doit en_CA "mk-list --accents=strip en_CA $SIZE"
79 doit en_GB-ize "mk-list --accents=strip en_GB-ize $SIZE"
80 doit en_GB-ise "mk-list --accents=strip en_GB-ise $SIZE"
81 doit en_AU "mk-list --accents=strip en_AU $SIZE"
82
83 doit en_US-large "mk-list -v1 --accents=both en_US 70"
84 doit en_CA-large "mk-list -v1 --accents=both en_CA 70"
85 doit en_GB-large "mk-list -v1 --accents=both en_GB-ize en_GB-ise 70"
86 doit en_AU-large "mk-list -v1 --accents=both en_AU 70"
87
88 sh $SPELLER/README_en.txt.sh > hunspell/README
89
90 elif [ "$1" = "-one" -a -n "$2" -a -n "$3" ]
91 then
92
93 doit $2 "cat" $3
94
95 else
96
97 echo "usage: $0 -all | -one <dict-name> <parms file>"
98
99 fi
100
101 #rm eng*.dat nosug en_US*.? en_CA*.?