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
|
@classmethod
|
||||||
def load(cls, pkg_or_str_or_file, Vocab vocab):
|
def load(cls, pkg_or_str_or_file, Vocab vocab):
|
||||||
package = Package.create_or_return(pkg_or_str_or_file)
|
package = Package.create_or_return(pkg_or_str_or_file)
|
||||||
patterns = package.load_utf8(json.load,
|
|
||||||
'vocab', 'gazetteer.json',
|
with package.open(('vocab', 'serializer.json'), default=None) as file_:
|
||||||
default={}) # TODO: really optional?
|
patterns = json.load(file_) if file_ is not None else {}
|
||||||
return cls(vocab, patterns)
|
return cls(vocab, patterns)
|
||||||
|
|
||||||
def __init__(self, vocab, patterns):
|
def __init__(self, vocab, patterns):
|
||||||
|
|
Loading…
Reference in New Issue