mirror of https://github.com/explosion/spaCy.git
Return None if /deps directory not present, instead of trying to load the parser.
This commit is contained in:
parent
e07b9665f7
commit
b14b9b096b
|
@ -96,14 +96,20 @@ class BaseDefaults(object):
|
|||
|
||||
def Parser(self, vocab):
|
||||
if self.path:
|
||||
if (self.path / 'deps').exists():
|
||||
return Parser.load(self.path / 'deps', vocab, ArcEager)
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
return Parser.blank(vocab, ArcEager,
|
||||
features=self.parser_features, labels=self.parser_labels)
|
||||
|
||||
def Entity(self, vocab):
|
||||
if self.path and (self.path / 'ner').exists():
|
||||
if self.path:
|
||||
if (self.path / 'ner').exists():
|
||||
return Parser.load(self.path / 'ner', vocab, BiluoPushDown)
|
||||
else:
|
||||
return None
|
||||
else:
|
||||
return Parser.blank(vocab, BiluoPushDown,
|
||||
features=self.entity_features, labels=self.entity_labels)
|
||||
|
|
Loading…
Reference in New Issue