mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
* Write serializer freqs to single file, vocab/serializer.json
This commit is contained in:
parent
a0e36e8efc
commit
680bb47b55
|
@ -153,15 +153,14 @@ 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'))
|
||||||
|
|
||||||
packer = Packer(self.vocab, [
|
with open(path.join(data_dir, 'vocab', 'serializer.json'), 'w') as file_:
|
||||||
(TAG, self.tagger.moves.freqs[TAG].items()),
|
file_.write(
|
||||||
(HEAD, self.parser.moves.freqs[HEAD].items()),
|
json.dumps([
|
||||||
(DEP, self.parser.moves.freqs[DEP].items()),
|
(TAG, self.tagger.freqs[TAG].items()),
|
||||||
(ENT_IOB, self.entity.moves.freqs[ENT_IOB].items()),
|
(DEP, self.parser.moves.freqs[DEP].items()),
|
||||||
(ENT_TYPE, self.entity.moves.freqs[ENT_TYPE].items())
|
(ENT_IOB, self.entity.moves.freqs[ENT_IOB].items()),
|
||||||
])
|
(ENT_TYPE, self.entity.moves.freqs[ENT_TYPE].items()),
|
||||||
|
(HEAD, self.parser.moves.freqs[HEAD].items())]))
|
||||||
packer.dump(path.join(data_dir, 'vocab'))
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def tags(self):
|
def tags(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user