1

Fixing deinflection bugs

Former-commit-id: 6b5776ae9ea8243380a845289b61999641e6af00
This commit is contained in:
Alex Yatskov 2013-11-09 12:11:46 -08:00
parent d9e3e3619e
commit c854826ed4

View File

@ -32,9 +32,24 @@ class Deinflection:
self.term = term
self.tags = tags
self.rule = rule
self.success = False
def validateTerm(self, validator):
for tags in validator(self.term):
if len(self.tags) == 0:
return True
for tag in self.tags:
if self.searchTags(tag, tags):
return True
def deinflect(self, validator, rules, candidates):
if self.validateTerm(validator):
child = Deinflection(self.term)
self.children.append(child)
for rule, variants in rules.items():
for variant in variants:
tagsIn = variant['tagsIn']
@ -61,14 +76,6 @@ class Deinflection:
if len(self.children) > 0:
return True
for tags in validator(self.term):
if len(self.tags) == 0:
return True
for tag in self.tags:
if self.searchTags(tag, tags):
return True
def searchTags(self, tag, tags):
for t in tags: