From d6327e8495b573af428b3c33305f8b48e316125a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B8ren=20Lind=20Kristiansen?= Date: Wed, 3 Jan 2018 12:20:49 +0100 Subject: [PATCH] Fix handling case when vectors not specified --- spacy/cli/init_model.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spacy/cli/init_model.py b/spacy/cli/init_model.py index 2141d8b60..c5dace24f 100644 --- a/spacy/cli/init_model.py +++ b/spacy/cli/init_model.py @@ -36,7 +36,7 @@ def init_model(_cmd, lang, output_dir, freqs_loc, clusters_loc=None, vectors_loc vectors_loc = ensure_path(vectors_loc) probs, oov_prob = read_freqs(freqs_loc) - vectors_data, vector_keys = read_vectors(vectors_loc) if vectors_loc else None + vectors_data, vector_keys = read_vectors(vectors_loc) if vectors_loc else None, None clusters = read_clusters(clusters_loc) if clusters_loc else {} nlp = create_model(lang, probs, oov_prob, clusters, vectors_data, vector_keys, prune_vectors) @@ -69,7 +69,7 @@ def create_model(lang, probs, oov_prob, clusters, vectors_data, vector_keys, pru lex_added += 1 nlp.vocab.cfg.update({'oov_prob': oov_prob}) - if len(vectors_data): + if vectors_data: nlp.vocab.vectors = Vectors(data=vectors_data, keys=vector_keys) if prune_vectors >= 1: nlp.vocab.prune_vectors(prune_vectors)