-
Notifications
You must be signed in to change notification settings - Fork 0
/
apertium-swe.swe.rlx
283 lines (192 loc) · 5.98 KB
/
apertium-swe.swe.rlx
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
# -*- cg-pre-pipe: "apertium -d . swe-morph|cg-conv -a 2>/dev/null" -*-
DELIMITERS = "<.>" "<!>" "<?>" "<...>" "<¶>" "<:>";
SOFT-DELIMITERS = "<,>" cm ;
SETS
LIST N = n ;
LIST Adv = adv ;
LIST Pr = pr ;
LIST Det = det ;
LIST Num = num ;
LIST Num/Qnt/årstalet = num qnt ("[0-9]+-tal"ri def) ;
LIST A = adj ;
LIST Prop = np ;
LIST V = vblex vbser vbmod vaux vbhaver ;
LIST Prn = prn ;
LIST Cnjsub = cnjsub ;
LIST Cnjcoo = cnjcoo ;
LIST Ij = Ij ;
LIST Dem = dem ;
LIST Qnt = qnt ;
LIST Emph = emph ;
LIST Cop = "vara¹" "bli";
LIST Sg1 = (p1 sg) ;
LIST Sg2 = (p2 sg) ;
LIST Sg3 = (p3 sg) ;
LIST Pl1 = (p1 pl) ;
LIST Pl2 = (p2 pl) ;
LIST Pl3 = (p3 pl) ;
LIST Inf = inf ;
LIST Pasv = pasv ;
LIST Supn = supn ;
LIST PrsPrc = pprs ;
LIST Pp = pp ;
LIST Poss = pos ;
LIST Interr = itg ;
LIST Nom = nom ;
LIST Acc = acc ;
LIST Gen = gen ;
LIST Def = def ;
LIST Ind = ind ;
LIST Masc = ut m ;
LIST Fem = f fn ut ;
LIST Neut = nt fn ;
LIST Pres = pres ;
LIST Imp = imp ;
LIST Past = past ;
LIST Sg = sg ;
LIST Pl = pl ;
LIST Sp = sp ;
LIST Comma = cm;
LIST Var = "<var>"i ;
LIST Här = "<här>"i ;
LIST Den = "den" ;
LIST IndA = (adj ind) (adj comp) ;
LIST EOS = <<<;
LIST BOS = >>>;
LIST Aux = "kunna" "måste" "vara¹" "bli" "ha" ;
SET Nomen = N or Prop;
LIST Possessed = (n ind) (a sup);
SET Fin = Pres | Past | Imp ;
SET Number = Pl | Sg ;
SET Gender = Masc | Fem | Neut ;
SET NotAdv = (*) - Adv ;
SET NotA = (*) - A ;
SET NotIndA = (*) - IndA ;
LIST farliga-N = "<mitt>"i "<vad>"i "<med>"i "<sedan>"i "<sitter>"i;
LIST farliga-V = "<vart>"i "<sakta>"i;
###############################################################################
# Morphological disambiguation
#
SECTION frequent;
SELECT:hon Prn IF (0 ("<hon>"i)) ; # any safe contexts for the noun?
SELECT:jag Prn IF (0 ("<jag>"i)) (NOT -1 ("<ett>"i)) ;
REMOVE:med N IF (0 ("<med>"i)) (NOT *0 ("<släde>"i)) ;
SELECT Num IF (0 ("sex"i)) (1 N) ;
"<en>" REMOVE:en-fast-idé N OR Adv IF (1 A OR N);
"<för>" SELECT:för-att Pr IF (1 ("att")) ;
"<sedan>" SELECT:sedan-1926 Pr IF (1 Num/Qnt/årstalet) ;
"<sedan>" SELECT:sedan-1926 Pr IF (1 ("år")) (2 Num/Qnt/årstalet) ;
"<fast>" SELECT:stod-fast Adv IF (-1 ("stå") OR ("slå")) ;
"<fast>" SELECT:en-fast-idé A IF (-1C Det OR Prn) (1C N OR Prop) ;
"<sina>" REMOVE:sina V IF (*0 V);
"<andra>"i REMOVE V IF (*0 V) (0 Det OR A);
REMOVE:unlikely ("<bara>"i "bar");
"<början>" SELECT Def IF (-1 ("i")) ;
SECTION grammatical;
SELECT:som-bryter Cnjsub IF (NOT -1 BOS) (0 Adv) (1 Fin) ;
SELECT Adv IF (0 Var) (1 Fin) ;
SELECT Adv IF (0 Var) (2C Fin) ;
SELECT V IF (0 Var) (NOT 1 Fin) ;
SELECT:den-totala-kostnaden A + Def IF
(-1 Det + Def)
(1C N + Def)
;
REMOVE Det IF (1C Fin) ;
SELECT:sina-händer Det IF (0C Det OR Prn) (0C Poss) (1 N - Def) ;
SELECT Past IF (0 Var) (-1 N OR Prn) ;
SELECT Inf IF (-1 Aux) ;
SELECT:att Inf IF (-1 ("att")) ;
SELECT:kan-ses Inf + Pasv IF (*-1 Aux BARRIER Fin OR Cnjsub) ;
REMOVE:en-blå-kon N + Def IF (0 N + Ind) (*-1 Det + Ind CBARRIER NotIndA) ;
SELECT Supn IF (-1* ("ha") BARRIER (*) - Adv) ;
SELECT:en-dansk-ö N + $$Number IF
(-1 A + $$Number)
(-1C A OR N)
;
SELECT:en-dansk-ö N + $$Gender IF
(-1 A + $$Gender)
(-1C A OR N)
;
SELECT:en-dansk-ö A + $$Number IF
(1C N + $$Number)
(0C A OR N)
;
REMOVE A IF (0 V) (1 Pr);
REMOVE Prn IF (0 Det + Masc) (1C N + Masc);
REMOVE Prn IF (0 Det + Fem) (1C N + Fem);
REMOVE Prn IF (0 Det + Neut) (1C N + Neut);
SELECT:dina-barn-skriker N + $$Number IF
(-1 Det LINK 0C $$Number)
(NEGATE 0 V LINK -1 Prn)
(NEGATE 0 Ind LINK -1 Dem)
(NEGATE 0 A OR Det LINK 1 N)
(NEGATE 0 A OR Det LINK 1 A LINK 1 N)
;
SELECT:en-oberoende-ideell-förening A + Ind + $$Number + $$Gender IF
(-1 Det LINK 0C $$Number)
(1 A + Ind + $$Number + $$Gender LINK 1 N)
(NEGATE 0 V LINK -1 Prn)
;
SELECT:mycket-låg Adv IF
(0C Adv OR A OR Prn)
(1 A)
;
SELECT:äpplena-är-ätna A + $$Number IF
(*-1 N + $$Number BARRIER (*) - V LINK *1 Cop)
(NEGATE 0 Adv LINK 1 A)
;
REMOVE:Han+berättade+mig Pp + $$Number IF
(0 V)
(NEGATE *1 N + $$Number BARRIER NotA)
(NEGATE *-1 Cop BARRIER NotAdv LINK *-1 N + $$Number BARRIER NotAdv)
;
REMOVE:sex-år N IF
(0C N OR Det)
(1C N)
;
SELECT:flygledarnas-händer Possessed IF
(0C Possessed OR V OR A)
(-1C Gen)
;
REMOVE ("stadion") IF (0 ("stadium"));
"<vid>" SELECT:vid-behov Pr IF (1 ("behov")) ;
"<vid>" SELECT:i-vid-mening A IF (-1 ("<i>")) (1 N + Ind) ;
#SELECT:r1 Def IF (0 A) (0 Pl) (1C N) (1C Def) ;
#SELECT:r3 Vbser IF (0 ("<vara>")) (NOT -1 ("<en>")) ;
#SELECT A IF (0 A OR PrsPrc OR N) (1 N) ;
#SELECT A + $$Number IF (0 A) (NOT 0 Pr) (1 N + $$Number) ;
SELECT:sina-egna Emph IF (-1 ("sin"));
"<de>" REMOVE Prop IF (NEGATE -1 Prop) ;
REMOVE:alla-de-ämnen Prn IF (-1 Qnt OR ("båda") OR ("bägge")) (0 Dem + $$Number) (1 N + $$Number) ;
REMOVE:stora-barn Def IF
(0C A)
(1C N)
(NOT 1 Def)
;
SECTION heuristic;
SELECT Pr OR A IF (1 N) ;
SELECT Pr IF (1 Nomen) (NOT 0 A) ;
SELECT Pr IF (0 ("<i>"i)) ;
SELECT Pr IF (0 ("<av>"i)) ;
"<dess>" SELECT:sedan Adv (-1 ("sedan"));
"<båda>" REMOVE:båda V OR N;
REMOVE:farliga-N N + farliga-N;
REMOVE:farliga-V V + farliga-V;
REMOVE ("vara²") ;
SELECT:Tala-om-för-mig Imp IF (0C V) (-1 BOS) (0 ("<[A-ZÄÖÅ].*>"r)) (NOT *1 ("?")) ;
REMOVE Imp;
REMOVE Ij;
"<man>" SELECT N IF (-1 Det);
"<man>" REMOVE:default N;
"<vara>" REMOVE:det-vara N IF (NOT -1 Det + Ind);
"<er>" SELECT Acc IF (NOT 1 N + Ind);
"<för>" SELECT Pr ;
"<sina>" REMOVE:sina V;
"<funnits>" SELECT:default ("finnas");
"<kallas>" SELECT:default V;
SELECT Cnjcoo IF (0 ("<fast>"i)) (-1 BOS) (NOT *1 Comma);
SELECT Cnjsub IF (0 ("<fast>"i)) (*0 Comma);
REMOVE N IF (0 Här) (-1 Den + Neut) ;
REMOVE Masc + ("val") IF (0 Neut); # vanlegvis røysting, ikkje kval
REMOVE:why Def IF (0 Prop) ;
# example?