From 67ce96c9c9f0ce1ec08623e9c00e4e9a8f72bbde Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Sun, 17 Apr 2016 21:32:24 +0200 Subject: [PATCH] * Make patterns argument to Matcher class optional --- spacy/matcher.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spacy/matcher.pyx b/spacy/matcher.pyx index b57312e32..64fd4e683 100644 --- a/spacy/matcher.pyx +++ b/spacy/matcher.pyx @@ -163,12 +163,12 @@ cdef class Matcher: patterns = package.load_json(('vocab', 'gazetteer.json')) return cls(vocab, patterns) - def __init__(self, vocab, patterns): + def __init__(self, vocab, patterns={}): + self._patterns = dict(patterns) # Make sure we own the object self.vocab = vocab self.mem = Pool() self.vocab = vocab - self._patterns = dict(patterns) - for entity_key, (etype, attrs, specs) in sorted(patterns.items()): + for entity_key, (etype, attrs, specs) in sorted(self._patterns.items()): self.add(entity_key, etype, attrs, specs) def __reduce__(self):