Skip to content

Commit

Permalink
Add vectors.n_keys property
Browse files Browse the repository at this point in the history
  • Loading branch information
honnibal committed Oct 31, 2017
1 parent 8075726 commit 997a615
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion spacy/vectors.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ cdef class Vectors:
"""Returns True if no keys are available for new keys."""
return len(self._unset) == 0

@property
def n_keys(self):
"""Returns True if no keys are available for new keys."""
return len(self.key2row)

def __reduce__(self):
keys_and_rows = self.key2row.items()
return (unpickle_vectors, (keys_and_rows, self.data))
Expand Down Expand Up @@ -204,7 +209,7 @@ cdef class Vectors:
self._unset.remove(row)
return row

def most_similar(self, queries, *, return_scores=False, return_rows,
def most_similar(self, queries, *, return_scores=False, return_rows=False,
batch_size=1024):
'''For each of the given vectors, find the single entry most similar
to it, by cosine.
Expand Down

0 comments on commit 997a615

Please sign in to comment.