From 664f89327ad03b7db0f2285601c9eae155d7df52 Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Mon, 25 Jun 2018 17:58:45 +0200 Subject: [PATCH] Fix init-model if no vectors provided --- spacy/cli/init_model.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/spacy/cli/init_model.py b/spacy/cli/init_model.py index 87c3033ad..c83b95782 100644 --- a/spacy/cli/init_model.py +++ b/spacy/cli/init_model.py @@ -90,11 +90,12 @@ def create_model(lang, probs, oov_prob, clusters, vectors_data, vector_keys, pru lexeme.cluster = 0 lex_added += 1 nlp.vocab.cfg.update({'oov_prob': oov_prob}) - for word in vector_keys: - if word not in nlp.vocab: - lexeme = nlp.vocab[word] - lexeme.is_oov = False - lex_added += 1 + if vector_keys is not None: + for word in vector_keys: + if word not in nlp.vocab: + lexeme = nlp.vocab[word] + lexeme.is_oov = False + lex_added += 1 if len(vectors_data): nlp.vocab.vectors = Vectors(data=vectors_data, keys=vector_keys) if prune_vectors >= 1: