Change clear_vectors to reset_vectors (resolves #1516)

This commit is contained in:
ines 2017-11-08 18:11:23 +01:00
parent 89bd40b821
commit 33b84f4c39
2 changed files with 13 additions and 8 deletions

View File

@ -18,7 +18,7 @@ def main(vectors_loc):
with open(vectors_loc, 'rb') as file_:
header = file_.readline()
nr_row, nr_dim = header.split()
nlp.vocab.clear_vectors(int(nr_dim))
nlp.vocab.reset_vectors(width=int(nr_dim))
for line in file_:
line = line.decode('utf8')
pieces = line.split()

View File

@ -162,24 +162,29 @@ p
+cell int
+cell The integer ID by which the flag value can be checked.
+h(2, "clear_vectors") Vocab.clear_vectors
+h(2, "reset_vectors") Vocab.reset_vectors
+tag method
+tag-new(2)
p
| Drop the current vector table. Because all vectors must be the same
| width, you have to call this to change the size of the vectors.
| width, you have to call this to change the size of the vectors. Only
| one of the #[code width] and #[code shape] keyword arguments can be
| specified.
+aside-code("Example").
nlp.vocab.clear_vectors(new_dim=300)
nlp.vocab.reset_vectors(width=300)
+table(["Name", "Type", "Description"])
+row
+cell #[code new_dim]
+cell #[code width]
+cell int
+cell
| Number of dimensions of the new vectors. If #[code None], size
| is not changed.
+cell The new width (keyword argument only).
+row
+cell #[code shape]
+cell int
+cell The new shape (keyword argument only).
+h(2, "prune_vectors") Vocab.prune_vectors
+tag method