-
Notifications
You must be signed in to change notification settings - Fork 50
/
apertium-eng.eng.rlx
655 lines (463 loc) · 19 KB
/
apertium-eng.eng.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
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
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
#This program is free software: you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation, either version 3 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program. If not, see <http://www.gnu.org/licenses/>.
DELIMITERS = "<.>" "<..>" "<...>" "<!>" "<?>" "<¶>" sent ;
SOFT-DELIMITERS = "<,>" ;
SUBREADINGS = LTR ;
LIST BOS = (>>>) ;
LIST EOS = (<<<) ;
SETS
LIST Unknown = ("\\*.*"r) ;
LIST N = n ;
LIST Np = np ;
LIST NpAnt = (np ant) ;
LIST NpCog = (np cog) ;
LIST Prn = prn ;
LIST PrnObj = (prn obj) ;
LIST PrnSubj = (prn subj) ;
LIST PrnItg = (prn itg) ;
LIST Det = det ;
LIST Adj = adj ;
LIST Predet = predet ;
LIST Preadv = preadv ;
LIST Adv = adv ;
LIST AdvItg = (adv itg) ;
LIST Pr = pr ;
LIST Ger = ger ;
LIST Pprs = pprs ;
LIST Subs = subs ;
LIST Num = num ;
LIST Rel = (prn rel) ;
LIST Ij = ij ;
LIST Cnjadv = cnjadv ;
LIST Cnjcoo = cnjcoo ;
LIST Cnjsub = cnjsub ;
LIST V = vblex vbser vaux vbmod vbhaver vbdo ;
LIST Vblex = vblex ;
LIST Vbser = vbser ;
LIST Vbhaver = vbhaver ;
LIST Vbdo = vbdo ;
LIST Vbaux = vaux ;
LIST Vbmod = vbmod ;
LIST Gen = gen ;
LIST Guio = guio ;
LIST Apos = apos ;
LIST Not = "not" ;
SET Please = ("please" adv) | ("please" ij) ;
SET Imp = (vblex imp) | (vbser imp) | (vbdo imp) ;
SET Inf = (vblex inf) | (vbmod inf) | (vaux inf) | (vbser inf) | (vbhaver inf) | (vbdo inf) ;
SET Pp = (vblex pp) | (vbmod pp) | (vaux pp) | (vbser pp) | (vbhaver pp) | (vbdo pp) ;
SET Pres = (vblex pres) | (vbmod pres) | (vaux pres) | (vbser pres) | (vbhaver pres) | (vbdo pres) ;
SET Past = (vblex past) | (vbmod past) | (vaux past) | (vbser past) | (vbhaver past) | (vbdo past) ;
LIST Could = ("can" vbmod past) ;
LIST Will = ("will" vbmod pres) ;
LIST ArtV = (vbser pres p2 sg) ;
LIST By = ("by" pr) ;
LIST ThatCnj = ("that" cnjsub) ;
LIST Sg = sg ;
LIST Pl = pl ;
LIST Sp = sp ;
LIST M = m ;
LIST F = f ;
LIST Nt = nt ;
LIST Mf = mf ;
LIST The = "the" ;
LIST Fin = pres past imp ;
LIST To = "to" ;
SET Pers = (p1) | (p2) | (p3) ;
LIST P1 = p1 ;
LIST P2 = p2 ;
LIST P3 = p3 ;
LIST PrnSubjP1Sg = (prn subj p1 mf sg) ;
LIST PrnSubjP1Pl = (prn subj p1 mf pl) ;
LIST PrnSubjP2Sp = (prn subj p2 mf sp) ;
LIST PrnSubjP2Sg = (prn subj p2 mf sg) ;
LIST Letters = "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" "k" "l" "m" "n" "o" "p" "q" "r" "s" "t" "u" "v" "w" "x" "y" "z" ;
LIST Ing = "<.*ing>"ri ;
LIST Cm = cm ;
LIST Sup = sup ;
LIST Supadj = (adj sint sup) ;
LIST Pred = pred ;
List Nsg = (n sg) ;
List Npl = (n pl) ;
List As = "as" ;
List Both = "both" ;
SECTION
# Basic rules
REMOVE V IF (0 V) (0 N) (-1C Det) ;
REMOVE V IF (0 V) (0 N) (-1C Gen) ;
REMOVE Adv IF (0 Adv) (1C N) ;
REMOVE Adv IF (0 Adv) (1 Adj) (2C N) ;
REMOVE Preadv IF (0 Preadv) (1C N) ;
SELECT Predet IF (0 Predet) (1C Det) ;
REMOVE Cnjadv IF (0 Cnjadv) (1 EOS) ;
REMOVE Cnjadv IF (0 Cnjadv) (NOT 1* EOS) ;
REMOVE Pl IF (0 Letters) ;
REMOVE Preadv IF (1 (cm)) ;
REMOVE Cnjsub IF (0 ThatCnj) (-1 BOS) ;
# Proper nouns
REMOVE N IF (0 NpCog) (0 N) (-1C NpAnt OR NpCog) ;
REMOVE N IF (0 NpCog) (0 N) (-1 N + ("president")) ;
# Verbs: select infitinive if preceded by "to"
SELECT Inf IF (0C V) (-1C To) ;
SELECT Inf IF (0C V) (-2C To) (-1 Adv) ;
SELECT Inf IF (0 V) (0 N) (-2C V) (-1C To) ;
SELECT Inf IF (0 V) (0 N) (-3C V) (-2C To) (-1 Adv) ;
# Verbs: select infinitive if preceded by vbmod/vbdo
SELECT Inf IF (0 V) (-1 Vbmod) ;
SELECT Inf IF (0 V) (-2 Vbmod) (-1 Adv) ;
SELECT Inf IF (0 V) (-1 Vbdo) ;
SELECT Inf IF (0 V) (-2 Adv) (-1 Vbdo) ;
SELECT Inf IF (0 V) (-1/1 ("will")) ; # TODO: Needs to be changed to a generic "Vbmod", but that doesn't work for some reason
SELECT Inf IF (0 V) (-1/1 ("can")) ;
SELECT Inf IF (0 V) (-1/1 ("shall")) ;
SELECT Inf IF (0 V) (-2/1 ("will")) (-1 Adv) ;
SELECT Inf IF (0 V) (-2/1 ("can")) (-1 Adv) ;
SELECT Inf IF (0 V) (-2/1 ("shall")) (-1 Adv) ;
SELECT Inf IF (0 V) (-2 Vbdo) (-1 PrnSubj | Prn) ;
SELECT Inf IF (0 V) (-2 Vbmod) (-1 PrnSubj | Prn) ;
SELECT Inf IF (0 V) (-3 Vbmod) (-2 Adv) (-1 PrnSubj) ;
SELECT Inf IF (0 V) (-2/1 ("will")) (-1 PrnSubj) ;
SELECT Inf IF (0 V) (-2/1 ("can")) (-1 PrnSubj) ;
SELECT Inf IF (0 V) (-2/1 ("shall")) (-1 PrnSubj) ;
SELECT Inf IF (0 V) (-3/1 ("will")) (-2 Adv) (-1 PrnSubj) ;
SELECT Inf IF (0 V) (-3/1 ("can")) (-2 Adv) (-1 PrnSubj) ;
SELECT Inf IF (0 V) (-3/1 ("shall")) (-2 Adv) (-1 PrnSubj) ;
# Verbs: select participle if preceded by Vbhaver
SELECT Pp IF (0 V) (-1 Vbhaver) ;
SELECT Pp IF (0 V) (-2 Vbhaver) (-1 Adv) ;
SELECT Pp IF (0 V) (-1/1 ("have")) ;
SELECT Pp IF (0 V) (-2/1 ("have")) (-1 Adv) ;
SELECT Pp IF (0 V) (-2 Vbhaver) (-1 PrnSubj) ;
SELECT Pp IF (0 V) (-3 Vbhaver) (-2 Adv) (-1 PrnSubj) ;
SELECT Pp IF (0 V) (-2/1 ("have")) (-1 PrnSubj) ;
SELECT Pp IF (0 V) (-3/1 ("have")) (-2 Adv) (-1 PrnSubj) ;
# Verbs: select gerund if preceded by Vbser
SELECT Ger IF (0 V) (-1 Vbser) ;
SELECT Ger IF (0 V) (-2 Vbser) (-1 Adv) ;
SELECT Ger IF (0 V) (-1/1 ("be")) ;
SELECT Ger IF (0 V) (-2/1 ("be")) (-1 Adv) ;
SELECT Ger IF (0 V) (-2 Vbser) (-1 PrnSubj) ;
SELECT Ger IF (0 V) (-3 Vbser) (-2 Adv) (-1 PrnSubj) ;
SELECT Ger IF (0 V) (-2/1 ("be")) (-1 PrnSubj) ;
SELECT Ger IF (0 V) (-3/1 ("be")) (-2 Adv) (-1 PrnSubj) ;
# Please (adv/ij) and please (vblex)
SELECT Vblex IF (0 Please) (0 Vblex) (-1C To) ;
SELECT Vblex IF (0 Please) (0 Vblex) (1 PrnObj) ;
SELECT Vblex IF (0 Please) (0 Vblex) (1 Np) ;
SELECT Vblex IF (0 Please) (0 Vblex) (1 Det) (2 N) ;
SELECT Vblex IF (0 Please) (0 Vblex) (1 Det) (2 Adj) (3 N) ;
SELECT Vblex IF (0 Please) (0 Vblex) (1 Det) (2 Preadv) (3 Adj) (4 N) ;
REMOVE Vblex IF (0 Please) (0 Vblex) ;
# Modal verbs in present or past: select if placed at BOS and are part of an inverted structure ("Would you like...?")
SELECT Vbmod IF (0 Vbmod) (0 N) (-1C BOS) (1 PrnSubj) (2 Inf) ;
REMOVE Inf IF (0 Vbmod) (-1C BOS) (1 PrnSubj) (2 Inf) ;
# Have: select if placed at BOS and are part of an inverted structure ("Have you been...?")
SELECT Vbhaver IF (0 Vbhaver) (-1C BOS) (1 PrnSubj) (2 Pp) ;
REMOVE Inf IF (0 Vbhaver) (-1C BOS) (1 PrnSubj) (2 Pp) ;
# Do: select if placed at BOS and are part of an inverted structure ("Do you like...?")
SELECT Vbdo IF (0 Vbdo) (-1C BOS) (1 PrnSubj | Prn) (2 Inf) ;
REMOVE Inf IF (0 Vbdo) (-1C BOS) (1 PrnSubj) (2 Inf) ;
# Verbs in past or participle: remove Pp
REMOVE Pp IF (0 Past) (0 Pp) (1C PrnObj) ;
REMOVE Pp IF (0 Past) (0 Pp) (-2C Past) (-1C Cnjcoo) ;
# Verbs in present or past: remove if placed at BOS
REMOVE Pres IF (0C V) (-1C BOS) ;
REMOVE Past IF (0C V) (-1C BOS) ;
# Imperatives: remove unless preceded by "please"/Adv or placed at BOS and not followed by another verb
SELECT Imp IF (0C V) (-1 BOS | _S_SOFT_DELIMITERS_) (NOT 1C Fin) ;
SELECT Imp IF (0C V) (-2 BOS) (-1 Please) ;
SELECT Imp IF (0C V) (-2 BOS) (-1 Adv) ;
SELECT Imp IF (0C V) (-2C Imp) (-1 Cnjcoo) ;
SELECT Imp IF (0C V) (-2C Imp) (-1 Cnjcoo) ;
SELECT Imp IF (0C V) (-3C Imp) (-2 N OR PrnObj) (-1 Cnjcoo) ;
SELECT Imp IF (0C V) (-4C Imp) (-3 Det) (-2 N) (-1 Cnjcoo) ;
SELECT Imp IF (0C V) (-5C Imp) (-4 Det) (-3 N) (-2 N) (-1 Cnjcoo) ;
REMOVE Imp IF (0C V) (0 Imp) ;
# Verbs: "could have succeeded"
SELECT Inf IF (0 Vbhaver) (-1 Could) (1 Pp) ;
# Verbs: "thou art"
SELECT V IF (0 Vbser) (0 ArtV) (-1 PrnSubjP2Sg) ;
REMOVE V IF (0 Vbser) (0 ArtV) ;
# Verbs: "would like"
REMOVE Pr IF (0 V) (0 Pr) (-1/1 Vbmod) ;
REMOVE Pr IF (0 V) (0 Pr) (-1 Vbmod) ;
REMOVE Pr IF (0 V) (0 Pr) (-1 Vbmod) (-1/1 Adv) ;
REMOVE Pr IF (0 V) (0 Pr) (-2/1 Vbmod) (-1 Adv) ;
REMOVE Pr IF (0 V) (0 Pr) (-2 Vbmod) (-1 Adv) ;
REMOVE Pr IF (0 V) (0 Pr) (1C Pr) ;
REMOVE Pr IF (0 V) (0 Pr) (-1 PrnSubj) (1 Ger) ;
# Verbs ending in -ing
SELECT Adj IF (0 Ger) (0 Pprs) (0 Subs) (0 Adj) (NOT -1 V) ;
SELECT Pprs IF (0 Ger) (0 Pprs) (0 Subs) (-1C Det) (1C N) ;
SELECT Subs IF (0 Ger) (0 Pprs) (0 Subs) (-1C V) ;
SELECT Subs IF (0 Ger) (0 Pprs) (0 Subs) (1C Fin) ;
SELECT Subs IF (0 Ger) (0 Pprs) (0 Subs) (NOT -1 Vbser) (1C Pr) ;
SELECT Subs IF (0 Ger) (0 Pprs) (0 Subs) (-1C Pr) ;
SELECT Subs IF (0 Ger) (0 Pprs) (0 Subs) (-2C Pr) (-1 Adv) ;
SELECT Ger IF (0 Ger) (0 Pprs) (0 Subs) (-1 By) ;
SELECT Ger IF (0 Ger) (0 Pprs) (0 Subs) (-1 BOS) (1 EOS) ;
# Lemmas that are N or V: vbmod if will/can/may
SELECT Vbmod IF (0 Vbmod) (0 N) (1 Inf) ;
SELECT Vbmod IF (0 Vbmod) (0 N) (1 Adv) (2 Inf) ;
SELECT Vbmod IF (0 Vbmod) (0 N) (1 Adv) (2 Adv) (3 Inf) ;
SELECT Vbmod IF (0 Vbmod) (0 N) (1 PrnSubj) (2 Inf) ;
# Lemmas that are N or V: N if Det/Adj precedes it
SELECT N IF (0 N) (0 V) (-1 Det) ;
SELECT N IF (0 N) (0 V) (-1 Adj) ;
SELECT N IF (0 N) (0 V) (NOT 0 P3) (-2 Det) (-1C N + Sg) ;
SELECT N IF (0 N) (0 V) (NOT 0 P3) (-2 Adj) (-1C N + Sg) ;
# Lemmas that are N or V: N if Subs follows it
SELECT N IF (0 N) (0 V) (1 Subs) ;
# Lemmas that are N or V: N if alone in sentence
SELECT N IF (0 N) (0 V) (-1 BOS) (NOT 1* N ) ;
# Lemmas that are N or V: V if vbmod/Vbdo precedes it
SELECT V IF (0 N) (0 V) (-1 Vbmod | Vbaux) ;
SELECT V IF (0 N) (0 V) (-2 Vbmod | Vbaux) (-1 Adv) ;
SELECT V IF (0 N) (0 V) (-3 Vbmod | Vbaux) (-2 PrnSubj) (-1 Adv) ;
SELECT V IF (0 N) (0 V) (-1 Vbdo) ;
SELECT V IF (0 N) (0 V) (-2 Vbdo) (-1 Adv) ;
SELECT V IF (0 N) (0 V) (-3 Vbdo) (-2 Adv) (-1 Adv) ;
# Lemmas that are N or V: V if Adv/Prn/N/vbmod precedes it
SELECT V IF (0 N) (0 V) (-2 N) (-1C Adv) ;
SELECT V IF (0 N) (0 V) (-1 Prn) ;
SELECT V IF (0 N) (0 V) (-3 Prn) (-2 Cnjcoo) (-1 Prn) ;
SELECT V IF (0 N) (0 V) (-3 Prn) (-2 Cnjcoo) (-1 Np) ;
SELECT V IF (0 N) (0 V) (-2 Prn) (-1 Adv) ;
SELECT V IF (0 N) (0 V) (-1 Np) ;
SELECT V IF (0 N) (0 V) (-3 Np) (-2 Cnjcoo) (-1 Np) ;
SELECT V IF (0 N) (0 V) (-3 Np) (-2 Cnjcoo) (-1 Prn) ;
SELECT V IF (0 N) (0 V) (-2 Np) (-1 Adv) ;
# Lemmas that are N or V: V if N/Prn follows it
SELECT V IF (0 N) (0 V) (1 PrnObj) ;
SELECT V IF (0 N) (0 V) (1C Prn) (NOT 1 PrnSubj) ;
SELECT V IF (0 N) (0 V) (1C Det) (2C N) ;
SELECT V IF (0 N) (0 V) (1C Num) (2C N) ;
# Lemmas that are N or V: V if another V precedes or follows it
SELECT V IF (0 N) (0 V) (1 Cnjcoo) (2C V) ;
SELECT V IF (0 N) (0 V) (-2C V) (-1 Cnjcoo) ;
SELECT V IF (0 N) (0 V) (-3C V) (-2 N OR PrnObj) (-1 Cnjcoo) ;
SELECT V IF (0 N) (0 V) (-4C V) (-3 Det) (-2 N) (-1 Cnjcoo) ;
SELECT V IF (0 N) (0 V) (-5C V) (-4 Det) (-3 N) (-2 N) (-1 Cnjcoo) ;
# Verbs: vbmod if Inf follows and Vbhaver if Pp follows
SELECT Vbhaver IF (1 Pp) ;
SELECT Vbhaver IF (2 Pp) ;
SELECT SUB:-1 Vbhaver IF (1 Pp) ;
SELECT SUB:-1 Vbhaver IF (2 Pp) ;
REMOVE SUB:-1 Vbhaver ;
SELECT SUB:-1 Vbmod IF (1 Inf) ;
SELECT SUB:-1 Vbmod IF (1 Adv) (2 Inf) ;
#Lemmas that are N or Adj: N if Adj/Guio precedes it or V follows
SELECT N IF (0 N) (0 Adj) (-1 Guio) ;
SELECT N IF (0 N) (0 Adj) (-1 Adj) ;
SELECT N IF (0 N) (0 Adj) (1 V) ;
#Lemmas that are N or Adj: Adj if N follows it
SELECT Adj IF (0 N) (0 Adj) (1 N) ;
# Different cases for as ("as __ as")
SELECT Cnjsub IF (0 Det) (-1 Vblex) (1 N) (2 Vbser) ;
#Example (that):
#He thinks that candy is evil.
SELECT Pr IF (0 As) (-2 As) (-1 Adv) (-1 Adj) (-3 Vbser) ;
#Example (as):
#You are as quick as I am.
SELECT Pr IF (0 As) (-2 As) (-1 Adv) (-1 Adj) (-3 Vblex) ;
#Example (as):
#The Earth was formed as early as 4.54 billion years ago.
# Has (Cnjsub) and has (Det)
SELECT Cnjsub IF (0 Det) (-1 Adj) (-2 Vbser) (1 Nsg) ;
#Example (that):
#It is true that candy is evil.
SELECT Cnjsub IF (0 Det) (-1 Vbser) (-2 N) (1 Nsg) ;
#Example (that):
#The problem is that candy is evil.
SELECT Det IF (0 Cnjsub) (1 Nsg) (2 Vbser) ;
#Example (that):
#That cat is evil.
SELECT Cnjsub IF (0 Det) (1 Det) ;
#Example (that):
#I believe that the cat is evil.
SELECT Cnjsub IF (0 Det) (-1 Vblex) (2 Vbser) (1 N) ;
#Example (that):
#I find that candy is evil.
SELECT Cnjsub IF (0 Det) (-1 Vblex) (1 Adj) (2 N) ;
#Example (that):
#I find that red candy is evil.
REMOVE Cnjsub IF (0 Det) (0 Prn) (1 _S_DELIMITERS_) ;
# Both (Cnjcoo/Det/Prn)
SELECT Cnjcoo IF (0 Both) (1C Nsg) (NOT 2C Npl) ;
SELECT Cnjcoo IF (0 Both) (1C Adj) (NOT 2C Npl) ;
SELECT Cnjcoo IF (0 Both) (1C Adj) (2C Nsg) (NOT 3C Npl) ;
SELECT Det IF (0 Both) (1C Nsg) (2C Npl) ;
SELECT Det IF (0 Both) (1C Adj) (2C Npl) ;
SELECT Det IF (0 Both) (1C Adj) (2C Nsg) (3C Npl) ;
SELECT Prn IF (0 Both) (-1 PrnSubj) ;
# Lemmas that are Det or Prn: Det if N/Aadj follows
REMOVE Det IF (0 Det) (-1 Det) ;
SELECT Det IF (0 Det) (0 Prn) (NOT -1 V) (1 N OR Np) ;
SELECT Det IF (0 Det) (0 Prn) (NOT -1 V) (1 Adj) (2 N OR Np) ;
SELECT Det IF (0 Det) (0 Prn) (NOT -1 V) (1 Preadv) (2 Adj) (3 N OR Np) ;
# Lemmas that are Det or Prn: Remove Det
REMOVE Det IF (0 Det) (0 Prn) (NOT -1 V) ;
#Lemmas that are Adj+Pred or Det ('his')
SELECT Det IF (0 Adj) (0 Det) (1 N OR Np) ;
SELECT Det IF (0 Adj) (0 Det) (1 Adj) (2 N OR Np) ;
SELECT Det IF (0 Adj) (0 Det) (1 Preadv) (2 Adj) (3 N OR Np) ;
REMOVE Det IF (0 Adj) (0 Det) ;
#Lemmas that are Adj or Det ('little'): Adj if Det precedes it or N+Pl follows
SELECT Adj IF (0 Adj) (0 Det) (-1 Det) ;
SELECT Adj IF (0 Adj) (0 Det) (1 N + Pl) ;
#Lemmas that are Adv or Adj ('free'): Adj if Pr follows
SELECT Adj IF (0 Adj) (0 Adv) (-1 Vbser) (1 Pr) ;
#Lemmas that are Adv or Det ('no'): Adv unless N follows
SELECT Det IF (0 Adv) (0 Det) (1 N) ;
SELECT Det IF (0 Adv) (0 Det) (1 Adj) (2 N) ;
SELECT Adv IF (0 Adv) (0 Det) ;
#Lemmas that are Adv or Prep ('around'): Adv unless N/Np/Subs follows
SELECT Pr IF (0 Adv) (0 Pr) (1 Np) ;
SELECT Pr IF (0 Adv) (0 Pr) (1 Adj) (2 Np) ;
SELECT Pr IF (0 Adv) (0 Pr) (1 N) ;
SELECT Pr IF (0 Adv) (0 Pr) (1 Adj) (2 N) ;
SELECT Pr IF (0 Adv) (0 Pr) (1 Det) (2 N) ;
SELECT Pr IF (0 Adv) (0 Pr) (1 Det) (2 Adj) (3 N) ;
SELECT Pr IF (0 Adv) (0 Pr) (1 Det) (2 Preadv) (3 Adj) (4 N) ;
SELECT Pr IF (0 Adv) (0 Pr) (1 Num) ;
SELECT Pr IF (0 Adv) (0 Pr) (1 Det) (2 Num) (2 N) ;
SELECT Pr IF (0 Adv) (0 Pr) (1 Prn) ;
SELECT Pr IF (0 Adv) (0 Pr) (1 Subs) ;
SELECT SUB:0 Pr IF (0 Adv) (0/0 Pr) (0/-1 Adj) (1 N) ;
SELECT SUB:0 Pr IF (0 Adv) (0/0 Pr) (0/-1 Adj) (1 Guio) ;
REMOVE Pr IF (0 Adv) (0 Pr) ;
#Lemmas that are Preadv or Cnjadv ('so'): Cnjadv unless Adv/Adj follows
SELECT Preadv IF (0 Preadv) (0 Cnjadv) (1 Adv) ;
SELECT Preadv IF (0 Preadv) (0 Cnjadv) (1 Adj) ;
REMOVE Preadv IF (0 Preadv) (0 Cnjadv) ;
# Verbs with person/number: P1
SELECT P1 IF (0C Pres) (0C Past) (-1 PrnSubjP1Sg) ;
SELECT P1 IF (0C Pres) (0C Past) (-1 Adv) (-2 PrnSubjP1Sg) ;
SELECT P1 IF (0C Pres) (0C Past) (-1 Adv) (-2 Adv) (-3 PrnSubjP1Sg) ;
# Verbs with person/number: P3 (default) (if not genitive)
SELECT P3 IF (0C Pres) (0C Past) (NOT 0 ("'s")) ;
# Saxon genitive ('s)
SELECT Gen IF (0 Gen) (-1 Unknown) ;
REMOVE Gen IF (0 Gen) (NOT -1 N | Np) ;
REMOVE Gen IF (0 Gen) (0 Apos) (NOT -1 ("<.*s>"r)) ;
SELECT Gen IF (0 Gen) (0 Vbser) (0 Vbhaver) (-1 N + Pl) ;
# Have (vblex) and have (vbhaver)
REMOVE Vblex IF (0 Vblex) (0 Vbhaver) (1 Pp) ;
REMOVE Vblex IF (0 Vblex) (0 Vbhaver) (1 Adv) (2 Pp) ;
REMOVE Vblex IF (0 Vblex) (0 Vbhaver) (1 Adv) (2 Adv) (3 Pp) ;
REMOVE Vbhaver IF (0 Vblex) (0 Vbhaver) ;
# Do (vbdo) and do (vblex)
SELECT Vbdo IF (1 Inf) ;
SELECT Vbdo IF (1 Adv) (2 Inf) ;
SELECT Vbdo IF (1 Adv) (2 Adv) (3 Inf) ;
SELECT Vbdo IF (1 PrnSubj) (2 Inf) ;
REMOVE Vbdo IF (0 Vblex) (0 Vbdo) ;
# one: eins (num) / man (prn)
SELECT Num IF (1 N) ;
SELECT Num IF (1 Adj) (2 N) ;
SELECT Num IF (1 Adv) (2 Adj) (3 N) ;
# PrnSubj / PrnObj
SELECT PrnSubj IF (0 PrnSubj) (0 PrnObj) (-1 Vbmod) (1 Inf) ;
SELECT PrnSubj IF (0 PrnSubj) (0 PrnObj) (-1 Vbdo) (1 Inf) ;
SELECT PrnSubj IF (0 PrnSubj) (0 PrnObj) (-1 Vbhaver) (1 Pp) ;
SELECT PrnSubj IF (0 PrnSubj) (0 PrnObj) (-2 AdvItg) (-1 Vbser) ;
SELECT PrnSubj IF (0 PrnSubj) (0 PrnObj) (-2 PrnItg) (-1 Vbser) ;
SELECT PrnObj IF (0 PrnSubj) (0 PrnObj) (-1 Imp) ;
# Cnjcoo/Prn
SELECT Prn IF (0 Cnjcoo) (0 Prn) (1C V) ;
#
# Other rules
#
REMOVE Cnjadv IF (-1 BOS) ;
REMOVE Preadv IF (1 EOS) ;
REMOVE (vblex pp) IF (-1 PrnSubj) ;
REMOVE (vbmod inf) IF (1 Inf) ;
REMOVE (vbmod inf) IF (1 Adv) (2 Inf) ;
REMOVE ("second"i n) IF (1 (n)) ;
#REMOVE PrnObj IF (-1 V) (-2 BOS) ;
REMOVE (prn obj) IF (1 (vblex inf)) ;
REMOVE (prn obj) IF (1 Vbmod) (2 (vblex inf)) ;
SELECT AdvItg IF (-1 BOS) ;
SELECT PrnItg IF (-1 BOS) ;
SELECT V IF (-1 (prn pers)) ;
SELECT SUB:1 Vbser IF (1 Ing) (0/* Vbhaver) ;
SELECT Ger IF (-1/* Vbser) (1 To) ;
SELECT Adv IF (0 N) (0 Adv) (1 Supadj) (-1 Det) (-2 Vbser) ;
#Example (largest)
#Canada is the second largest country in the world.
REMOVE Pr IF (0 Cnjadv) (0 Pr) (1 PrnSubj) ;
#Example (for):
#I was happy, for I had just won the lottery.
SELECT Pr IF (0 Cnjadv) (0 Pr) (1 PrnObj) ;
#Example (for):
#The food is for me.
# Specific rules
# Nice to meet you (Adj/Np)
SELECT Adj IF (0 ("Nice")) (-1 BOS) (1 Pr) (2 Inf) ;
# shows recommended files
SELECT V IF (0 ("show")) (-1 BOS) (1 Adj OR Pp) (2 ("file")) ;
# open with
SELECT V IF (0 ("open")) (0 V) (0 Adj) (-1 BOS) (1 Pr) ;
# sort from
SELECT V IF (0 ("sort")) (0 V) (0 N) (-1 BOS) (1 Pr) ;
# press and hold
SELECT V IF (0 ("press")) (0 V) (0 N) (-1 BOS) (1 Cnjcoo) (2 ("hold")) ;
# right
SELECT Ij IF (0 ("right")) (0 Ij) (-1 _S_SOFT_DELIMITERS_) (1 ("?") + _S_DELIMITERS_) ;
SELECT Ij IF (0 ("right")) (0 Ij) (-1 BOS) (1 ("?") + _S_DELIMITERS_) ;
REMOVE Ij IF (0 ("right")) (0 Ij) ;
# He
SELECT NpCog IF (0 NpCog) (0 PrnSubj) (-1 NpAnt) ;
REMOVE NpCog IF (0 NpCog) (0 PrnSubj) ;
#
# TODO: Rules to be revised
#
# a job / Steve Jobs (breaks phrases such as "an Apple representative")
# REMOVE Np IF (-1C (det ind)) ;
# Flammie's last resorts
# Roman ordinal unlikely
REMOVE ("I" adj) ;
# so much more common as not names also
REMOVE ("You" np) ;
REMOVE ("He" np) ;
REMOVE ("Also" np) ;
# I think there's some noun->adj conversion in apertium-eng that fails for
# eng-fin
LIST FLAMMIE-NO-LIKE-ADJS = ("house" adj) ("car" adj) ("animal" adj)
("animal" adj) ("downtown" adj) ("summer" adj)
("school" adj) ("stage" adj) ("airport" adj)
("business" adj) ("mass" adj) ("riot" adj)
("kettle" adj) ("pilot" adj) ("police" adj)
("market" adj) ("radio" adj) ("rail" adj)
("chess" adj) ("parish" adj) ("foster" adj)
("citrus" adj) ("television" adj)
("road" adj) ("space" adj) ("accounting" adj)
("training" adj) ("labour" adj) ("jar" adj)
("career" adj) ("dish" adj) ("state" adj)
("blood" adj) ("basin" adj) ("bucket" adj)
("audio" adj) ("tourist" adj)
;
REMOVE FLAMMIE-NO-LIKE-ADJS ;
# for conjunction (wrong)
REMOVE ("for" cnjadv) (NOT -1 BOS) ;
#
LIST INF = (inf) ;
LIST PRN-PRS-SUBJ = (subj) ;
REMOVE INF (-1 PRN-PRS-SUBJ) ;
LIST PARTICIPLE = (pp) ;
LIST PP-AUX = ("be" vbser) ;
SELECT PARTICIPLE (-1 PP-AUX) ;
REMOVE ("if" n) ;
# titlecasing something mid-sentence should be an np
LIST TitleCasedNP = (r"<[A-Z].*>" np) ;
SELECT TitleCasedNP (not -1 BOS) ;