* Remove broken Vocab pickling

This commit is contained in:
Matthew Honnibal 2016-02-06 14:08:47 +01:00
parent e66d45bf66
commit dcb401f3e1

View File

@ -110,20 +110,21 @@ cdef class Vocab:
# TODO: This is hopelessly broken. The state is transferred as just # TODO: This is hopelessly broken. The state is transferred as just
# a temp directory! We then fail to clean this up. This method therefore # a temp directory! We then fail to clean this up. This method therefore
# only pretends to work. What we need to do is form an archive file. # only pretends to work. What we need to do is form an archive file.
tmp_dir = tempfile.mkdtemp() raise NotImplementedError
lex_loc = path.join(tmp_dir, 'lexemes.bin') #tmp_dir = tempfile.mkdtemp()
str_loc = path.join(tmp_dir, 'strings.json') #lex_loc = path.join(tmp_dir, 'lexemes.bin')
vec_loc = path.join(tmp_dir, 'vec.bin') #str_loc = path.join(tmp_dir, 'strings.json')
#vec_loc = path.join(tmp_dir, 'vec.bin')
self.dump(lex_loc) #self.dump(lex_loc)
with io.open(str_loc, 'w', encoding='utf8') as file_: #with io.open(str_loc, 'w', encoding='utf8') as file_:
self.strings.dump(file_) # self.strings.dump(file_)
self.dump_vectors(vec_loc) #self.dump_vectors(vec_loc)
#
state = (str_loc, lex_loc, vec_loc, self.morphology, self.get_lex_attr, #state = (str_loc, lex_loc, vec_loc, self.morphology, self.get_lex_attr,
self.serializer_freqs, self.data_dir) # self.serializer_freqs, self.data_dir)
return (unpickle_vocab, state, None, None) #return (unpickle_vocab, state, None, None)
cdef const LexemeC* get(self, Pool mem, unicode string) except NULL: cdef const LexemeC* get(self, Pool mem, unicode string) except NULL:
'''Get a pointer to a LexemeC from the lexicon, creating a new Lexeme '''Get a pointer to a LexemeC from the lexicon, creating a new Lexeme