Also need to check msd for agreements in the whole corpus.

This commit is contained in:
Ozbolt Menegatti 2019-06-03 15:09:22 +02:00
parent 44d532808d
commit 3263125898

13
wani.py
View File

@ -231,15 +231,15 @@ class WordFormMsdCR(WordFormAnyCR):
self.lemma = None
self.msd = None
def check_msd(self, word):
def check_msd(self, word_msd):
if 'msd' not in self.data:
return True
selectors = self.data['msd']
for key, value in selectors.items():
t = word.msd[0]
t = word_msd[0]
v = TAGSET[t].index(key.lower())
f1 = word.msd[v + 1]
f1 = word_msd[v + 1]
f2 = CODES[value]
if '-' not in [f1, f2] and f1 != f2:
@ -253,7 +253,7 @@ class WordFormMsdCR(WordFormAnyCR):
self.lemma = word.lemma
self.msd = word.msd
if self.check_msd(word):
if self.check_msd(word.msd):
super().add_word(word)
def _render(self):
@ -280,8 +280,9 @@ class WordFormAgreementCR(WordFormMsdCR):
continue
if WordFormAgreementCR.check_agreement(word_msd, candidate_msd, self.data['agreement']):
self.rendition_candidate = candidate_text
return True
if self.check_msd(candidate_msd):
self.rendition_candidate = candidate_text
return True
return False