mirror of https://github.com/explosion/spaCy.git
Fix init-model if no vectors provided
This commit is contained in:
parent
c4698f5712
commit
664f89327a
|
@ -90,11 +90,12 @@ def create_model(lang, probs, oov_prob, clusters, vectors_data, vector_keys, pru
|
||||||
lexeme.cluster = 0
|
lexeme.cluster = 0
|
||||||
lex_added += 1
|
lex_added += 1
|
||||||
nlp.vocab.cfg.update({'oov_prob': oov_prob})
|
nlp.vocab.cfg.update({'oov_prob': oov_prob})
|
||||||
for word in vector_keys:
|
if vector_keys is not None:
|
||||||
if word not in nlp.vocab:
|
for word in vector_keys:
|
||||||
lexeme = nlp.vocab[word]
|
if word not in nlp.vocab:
|
||||||
lexeme.is_oov = False
|
lexeme = nlp.vocab[word]
|
||||||
lex_added += 1
|
lexeme.is_oov = False
|
||||||
|
lex_added += 1
|
||||||
if len(vectors_data):
|
if len(vectors_data):
|
||||||
nlp.vocab.vectors = Vectors(data=vectors_data, keys=vector_keys)
|
nlp.vocab.vectors = Vectors(data=vectors_data, keys=vector_keys)
|
||||||
if prune_vectors >= 1:
|
if prune_vectors >= 1:
|
||||||
|
|
Loading…
Reference in New Issue