From ee7dcf65c9c1a110cc563ed7391643def002bfcf Mon Sep 17 00:00:00 2001 From: ines Date: Sat, 13 May 2017 21:22:25 +0200 Subject: [PATCH] Fix expand_exc to make sure it returns combined dict --- spacy/util.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spacy/util.py b/spacy/util.py index e9616468c..4c932da95 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -150,7 +150,7 @@ def update_exc(base_exceptions, *addition_dicts): # overlap = set(exc.keys()).intersection(set(additions)) # assert not overlap, overlap exc.update(additions) - expand_exc(exc, "'", "’") + exc = expand_exc(exc, "'", "’") return exc @@ -159,13 +159,13 @@ def expand_exc(excs, search, replace): fixed = dict(token) fixed[ORTH] = fixed[ORTH].replace(search, replace) return fixed - updates = {} + new_excs = dict(excs) for token_string, tokens in excs.items(): if search in token_string: new_key = token_string.replace(search, replace) new_value = [_fix_token(t, search, replace) for t in tokens] - updates[new_key] = new_value - return updates + new_excs[new_key] = new_value + return new_excs def normalize_slice(length, start, stop, step=None):