You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: udapi/block/msf/phrase.py
+51-41Lines changed: 51 additions & 41 deletions
Original file line number
Diff line number
Diff line change
@@ -10,53 +10,63 @@
10
10
11
11
classPhrase(Block):
12
12
13
-
defprocess_node(self, node):
13
+
def__init__(self, feature_prefix='CG', **kwargs):
14
14
"""
15
-
Override this in a derived class!
15
+
Parameters:
16
+
feature_prefix (string) - The prefix of phrase features (e. g. 'CG', 'Phrase'), default is 'CG'
16
17
"""
17
-
logging.fatal('process_node() not implemented.')
18
+
super().__init__(**kwargs)
19
+
self.feature_prefix=feature_prefix
20
+
21
+
self.dictionary= {
22
+
'person': f'{feature_prefix}Person',
23
+
'number': f'{feature_prefix}Number',
24
+
'mood': f'{feature_prefix}Mood',
25
+
'tense': f'{feature_prefix}Tense',
26
+
'voice': f'{feature_prefix}Voice',
27
+
'aspect':f'{feature_prefix}Aspect',
28
+
'form': f'{feature_prefix}Form',
29
+
'reflex': f'{feature_prefix}Reflex',
30
+
'polarity': f'{feature_prefix}Polarity',
31
+
'gender': f'{feature_prefix}Gender',
32
+
'animacy': f'{feature_prefix}Animacy',
33
+
'ords': feature_prefix,
34
+
'expl': f'{feature_prefix}Expl',
35
+
'analytic': 'Analytic',
36
+
}
37
+
38
+
# a dictionary where the key is the lemma of a negative particle and the value is a list of the lemmas of their possible children that have a 'fixed' relation
39
+
# we do not want to include these negative particles in the phrase; these are expressions like "never", etc.
40
+
self.negation_fixed= {
41
+
# Belarusian
42
+
'ні' : ['раз'],
43
+
'ня' : ['толькі'],
18
44
19
-
dictionary= {
20
-
'person': 'PeriPerson',
21
-
'number': 'PeriNumber',
22
-
'mood': 'PeriMood',
23
-
'tense': 'PeriTense',
24
-
'voice': 'PeriVoice',
25
-
'aspect':'PeriAspect',
26
-
'form': 'PeriForm',
27
-
'reflex': 'PeriReflex',
28
-
'polarity': 'PeriPolarity',
29
-
'gender':'PeriGender',
30
-
'animacy':'PeriAnimacy',
31
-
'ords':'Peri',
32
-
'expl':'PeriExpl',
33
-
'periphrasis':'Periphrasis',
34
-
}
35
-
36
-
# a dictionary where the key is the lemma of a negative particle and the value is a list of the lemmas of their possible children that have a 'fixed' relation
37
-
# we do not want to include these negative particles in the phrase; these are expressions like "never", etc.
38
-
negation_fixed= {
39
-
# Belarusian
40
-
'ні' : ['раз'],
41
-
'ня' : ['толькі'],
45
+
# Upper Sorbian
46
+
'nic' : ['naposledku'],
47
+
48
+
# Polish
49
+
'nie' : ['mało'],
42
50
43
-
# Upper Sorbian
44
-
'nic' : ['naposledku'],
51
+
# Pomak
52
+
'néma' : ['kak'],
45
53
46
-
# Polish
47
-
'nie' : ['mało'],
54
+
# Slovenian
55
+
'ne' : ['le'],
48
56
49
-
# Pomak
50
-
'néma' : ['kak'],
57
+
# Russian and Old East Slavic
58
+
'не' : ['то', 'токмо'],
59
+
'ни' : ['в', 'раз', 'шатко'],
60
+
'нет' : ['нет']
61
+
}
51
62
52
-
# Slovenian
53
-
'ne' : ['le'],
63
+
defprocess_node(self, node):
64
+
"""
65
+
Override this in a derived class!
66
+
"""
67
+
logging.fatal('process_node() not implemented.')
54
68
55
-
# Russian and Old East Slavic
56
-
'не' : ['то', 'токмо'],
57
-
'ни' : ['в', 'раз', 'шатко'],
58
-
'нет' : ['нет']
59
-
}
69
+
60
70
61
71
defwrite_node_info(self, node,
62
72
tense=None,
@@ -72,7 +82,7 @@ def write_node_info(self, node,
72
82
animacy=None,
73
83
aspect=None,
74
84
expl=None,
75
-
periphrasis=None):
85
+
analytic=None):
76
86
arguments=locals()
77
87
delarguments['self'] # delete self and node from arguments,
78
88
delarguments['node'] # we want only grammatical categories
0 commit comments