-
Notifications
You must be signed in to change notification settings - Fork 0
/
apertium-deu.deu.rlx
executable file
·218 lines (160 loc) · 6.9 KB
/
apertium-deu.deu.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
DELIMITERS = "<.>" "<!>" "<?>" "<...>" "<¶>" "<:>" ;
SOFT-DELIMITERS = "<,>" ;
SETS
LIST BOS = (>>>) (sent) ;
LIST EOS = (<<<) (sent) ;
LIST Det = (det) ;
LIST DetDef = (det def) ;
LIST DetInd = (det ind) ;
LIST N = (n) ;
LIST Np = (np) ;
LIST Vblex = (vblex) ;
LIST Vbser = (vbser) ;
LIST Vbhaver = (vbhaver) ;
LIST Vbdo = (vbdo) ;
LIST Vbmod = (vbmod) ;
LIST Vaux = (vaux) ;
LIST PrnDem = (prn dem) ;
LIST Pr = (pr) ;
LIST Adj = (adj) ;
LIST Adv = (adv) ;
LIST Num = (num) ;
LIST Prn = (prn) ;
LIST Rel = (prn rel) ;
LIST Ij = (ij) ;
LIST Nom = (nom) ;
LIST P3 = (p3) ;
LIST Sg = (sg) ;
LIST Pl = (pl) ;
LIST Sp = (sp) ;
LIST M = (m) ;
LIST F = (f) ;
LIST Nt = (nt) ;
LIST Mf = (mf) ;
LIST Mfn = (mfn) ;
LIST Un = (un) ;
LIST Imp = (imp) ;
SET GENDER = M | F | Nt | Un ;
SET NUMBER = Sg | Pl ;
SET CASE = (nom) | (gen) | (dat) | (acc) ;
SET Verb = (vblex) | (vbmod) | (vaux) | (vbser) | (vbhaver) | (vbdo) ;
SET Cnj = (cnjcoo) | (cnjsub) | (cnjadv) ;
BEFORE-SECTIONS
# Remove readings that were generated by guessing rules in heuristics section,
# unless they are the only readings available.
# The assumption is that if the dictionary knows a word, it knows everything about it
REMOVE (vblex heur) ;
SECTION
# "einige Jungen", have to executed before #REMOVE Det + Mfn + Pl + $$CASE IF (1 Adj) (NOT 1 Adj + Mf + Pl + $$CASE)
SELECT ("Junge" n) IF (1 Verb) (0 N) (0 Adj) ;
# remove lower-case over-analysis of nouns, if other readings exist
REMOVE (n lower) ;
# remove verbs in upper case (wth)
REMOVE (vblex) IF (0 ("<\\p{Lu}.*>"r)) (NOT -1 BOS) ;
REMOVE Rel IF (NOT -1 (cm)) ;
REMOVE Vblex IF (0 N) (-1 Det) ;
REMOVE ("hast"i n) IF (1 (prn pers p2)) ;
SELECT (prn pers p3 sg) IF (1 (vblex p3 sg)) ;
SELECT (vblex p3 sg) IF (-1 (prn pers p3 sg)) ;
SELECT (prn pers p3 sg) IF (-1 (vblex p3 sg)) ;
REMOVE DetDef IF (1 EOS) ;
REMOVE DetInd IF (1 EOS) ;
REMOVE PrnDem IF (0 DetDef) (1 N) ;
REMOVE ("während"i vblex pprs) IF (NOT 1 EOS) ;
# remove p1/p2 verb readings if there is no p1/p2 pronoun in the same sentence
REMOVE Verb + (p1) IF (NOT *-1 (prn pers p1) BARRIER BOS) (NOT *1 (prn pers p1) BARRIER EOS) ;
REMOVE Verb + (p2) IF (NOT *-1 (prn pers p2) BARRIER BOS) (NOT *1 (prn pers p2) BARRIER EOS) ;
# remove implausible gender case combinations
REMOVE Det + $$GENDER + Sg + $$CASE IF (NOT 0 Verb) (1 N) (NOT 1 N + $$GENDER + Sg + $$CASE) ;
REMOVE Det + Mfn + Pl + $$CASE IF (NOT 0 Verb) (1 N) (NOT 1 N + $$GENDER + Pl + $$CASE) ;
REMOVE N + $$GENDER + Sg + $$CASE IF (0C N) (-1 Det) (NOT -1 Det + $$GENDER + Sg + $$CASE) ;
REMOVE N + $$GENDER + Pl + $$CASE IF (0C N) (-1 Det) (NOT -1 Det + Mfn + Pl + $$CASE) ;
REMOVE Det + $$GENDER + Sg + $$CASE IF (NOT 0 Verb) (1 Adj) (2 N) (NOT 2 N + $$GENDER + Sg + $$CASE) ;
REMOVE Det + Mfn + Pl + $$CASE IF (NOT 0 Verb) (1 Adj) (2 N) (NOT 2 N + $$GENDER + Pl + $$CASE) ;
REMOVE N + $$GENDER + Sg + $$CASE IF (0C N) (-2 Det) (NOT -2 Det + $$GENDER + Sg + $$CASE) (-1 Adj) ;
REMOVE N + $$GENDER + Pl + $$CASE IF (0C N) (-2 Det) (NOT -2 Det + Mfn + Pl + $$CASE) (-1 Adj) ;
REMOVE Det + $$GENDER + Sg + $$CASE IF (NOT 0 Verb) (1 Adj) (NOT 1 Adj + $$GENDER + Sg + $$CASE) ;
REMOVE Det + Mfn + Pl + $$CASE IF (NOT 0 Verb) (1 Adj) (NOT 1 Adj + Mf + Pl + $$CASE) ;
REMOVE Adj + $$GENDER + Sg + $$CASE IF (NOT 0 Verb) (-1 Det) (NOT -1 Det + $$GENDER + Sg + $$CASE) ;
REMOVE Adj + Mf + Pl + $$CASE IF (NOT 0 Verb) (-1 Det) (NOT -1 Det + $$GENDER + Pl + $$CASE) ;
REMOVE Det + $$GENDER + Sg + $$CASE IF (NOT 0 Verb) (-1 Pr) (NOT -1 Pr + $$CASE) (1 N) (NOT 1 N + $$GENDER + Sg + $$CASE) ;
REMOVE Det + Mfn + Pl + $$CASE IF (NOT 0 Verb) (-1 Pr) (NOT -1 Pr + $$CASE) (1 N) (NOT 1 N + $$GENDER + Pl + $$CASE) ;
REMOVE N + $$GENDER + Sg + $$CASE IF (0C N) (-2 Pr) (NOT -2 Pr + $$CASE) (-1 Det) (NOT -1 Det + $$GENDER + Sg + $$CASE) ;
REMOVE N + $$GENDER + Pl + $$CASE IF (0C N) (-2 Pr) (NOT -2 Pr + $$CASE) (-1 Det) (NOT -1 Det + Mfn + Pl + $$CASE) ;
REMOVE Adj + $$GENDER + Sg + $$CASE IF (NOT 0 Verb) (1 N) (NOT 1 N + $$GENDER + Sg + $$CASE) ;
REMOVE N + $$GENDER + Sg + $$CASE IF (0C N) (-1 Adj) (NOT -1 Adj + $$GENDER + Sg + $$CASE) ;
REMOVE Adj + $$GENDER + Pl + $$CASE IF (NOT 0 Verb) (1 N) (NOT 1 N + $$GENDER + Pl + $$CASE) ;
REMOVE N + $$GENDER + Pl + $$CASE IF (0C N) (-1 Adj) (NOT -1 Adj + $$GENDER + Pl + $$CASE) ;
REMOVE Adj + Mf + Pl + $$CASE IF (NOT 0 Verb) (1 N) (NOT 1 N + $$GENDER + Pl + $$CASE) ;
REMOVE N + $$GENDER + Pl + $$CASE IF (0C N) (-1 Adj) (NOT -1 Adj + Mf + Pl + $$CASE) ;
REMOVE Pr + $$CASE IF (1 N) (NOT 1 N + $$CASE) ;
REMOVE N + $$CASE IF (-1 Pr) (NOT -1 Pr + $$CASE) ;
REMOVE Pr + $$CASE IF (1 Det) (2 N) (NOT 2 N + $$CASE) ;
REMOVE N + $$CASE IF (-2 Pr) (NOT -2 Pr + $$CASE) (-1 Det) ;
SELECT (vblex pp) IF (1 (vbhaver)) ;
SELECT (vblex pp) IF (-1 (vbhaver)) ;
REMOVE PrnDem IF (0 Det) (1 Adj) (2 N) ;
REMOVE (prn pers) IF (-1 Pr) (0 (det pos)) (1 N) ;
REMOVE (adj attr) IF (1 EOS) ;
REMOVE (adj attr) IF (-1 Det) (0 Adj + GENDER) (1 N) ;
REMOVE (adj pred) IF (-1 Det) (0 Adj + GENDER) (1 N) ;
SELECT (det dem) IF (NOT 0 DetDef) (1 N) ;
# "Sie ist"
SELECT (prn pers p3 f sg nom) IF (1 Verb + (p3 sg)) ;
# "Ich habe dich gefunden"
REMOVE Verb + (prs) IF (0 Verb + (pri)) ;
# remove num reading of "ein" unless there are other nums in the sentence
REMOVE ("ein"i num) IF (NOT *-1 (num) BARRIER BOS) (NOT *1 (num) BARRIER EOS) ;
# (by wth)
# "nach London"
SELECT (pr) IF (1 (np top)) ;
# "Mauer" (n) (instead of (adj comp) "mau"/"mauer")
SELECT N IF (-1 Det) (0 N) (0 Adj) (NOT 1 N) ;
SELECT (adv itg) IF (-1 BOS) ;
SELECT Pr IF (1 Det) ;
SELECT Adj IF (-1 Vbser) (1 EOS) ;
SELECT Adj IF (-2 Vbser) (1 EOS) ;
REMOVE Cnj IF (-1 BOS) ;
# use det.pos (avoid prpers dummy)
REMOVE (prn det) ;
# haben <> anhaben/haben an
REMOVE ("haben"i vblex) IF (-1 (prn)) ;
# haben (v) / Haben (n)
REMOVE ("Haben" n) IF (-1 N) ;
# prefer non compound nouns
REMOVE (n cmp) ;
# "das ist" : (prn dem)
REMOVE DetDef IF (1 Vbser) ;
# "ist das" : (prn dem)
REMOVE DetDef IF (-1 Vbser) ;
# "ist sein Auto"
REMOVE Vbser IF (-1 Vbser) ;
# kanadischer Weizen
REMOVE (adj comp) IF (1 N);
REMOVE (n gen) IF (1C Verb);
REMOVE (vblex ger gen) ;
#REMOVE (prn pl) IF (1 Verb) (NOT 1 Verb + Pl) ;
REMOVE (prn pl) IF (-1 Verb) (NOT -1 Verb + Pl) ;
# ex: @viel Glück
REMOVE ("viel" adv) IF (1 N) ;
REMOVE (adj sint pred) IF (1 N) ;
# suppress adverbs that are also preps in front of a noun giving preference to prepositional tag
# ex: Erträge @aus Kreditprodukten
REMOVE (adv) IF (-1 N) (0 Pr) (1 N);
#SELECT (n lower) IF (-1 (n cmp)) ;
#SELECT (n cmp) IF (1 (n lower)) ;
# (by nuboro)
# "Das 1 Monat alte Kind kann laufen, was kaum zu glauben ist."
SELECT (inf) IF (-1 ("zu")) ;
# "nur noch"
SELECT (adv) IF (0 ("noch"))(-1 ("nur")) ;
# "immer noch"
SELECT (adv) IF (0 ("noch"))(-1 ("immer")) ;
# "beim offiziellen Spiel"
SELECT (nt sg dat) IF (-1 (det sg dat)) (1 (nt sg dat)) ;
# "bei offiziellen Turnieren"
SELECT (nt pl dat) IF (-1 Pr) (1 (nt pl dat)) ;
SELECT (x) ;
SECTION
# remove all imperative readings not selected in previous section
REMOVE Imp ;