From 2ec2192000e99414a7bbbf11c069c92606da4dc5 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 29 Jun 2018 19:43:02 +0200 Subject: [PATCH] Revert #1389: Don't overrule rules when lemma exception is present --- spacy/lemmatizer.py | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/spacy/lemmatizer.py b/spacy/lemmatizer.py index b4323e424..ee1a35ef1 100644 --- a/spacy/lemmatizer.py +++ b/spacy/lemmatizer.py @@ -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: