Skip to content

Commit 2a00121

Browse files
Add Romance Preprocessor
1 parent 002d6ba commit 2a00121

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from phrase import Phrase
2+
from enum import Enum
3+
4+
class Preprocessor(Phrase):
5+
6+
7+
def process_node(self, node):
8+
9+
# In Porttinari treebank, the negative adverb não is not marked with feat Polarity=Neg
10+
if node.lemma == 'não' and node.upos == 'ADV':
11+
node.feats['Polarity'] = 'Neg'
12+
13+
if node.upos == 'ADV' and node.feats['PronType'] == 'Neg':
14+
node.feats['PronType'] = ''
15+
node.feats['Polarity'] = 'Neg'
16+
17+
# In Romanian RRT treebank, there is no annotation of the voice feature
18+
# Automatically assign passive voice
19+
pass_auxes = [x for x in node.children if x.deprel == 'aux:pass']
20+
if pass_auxes:
21+
node.feats['Voice'] = 'Pass'

0 commit comments

Comments
 (0)