mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 09:56:28 +03:00
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):
|
def Parser(self, vocab):
|
||||||
if self.path:
|
if self.path:
|
||||||
return Parser.load(self.path / 'deps', vocab, ArcEager)
|
if (self.path / 'deps').exists():
|
||||||
|
return Parser.load(self.path / 'deps', vocab, ArcEager)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
return Parser.blank(vocab, ArcEager,
|
return Parser.blank(vocab, ArcEager,
|
||||||
features=self.parser_features, labels=self.parser_labels)
|
features=self.parser_features, labels=self.parser_labels)
|
||||||
|
|
||||||
def Entity(self, vocab):
|
def Entity(self, vocab):
|
||||||
if self.path and (self.path / 'ner').exists():
|
if self.path:
|
||||||
return Parser.load(self.path / 'ner', vocab, BiluoPushDown)
|
if (self.path / 'ner').exists():
|
||||||
|
return Parser.load(self.path / 'ner', vocab, BiluoPushDown)
|
||||||
|
else:
|
||||||
|
return None
|
||||||
else:
|
else:
|
||||||
return Parser.blank(vocab, BiluoPushDown,
|
return Parser.blank(vocab, BiluoPushDown,
|
||||||
features=self.entity_features, labels=self.entity_labels)
|
features=self.entity_features, labels=self.entity_labels)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user