mirror of https://github.com/explosion/spaCy.git
Change clear_vectors to reset_vectors (resolves #1516)
This commit is contained in:
parent
89bd40b821
commit
33b84f4c39
|
@ -18,7 +18,7 @@ def main(vectors_loc):
|
||||||
with open(vectors_loc, 'rb') as file_:
|
with open(vectors_loc, 'rb') as file_:
|
||||||
header = file_.readline()
|
header = file_.readline()
|
||||||
nr_row, nr_dim = header.split()
|
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_:
|
for line in file_:
|
||||||
line = line.decode('utf8')
|
line = line.decode('utf8')
|
||||||
pieces = line.split()
|
pieces = line.split()
|
||||||
|
|
|
@ -162,24 +162,29 @@ p
|
||||||
+cell int
|
+cell int
|
||||||
+cell The integer ID by which the flag value can be checked.
|
+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 method
|
||||||
+tag-new(2)
|
+tag-new(2)
|
||||||
|
|
||||||
p
|
p
|
||||||
| Drop the current vector table. Because all vectors must be the same
|
| 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").
|
+aside-code("Example").
|
||||||
nlp.vocab.clear_vectors(new_dim=300)
|
nlp.vocab.reset_vectors(width=300)
|
||||||
|
|
||||||
+table(["Name", "Type", "Description"])
|
+table(["Name", "Type", "Description"])
|
||||||
+row
|
+row
|
||||||
+cell #[code new_dim]
|
+cell #[code width]
|
||||||
+cell int
|
+cell int
|
||||||
+cell
|
+cell The new width (keyword argument only).
|
||||||
| Number of dimensions of the new vectors. If #[code None], size
|
|
||||||
| is not changed.
|
+row
|
||||||
|
+cell #[code shape]
|
||||||
|
+cell int
|
||||||
|
+cell The new shape (keyword argument only).
|
||||||
|
|
||||||
+h(2, "prune_vectors") Vocab.prune_vectors
|
+h(2, "prune_vectors") Vocab.prune_vectors
|
||||||
+tag method
|
+tag method
|
||||||
|
|
Loading…
Reference in New Issue