-
Notifications
You must be signed in to change notification settings - Fork 0
/
tagset.py
369 lines (361 loc) · 18.6 KB
/
tagset.py
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
import re
# This module reduces the default tagsets in different ways
# every mode
# mode 0: NO CHANGES
# The amount of tags excludes START and END tag
# mode 1: (105 tags): Reduce compound tags (e.g. 'JJR-HL' or 'FW-IN+NP-TL' to 'JJR' and 'FW') (1st experiment)
# mode 2: Only remove $ and *
# mode 3: mode 1 + 2 combined (2nd experiment)
# mode 4: mode 3 + concentrate all most of the 3-letter tags to 2-letters
# mode 5: naive cut-off of the 3rd letter if existent
# mode 6: reduce most of the tags to one letter
# mode 7: concentrate non-word characters such as brackets, hyphens and quotation marks
# mode 8 (15 tags): extreme concentration of characters
# mode 9: merge all nouns, verbs, adjectives, pronouns and adverbs to their superclasses (3rd experiment)
# mode 10: just a test with QL/QLP
# mode 11: 9 + merge HAVING & BEING to HV_ and BE_
# mode 12: merge all the adjectives to see the impact on the
# mode 13: make brown tags compatible to alpino, by narrowing down
# mode 14: for alpino: merge name & nouns; fix for pron -> det
def reducetagset(tagset, mode):
tmpset = []
if mode == 1: # 105
for t in tagset:
tmpset.append(re.sub(r"([\+\-][\*\w+].*$)", "", t.encode('ascii', 'ignore')))
return set(tmpset)
elif mode == 2:
for t in tagset:
tmpset.append(re.sub(r"(\$)|(\b\*)|(\-\*)", "", t.encode('ascii', 'ignore')))
return set(tmpset)
elif mode == 3: # 81
for t in tagset:
tmpset.append(re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", t.encode('ascii', 'ignore')))
return set(tmpset)
elif mode == 4: # 47
for t in tagset:
tmptag = re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", t.encode('ascii', 'ignore'))
tmptag = re.sub(r"BE\w+$", "BE", tmptag)
tmptag = re.sub(r"DO\w$", "DO", tmptag)
tmptag = re.sub(r"DT\w+$", "DT", tmptag)
tmptag = re.sub(r"HV\w$", "HV", tmptag)
tmptag = re.sub(r"JJ\w$", "JJ", tmptag)
tmptag = re.sub(r"NN\w+$", "NN", tmptag)
tmptag = re.sub(r"NP\w+$", "NP", tmptag)
tmptag = re.sub(r"NR\w+$", "NR", tmptag)
tmptag = re.sub(r"PP\w+$", "PP", tmptag)
tmptag = re.sub(r"QL\w+$", "QL", tmptag)
tmptag = re.sub(r"VB\w+$", "VB", tmptag)
tmptag = re.sub(r"WP\w+$", "WP", tmptag)
tmpset.append(tmptag)
return set(tmpset)
elif mode == 5: # 43
for t in tagset:
tmptag = re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", t.encode('ascii', 'ignore'))
if len(tmptag) > 2:
tmpset.append(tmptag[:2])
else:
tmpset.append(tmptag)
return set(tmpset)
elif mode == 6: # 29
for t in tagset:
tmptag = re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", t.encode('ascii', 'ignore'))
tmptag = re.sub(r"^A\w+$", "A", tmptag)
tmptag = re.sub(r"^BE\w+$", "BE", tmptag)
tmptag = re.sub(r"^C[CS]$", "C", tmptag) #! tmptag = re.sub(r"^C\w+$", "C", tmptag) for naive merging of C (experiment)
tmptag = re.sub(r"^CD$", "A", tmptag) #!
tmptag = re.sub(r"^DO\w+$", "DO", tmptag)
tmptag = re.sub(r"^DT\w+$", "DT", tmptag)
tmptag = re.sub(r"^HV\w+$", "HV", tmptag)
tmptag = re.sub(r"^JJ\w+$", "JJ", tmptag)
tmptag = re.sub(r"^N[NPR]\w*$", "N", tmptag)
tmptag = re.sub(r"^P\w+$", "P", tmptag)
tmptag = re.sub(r"^QL\w+$", "QL", tmptag)
tmptag = re.sub(r"^R\w+$", "R", tmptag)
tmptag = re.sub(r"^VB\w+$", "VB", tmptag)
tmptag = re.sub(r"^W\w+$", "W", tmptag)
tmpset.append(tmptag)
return set(tmpset)
elif mode == 7: # 24
for t in tagset:
tmptag = re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", t.encode('ascii', 'ignore'))
tmptag = re.sub(r"^A\w+$", "A", tmptag)
tmptag = re.sub(r"^BE\w+$", "BE", tmptag)
tmptag = re.sub(r"^C[CS]$", "C", tmptag) #!
tmptag = re.sub(r"^CD$", "A", tmptag) #!
tmptag = re.sub(r"^DO\w+$", "DO", tmptag)
tmptag = re.sub(r"^DT\w+$", "DT", tmptag)
tmptag = re.sub(r"^HV\w+$", "HV", tmptag)
tmptag = re.sub(r"^JJ\w+$", "JJ", tmptag)
tmptag = re.sub(r"^N[NPR]\w*$", "N", tmptag)
tmptag = re.sub(r"^P\w+$", "P", tmptag)
tmptag = re.sub(r"^QL\w+$", "QL", tmptag)
tmptag = re.sub(r"^R\w+$", "R", tmptag)
tmptag = re.sub(r"^VB\w+$", "VB", tmptag)
tmptag = re.sub(r"^W\w+$", "W", tmptag)
tmptag = re.sub(r"^[\'\-\)\(\`]{1,2}", "S", tmptag)
tmptag = re.sub(r"^[\,\.\:]", ".", tmptag)
tmpset.append(tmptag)
return set(tmpset)
elif mode == 8: # 15
for t in tagset:
tmptag = re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", t.encode('ascii', 'ignore'))
tmptag = re.sub(r"^A\w*$", "A", tmptag)
tmptag = re.sub(r"^BE\w*$", "VB", tmptag)
tmptag = re.sub(r"^C[CS]$", "C", tmptag) #!
tmptag = re.sub(r"^CD$", "A", tmptag) #!
tmptag = re.sub(r"^DO\w*$", "VB", tmptag)
tmptag = re.sub(r"^DT\w*$", "A", tmptag)
tmptag = re.sub(r"^HV\w*$", "VB", tmptag)
tmptag = re.sub(r"^JJ\w*$", "JJ", tmptag)
tmptag = re.sub(r"^MD\w*$", "VB", tmptag)
tmptag = re.sub(r"^N[NPR]\w*$", "N", tmptag)
tmptag = re.sub(r"^P\w*$", "P", tmptag)
tmptag = re.sub(r"^QL\w*$", "JJ", tmptag)
tmptag = re.sub(r"^R\w*$", "R", tmptag)
tmptag = re.sub(r"^TO$", "VB", tmptag)
tmptag = re.sub(r"^UH$", "OD", tmptag)
tmptag = re.sub(r"^VB\w*$", "VB", tmptag)
tmptag = re.sub(r"^W\w*$", "R", tmptag)
tmptag = re.sub(r"^[\'\-\)\(\`]{1,2}", "S", tmptag)
tmptag = re.sub(r"^[\,\.\:]", ".", tmptag)
tmpset.append(tmptag)
return set(tmpset)
elif mode == 9:
for t in tagset:
tmptag = re.sub(r"([\+\-][\*\w+].*$)", "", t.encode('ascii', 'ignore'))
tmptag = re.sub(r"^JJ\w*", "JJ", tmptag) # merge all adjectives
tmptag = re.sub(r"^N[NPR]S?", "N", tmptag) # merge all nouns
tmptag = re.sub(r"^P\w+", "P", tmptag) # merge all pronouns
tmptag = re.sub(r"^R\w+", "R", tmptag) # merge all adverbs
tmptag = re.sub(r"^VB\w*$", "VB", tmptag) # merge all verbs
tmpset.append(tmptag)
return set(tmpset)
elif mode == 10:
for t in tagset:
tmptag = re.sub(r"([\+\-][\*\w+].*$)", "", t.encode('ascii', 'ignore'))
tmptag = re.sub(r"^JJ\w*", "JJ", tmptag) # merge all adjectives
tmptag = re.sub(r"^N[NPR]S?\$?", "N", tmptag) # merge all nouns + $
tmptag = re.sub(r"^P\w+\${,2}", "P", tmptag) # merge all pronouns
tmptag = re.sub(r"^R\w+", "R", tmptag) # merge all adverbs
tmptag = re.sub(r"^VB\w*$", "VB", tmptag) # merge all verbs
## tmptag = re.sub(r"^QLP$", "QL", tmptag) # merge QLP to QL
## tmptag = re.sub(r"(^BEG$)|(^HVN$)", "VB", tmptag) # being and having to vbs
tmpset.append(tmptag)
return set(tmpset)
elif mode == 11:
for t in tagset:
tmptag = re.sub(r"([\+\-][\*\w+].*$)", "", t.encode('ascii', 'ignore'))
tmptag = re.sub(r"^JJ\w*", "JJ", tmptag) # merge all adjectives
tmptag = re.sub(r"^N[NPR]S?\$?", "N", tmptag) # merge all nouns + $
tmptag = re.sub(r"^P\w+\${,2}", "P", tmptag) # merge all pronouns
tmptag = re.sub(r"^R\w+", "R", tmptag) # merge all adverbs
tmptag = re.sub(r"^VB\w*$", "VB", tmptag) # merge all verbs
tmptag = re.sub(r"^BE.*$", "BE", tmptag) # merge be
tmptag = re.sub(r"^HV.*$", "HV", tmptag) # merge have
tmpset.append(tmptag)
return set(tmpset)
elif mode == 12:
for t in tagset:
tmptag = re.sub(r"^JJ.*$", "JJ", t.encode('ascii', 'ignore'))
tmpset.append(tmptag)
return set(tmpset)
elif mode == 13: # make brown compatible to alpino
for t in tagset:
tmptag = re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", t.encode('ascii', 'ignore'))
tmptag = re.sub(r"(^AB\w?$)", "ab", tmptag)
tmptag = re.sub(r"(^JJ\w?$)", "adj", tmptag)
tmptag = re.sub(r"(^QLP?$)|(^RB[RT]?$)", "adv", tmptag)
tmptag = re.sub(r"(^TO$)", "comp", tmptag)
tmptag = re.sub(r"(^A[PT]$)|(^DT[IS]?$)|(^WDT$)|(^WPO$)|(^WPS?$)|(^WRB$)", "det", tmptag)
tmptag = re.sub(r"(^NN$)|(^NP$)|(^NNS$)|(^NPS$)|(^NR$)", "noun", tmptag)
tmptag = re.sub(r"(^CD$)|(^OD$)", "num", tmptag)
tmptag = re.sub(r"^RP$", "part", tmptag)
tmptag = re.sub(r"^IN$", "prep", tmptag)
tmptag = re.sub(r"(^PN$)|(^PP$)|(^PPO$)|(^PPL$)|(^PPLS$)|(^PPS{1,2}$)", "pron", tmptag)
tmptag = re.sub(r"^[\,\.\:\'\-\)\(\`]{1,2}$", "punct", tmptag)
tmptag = re.sub(r"^EX$", "tag", tmptag)
tmptag = re.sub(r"(^BE\w{0,2}$)|(^DO[DZ]?$)|(^HV[DNZ]?$)|(^MD$)|(^VB[DGNZ]?$)", "verb", tmptag)
tmptag = re.sub(r"^C[CS]$", "vg", tmptag)
tmpset.append(tmptag)
return set(tmpset)
elif mode == 14: # make alpino comparable and fix pron
for t in tagset:
tmptag = re.sub(r"^name$", "noun", t.encode('ascii', 'ignore'))
tmptag = re.sub(r"^pron$", "det", tmptag)
tmpset.append(tmptag)
return set(tmpset)
else:
return set(tagset)
# This function updates the tags of the sentences in the training set according to the reduced tagset
def updatetags(sen, mode):
tmpsen = []
if mode == 1:
for wd in sen:
tmptag = re.sub(r"([\+\-][\*\w+].*$)", "", wd[1].encode('ascii', 'ignore'))
tmpsen.append((wd[0],tmptag))
return tmpsen
elif mode == 2:
for wd in sen:
tmptag = re.sub(r"(\$)|(\b\*)|(\-\*)", "", wd[1].encode('ascii', 'ignore'))
tmpsen.append((wd[0],tmptag))
return tmpsen
elif mode == 3:
for wd in sen:
tmptag = re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", wd[1].encode('ascii', 'ignore'))
tmpsen.append((wd[0],tmptag))
return tmpsen
elif mode == 4:
for wd in sen:
tmptag = re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", wd[1].encode('ascii', 'ignore'))
tmptag = re.sub(r"BE\w+$", "BE", tmptag)
tmptag = re.sub(r"DO\w$", "DO", tmptag)
tmptag = re.sub(r"DT\w+$", "DT", tmptag)
tmptag = re.sub(r"HV\w$", "HV", tmptag)
tmptag = re.sub(r"JJ\w$", "JJ", tmptag)
tmptag = re.sub(r"NN\w+$", "NN", tmptag)
tmptag = re.sub(r"NP\w+$", "NP", tmptag)
tmptag = re.sub(r"NR\w+$", "NR", tmptag)
tmptag = re.sub(r"PP\w+$", "PP", tmptag)
tmptag = re.sub(r"QL\w+$", "QL", tmptag)
tmptag = re.sub(r"VB\w+$", "VB", tmptag)
tmptag = re.sub(r"WP\w+$", "WP", tmptag)
tmpsen.append((wd[0],tmptag))
return tmpsen
elif mode == 5:
for wd in sen:
tmptag = re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", wd[1].encode('ascii', 'ignore'))
if len(tmptag) > 2:
tmpsen.append((wd[0],tmptag[:2]))
else:
tmpsen.append((wd[0],tmptag))
return tmpsen
elif mode == 6:
for wd in sen:
tmptag = re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", wd[1].encode('ascii', 'ignore'))
tmptag = re.sub(r"A\w+$", "A", tmptag)
tmptag = re.sub(r"BE\w+$", "BE", tmptag)
tmptag = re.sub(r"^C[CS]$", "C", tmptag) #!
tmptag = re.sub(r"^CD$", "A", tmptag) #!
tmptag = re.sub(r"DO\w+$", "DO", tmptag)
tmptag = re.sub(r"DT\w+$", "DT", tmptag)
tmptag = re.sub(r"HV\w+$", "HV", tmptag)
tmptag = re.sub(r"JJ\w+$", "JJ", tmptag)
tmptag = re.sub(r"N[NPR]\w*$", "N", tmptag)
tmptag = re.sub(r"P\w+$", "P", tmptag)
tmptag = re.sub(r"QL\w+$", "QL", tmptag)
tmptag = re.sub(r"R\w+$", "R", tmptag)
tmptag = re.sub(r"VB\w+$", "VB", tmptag)
tmptag = re.sub(r"W\w+$", "W", tmptag)
tmpsen.append((wd[0],tmptag))
return tmpsen
elif mode == 7:
for wd in sen:
tmptag = re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", wd[1].encode('ascii', 'ignore'))
tmptag = re.sub(r"A\w+$", "A", tmptag)
tmptag = re.sub(r"BE\w+$", "BE", tmptag)
tmptag = re.sub(r"^C[CS]$", "C", tmptag) #!
tmptag = re.sub(r"^CD$", "A", tmptag) #!
tmptag = re.sub(r"DO\w+$", "DO", tmptag)
tmptag = re.sub(r"DT\w+$", "DT", tmptag)
tmptag = re.sub(r"HV\w+$", "HV", tmptag)
tmptag = re.sub(r"JJ\w+$", "JJ", tmptag)
tmptag = re.sub(r"N[NPR]\w*$", "N", tmptag)
tmptag = re.sub(r"P\w+$", "P", tmptag)
tmptag = re.sub(r"QL\w+$", "QL", tmptag)
tmptag = re.sub(r"R\w+$", "R", tmptag)
tmptag = re.sub(r"VB\w+$", "VB", tmptag)
tmptag = re.sub(r"W\w+$", "W", tmptag)
tmptag = re.sub(r"^[\'\-\)\(\`]{1,2}", "S", tmptag)
tmptag = re.sub(r"^[\,\.\:]", ".", tmptag)
tmpsen.append((wd[0],tmptag))
return tmpsen
elif mode == 8:
for wd in sen:
tmptag = re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", wd[1].encode('ascii', 'ignore'))
tmptag = re.sub(r"^A\w*$", "A", tmptag)
tmptag = re.sub(r"^BE\w*$", "VB", tmptag)
tmptag = re.sub(r"^C[CS]$", "C", tmptag) #!
tmptag = re.sub(r"^CD$", "A", tmptag) #!
tmptag = re.sub(r"^DO\w*$", "VB", tmptag)
tmptag = re.sub(r"^DT\w*$", "A", tmptag)
tmptag = re.sub(r"^HV\w*$", "VB", tmptag)
tmptag = re.sub(r"^JJ\w*$", "JJ", tmptag)
tmptag = re.sub(r"^MD\w*$", "VB", tmptag)
tmptag = re.sub(r"^N[NPR]\w*$", "N", tmptag)
tmptag = re.sub(r"^P\w*$", "P", tmptag)
tmptag = re.sub(r"^QL\w*$", "JJ", tmptag)
tmptag = re.sub(r"^R\w*$", "R", tmptag)
tmptag = re.sub(r"^TO$", "VB", tmptag)
tmptag = re.sub(r"^UH$", "OD", tmptag)
tmptag = re.sub(r"^VB\w*$", "VB", tmptag)
tmptag = re.sub(r"^W\w*$", "R", tmptag)
tmptag = re.sub(r"^[\'\-\)\(\`]{1,2}", "S", tmptag)
tmptag = re.sub(r"^[\,\.\:]", ".", tmptag)
tmpsen.append((wd[0],tmptag))
return tmpsen
elif mode == 9:
for wd in sen:
tmptag = re.sub(r"([\+\-][\*\w+].*$)", "", wd[1].encode('ascii', 'ignore'))
tmptag = re.sub(r"^JJ\w*$", "JJ", tmptag) # merge all adjectives
tmptag = re.sub(r"^N[NPR]S?", "N", tmptag) # merge all nouns
tmptag = re.sub(r"^P\w+", "P", tmptag) # merge all pronouns
tmptag = re.sub(r"^R\w+", "R", tmptag) # merge all adverbs
tmptag = re.sub(r"^VB\w*$", "VB", tmptag) # merge all verbs
tmpsen.append((wd[0],tmptag))
return tmpsen
elif mode == 10:
for wd in sen:
tmptag = re.sub(r"([\+\-][\*\w+].*$)", "", wd[1].encode('ascii', 'ignore'))
tmptag = re.sub(r"^JJ\w*", "JJ", tmptag) # merge all adjectives
tmptag = re.sub(r"^N[NPR]S?\$?", "N", tmptag) # merge all nouns + $
tmptag = re.sub(r"^P\w+\${,2}", "P", tmptag) # merge all pronouns
tmptag = re.sub(r"^R\w+", "R", tmptag) # merge all adverbs
tmptag = re.sub(r"^VB\w*$", "VB", tmptag) # merge all verbs
## tmptag = re.sub(r"^QLP$", "QL", tmptag) # merge QLP to QL
## tmptag = re.sub(r"(^BEG$)|(^HVN$)", "VB", tmptag) # being and having to vbs
tmpsen.append((wd[0],tmptag))
return tmpsen
elif mode == 11:
for wd in sen:
tmptag = re.sub(r"([\+\-][\*\w+].*$)", "", wd[1].encode('ascii', 'ignore'))
tmptag = re.sub(r"^JJ\w*", "JJ", tmptag) # merge all adjectives
tmptag = re.sub(r"^N[NPR]S?\$?", "N", tmptag) # merge all nouns + $
tmptag = re.sub(r"^P\w+\${,2}", "P", tmptag) # merge all pronouns
tmptag = re.sub(r"^R\w+", "R", tmptag) # merge all adverbs
tmptag = re.sub(r"^VB\w*$", "VB", tmptag) # merge all verbs
tmptag = re.sub(r"^BE.*$", "BE", tmptag) # merge be
tmptag = re.sub(r"^HV.*$", "HV", tmptag) # merge have
tmpsen.append((wd[0],tmptag))
return tmpsen
elif mode == 12:
for wd in sen:
tmptag = re.sub(r"^JJ.*$", "JJ", wd[1].encode('ascii', 'ignore')) # merge all adjectives
tmpsen.append((wd[0],tmptag))
return tmpsen
elif mode == 13: # brown make compatible to alpino
for wd in sen:
tmptag = re.sub(r"([\+\-][\*\w+].*$)|(\b\*)|(\$+)", "", wd[1].encode('ascii', 'ignore'))
tmptag = re.sub(r"(^AB\w?$)", "ab", tmptag)
tmptag = re.sub(r"(^JJ\w?$)", "adj", tmptag)
tmptag = re.sub(r"(^QLP?$)|(^RB[RT]?$)", "adv", tmptag)
tmptag = re.sub(r"(^TO$)", "comp", tmptag)
tmptag = re.sub(r"(^A[PT]$)|(^DT[IS]?$)|(^WDT$)|(^WPO$)|(^WPS?$)|(^WRB$)", "det", tmptag)
tmptag = re.sub(r"(^NN$)|(^NP$)|(^NNS$)|(^NPS$)|(^NR$)", "noun", tmptag)
tmptag = re.sub(r"(^CD$)|(^OD$)", "num", tmptag)
tmptag = re.sub(r"^RP$", "part", tmptag)
tmptag = re.sub(r"^IN$", "prep", tmptag)
tmptag = re.sub(r"(^PN$)|(^PP$)|(^PPO$)|(^PPL$)|(^PPLS$)|(^PPS{1,2}$)", "pron", tmptag)
tmptag = re.sub(r"^[\,\.\:\'\-\)\(\`]{1,2}$", "punct", tmptag)
tmptag = re.sub(r"^EX$", "tag", tmptag)
tmptag = re.sub(r"(^BE\w{0,2}$)|(^DO[DZ]?$)|(^HV[DNZ]?$)|(^MD$)|(^VB[DGNZ]?$)", "verb", tmptag)
tmptag = re.sub(r"^C[CS]$", "vg", tmptag)
tmpsen.append((wd[0],tmptag))
return tmpsen
elif mode == 14: # alpino fixes
for wd in sen:
tmptag = re.sub(r"^name$", "noun", wd[1].encode('ascii', 'ignore'))
tmptag = re.sub(r"^pron$", "det", tmptag)
tmpsen.append((wd[0],tmptag))
return tmpsen
else:
return sen