mirror of https://github.com/explosion/spaCy.git
* Fix resource loading for Matcher
This commit is contained in:
parent
55bcdf8bdd
commit
029136a007
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue