diff --git a/wani.py b/wani.py index e7d9bf3..a4c701c 100644 --- a/wani.py +++ b/wani.py @@ -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