mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-26 01:04:34 +03:00
Specify order of vocab deserialization
This commit is contained in:
parent
f4aafca222
commit
920887f4e4
|
@ -9,6 +9,7 @@ from libc.string cimport memset, memcpy
|
||||||
from libc.stdint cimport int32_t
|
from libc.stdint cimport int32_t
|
||||||
from libc.math cimport sqrt
|
from libc.math cimport sqrt
|
||||||
from cymem.cymem cimport Address
|
from cymem.cymem cimport Address
|
||||||
|
from collections import OrderedDict
|
||||||
from .lexeme cimport EMPTY_LEXEME
|
from .lexeme cimport EMPTY_LEXEME
|
||||||
from .lexeme cimport Lexeme
|
from .lexeme cimport Lexeme
|
||||||
from .strings cimport hash_string
|
from .strings cimport hash_string
|
||||||
|
@ -304,10 +305,10 @@ cdef class Vocab:
|
||||||
**exclude: Named attributes to prevent from being loaded.
|
**exclude: Named attributes to prevent from being loaded.
|
||||||
RETURNS (Vocab): The `Vocab` object.
|
RETURNS (Vocab): The `Vocab` object.
|
||||||
"""
|
"""
|
||||||
setters = {
|
setters = OrderedDict((
|
||||||
'strings': lambda b: self.strings.from_bytes(b),
|
('strings', lambda b: self.strings.from_bytes(b)),
|
||||||
'lexemes': lambda b: self.lexemes_from_bytes(b)
|
('lexemes', lambda b: self.lexemes_from_bytes(b))
|
||||||
}
|
))
|
||||||
return util.from_bytes(bytes_data, setters, exclude)
|
return util.from_bytes(bytes_data, setters, exclude)
|
||||||
|
|
||||||
def lexemes_to_bytes(self):
|
def lexemes_to_bytes(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user