Spaces:
Running
Running
Fix get_gramatical_number method
Browse files- modules/m_apvoice.py +5 -1
modules/m_apvoice.py
CHANGED
@@ -95,7 +95,8 @@ class APVoice:
|
|
95 |
dobj_data: List[List[Tuple[str,str,str]]]
|
96 |
) -> Union[str, None]:
|
97 |
|
98 |
-
|
|
|
99 |
if len(result) == 0:
|
100 |
result = None
|
101 |
else:
|
@@ -237,6 +238,9 @@ class APVoice:
|
|
237 |
_, neg_data, main_data = verb_data
|
238 |
neg = " not" if len(neg_data) > 0 else ""
|
239 |
gramatical_number = self.get_gramatical_number(dobj_data)
|
|
|
|
|
|
|
240 |
if debug: print(gramatical_number)
|
241 |
p_tobe = self.Tense[verbal_tense].value['tobe'][gramatical_number].format(neg)
|
242 |
p_verb = self.verb2participle(main_data[0][0].text)
|
|
|
95 |
dobj_data: List[List[Tuple[str,str,str]]]
|
96 |
) -> Union[str, None]:
|
97 |
|
98 |
+
allowed_tag = ['NN','NNP','NNS']
|
99 |
+
result = [tag for _,dep,tag in dobj_data if dep == 'dobj' and dep in allowed_tag]
|
100 |
if len(result) == 0:
|
101 |
result = None
|
102 |
else:
|
|
|
238 |
_, neg_data, main_data = verb_data
|
239 |
neg = " not" if len(neg_data) > 0 else ""
|
240 |
gramatical_number = self.get_gramatical_number(dobj_data)
|
241 |
+
raise RuntimeError(
|
242 |
+
f"Error: The gramatical number has not been possible to determinate!"
|
243 |
+
)
|
244 |
if debug: print(gramatical_number)
|
245 |
p_tobe = self.Tense[verbal_tense].value['tobe'][gramatical_number].format(neg)
|
246 |
p_verb = self.verb2participle(main_data[0][0].text)
|