Debian Codegraph @

algorithms/greek.sbl

raw
1 // A stemmer for Modern Greek language, based on:
2 //
3 // Ntais, Georgios. Development of a Stemmer for the Greek
4 // Language. Diss. Royal Institute of Technology, 2006.
5 // https://sais.se/mthprize/2007/ntais2007.pdf
6 //
7 // Saroukos, Spyridon. Enhancing a Greek language stemmer.
8 // University of Tampere, 2008.
9 // https://tampub.uta.fi/bitstream/handle/10024/80480/gradu03463.pdf
10
11 stringescapes {}
12
13 stringdef a '{U+03B1}' // alpha
14 stringdef v '{U+03B2}' // beta
15 stringdef g '{U+03B3}' // gamma
16 stringdef d '{U+03B4}' // delta
17 stringdef e '{U+03B5}' // epsilon
18 stringdef z '{U+03B6}' // zeta
19 stringdef i '{U+03B7}' // eta
20 stringdef th '{U+03B8}' // theta
21 stringdef y '{U+03B9}' // iota
22 stringdef k '{U+03BA}' // kappa
23 stringdef l '{U+03BB}' // lamda
24 stringdef m '{U+03BC}' // mu
25 stringdef n '{U+03BD}' // nu
26 stringdef x '{U+03BE}' // xi
27 stringdef o '{U+03BF}' // omicron
28 stringdef p '{U+03C0}' // pi
29 stringdef r '{U+03C1}' // rho
30 stringdef ss '{U+03C2}' // sigma final
31 stringdef s '{U+03C3}' // sigma
32 stringdef t '{U+03C4}' // tau
33 stringdef u '{U+03C5}' // upsilon
34 stringdef f '{U+03C6}' // phi
35 stringdef ch '{U+03C7}' // chi
36 stringdef ps '{U+03C8}' // psi
37 stringdef oo '{U+03C9}' // omega
38
39 stringdef A '{U+0391}' // Alpha
40 stringdef V '{U+0392}' // Beta
41 stringdef G '{U+0393}' // Gamma
42 stringdef D '{U+0394}' // Delta
43 stringdef E '{U+0395}' // Epsilon
44 stringdef Z '{U+0396}' // Zeta
45 stringdef I '{U+0397}' // Eta
46 stringdef Th '{U+0398}' // Theta
47 stringdef Y '{U+0399}' // Iota
48 stringdef K '{U+039A}' // Kappa
49 stringdef L '{U+039B}' // Lamda
50 stringdef M '{U+039C}' // Mu
51 stringdef N '{U+039D}' // Nu
52 stringdef X '{U+039E}' // Xi
53 stringdef O '{U+039F}' // Omicron
54 stringdef P '{U+03A0}' // Pi
55 stringdef R '{U+03A1}' // Rho
56 stringdef S '{U+03A3}' // Sigma
57 stringdef T '{U+03A4}' // Tau
58 stringdef U '{U+03A5}' // Upsilon
59 stringdef F '{U+03A6}' // Phi
60 stringdef Ch '{U+03A7}' // Chi
61 stringdef Ps '{U+03A8}' // Psi
62 stringdef Oo '{U+03A9}' // Omega
63
64 stringdef Y: '{U+03AA}' // Iota with dialytika
65 stringdef U: '{U+03AB}' // Upsilon with dialytika
66
67 stringdef a' '{U+03AC}' // alpha with tonos
68 stringdef e' '{U+03AD}' // epsilon with tonos
69 stringdef i' '{U+03AE}' // eta with tonos
70 stringdef y' '{U+03AF}' // iota with tonos
71 stringdef o' '{U+03CC}' // omicron with tonos
72 stringdef u' '{U+03CD}' // upsilon with tonos
73 stringdef oo' '{U+03CE}' // omega with tonos
74
75 stringdef i:' '{U+0390}' // iota with dialytika and tonos
76 stringdef u:' '{U+03B0}' // upsilon with dialytika and tonos
77
78 stringdef i: '{U+03CA}' // iota with dialytika
79 stringdef u: '{U+03CB}' // upsilon with dialytika
80
81 stringdef A' '{U+0386}' // Alpha with tonos
82 stringdef E' '{U+0388}' // Epsilon with tonos
83 stringdef I' '{U+0389}' // Eta with tonos
84 stringdef Y' '{U+038A}' // Iota with tonos
85 stringdef O' '{U+038C}' // Omicron with tonos
86 stringdef U' '{U+038E}' // Upsilon with tonos
87 stringdef OO' '{U+038F}' // Omega with tonos
88
89 externals ( stem )
90
91 booleans ( test1 )
92
93 groupings ( v v2 )
94
95 routines ( tolower has_min_length
96 steps1 steps2 steps3 steps4 steps5 steps6 steps7
97 steps8 steps9 steps10
98 step1 step2a step2b step2c step2d step3 step4
99 step5a step5b step5c step5d step5e step5f
100 step5g step5h step5i
101 step5j step5k step5l step5m
102 step6 step7 )
103
104 define v '{a}{e}{i}{y}{o}{u}{oo}'
105 define v2 '{a}{e}{i}{y}{o}{oo}'
106
107 strings ( s )
108
109 backwardmode (
110 define has_min_length as (
111 $(len >= 3)
112 )
113
114 define tolower as (
115 repeat (
116 [substring] among (
117 '{A}' (<- '{a}')
118 '{V}' (<- '{v}')
119 '{G}' (<- '{g}')
120 '{D}' (<- '{d}')
121 '{E}' (<- '{e}')
122 '{Z}' (<- '{z}')
123 '{I}' (<- '{i}')
124 '{Th}' (<- '{th}')
125 '{Y}' (<- '{y}')
126 '{K}' (<- '{k}')
127 '{L}' (<- '{l}')
128 '{M}' (<- '{m}')
129 '{N}' (<- '{n}')
130 '{X}' (<- '{x}')
131 '{O}' (<- '{o}')
132 '{P}' (<- '{p}')
133 '{R}' (<- '{r}')
134 '{S}' (<- '{s}')
135 '{T}' (<- '{t}')
136 '{U}' (<- '{u}')
137 '{F}' (<- '{f}')
138 '{Ch}' (<- '{ch}')
139 '{Ps}' (<- '{ps}')
140 '{Oo}' (<- '{oo}')
141 '{Y:}' (<- '{y}')
142 '{U:}' (<- '{u}')
143 '{a'}' (<- '{a}')
144 '{e'}' (<- '{e}')
145 '{i'}' (<- '{i}')
146 '{y'}' (<- '{y}')
147 '{o'}' (<- '{o}')
148 '{u'}' (<- '{u}')
149 '{oo'}' (<- '{oo}')
150 '{i:'}' (<- '{i}')
151 '{u:'}' (<- '{u}')
152 '{i:}' (<- '{i}')
153 '{u:}' (<- '{u}')
154 '{A'}' (<- '{a}')
155 '{E'}' (<- '{e}')
156 '{I'}' (<- '{i}')
157 '{Y'}' (<- '{y}')
158 '{O'}' (<- '{o}')
159 '{U'}' (<- '{u}')
160 '{OO'}' (<- '{oo}')
161 '{ss}' (<- '{s}')
162 '' (next)
163 )
164 )
165 )
166
167 define step1 as (
168 [substring] among (
169 '{f}{a}{g}{y}{a}' '{f}{a}{g}{y}{o}{u}' '{f}{a}{g}{y}{oo}{n}' (<- '{f}{a}')
170 '{s}{k}{a}{g}{y}{a}' '{s}{k}{a}{g}{y}{o}{u}' '{s}{k}{a}{g}{y}{oo}{n}' (<- '{s}{k}{a}')
171 '{o}{l}{o}{g}{y}{o}{u}' '{o}{l}{o}{g}{y}{a}' '{o}{l}{o}{g}{y}{oo}{n}' (<- '{o}{l}{o}')
172 '{s}{o}{g}{y}{o}{u}' '{s}{o}{g}{y}{a}' '{s}{o}{g}{y}{oo}{n}' (<- '{s}{o}')
173 '{t}{a}{t}{o}{g}{y}{a}' '{t}{a}{t}{o}{g}{y}{o}{u}' '{t}{a}{t}{o}{g}{y}{oo}{n}' (<- '{t}{a}{t}{o}')
174 '{k}{r}{e}{a}{s}' '{k}{r}{e}{a}{t}{o}{s}' '{k}{r}{e}{a}{t}{a}' '{k}{r}{e}{a}{t}{oo}{n}' (<- '{k}{r}{e}')
175 '{p}{e}{r}{a}{s}' '{p}{e}{r}{a}{t}{o}{s}' '{p}{e}{r}{a}{t}{i}' '{p}{e}{r}{a}{t}{a}' '{p}{e}{r}{a}{t}{oo}{n}' (<- '{p}{e}{r}')
176 '{t}{e}{r}{a}{s}' '{t}{e}{r}{a}{t}{o}{s}' '{t}{e}{r}{a}{t}{a}' '{t}{e}{r}{a}{t}{oo}{n}' (<- '{t}{e}{r}')
177 '{f}{oo}{s}' '{f}{oo}{t}{o}{s}' '{f}{oo}{t}{a}' '{f}{oo}{t}{oo}{n}' (<- '{f}{oo}')
178 '{k}{a}{th}{e}{s}{t}{oo}{s}' '{k}{a}{th}{e}{s}{t}{oo}{t}{o}{s}' '{k}{a}{th}{e}{s}{t}{oo}{t}{a}' '{k}{a}{th}{e}{s}{t}{oo}{t}{oo}{n}' (<- '{k}{a}{th}{e}{s}{t}')
179 '{g}{e}{g}{o}{n}{o}{s}' '{g}{e}{g}{o}{n}{o}{t}{o}{s}' '{g}{e}{g}{o}{n}{o}{t}{a}' '{g}{e}{g}{o}{n}{o}{t}{oo}{n}' (<- '{g}{e}{g}{o}{n}')
180 )
181 unset test1
182 )
183
184 define steps1 as (
185 [substring] among (
186 '{y}{z}{a}' '{y}{z}{e}{s}' '{y}{z}{e}' '{y}{z}{a}{m}{e}' '{y}{z}{a}{t}{e}' '{y}{z}{a}{n}' '{y}{z}{a}{n}{e}' '{y}{z}{oo}' '{y}{z}{e}{y}{s}' '{y}{z}{e}{y}'
187 '{y}{z}{o}{u}{m}{e}' '{y}{z}{e}{t}{e}' '{y}{z}{o}{u}{n}' '{y}{z}{o}{u}{n}{e}' (
188 delete
189 unset test1
190 ([substring] atlimit among (
191 '{a}{n}{a}{m}{p}{a}' '{e}{m}{p}{a}' '{e}{p}{a}' '{x}{a}{n}{a}{p}{a}' '{p}{a}' '{p}{e}{r}{y}{p}{a}' '{a}{th}{r}{o}' '{s}{u}{n}{a}{th}{r}{o}' '{d}{a}{n}{e}'
192 (-> s <- '{y}' insert s)
193 )) or
194 ([substring] atlimit among (
195 '{m}{a}{r}{k}' '{k}{o}{r}{n}' '{a}{m}{p}{a}{r}' '{a}{r}{r}' '{v}{a}{th}{u}{r}{y}' '{v}{a}{r}{k}' '{v}' '{v}{o}{l}{v}{o}{r}' '{g}{k}{r}'
196 '{g}{l}{u}{k}{o}{r}' '{g}{l}{u}{k}{u}{r}' '{y}{m}{p}' '{l}' '{l}{o}{u}' '{m}{a}{r}' '{m}' '{p}{r}' '{m}{p}{r}' '{p}{o}{l}{u}{r}' '{p}'
197 '{r}' '{p}{y}{p}{e}{r}{o}{r}'
198 (-> s <- '{y}{z}' insert s)
199 ))
200 )
201 )
202 )
203
204 define steps2 as (
205 [substring] among (
206 '{oo}{th}{i}{k}{a}' '{oo}{th}{i}{k}{e}{s}' '{oo}{th}{i}{k}{e}' '{oo}{th}{i}{k}{a}{m}{e}' '{oo}{th}{i}{k}{a}{t}{e}' '{oo}{th}{i}{k}{a}{n}' '{oo}{th}{i}{k}{a}{n}{e}' (
207 delete
208 unset test1
209 [substring] atlimit among (
210 '{a}{l}' '{v}{y}' '{e}{n}' '{u}{ps}' '{l}{y}' '{z}{oo}' '{s}' '{ch}' (-> s <- '{oo}{n}' insert s)
211 )
212 )
213 )
214 )
215
216 define steps3 as (
217 [substring] among (
218 '{y}{s}{a}' '{y}{s}{e}{s}' '{y}{s}{e}' '{y}{s}{a}{m}{e}' '{y}{s}{a}{t}{e}' '{y}{s}{a}{n}' '{y}{s}{a}{n}{e}' (
219 delete
220 unset test1
221 ('{y}{s}{a}' atlimit <- '{y}{s}') or
222 ([substring] atlimit among (
223 '{a}{n}{a}{m}{p}{a}' '{a}{th}{r}{o}' '{e}{m}{p}{a}' '{e}{s}{e}' '{e}{s}{oo}{k}{l}{e}' '{e}{p}{a}' '{x}{a}{n}{a}{p}{a}' '{e}{p}{e}' '{p}{e}{r}{y}{p}{a}'
224 '{s}{u}{n}{a}{th}{r}{o}' '{d}{a}{n}{e}' '{k}{l}{e}' '{ch}{a}{r}{t}{o}{p}{a}' '{e}{x}{a}{r}{ch}{a}' '{m}{e}{t}{e}{p}{e}' '{a}{p}{o}{k}{l}{e}'
225 '{a}{p}{e}{k}{l}{e}' '{e}{k}{l}{e}' '{p}{e}'
226 (-> s <- '{y}' insert s)
227 )) or
228 ([substring] atlimit among (
229 '{a}{n}' '{a}{f}' '{g}{e}' '{g}{y}{g}{a}{n}{t}{o}{a}{f}' '{g}{k}{e}' '{d}{i}{m}{o}{k}{r}{a}{t}' '{k}{o}{m}' '{g}{k}' '{m}' '{p}'
230 '{p}{o}{u}{k}{a}{m}' '{o}{l}{o}' '{l}{a}{r}'
231 (-> s <- '{y}{s}' insert s)
232 ))
233 )
234 )
235 )
236
237 define steps4 as (
238 [substring] among (
239 '{y}{s}{oo}' '{y}{s}{e}{y}{s}' '{y}{s}{e}{y}' '{y}{s}{o}{u}{m}{e}' '{y}{s}{e}{t}{e}' '{y}{s}{o}{u}{n}' '{y}{s}{o}{u}{n}{e}' (
240 delete
241 unset test1
242 [substring] atlimit among (
243 '{a}{n}{a}{m}{p}{a}' '{e}{m}{p}{a}' '{e}{s}{e}' '{e}{s}{oo}{k}{l}{e}' '{e}{p}{a}' '{x}{a}{n}{a}{p}{a}' '{e}{p}{e}' '{p}{e}{r}{y}{p}{a}' '{a}{th}{r}{o}'
244 '{s}{u}{n}{a}{th}{r}{o}' '{d}{a}{n}{e}' '{k}{l}{e}' '{ch}{a}{r}{t}{o}{p}{a}' '{e}{x}{a}{r}{ch}{a}' '{m}{e}{t}{e}{p}{e}' '{a}{p}{o}{k}{l}{e}' '{a}{p}{e}{k}{l}{e}'
245 '{e}{k}{l}{e}' '{p}{e}'
246 (-> s <- '{y}' insert s)
247 )
248 )
249 )
250 )
251
252 define steps5 as (
253 [substring] among (
254 '{y}{s}{t}{o}{s}' '{y}{s}{t}{o}{u}' '{y}{s}{t}{o}' '{y}{s}{t}{e}' '{y}{s}{t}{o}{y}' '{y}{s}{t}{oo}{n}' '{y}{s}{t}{o}{u}{s}' '{y}{s}{t}{i}' '{y}{s}{t}{i}{s}'
255 '{y}{s}{t}{a}' '{y}{s}{t}{e}{s}' (
256 delete
257 unset test1
258 ([substring] atlimit among (
259 '{d}{a}{n}{e}' '{s}{u}{n}{a}{th}{r}{o}' '{k}{l}{e}' '{s}{e}' '{e}{s}{oo}{k}{l}{e}' '{a}{s}{e}' '{p}{l}{e}'
260 (-> s <- '{y}' insert s)
261 )) or
262 ([substring] atlimit among (
263 '{m}' '{p}' '{a}{p}' '{a}{r}' '{i}{d}' '{k}{t}' '{s}{k}' '{s}{ch}' '{u}{ps}' '{f}{a}' '{ch}{r}' '{ch}{t}' '{a}{k}{t}'
264 '{a}{o}{r}' '{a}{s}{ch}' '{a}{t}{a}' '{a}{ch}{n}' '{a}{ch}{t}' '{g}{e}{m}' '{g}{u}{r}' '{e}{m}{p}' '{e}{u}{p}' '{e}{ch}{th}' '{i}{f}{a}'
265 '{k}{a}{th}' '{k}{a}{k}' '{k}{u}{l}' '{l}{u}{g}' '{m}{a}{k}' '{m}{e}{g}' '{t}{a}{ch}' '{f}{y}{l}' '{ch}{oo}{r}'
266 (-> s <- '{y}{s}{t}' insert s)
267 ))
268 )
269 )
270 )
271
272 define steps6 as (
273 [substring] among (
274 '{y}{s}{m}{o}' '{y}{s}{m}{o}{y}' '{y}{s}{m}{o}{s}' '{y}{s}{m}{o}{u}' '{y}{s}{m}{o}{u}{s}' '{y}{s}{m}{oo}{n}' (
275 delete
276 unset test1
277 ([substring] atlimit among (
278 '{s}{e}' '{m}{e}{t}{a}{s}{e}' '{m}{y}{k}{r}{o}{s}{e}' '{e}{g}{k}{l}{e}' '{a}{p}{o}{k}{l}{e}'
279 (-> s <- '{y}{s}{m}' insert s)
280 )) or
281 ([substring] atlimit among (
282 '{d}{a}{n}{e}' '{a}{n}{t}{y}{d}{a}{n}{e}'
283 (-> s <- '{y}' insert s)
284 )) or
285 ([substring] among (
286 '{a}{g}{n}{oo}{s}{t}{y}{k}' (<- '{a}{g}{n}{oo}{s}{t}')
287 '{a}{t}{o}{m}{y}{k}' (<- '{a}{t}{o}{m}')
288 '{g}{n}{oo}{s}{t}{y}{k}' (<- '{g}{n}{oo}{s}{t}')
289 '{e}{th}{n}{y}{k}' (<- '{e}{th}{n}')
290 '{e}{k}{l}{e}{k}{t}{y}{k}' (<- '{e}{k}{l}{e}{k}{t}')
291 '{s}{k}{e}{p}{t}{y}{k}' (<- '{s}{k}{e}{p}{t}')
292 '{t}{o}{p}{y}{k}' (<- '{t}{o}{p}')
293 '{a}{l}{e}{x}{a}{n}{d}{r}{y}{n}' (<- '{a}{l}{e}{x}{a}{n}{d}{r}')
294 '{v}{u}{z}{a}{n}{t}{y}{n}' (<- '{v}{u}{z}{a}{n}{t}')
295 '{th}{e}{a}{t}{r}{y}{n}' (<- '{th}{e}{a}{t}{r}')
296 ))
297 )
298 )
299 )
300
301 define steps7 as (
302 [substring] among (
303 '{a}{r}{a}{k}{y}' '{a}{r}{a}{k}{y}{a}' '{o}{u}{d}{a}{k}{y}' '{o}{u}{d}{a}{k}{y}{a}' (
304 delete
305 unset test1
306 [substring] atlimit among (
307 '{s}' '{ch}'
308 (-> s <- '{a}{r}{a}{k}' insert s)
309 )
310 )
311 )
312 )
313
314 define steps8 as (
315 [substring] among (
316 '{a}{k}{y}' '{a}{k}{y}{a}' '{y}{t}{s}{a}' '{y}{t}{s}{a}{s}' '{y}{t}{s}{e}{s}' '{y}{t}{s}{oo}{n}' '{a}{r}{a}{k}{y}' '{a}{r}{a}{k}{y}{a}' (
317 delete
318 unset test1
319 ([substring] atlimit among (
320 '{v}{a}{m}{v}' '{v}{r}' '{k}{a}{y}{m}' '{k}{o}{n}' '{k}{o}{r}' '{l}{a}{v}{r}' '{l}{o}{u}{l}' '{m}{e}{r}' '{m}{o}{u}{s}{t}'
321 '{n}{a}{g}{k}{a}{s}' '{p}{l}' '{r}' '{r}{u}' '{s}' '{s}{k}' '{s}{o}{k}' '{s}{p}{a}{n}' '{t}{z}' '{f}{a}{r}{m}' '{ch}' '{k}{a}{p}{a}{k}'
322 '{a}{l}{y}{s}{f}' '{a}{m}{v}{r}' '{a}{n}{th}{r}' '{k}' '{f}{u}{l}' '{k}{a}{t}{r}{a}{p}' '{k}{l}{y}{m}' '{m}{a}{l}' '{s}{l}{o}{v}' '{f}'
323 '{s}{f}' '{t}{s}{e}{ch}{o}{s}{l}{o}{v}'
324 (-> s <- '{a}{k}' insert s)
325 )) or
326 ([substring] atlimit among (
327 '{v}' '{v}{a}{l}' '{g}{y}{a}{n}' '{g}{l}' '{z}' '{i}{g}{o}{u}{m}{e}{n}' '{k}{a}{r}{d}' '{k}{o}{n}' '{m}{a}{k}{r}{u}{n}' '{n}{u}{f}'
328 '{p}{a}{t}{e}{r}' '{p}' '{s}{k}' '{t}{o}{s}' '{t}{r}{y}{p}{o}{l}'
329 (-> s <- '{y}{t}{s}' insert s)
330 )) or
331 (['{k}{o}{r}'] -> s <- '{y}{t}{s}' insert s)
332 )
333 )
334 )
335
336 define steps9 as (
337 [substring] among (
338 '{y}{d}{y}{o}' '{y}{d}{y}{a}' '{y}{d}{y}{oo}{n}' (
339 delete
340 unset test1
341 ([substring] atlimit among (
342 '{a}{y}{f}{n}' '{y}{r}' '{o}{l}{o}' '{ps}{a}{l}' (-> s <- '{y}{d}' insert s)
343 )) or
344 ([substring] among (
345 '{e}' '{p}{a}{y}{ch}{n}' (-> s <- '{y}{d}' insert s)
346 ))
347 )
348 )
349 )
350
351 define steps10 as (
352 [substring] among (
353 '{y}{s}{k}{o}{s}' '{y}{s}{k}{o}{u}' '{y}{s}{k}{o}' '{y}{s}{k}{e}' (
354 delete
355 unset test1
356 [substring] atlimit among (
357 '{d}' '{y}{v}' '{m}{i}{n}' '{r}' '{f}{r}{a}{g}{k}' '{l}{u}{k}' '{o}{v}{e}{l}'
358 (-> s <- '{y}{s}{k}' insert s)
359 )
360 )
361 )
362 )
363
364 define step2a as (
365 [substring] among (
366 '{a}{d}{e}{s}' '{a}{d}{oo}{n}' (delete)
367 )
368 not ([substring] among (
369 '{o}{k}' '{m}{a}{m}' '{m}{a}{n}' '{m}{p}{a}{m}{p}' '{p}{a}{t}{e}{r}' '{g}{y}{a}{g}{y}' '{n}{t}{a}{n}{t}' '{k}{u}{r}' '{th}{e}{y}' '{p}{e}{th}{e}{r}'
370 ))
371 insert '{a}{d}'
372 )
373
374 define step2b as (
375 [substring] among (
376 '{e}{d}{e}{s}' '{e}{d}{oo}{n}' (delete)
377 )
378 [substring] among (
379 '{o}{p}' '{y}{p}' '{e}{m}{p}' '{u}{p}' '{g}{i}{p}' '{d}{a}{p}' '{k}{r}{a}{s}{p}' '{m}{y}{l}' (-> s <- '{e}{d}' insert s)
380 )
381 )
382
383 define step2c as (
384 [substring] among (
385 '{o}{u}{d}{e}{s}' '{o}{u}{d}{oo}{n}' (delete)
386 )
387 [substring] among (
388 '{a}{r}{k}' '{k}{a}{l}{y}{a}{k}' '{p}{e}{t}{a}{l}' '{l}{y}{ch}' '{p}{l}{e}{x}' '{s}{k}' '{s}' '{f}{l}' '{f}{r}' '{v}{e}{l}' '{l}{o}{u}{l}' '{ch}{n}'
389 '{s}{p}' '{t}{r}{a}{g}' '{f}{e}' (-> s <- '{o}{u}{d}' insert s)
390 )
391 )
392
393 define step2d as (
394 [substring] among (
395 '{e}{oo}{s}' '{e}{oo}{n}' (delete unset test1)
396 )
397 [substring] atlimit among (
398 '{th}' '{d}' '{e}{l}' '{g}{a}{l}' '{n}' '{p}' '{y}{d}' '{p}{a}{r}' (-> s <- '{e}' insert s)
399 )
400 )
401
402 define step3 as (
403 [substring] among (
404 '{y}{a}' '{y}{o}{u}' '{y}{oo}{n}' (delete unset test1)
405 )
406 ([v] -> s <- '{y}' insert s)
407 )
408
409 define step4 as (
410 [substring] among (
411 '{y}{k}{a}' '{y}{k}{o}' '{y}{k}{o}{u}' '{y}{k}{oo}{n}' (delete unset test1)
412 )
413 ([v] -> s <- '{y}{k}' insert s) or
414 [substring] atlimit among (
415 '{a}{l}' '{a}{d}' '{e}{n}{d}' '{a}{m}{a}{n}' '{a}{m}{m}{o}{ch}{a}{l}' '{i}{th}' '{a}{n}{i}{th}' '{a}{n}{t}{y}{d}' '{f}{u}{s}' '{v}{r}{oo}{m}' '{g}{e}{r}'
416 '{e}{x}{oo}{d}' '{k}{a}{l}{p}' '{k}{a}{l}{l}{y}{n}' '{k}{a}{t}{a}{d}' '{m}{o}{u}{l}' '{m}{p}{a}{n}' '{m}{p}{a}{g}{y}{a}{t}' '{m}{p}{o}{l}' '{m}{p}{o}{s}'
417 '{n}{y}{t}' '{x}{y}{k}' '{s}{u}{n}{o}{m}{i}{l}' '{p}{e}{t}{s}' '{p}{y}{t}{s}' '{p}{y}{k}{a}{n}{t}' '{p}{l}{y}{a}{t}{s}' '{p}{o}{s}{t}{e}{l}{n}' '{p}{r}{oo}{t}{o}{d}'
418 '{s}{e}{r}{t}' '{s}{u}{n}{a}{d}' '{t}{s}{a}{m}' '{u}{p}{o}{d}' '{f}{y}{l}{o}{n}' '{f}{u}{l}{o}{d}' '{ch}{a}{s}'
419 (-> s <- '{y}{k}' insert s)
420 )
421 )
422
423 define step5a as (
424 do ('{a}{g}{a}{m}{e}' atlimit <- '{a}{g}{a}{m}')
425 do (
426 [substring] among (
427 '{a}{g}{a}{m}{e}' '{i}{s}{a}{m}{e}' '{o}{u}{s}{a}{m}{e}' '{i}{k}{a}{m}{e}' '{i}{th}{i}{k}{a}{m}{e}' (delete unset test1)
428 )
429 )
430 ['{a}{m}{e}']
431 delete
432 unset test1
433 [substring] atlimit among (
434 '{a}{n}{a}{p}' '{a}{p}{o}{th}' '{a}{p}{o}{k}' '{a}{p}{o}{s}{t}' '{v}{o}{u}{v}' '{x}{e}{th}' '{o}{u}{l}' '{p}{e}{th}' '{p}{y}{k}{r}' '{p}{o}{t}' '{s}{y}{ch}' '{ch}'
435 (-> s <- '{a}{m}' insert s)
436 )
437 )
438
439 define step5b as (
440 do (
441 [substring] among (
442 '{a}{g}{a}{n}{e}' '{i}{s}{a}{n}{e}' '{o}{u}{s}{a}{n}{e}' '{y}{o}{n}{t}{a}{n}{e}' '{y}{o}{t}{a}{n}{e}' '{y}{o}{u}{n}{t}{a}{n}{e}' '{o}{n}{t}{a}{n}{e}' '{o}{t}{a}{n}{e}'
443 '{o}{u}{n}{t}{a}{n}{e}' '{i}{k}{a}{n}{e}' '{i}{th}{i}{k}{a}{n}{e}' (
444 delete
445 unset test1
446 [substring] atlimit among (
447 '{t}{r}' '{t}{s}' (-> s <- '{a}{g}{a}{n}' insert s)
448 )
449 )
450 )
451 )
452 ['{a}{n}{e}']
453 delete
454 unset test1
455 ([v2] -> s <- '{a}{n}' insert s) or
456 [substring] atlimit among (
457 '{v}{e}{t}{e}{r}' '{v}{o}{u}{l}{k}' '{v}{r}{a}{ch}{m}' '{g}' '{d}{r}{a}{d}{o}{u}{m}'
458 '{th}' '{k}{a}{l}{p}{o}{u}{z}' '{k}{a}{s}{t}{e}{l}' '{k}{o}{r}{m}{o}{r}' '{l}{a}{o}{p}{l}' '{m}{oo}{a}{m}{e}{th}'
459 '{m}' '{m}{o}{u}{s}{o}{u}{l}{m}' '{n}' '{o}{u}{l}' '{p}' '{p}{e}{l}{e}{k}' '{p}{l}' '{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{y}{v}' '{o}{l}{y}{g}{o}{d}{a}{m}' '{o}{l}{o}{g}{a}{l}' '{p}{e}{n}{t}{a}{r}{f}' '{p}{e}{r}{i}{f}'
471 '{p}{e}{r}{y}{t}{r}' '{p}{l}{a}{t}' '{p}{o}{l}{u}{d}{a}{p}' '{p}{o}{l}{u}{m}{i}{ch}' '{s}{t}{e}{f}' '{t}{a}{v}'
472 '{t}{e}{t}' '{u}{p}{e}{r}{i}{f}' '{u}{p}{o}{k}{o}{p}' '{ch}{a}{m}{i}{l}{o}{d}{a}{p}' '{ps}{i}{l}{o}{t}{a}{v}'
473 (-> s <- '{a}{n}' insert s)
474 )
475 )
476
477 define step5c as (
478 do (
479 [substring] among (
480 '{i}{s}{e}{t}{e}' (delete unset test1)
481 )
482 )
483 ['{e}{t}{e}']
484 delete
485 unset test1
486 ([v2] -> s <- '{e}{t}' insert s) or
487 ([substring] among (
488 '{o}{d}' '{a}{y}{r}' '{f}{o}{r}' '{t}{a}{th}' '{d}{y}{a}{th}' '{s}{ch}' '{e}{n}{d}' '{e}{u}{r}' '{t}{y}{th}' '{u}{p}{e}{r}{th}'
489 '{r}{a}{th}' '{e}{n}{th}' '{r}{o}{th}' '{s}{th}' '{p}{u}{r}' '{a}{y}{n}' '{s}{u}{n}{d}' '{s}{u}{n}' '{s}{u}{n}{th}' '{ch}{oo}{r}'
490 '{p}{o}{n}' '{v}{r}' '{k}{a}{th}' '{e}{u}{th}' '{e}{k}{th}' '{n}{e}{t}' '{r}{o}{n}' '{a}{r}{k}' '{v}{a}{r}' '{v}{o}{l}' '{oo}{f}{e}{l}'
491 (-> s <- '{e}{t}' insert s)
492 )) or
493 [substring] atlimit among (
494 '{a}{v}{a}{r}' '{v}{e}{n}' '{e}{n}{a}{r}' '{a}{v}{r}' '{a}{d}' '{a}{th}' '{a}{n}' '{a}{p}{l}' '{v}{a}{r}{o}{n}' '{n}{t}{r}' '{s}{k}' '{k}{o}{p}'
495 '{m}{p}{o}{r}' '{n}{y}{f}' '{p}{a}{g}' '{p}{a}{r}{a}{k}{a}{l}' '{s}{e}{r}{p}' '{s}{k}{e}{l}' '{s}{u}{r}{f}' '{t}{o}{k}' '{u}' '{d}' '{e}{m}'
496 '{th}{a}{r}{r}' '{th}'
497 (-> s <- '{e}{t}' insert s)
498 )
499 )
500
501 define step5d as (
502 [substring] among (
503 '{o}{n}{t}{a}{s}' '{oo}{n}{t}{a}{s}' (
504 delete
505 unset test1
506 (['{a}{r}{ch}'] atlimit -> s <- '{o}{n}{t}' insert s) or
507 (['{k}{r}{e}'] -> s <- '{oo}{n}{t}' insert s)
508 )
509 )
510 )
511
512 define step5e as (
513 [substring] among (
514 '{o}{m}{a}{s}{t}{e}' '{y}{o}{m}{a}{s}{t}{e}' (
515 delete
516 unset test1
517 (['{o}{n}'] atlimit -> s <- '{o}{m}{a}{s}{t}' insert s)
518 )
519 )
520 )
521
522 define step5f as (
523 do (
524 ['{y}{e}{s}{t}{e}']
525 delete
526 unset test1
527 [substring] atlimit among (
528 '{p}' '{a}{p}' '{s}{u}{m}{p}' '{a}{s}{u}{m}{p}' '{a}{k}{a}{t}{a}{p}' '{a}{m}{e}{t}{a}{m}{f}' (-> s <- '{y}{e}{s}{t}' insert s)
529 )
530 )
531 ['{e}{s}{t}{e}']
532 delete
533 unset test1
534 [substring] atlimit among (
535 '{a}{l}' '{a}{r}' '{e}{k}{t}{e}{l}' '{z}' '{m}' '{x}' '{p}{a}{r}{a}{k}{a}{l}' '{p}{r}{o}' '{n}{y}{s}'
536 (-> s <- '{y}{e}{s}{t}' insert s)
537 )
538 )
539
540 define step5g as (
541 do (
542 [substring] among (
543 '{i}{th}{i}{k}{a}' '{i}{th}{i}{k}{e}{s}' '{i}{th}{i}{k}{e}' (delete unset test1)
544 )
545 )
546 [substring] among (
547 '{i}{k}{a}' '{i}{k}{e}{s}' '{i}{k}{e}' (
548 delete
549 unset test1
550 ([substring] among (
551 '{s}{k}{oo}{l}' '{s}{k}{o}{u}{l}' '{n}{a}{r}{th}' '{s}{f}' '{o}{th}' '{p}{y}{th}' (-> s <- '{i}{k}' insert s)
552 )) or
553 ([substring] atlimit among (
554 '{d}{y}{a}{th}' '{th}' '{p}{a}{r}{a}{k}{a}{t}{a}{th}' '{p}{r}{o}{s}{th}' '{s}{u}{n}{th}' (-> s <- '{i}{k}' insert s)
555 ))
556 )
557 )
558 )
559
560 define step5h as (
561 [substring] among (
562 '{o}{u}{s}{a}' '{o}{u}{s}{e}{s}' '{o}{u}{s}{e}' (
563 delete
564 unset test1
565 ([substring] among (
566 '{p}{o}{d}{a}{r}' '{v}{l}{e}{p}' '{p}{a}{n}{t}{a}{ch}' '{f}{r}{u}{d}' '{m}{a}{n}{t}{y}{l}' '{m}{a}{l}{l}' '{k}{u}{m}{a}{t}' '{l}{a}{ch}' '{l}{i}{g}'
567 '{f}{a}{g}' '{o}{m}' '{p}{r}{oo}{t}' (-> s <- '{o}{u}{s}' insert s)
568
569 )) or
570 ([substring] atlimit among (
571 '{f}{a}{r}{m}{a}{k}' '{ch}{a}{d}' '{a}{g}{k}' '{a}{n}{a}{r}{r}' '{v}{r}{o}{m}' '{e}{k}{l}{y}{p}' '{l}{a}{m}{p}{y}{d}' '{l}{e}{ch}' '{m}' '{p}{a}{t}'
572 '{r}' '{l}' '{m}{e}{d}' '{m}{e}{s}{a}{z}' '{u}{p}{o}{t}{e}{y}{n}' '{a}{m}' '{a}{y}{th}' '{a}{n}{i}{k}' '{d}{e}{s}{p}{o}{z}'
573 '{e}{n}{d}{y}{a}{f}{e}{r}' '{d}{e}' '{d}{e}{u}{t}{e}{r}{e}{u}' '{k}{a}{th}{a}{r}{e}{u}' '{p}{l}{e}' '{t}{s}{a}'
574 (-> s <- '{o}{u}{s}' insert s)
575 ))
576 )
577 )
578 )
579
580 define step5i as (
581 [substring] among (
582 '{a}{g}{a}' '{a}{g}{e}{s}' '{a}{g}{e}' (
583 delete
584 unset test1
585 (['{k}{o}{l}{l}'] -> s <- '{a}{g}' insert s) or (
586 not ([substring] among ('{ps}{o}{f}' '{n}{a}{u}{l}{o}{ch}'))
587 ([substring] among (
588 '{o}{f}' '{p}{e}{l}' '{ch}{o}{r}{t}' '{l}{l}' '{s}{f}' '{r}{p}' '{f}{r}' '{p}{r}' '{l}{o}{ch}' '{s}{m}{i}{n}'
589 (-> s <- '{a}{g}' insert s)
590 )) or
591 ([substring] atlimit among (
592 '{a}{v}{a}{s}{t}' '{p}{o}{l}{u}{f}' '{a}{d}{i}{f}' '{p}{a}{m}{f}' '{r}' '{a}{s}{p}' '{a}{f}' '{a}{m}{a}{l}' '{a}{m}{a}{l}{l}{y}'
593 '{a}{n}{u}{s}{t}' '{a}{p}{e}{r}' '{a}{s}{p}{a}{r}' '{a}{ch}{a}{r}' '{d}{e}{r}{v}{e}{n}' '{d}{r}{o}{s}{o}{p}' '{x}{e}{f}' '{n}{e}{o}{p}'
594 '{n}{o}{m}{o}{t}' '{o}{l}{o}{p}' '{o}{m}{o}{t}' '{p}{r}{o}{s}{t}' '{p}{r}{o}{s}{oo}{p}{o}{p}' '{s}{u}{m}{p}' '{s}{u}{n}{t}' '{t}' '{u}{p}{o}{t}'
595 '{ch}{a}{r}' '{a}{e}{y}{p}' '{a}{y}{m}{o}{s}{t}' '{a}{n}{u}{p}' '{a}{p}{o}{t}' '{a}{r}{t}{y}{p}' '{d}{y}{a}{t}' '{e}{n}' '{e}{p}{y}{t}'
596 '{k}{r}{o}{k}{a}{l}{o}{p}' '{s}{y}{d}{i}{r}{o}{p}' '{l}' '{n}{a}{u}' '{o}{u}{l}{a}{m}' '{o}{u}{r}' '{p}' '{t}{r}' '{m}'
597 (-> s <- '{a}{g}' insert s)
598 ))
599 )
600 )
601 )
602 )
603
604 define step5j as (
605 [substring] among (
606 '{i}{s}{e}' '{i}{s}{o}{u}' '{i}{s}{a}' (delete unset test1)
607 )
608 [substring] atlimit among (
609 '{n}' '{ch}{e}{r}{s}{o}{n}' '{d}{oo}{d}{e}{k}{a}{n}' '{e}{r}{i}{m}{o}{n}' '{m}{e}{g}{a}{l}{o}{n}' '{e}{p}{t}{a}{n}' (-> s <- '{i}{s}' insert s)
610 )
611 )
612
613 define step5k as (
614 [substring] among (
615 '{i}{s}{t}{e}' (delete unset test1)
616 )
617 [substring] atlimit among (
618 '{a}{s}{v}' '{s}{v}' '{a}{ch}{r}' '{ch}{r}' '{a}{p}{l}' '{a}{e}{y}{m}{n}' '{d}{u}{s}{ch}{r}' '{e}{u}{ch}{r}' '{k}{o}{y}{n}{o}{ch}{r}' '{p}{a}{l}{y}{m}{ps}'
619 (-> s <- '{i}{s}{t}' insert s)
620 )
621 )
622
623 define step5l as (
624 [substring] among (
625 '{o}{u}{n}{e}' '{i}{s}{o}{u}{n}{e}' '{i}{th}{o}{u}{n}{e}' (delete unset test1)
626 )
627 [substring] atlimit among (
628 '{n}' '{r}' '{s}{p}{y}' '{s}{t}{r}{a}{v}{o}{m}{o}{u}{t}{s}' '{k}{a}{k}{o}{m}{o}{u}{t}{s}' '{e}{x}{oo}{n}' (-> s <- '{o}{u}{n}' insert s)
629 )
630 )
631
632 define step5m as (
633 [substring] among (
634 '{o}{u}{m}{e}' '{i}{s}{o}{u}{m}{e}' '{i}{th}{o}{u}{m}{e}' (delete unset test1)
635 )
636 [substring] atlimit among (
637 '{p}{a}{r}{a}{s}{o}{u}{s}' '{f}' '{ch}' '{oo}{r}{y}{o}{p}{l}' '{a}{z}' '{a}{l}{l}{o}{s}{o}{u}{s}' '{a}{s}{o}{u}{s}'
638 (-> s <- '{o}{u}{m}' insert s)
639 )
640 )
641
642 define step6 as (
643 do (
644 [substring] among (
645 '{m}{a}{t}{a}' '{m}{a}{t}{oo}{n}' '{m}{a}{t}{o}{s}' (<- '{m}{a}')
646 )
647 )
648 test1
649 [substring] among (
650 '{a}' '{a}{g}{a}{t}{e}' '{a}{g}{a}{n}' '{a}{e}{y}' '{a}{m}{a}{y}' '{a}{n}' '{a}{s}' '{a}{s}{a}{y}' '{a}{t}{a}{y}' '{a}{oo}' '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{n}{a}' '{o}{t}{a}{n}' '{o}{u}' '{o}{u}{m}{a}{y}'
658 '{o}{u}{m}{a}{s}{t}{e}' '{o}{u}{n}' '{o}{u}{n}{t}{a}{y}' '{o}{u}{n}{t}{a}{n}' '{o}{u}{s}' '{o}{u}{s}{a}{n}' '{o}{u}{s}{a}{t}{e}' '{u}' '{u}{s}' '{oo}'
659 '{oo}{n}' (delete)
660 )
661 )
662
663 define step7 as (
664 [substring] among (
665 '{e}{s}{t}{e}{r}' '{e}{s}{t}{a}{t}' '{o}{t}{e}{r}' '{o}{t}{a}{t}' '{u}{t}{e}{r}' '{u}{t}{a}{t}' '{oo}{t}{e}{r}' '{oo}{t}{a}{t}' (delete)
666 )
667 )
668 )
669
670 define stem as (
671 backwards (
672 do tolower
673 has_min_length
674 set test1
675 do step1
676 do steps1
677 do steps2
678 do steps3
679 do steps4
680 do steps5
681 do steps6
682 do steps7
683 do steps8
684 do steps9
685 do steps10
686 do step2a
687 do step2b
688 do step2c
689 do step2d
690 do step3
691 do step4
692 do step5a
693 do step5b
694 do step5c
695 do step5d
696 do step5e
697 do step5f
698 do step5g
699 do step5h
700 do step5j
701 do step5i
702 do step5k
703 do step5l
704 do step5m
705 do step6
706 do step7
707 )
708 )