issue5230 changed reference to function to anonymous function

This commit is contained in:
Leander Fiedler 2020-04-15 21:52:52 +02:00 committed by lfiedler
parent cef0c909b9
commit a3401b1194
2 changed files with 3 additions and 3 deletions

View File

@ -625,7 +625,7 @@ class Tagger(Pipe):
serialize = OrderedDict(( serialize = OrderedDict((
("vocab", lambda p: self.vocab.to_disk(p)), ("vocab", lambda p: self.vocab.to_disk(p)),
("tag_map", lambda p: srsly.write_msgpack(p, tag_map)), ("tag_map", lambda p: srsly.write_msgpack(p, tag_map)),
("model", self.model.to_disk), ("model", lambda p: self.model.to_disk(p)),
("cfg", lambda p: srsly.write_json(p, self.cfg)) ("cfg", lambda p: srsly.write_json(p, self.cfg))
)) ))
exclude = util.get_serialization_exclude(serialize, exclude, kwargs) exclude = util.get_serialization_exclude(serialize, exclude, kwargs)
@ -1394,7 +1394,7 @@ class EntityLinker(Pipe):
serialize["vocab"] = lambda p: self.vocab.to_disk(p) serialize["vocab"] = lambda p: self.vocab.to_disk(p)
serialize["kb"] = lambda p: self.kb.dump(p) serialize["kb"] = lambda p: self.kb.dump(p)
if self.model not in (None, True, False): if self.model not in (None, True, False):
serialize["model"] = self.model.to_disk serialize["model"] = lambda p: self.model.to_disk(p)
exclude = util.get_serialization_exclude(serialize, exclude, kwargs) exclude = util.get_serialization_exclude(serialize, exclude, kwargs)
util.to_disk(path, serialize, exclude) util.to_disk(path, serialize, exclude)

View File

@ -385,7 +385,7 @@ cdef class Vectors:
save_array(self.data, _file) save_array(self.data, _file)
serializers = OrderedDict(( serializers = OrderedDict((
("vectors", save_vectors), ("vectors", lambda p: save_vectors(p)),
("key2row", lambda p: srsly.write_msgpack(p, self.key2row)) ("key2row", lambda p: srsly.write_msgpack(p, self.key2row))
)) ))
return util.to_disk(path, serializers, []) return util.to_disk(path, serializers, [])