mirror of
https://github.com/explosion/spaCy.git
synced 2025-03-03 19:08:06 +03:00
Fix vocab pickling
This commit is contained in:
parent
8dfb9546f0
commit
9805e0e369
|
@ -392,25 +392,22 @@ def pickle_vocab(vocab):
|
||||||
lex_attr_getters = vocab.lex_attr_getters
|
lex_attr_getters = vocab.lex_attr_getters
|
||||||
|
|
||||||
lexemes_data = vocab.lexemes_to_bytes()
|
lexemes_data = vocab.lexemes_to_bytes()
|
||||||
vectors_length = vocab.vectors_length
|
|
||||||
|
|
||||||
return (unpickle_vocab,
|
return (unpickle_vocab,
|
||||||
(sstore, morph, data_dir, lex_attr_getters,
|
(sstore, morph, data_dir, lex_attr_getters,
|
||||||
lexemes_data, length, vectors_length))
|
lexemes_data, length))
|
||||||
|
|
||||||
|
|
||||||
def unpickle_vocab(sstore, morphology, data_dir,
|
def unpickle_vocab(sstore, morphology, data_dir,
|
||||||
lex_attr_getters, bytes lexemes_data, int length, int vectors_length):
|
lex_attr_getters, bytes lexemes_data, int length):
|
||||||
cdef Vocab vocab = Vocab()
|
cdef Vocab vocab = Vocab()
|
||||||
vocab.length = length
|
vocab.length = length
|
||||||
vocab.vectors_length = vectors_length
|
|
||||||
vocab.strings = sstore
|
vocab.strings = sstore
|
||||||
vocab.morphology = morphology
|
vocab.morphology = morphology
|
||||||
vocab.data_dir = data_dir
|
vocab.data_dir = data_dir
|
||||||
vocab.lex_attr_getters = lex_attr_getters
|
vocab.lex_attr_getters = lex_attr_getters
|
||||||
vocab.lexemes_from_bytes(lexemes_data)
|
vocab.lexemes_from_bytes(lexemes_data)
|
||||||
vocab.length = length
|
vocab.length = length
|
||||||
vocab.vectors_length = vectors_length
|
|
||||||
return vocab
|
return vocab
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user