spaCy/spacy
adrianeboyd 40e65d6f63
Fix most_similar for vectors with unused rows (#5348)
* Fix most_similar for vectors with unused rows

Address issues related to the unused rows in the vector table and
`most_similar`:

* Update `most_similar()` to search only through rows that are in use
according to `key2row`.

* Raise an error when `most_similar(n=n)` is larger than the number of
vectors in the table.

* Set and restore `_unset` correctly when vectors are added or
deserialized so that new vectors are added in the correct row.

* Set data and keys to the same length in `Vocab.prune_vectors()` to
avoid spurious entries in `key2row`.

* Fix regression test using `most_similar`

Co-authored-by: Matthew Honnibal <honnibal+gh@gmail.com>
2020-05-19 16:41:26 +02:00
..
cli Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
data Make spacy/data a package 2017-03-18 20:04:22 +01:00
displacy Add missing import 2020-04-28 13:48:37 +02:00
lang Update Polish tokenizer for UD_Polish-PDB (#5432) 2020-05-19 15:59:55 +02:00
matcher Normalize TokenC.sent_start values for Matcher (#5346) 2020-04-29 12:57:30 +02:00
ml Replace function registries with catalogue (#4584) 2019-11-07 11:45:22 +01:00
pipeline Simplify warnings 2020-04-28 13:37:37 +02:00
syntax prevent updating cfg if the Model was already defined (#5078) 2020-03-03 13:58:56 +01:00
tests Fix most_similar for vectors with unused rows (#5348) 2020-05-19 16:41:26 +02:00
tokens Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
__init__.pxd * Seems to be working after refactor. Need to wire up more POS tag features, and wire up save/load of POS tags. 2014-10-24 02:23:42 +11:00
__init__.py Simplify warnings 2020-04-28 13:37:37 +02:00
__main__.py Use latest wasabi 2019-11-04 02:38:45 +01:00
_ml.py Skip duplicate lexeme rank setting (#5401) 2020-05-14 18:26:12 +02:00
about.py Set version to v2.2.4 2020-03-12 11:30:41 +01:00
analysis.py Simplify warnings 2020-04-28 13:37:37 +02:00
attrs.pxd Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
attrs.pyx Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
compat.py Replace function registries with catalogue (#4584) 2019-11-07 11:45:22 +01:00
errors.py Fix most_similar for vectors with unused rows (#5348) 2020-05-19 16:41:26 +02:00
glossary.py Update tag maps and docs for English and German (#4501) 2019-10-24 12:56:05 +02:00
gold.pxd Merge changes from master 2019-08-21 14:18:52 +02:00
gold.pyx Add warning for misaligned character offset spans (#5007) 2020-05-19 16:01:18 +02:00
kb.pxd rename entity frequency 2019-07-19 17:40:28 +02:00
kb.pyx Simplify warnings 2020-04-28 13:37:37 +02:00
language.py Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
lemmatizer.py Remove duplicated branch in if/else-if statement (#5234) 2020-04-02 14:47:42 +02:00
lexeme.pxd Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
lexeme.pyx Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
lookups.py Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
morphology.pxd annotate kb_id through ents in doc 2019-03-22 11:36:44 +01:00
morphology.pyx Improve Morphology errors (#4314) 2019-09-21 14:37:06 +02:00
parts_of_speech.pxd Add support for Universal Dependencies v2.0 2017-03-03 13:17:34 +01:00
parts_of_speech.pyx Tidy up rest 2017-10-27 21:07:59 +02:00
scorer.py Fix GoldParse init when token count differs (#5191) 2020-03-26 10:46:23 +01:00
strings.pxd Try to fix StringStore clean up (see #1506) 2017-11-11 03:11:27 +03:00
strings.pyx Merge branch 'master' into feature/lemmatizer 2019-03-16 13:44:22 +01:00
structs.pxd Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
symbols.pxd Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
symbols.pyx Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
tokenizer.pxd Flush tokenizer cache when necessary (#4258) 2019-09-08 20:52:46 +02:00
tokenizer.pyx Simplify warnings 2020-04-28 13:37:37 +02:00
typedefs.pxd Work on changing StringStore to return hashes. 2017-05-28 12:36:27 +02:00
typedefs.pyx Tidy up rest 2017-10-27 21:07:59 +02:00
util.py Fix passing of component configuration (#5374) 2020-04-29 12:56:17 +02:00
vectors.pyx Fix most_similar for vectors with unused rows (#5348) 2020-05-19 16:41:26 +02:00
vocab.pxd Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00
vocab.pyx Reduce stored lexemes data, move feats to lookups (#5238) 2020-05-19 15:59:14 +02:00