1

Fixes to deinflector

Former-commit-id: 6b7e2b5e0b4e181abe663c239302b0f9d031b5f8
This commit is contained in:
Alex Yatskov 2013-11-09 10:45:25 -08:00
parent e7aeb2f9df
commit 9ce77c40b5

View File

@ -62,6 +62,9 @@ class Deinflection:
return True return True
for tags in validator(self.term): for tags in validator(self.term):
if len(self.tags) == 0:
return True
for tag in self.tags: for tag in self.tags:
if self.searchTags(tag, tags): if self.searchTags(tag, tags):
return True return True
@ -105,8 +108,8 @@ class Deinflector:
self.rules = json.load(fp) self.rules = json.load(fp)
def deinflect(self, term, validator=lambda term, tags: True): def deinflect(self, term, validator):
candidates = set() candidates = set()
node = Deinflection(term) node = Deinflection(term)
node.deinflect(validator, self.rules, candidates) if node.deinflect(validator, self.rules, candidates):
return node.gather(), candidates return node.gather(), candidates