1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
|
Tests for spell checking with 'encoding' set to "utf-8". vim: set ft=vim :
STARTTEST
:so small.vim
:so mbyte.vim
:"
:" Don't want to depend on the locale from the environment. The .aff and .dic
:" text is in latin1, the test text is utf-8.
:set enc=latin1
:e!
:set fenc=
:" First generate a .spl file from a .dic and a .aff file.
gg:/^affstart1/+1,/^affend1/-1w! Xtest.aff
gg:/^dicstart/+1,/^dicend/-1w! Xtest.dic
:set enc=utf-8
:mkspell! Xtest Xtest
:"
:" use that spell file
:set spl=Xtest.utf-8.spl
:set spell
:func SpellTest()
/^test1:
normal ]smm
let str = spellbadword()
$put =str
normal `m
let lst = spellsuggest(str, 4)
$put =string(lst)
normal `m]smm
let str = spellbadword()
$put =str
normal `m
let lst = spellsuggest(str, 2)
$put =string(lst)
normal `m]smm
let str = spellbadword()
$put =str
normal `m
let lst = spellsuggest(str, 2)
$put =string(lst)
normal `m]smm
let str = spellbadword()
$put =str
normal `m
let lst = spellsuggest(str, 2)
$put =string(lst)
normal `m]smm
let str = spellbadword()
$put =str
normal `m
let lst = spellsuggest(str, 2)
$put =string(lst)
normal `m]smm
let str = spellbadword()
$put =str
normal `m
let lst = spellsuggest(str, 2)
$put =string(lst)
endfunc
:call SpellTest()
:spelldump
1GyG:q
:$put
:$put =soundfold('goobledygoook')
:$put =soundfold('kóopërÿnôven')
:$put =soundfold('oeverloos gezwets edale')
:"
:" and now with SAL instead of SOFO items; test automatic reloading
gg:/^affstart2/+1,/^affend2/-1w! Xtest.aff
:mkspell! Xtest Xtest
:$put =soundfold('goobledygoook')
:$put =soundfold('kóopërÿnôven')
:$put =soundfold('oeverloos gezwets edale')
:"
:" also use an addition file
gg:/^addstart/+1,/^addend/-1w! Xtest.utf-8.add
:mkspell! Xtest.utf-8.add.spl Xtest.utf-8.add
:set spellfile=Xtest.utf-8.add
/^test2:
]s:let str = spellbadword()
:$put =str
:set spl=Xtest_us.utf-8.spl
/^test2:
]smm:let str = spellbadword()
:$put =str
`m]s:let str = spellbadword()
:$put =str
:set spl=Xtest_gb.utf-8.spl
/^test2:
]smm:let str = spellbadword()
:$put =str
`m]s:let str = spellbadword()
:$put =str
:set spl=Xtest_nz.utf-8.spl
/^test2:
]smm:let str = spellbadword()
:$put =str
`m]s:let str = spellbadword()
:$put =str
:set spl=Xtest_ca.utf-8.spl
/^test2:
]smm:let str = spellbadword()
:$put =str
`m]s:let str = spellbadword()
:$put =str
:"
:" Postponed prefixes
gg:/^affstart3/+1,/^affend3/-1w! Xtest.aff
:mkspell! Xtest Xtest
:set spellfile=
:set spl=Xtest.utf-8.spl
:mess
:spelldump
1GyG:q
:$put
:call SpellTest()
:"
gg:/^test output:/,$wq! test.out
ENDTEST
affstart1
SET ISO8859-1
TRY esianrtolcdugmphbyfvkwjkqxz-������������'ESIANRTOLCDUGMPHBYFVKWJKQXZ
FOL ��������������������������������
LOW ��������������������������������
UPP ��������������������������������
SOFOFROM abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ�������������������������������������������������������������
SOFOTO ebctefghejklnnepkrstevvkesebctefghejklnnepkrstevvkeseeeeeeeceeeeeeeedneeeeeeeeeeepseeeeeeeeceeeeeeeedneeeeeeeeeeep?
MIDWORD '-
KEP =
RAR ?
BAD !
NOSPLITSUGS
PFX I N 1
PFX I 0 in .
PFX O Y 1
PFX O 0 out .
SFX S Y 2
SFX S 0 s [^s]
SFX S 0 es s
SFX N N 3
SFX N 0 en [^n]
SFX N 0 nen n
SFX N 0 n .
REP 3
REP g ch
REP ch g
REP svp s.v.p.
MAP 9
MAP a������
MAP e����
MAP i����
MAP o�����
MAP u����
MAP n�
MAP c�
MAP y��
MAP s�
affend1
affstart2
SET ISO8859-1
TRY esianrtolcdugmphbyfvkwjkqxz-������������'ESIANRTOLCDUGMPHBYFVKWJKQXZ
FOL ��������������������������������
LOW ��������������������������������
UPP ��������������������������������
MIDWORD '-
KEP =
RAR ?
BAD !
NOSPLITSUGS
PFX I N 1
PFX I 0 in .
PFX O Y 1
PFX O 0 out .
SFX S Y 2
SFX S 0 s [^s]
SFX S 0 es s
SFX N N 3
SFX N 0 en [^n]
SFX N 0 nen n
SFX N 0 n .
REP 3
REP g ch
REP ch g
REP svp s.v.p.
MAP 9
MAP a������
MAP e����
MAP i����
MAP o�����
MAP u����
MAP n�
MAP c�
MAP y��
MAP s�
SAL AH(AEIOUY)-^ *H
SAL AR(AEIOUY)-^ *R
SAL A(HR)^ *
SAL A^ *
SAL AH(AEIOUY)- H
SAL AR(AEIOUY)- R
SAL A(HR) _
SAL �^ *
SAL �^ *
SAL BB- _
SAL B B
SAL CQ- _
SAL CIA X
SAL CH X
SAL C(EIY)- S
SAL CK K
SAL COUGH^ KF
SAL CC< C
SAL C K
SAL DG(EIY) K
SAL DD- _
SAL D T
SAL �< E
SAL EH(AEIOUY)-^ *H
SAL ER(AEIOUY)-^ *R
SAL E(HR)^ *
SAL ENOUGH^$ *NF
SAL E^ *
SAL EH(AEIOUY)- H
SAL ER(AEIOUY)- R
SAL E(HR) _
SAL FF- _
SAL F F
SAL GN^ N
SAL GN$ N
SAL GNS$ NS
SAL GNED$ N
SAL GH(AEIOUY)- K
SAL GH _
SAL GG9 K
SAL G K
SAL H H
SAL IH(AEIOUY)-^ *H
SAL IR(AEIOUY)-^ *R
SAL I(HR)^ *
SAL I^ *
SAL ING6 N
SAL IH(AEIOUY)- H
SAL IR(AEIOUY)- R
SAL I(HR) _
SAL J K
SAL KN^ N
SAL KK- _
SAL K K
SAL LAUGH^ LF
SAL LL- _
SAL L L
SAL MB$ M
SAL MM M
SAL M M
SAL NN- _
SAL N N
SAL OH(AEIOUY)-^ *H
SAL OR(AEIOUY)-^ *R
SAL O(HR)^ *
SAL O^ *
SAL OH(AEIOUY)- H
SAL OR(AEIOUY)- R
SAL O(HR) _
SAL PH F
SAL PN^ N
SAL PP- _
SAL P P
SAL Q K
SAL RH^ R
SAL ROUGH^ RF
SAL RR- _
SAL R R
SAL SCH(EOU)- SK
SAL SC(IEY)- S
SAL SH X
SAL SI(AO)- X
SAL SS- _
SAL S S
SAL TI(AO)- X
SAL TH @
SAL TCH-- _
SAL TOUGH^ TF
SAL TT- _
SAL T T
SAL UH(AEIOUY)-^ *H
SAL UR(AEIOUY)-^ *R
SAL U(HR)^ *
SAL U^ *
SAL UH(AEIOUY)- H
SAL UR(AEIOUY)- R
SAL U(HR) _
SAL V^ W
SAL V F
SAL WR^ R
SAL WH^ W
SAL W(AEIOU)- W
SAL X^ S
SAL X KS
SAL Y(AEIOU)- Y
SAL ZZ- _
SAL Z S
affend2
affstart3
SET ISO8859-1
FOL ��������������������������������
LOW ��������������������������������
UPP ��������������������������������
PFXPOSTPONE
MIDWORD '-
KEP =
RAR ?
BAD !
NOSPLITSUGS
PFX I N 1
PFX I 0 in .
PFX O Y 1
PFX O 0 out [a-z]
SFX S Y 2
SFX S 0 s [^s]
SFX S 0 es s
SFX N N 3
SFX N 0 en [^n]
SFX N 0 nen n
SFX N 0 n .
REP 3
REP g ch
REP ch g
REP svp s.v.p.
MAP 9
MAP a������
MAP e����
MAP i����
MAP o�����
MAP u����
MAP n�
MAP c�
MAP y��
MAP s�
affend3
dicstart
123456
test/NO
# comment
wrong
Comment
OK
uk
put/ISO
the end
deol
d��r
dicend
addstart
/regions=usgbnz
elequint/2
elekwint/3
addend
test1:
inputs wrong
comment wrong
puts OK
ok wrong
Ok wrong
the end. test wrong
déôl
test2:
elequint test elekwint test elekwent asdf
test output:
|