* Check for directory presence before loading annotators

This commit is contained in:
Matthew Honnibal 2015-07-23 09:27:37 +02:00
parent da4821fc14
commit 5b41744270
1 changed files with 3 additions and 3 deletions

View File

@ -95,15 +95,15 @@ class English(object):
self.tokenizer = Tokenizer(self.vocab, path.join(data_dir, 'tokenizer')) self.tokenizer = Tokenizer(self.vocab, path.join(data_dir, 'tokenizer'))
if Tagger: if Tagger and path.exists(path.join(data_dir, 'pos')):
self.tagger = Tagger(self.vocab.strings, data_dir) self.tagger = Tagger(self.vocab.strings, data_dir)
else: else:
self.tagger = None self.tagger = None
if Parser: if Parser and path.exists(path.join(data_dir, 'deps')):
self.parser = Parser(self.vocab.strings, path.join(data_dir, 'deps')) self.parser = Parser(self.vocab.strings, path.join(data_dir, 'deps'))
else: else:
self.parser = None self.parser = None
if Entity: if Entity and path.exists(path.join(data_dir, 'ner')):
self.entity = Entity(self.vocab.strings, path.join(data_dir, 'ner')) self.entity = Entity(self.vocab.strings, path.join(data_dir, 'ner'))
else: else:
self.entity = None self.entity = None