Revert #1389: Don't overrule rules when lemma exception is present

This commit is contained in:
Matthew Honnibal 2018-06-29 19:43:02 +02:00
parent 01ace9734d
commit 2ec2192000
1 changed files with 9 additions and 10 deletions

View File

@ -95,16 +95,15 @@ def lemmatize(string, index, exceptions, rules):
forms = []
forms.extend(exceptions.get(string, []))
oov_forms = []
if not forms:
for old, new in rules:
if string.endswith(old):
form = string[:len(string) - len(old)] + new
if not form:
pass
elif form in index or not form.isalpha():
forms.append(form)
else:
oov_forms.append(form)
for old, new in rules:
if string.endswith(old):
form = string[:len(string) - len(old)] + new
if not form:
pass
elif form in index or not form.isalpha():
forms.append(form)
else:
oov_forms.append(form)
if not forms:
forms.extend(oov_forms)
if not forms: