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

pull/1/head
Ozbolt Menegatti 5 years ago
parent 44d532808d
commit 3263125898

@ -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,8 +280,9 @@ 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']):
self.rendition_candidate = candidate_text if self.check_msd(candidate_msd):
return True self.rendition_candidate = candidate_text
return True
return False return False

Loading…
Cancel
Save