* Fix Issue #116: Misleading handling of True value in Language.__init__.

This commit is contained in:
Matthew Honnibal 2015-09-29 20:54:12 +10:00
parent f9d2a5b651
commit a6ced80c0c
1 changed files with 7 additions and 7 deletions

View File

@ -186,19 +186,19 @@ class Language(object):
load_vectors=True): load_vectors=True):
if load_vectors is not True: if load_vectors is not True:
warn("load_vectors is deprecated", DeprecationWarning) warn("load_vectors is deprecated", DeprecationWarning)
if data_dir is None: if data_dir in (None, True):
data_dir = self.default_data_dir() data_dir = self.default_data_dir()
if vocab is None: if vocab in (None, True):
vocab = self.default_vocab(data_dir) vocab = self.default_vocab(data_dir)
if tokenizer is None: if tokenizer in (None, True):
tokenizer = self.default_tokenizer(vocab, data_dir=path.join(data_dir, 'tokenizer')) tokenizer = self.default_tokenizer(vocab, data_dir=path.join(data_dir, 'tokenizer'))
if tagger is None: if tagger in (None, True):
tagger = self.default_tagger(vocab, data_dir=path.join(data_dir, 'pos')) tagger = self.default_tagger(vocab, data_dir=path.join(data_dir, 'pos'))
if entity is None: if entity in (None, True):
entity = self.default_entity(vocab, data_dir=path.join(data_dir, 'ner')) entity = self.default_entity(vocab, data_dir=path.join(data_dir, 'ner'))
if parser is None: if parser in (None, True):
parser = self.default_parser(vocab, data_dir=path.join(data_dir, 'deps')) parser = self.default_parser(vocab, data_dir=path.join(data_dir, 'deps'))
if matcher is None: if matcher in (None, True):
matcher = self.default_matcher(vocab, data_dir=data_dir) matcher = self.default_matcher(vocab, data_dir=data_dir)
self.vocab = vocab self.vocab = vocab
self.tokenizer = tokenizer self.tokenizer = tokenizer