Make it easier to pass explicit no-pruning to vocab

This commit is contained in:
Matthew Honnibal 2017-10-31 20:14:47 +01:00
parent d90a22afe6
commit c390f2d745
1 changed files with 2 additions and 2 deletions

View File

@ -22,7 +22,7 @@ from ..util import prints, ensure_path
"option", "V", int)
)
def make_vocab(cmd, lang, output_dir, lexemes_loc,
vectors_loc=None, prune_vectors=0):
vectors_loc=None, prune_vectors=-1):
"""Compile a vocabulary from a lexicon jsonl file and word vectors."""
if not lexemes_loc.exists():
prints(lexemes_loc, title="Can't find lexical data", exits=1)
@ -49,7 +49,7 @@ def make_vocab(cmd, lang, output_dir, lexemes_loc,
if word.rank:
nlp.vocab.vectors.add(word.orth, row=word.rank)
if prune_vectors is not None:
if prune_vectors >= 1:
remap = nlp.vocab.prune_vectors(prune_vectors)
if not output_dir.exists():
output_dir.mkdir()