From 029136a00722cdbbb4e1721916b21d5f9767b6b7 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 31 Dec 2015 02:45:12 +0100 Subject: [PATCH] * Fix resource loading for Matcher --- spacy/matcher.pyx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spacy/matcher.pyx b/spacy/matcher.pyx index 842820b58..ba4b46fad 100644 --- a/spacy/matcher.pyx +++ b/spacy/matcher.pyx @@ -172,9 +172,9 @@ cdef class Matcher: @classmethod def load(cls, pkg_or_str_or_file, Vocab vocab): package = Package.create_or_return(pkg_or_str_or_file) - patterns = package.load_utf8(json.load, - 'vocab', 'gazetteer.json', - default={}) # TODO: really optional? + + with package.open(('vocab', 'serializer.json'), default=None) as file_: + patterns = json.load(file_) if file_ is not None else {} return cls(vocab, patterns) def __init__(self, vocab, patterns):