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

View File

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