mirror of https://github.com/explosion/spaCy.git
Fix string serialisation
This commit is contained in:
parent
e9419072e7
commit
b1469d3360
|
@ -16,6 +16,7 @@ from .symbols import NAMES as SYMBOLS_BY_INT
|
||||||
|
|
||||||
from .typedefs cimport hash_t
|
from .typedefs cimport hash_t
|
||||||
from . import util
|
from . import util
|
||||||
|
from .compat import json_dumps
|
||||||
|
|
||||||
|
|
||||||
cpdef hash_t hash_string(unicode string) except 0:
|
cpdef hash_t hash_string(unicode string) except 0:
|
||||||
|
@ -201,7 +202,7 @@ cdef class StringStore:
|
||||||
path = util.ensure_path(path)
|
path = util.ensure_path(path)
|
||||||
strings = list(self)
|
strings = list(self)
|
||||||
with path.open('w') as file_:
|
with path.open('w') as file_:
|
||||||
ujson.dump(strings, file_)
|
file_.write(json_dumps(strings))
|
||||||
|
|
||||||
def from_disk(self, path):
|
def from_disk(self, path):
|
||||||
"""Loads state from a directory. Modifies the object in place and
|
"""Loads state from a directory. Modifies the object in place and
|
||||||
|
|
Loading…
Reference in New Issue