-
Notifications
You must be signed in to change notification settings - Fork 29
Expand file tree
/
Copy pathczech.sbl
More file actions
255 lines (232 loc) · 4.84 KB
/
czech.sbl
File metadata and controls
255 lines (232 loc) · 4.84 KB
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
/*
* Czech language stemmer
*
* Source obtained from https://snowballstem.org/algorithms/czech/stemmer.html,
* created by Ljiljana Dolamic & Jacques Savoy in 2009 (thank you :)
*/
routines (
RV R1
palatalise
mark_regions
do_possessive
do_case
do_comparative
do_diminutive
do_augmentative
do_derivational
do_deriv_single
do_aggressive
)
externals ( stem )
integers ( pV p1 )
groupings ( v )
stringescapes {}
stringdef a' '{U+00E1}'
stringdef c^ '{U+010D}'
stringdef d^ '{U+010F}'
stringdef e' '{U+00E9}'
stringdef e^ '{U+011B}'
stringdef i' '{U+00ED}'
stringdef n^ '{U+0148}'
stringdef o' '{U+00F3}'
stringdef r^ '{U+0159}'
stringdef s^ '{U+0161}'
stringdef t^ '{U+0165}'
stringdef u' '{U+00FA}'
stringdef u* '{U+016F}'
stringdef y' '{U+00FD}'
stringdef z^ '{U+017E}'
define v 'aeiouy{a'}{e^}{e'}{i'}{o'}{u'}{u*}{y'}'
define mark_regions as (
$pV = limit
$p1 = limit
do (
gopast non-v setmark pV
gopast non-v gopast v setmark p1
)
)
backwardmode (
define RV as $pV <= cursor
define R1 as $p1 <= cursor
define palatalise as (
[substring] RV among (
'ci' 'ce' '{c^}i' '{c^}'
(<- 'k')
'zi' 'ze' '{z^}i' '{z^}e'
(<- 'h')
'{c^}t{e^}' '{c^}ti' '{c^}t{e'}'
(<- 'ck')
'{s^}t{e^}' '{s^}ti' '{s^}t{e'}'
(<- 'sk')
)
)
define do_possessive as (
[substring] RV among (
'ov' '{u*}v'
(delete)
'in'
(
delete
try palatalise
)
)
)
define do_case as (
[substring] among (
'atech'
'{e^}tem' 'at{u*}m'
'{a'}ch' '{y'}ch' 'ov{e'}' '{y'}mi'
'ata' 'aty' 'ama' 'ami' 'ovi'
'at' '{a'}m' 'os' 'us' '{y'}m' 'mi' 'ou'
'u' 'y' '{u*}' 'a' 'o' '{a'}' '{e'}' '{y'}'
(delete)
'ech' 'ich' '{i'}ch'
'{e'}ho' '{e^}mi' '{e'}mu' '{e^}te' '{e^}ti' '{i'}ho' '{i'}mi'
'emi' 'iho' 'imu'
'{e'}m' '{i'}m' 'es'
'e' 'i' '{i'}' '{e^}'
(
delete
try palatalise
)
'em'
(
<- 'e'
try palatalise
)
)
)
define do_derivational as (
[substring] R1 among (
'obinec'
'ovisk' 'ovstv' 'ovi{s^}t' 'ovn{i'}k'
'{a'}sek' 'loun' 'nost' 'teln' 'ovec' 'ov{i'}k' 'ovtv' 'ovin' '{s^}tin'
'{a'}rn' 'och' 'ost' 'ovn' 'oun' 'out' 'ou{s^}' 'u{s^}k'
'kyn' '{c^}an' 'k{a'}{r^}' 'n{e'}{r^}' 'n{i'}k' 'ctv' 'stv'
'{a'}{c^}' 'a{c^}' '{a'}n' 'an' '{a'}{r^}' 'as'
'ob' 'ot' 'ov' 'o{n^}' 'ul' 'yn'
'{c^}k' '{c^}n' 'dl' 'nk' 'tv' 'tk' 'vk'
(delete)
'ion{a'}{r^}'
'inec' 'itel'
'i{a'}n' 'ist' 'isk' 'i{s^}k' 'itb'
'ic' 'in' 'it' 'iv'
(
<- 'i'
palatalise
)
'enic' 'ec' 'en'
(
<- 'e'
palatalise
)
'{e'}{r^}'
(
<- '{e'}'
palatalise
)
'{e^}n'
(
<- '{e^}'
palatalise
)
'{i'}rn'
'{i'}{r^}' '{i'}n'
(
<- '{i'}'
palatalise
)
)
)
define do_deriv_single as (
[substring] among (
'c' '{c^}' 'k' 'l' 'n' 't'
(delete)
)
)
define do_augmentative as (
[substring] among (
'ajzn' '{a'}k'
(delete)
'izn' 'isk'
(
<- 'i'
palatalise
)
)
)
define do_diminutive as (
[substring] among (
'ou{s^}ek' '{a'}{c^}ek' 'a{c^}ek' 'o{c^}ek' 'u{c^}ek'
'anek' 'onek' 'unek' '{a'}nek'
'e{c^}k' '{e'}{c^}k' 'i{c^}k' '{i'}{c^}k' 'enk' '{e'}nk' 'ink' '{i'}nk'
'{a'}{c^}k' 'a{c^}k' 'o{c^}k' 'u{c^}k' 'ank' 'onk' 'unk'
'{a'}tk' '{a'}nk' 'u{s^}k'
'k'
(delete)
'e{c^}ek' 'enek' 'ek'
(
<- 'e'
palatalise
)
'{e'}{c^}ek' '{e'}k'
(
<- '{e'}'
palatalise
)
'i{c^}ek' 'inek' 'ik'
(
<- 'i'
palatalise
)
'{i'}{c^}ek' '{i'}k'
(
<- '{i'}'
palatalise
)
'{a'}k'
(<- '{a'}')
'ak'
(<- 'a')
'ok'
(<- 'o')
'uk'
(<- 'u')
)
)
define do_comparative as (
[substring] among (
'{e^}j{s^}'
(
<- '{e^}'
palatalise
)
'ej{s^}'
(
<- 'e'
palatalise
)
)
)
define do_aggressive as (
do do_comparative
do do_diminutive
do do_augmentative
do_derivational or do_deriv_single
)
)
define stem as (
do mark_regions
backwards (
do_case
do_possessive
// light and aggressive are the same to this point
// comment next line for light stemmer
do_aggressive
)
)
// Ljiljana Dolamic and Jacques Savoy. 2009.
// Indexing and stemming approaches for the Czech language.
// Inf. Process. Manage. 45, 6 (November 2009), 714-720.
// http://members.unine.ch/jacques.savoy/clef/CzechStemmerLight.txt
// http://members.unine.ch/jacques.savoy/clef/CzechStemmerAgressive.txt