From 66c7348cda2e0e52839564556f62d3a776164474 Mon Sep 17 00:00:00 2001 From: Ines Montani Date: Thu, 8 Dec 2016 13:58:12 +0100 Subject: [PATCH] Add update_exc util function --- spacy/util.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/spacy/util.py b/spacy/util.py index afed4142e..592f8e9dd 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -108,6 +108,12 @@ def compile_infix_regex(entries): return re.compile(expression) +def update_exc(exc, additions): + overlap = set(exc.keys()).intersection(set(additions)) + assert not overlap, overlap + exc.update(additions) + + def normalize_slice(length, start, stop, step=None): if not (step is None or step == 1): raise ValueError("Stepped slices not supported in Span objects."