From 37e62ab0e21757751b9606cefbc9f1deec8f2300 Mon Sep 17 00:00:00 2001 From: ines Date: Wed, 1 Nov 2017 01:25:09 +0100 Subject: [PATCH] Update vector meta in meta.json --- spacy/cli/package.py | 3 ++- spacy/cli/train.py | 3 ++- spacy/language.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/spacy/cli/package.py b/spacy/cli/package.py index 3157ba99d..5ee8a2b1e 100644 --- a/spacy/cli/package.py +++ b/spacy/cli/package.py @@ -99,7 +99,8 @@ def generate_meta(model_path, existing_meta): nlp = util.load_model_from_path(Path(model_path)) meta['pipeline'] = nlp.pipe_names meta['vectors'] = {'width': nlp.vocab.vectors_length, - 'entries': len(nlp.vocab.vectors)} + 'vectors': len(nlp.vocab.vectors), + 'keys': nlp.vocab.vectors.n_keys} prints("Enter the package settings for your model. The following " "information will be read from your model data: pipeline, vectors.", title="Generating meta.json") diff --git a/spacy/cli/train.py b/spacy/cli/train.py index 74e1d6d68..f489ba7bf 100644 --- a/spacy/cli/train.py +++ b/spacy/cli/train.py @@ -146,7 +146,8 @@ def train(cmd, lang, output_dir, train_data, dev_data, n_iter=30, n_sents=0, meta['speed'] = {'nwords': nwords, 'cpu': cpu_wps, 'gpu': gpu_wps} meta['vectors'] = {'width': nlp.vocab.vectors_length, - 'entries': len(nlp.vocab.vectors)} + 'vectors': len(nlp.vocab.vectors), + 'keys': nlp.vocab.vectors.n_keys} meta['lang'] = nlp.lang meta['pipeline'] = pipeline meta['spacy_version'] = '>=%s' % about.__version__ diff --git a/spacy/language.py b/spacy/language.py index 1ce74b265..806172f36 100644 --- a/spacy/language.py +++ b/spacy/language.py @@ -155,7 +155,8 @@ class Language(object): self._meta.setdefault('url', '') self._meta.setdefault('license', '') self._meta['vectors'] = {'width': self.vocab.vectors_length, - 'entries': len(self.vocab.vectors)} + 'vectors': len(self.vocab.vectors), + 'keys': self.vocab.vectors.n_keys} self._meta['pipeline'] = self.pipe_names return self._meta