From eceeaefe53fc28d89a98175e3e09d74791170362 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Fri, 30 Sep 2016 19:56:06 +0200 Subject: [PATCH] Fix defaults for Parser and Entity, adding a blank= argument. --- spacy/language.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/spacy/language.py b/spacy/language.py index df7728d08..bc9689cae 100644 --- a/spacy/language.py +++ b/spacy/language.py @@ -94,25 +94,23 @@ class BaseDefaults(object): else: return Tagger.blank(vocab, Tagger.default_templates()) - def Parser(self, vocab): - if self.path: - if (self.path / 'deps').exists(): - return Parser.load(self.path / 'deps', vocab, ArcEager) - else: - return None - else: + def Parser(self, vocab, blank=False): + if blank: return Parser.blank(vocab, ArcEager, features=self.parser_features, labels=self.parser_labels) - - def Entity(self, vocab): - if self.path: - if (self.path / 'ner').exists(): - return Parser.load(self.path / 'ner', vocab, BiluoPushDown) - else: - return None + elif self.path and (self.path / 'deps').exists(): + return Parser.load(self.path / 'deps', vocab, ArcEager) else: + return None + + def Entity(self, vocab, blank=False): + if blank: return Parser.blank(vocab, BiluoPushDown, features=self.entity_features, labels=self.entity_labels) + elif self.path and (self.path / 'ner').exists(): + return Parser.load(self.path / 'ner', vocab, BiluoPushDown) + else: + return None def Matcher(self, vocab): if self.path: