mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-27 02:16:32 +03:00
Fix issue #535: Pipeline elements added even when data not installed.
This commit is contained in:
parent
ca89fd0919
commit
d4aaf2752c
|
@ -70,8 +70,10 @@ class BaseDefaults(object):
|
||||||
def create_tagger(cls, nlp=None):
|
def create_tagger(cls, nlp=None):
|
||||||
if nlp is None:
|
if nlp is None:
|
||||||
return Tagger(cls.create_vocab(), features=cls.tagger_features)
|
return Tagger(cls.create_vocab(), features=cls.tagger_features)
|
||||||
elif nlp.path is None or not (nlp.path / 'pos').exists():
|
elif nlp.path is None:
|
||||||
return Tagger(nlp.vocab, features=cls.tagger_features)
|
return Tagger(nlp.vocab, features=cls.tagger_features)
|
||||||
|
elif not (nlp.path / 'pos').exists():
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
return Tagger.load(nlp.path / 'pos', nlp.vocab)
|
return Tagger.load(nlp.path / 'pos', nlp.vocab)
|
||||||
|
|
||||||
|
@ -79,8 +81,10 @@ class BaseDefaults(object):
|
||||||
def create_parser(cls, nlp=None):
|
def create_parser(cls, nlp=None):
|
||||||
if nlp is None:
|
if nlp is None:
|
||||||
return DependencyParser(cls.create_vocab(), features=cls.parser_features)
|
return DependencyParser(cls.create_vocab(), features=cls.parser_features)
|
||||||
elif nlp.path is None or not (nlp.path / 'deps').exists():
|
elif nlp.path is None:
|
||||||
return DependencyParser(nlp.vocab, features=cls.parser_features)
|
return DependencyParser(nlp.vocab, features=cls.parser_features)
|
||||||
|
elif not (nlp.path / 'deps').exists():
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
return DependencyParser.load(nlp.path / 'deps', nlp.vocab)
|
return DependencyParser.load(nlp.path / 'deps', nlp.vocab)
|
||||||
|
|
||||||
|
@ -88,8 +92,10 @@ class BaseDefaults(object):
|
||||||
def create_entity(cls, nlp=None):
|
def create_entity(cls, nlp=None):
|
||||||
if nlp is None:
|
if nlp is None:
|
||||||
return EntityRecognizer(cls.create_vocab(), features=cls.entity_features)
|
return EntityRecognizer(cls.create_vocab(), features=cls.entity_features)
|
||||||
elif nlp.path is None or not (nlp.path / 'ner').exists():
|
elif nlp.path is None:
|
||||||
return EntityRecognizer(nlp.vocab, features=cls.entity_features)
|
return EntityRecognizer(nlp.vocab, features=cls.entity_features)
|
||||||
|
elif not (nlp.path / 'ner').exists():
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
return EntityRecognizer.load(nlp.path / 'ner', nlp.vocab)
|
return EntityRecognizer.load(nlp.path / 'ner', nlp.vocab)
|
||||||
|
|
||||||
|
@ -97,8 +103,10 @@ class BaseDefaults(object):
|
||||||
def create_matcher(cls, nlp=None):
|
def create_matcher(cls, nlp=None):
|
||||||
if nlp is None:
|
if nlp is None:
|
||||||
return Matcher(cls.create_vocab())
|
return Matcher(cls.create_vocab())
|
||||||
elif nlp.path is None or not (nlp.path / 'vocab').exists():
|
elif nlp.path is None:
|
||||||
return Matcher(nlp.vocab)
|
return Matcher(nlp.vocab)
|
||||||
|
elif not (nlp.path / 'vocab').exists():
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
return Matcher.load(nlp.path / 'vocab', nlp.vocab)
|
return Matcher.load(nlp.path / 'vocab', nlp.vocab)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user