mirror of https://github.com/explosion/spaCy.git
* Update English.save_models for new Packer save/load stuff
This commit is contained in:
parent
bf77bcd6b9
commit
c86dbe4944
|
@ -153,22 +153,17 @@ class English(object):
|
||||||
self.tagger.model.end_training()
|
self.tagger.model.end_training()
|
||||||
self.vocab.strings.dump(path.join(data_dir, 'vocab', 'strings.txt'))
|
self.vocab.strings.dump(path.join(data_dir, 'vocab', 'strings.txt'))
|
||||||
|
|
||||||
with open(path.join(data_dir, 'pos', 'tag_freqs.json'), 'w') as file_:
|
packer = Packer(self.vocab, [
|
||||||
json.dump(list(self.tagger.freqs[TAG].items()), file_)
|
(TAG, self.tagger.moves.freqs[TAG].items()),
|
||||||
|
(HEAD, self.parser.moves.freqs[HEAD].items()),
|
||||||
|
(DEP, self.parser.moves.freqs[DEP].items()),
|
||||||
|
(ENT_IOB, self.entity.moves.freqs[ENT_IOB].items()),
|
||||||
|
(ENT_TYPE, self.entity.moves.freqs[ENT_TYPE].items())
|
||||||
|
])
|
||||||
|
|
||||||
with open(path.join(data_dir, 'deps', 'head_freqs.json'), 'w') as file_:
|
packer.dump(path.join(data_dir, 'vocab'))
|
||||||
json.dump(list(self.parser.moves.freqs[HEAD].items()), file_)
|
|
||||||
|
|
||||||
with open(path.join(data_dir, 'deps', 'dep_freqs.json'), 'w') as file_:
|
|
||||||
json.dump(list(self.parser.moves.freqs[DEP].items()), file_)
|
|
||||||
|
|
||||||
with open(path.join(data_dir, 'ner', 'iob_freqs.json'), 'w') as file_:
|
|
||||||
json.dump(list(self.entity.moves.freqs[ENT_IOB].items()), file_)
|
|
||||||
|
|
||||||
with open(path.join(data_dir, 'ner', 'ne_freqs.json'), 'w') as file_:
|
|
||||||
json.dump(list(self.entity.moves.freqs[ENT_TYPE].items()), file_)
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def tags(self):
|
def tags(self):
|
||||||
"""List of part-of-speech tag names."""
|
"""Deprecated. List of part-of-speech tag names."""
|
||||||
return self.tagger.tag_names
|
return self.tagger.tag_names
|
||||||
|
|
Loading…
Reference in New Issue