mirror of https://github.com/explosion/spaCy.git
Revert #1389: Don't overrule rules when lemma exception is present
This commit is contained in:
parent
01ace9734d
commit
2ec2192000
|
@ -95,16 +95,15 @@ def lemmatize(string, index, exceptions, rules):
|
||||||
forms = []
|
forms = []
|
||||||
forms.extend(exceptions.get(string, []))
|
forms.extend(exceptions.get(string, []))
|
||||||
oov_forms = []
|
oov_forms = []
|
||||||
if not forms:
|
for old, new in rules:
|
||||||
for old, new in rules:
|
if string.endswith(old):
|
||||||
if string.endswith(old):
|
form = string[:len(string) - len(old)] + new
|
||||||
form = string[:len(string) - len(old)] + new
|
if not form:
|
||||||
if not form:
|
pass
|
||||||
pass
|
elif form in index or not form.isalpha():
|
||||||
elif form in index or not form.isalpha():
|
forms.append(form)
|
||||||
forms.append(form)
|
else:
|
||||||
else:
|
oov_forms.append(form)
|
||||||
oov_forms.append(form)
|
|
||||||
if not forms:
|
if not forms:
|
||||||
forms.extend(oov_forms)
|
forms.extend(oov_forms)
|
||||||
if not forms:
|
if not forms:
|
||||||
|
|
Loading…
Reference in New Issue