From 680bb47b5535ca252ed2fca91b341d279499db6c Mon Sep 17 00:00:00 2001 From: Matthew Honnibal Date: Thu, 23 Jul 2015 01:15:25 +0200 Subject: [PATCH] * Write serializer freqs to single file, vocab/serializer.json --- spacy/en/__init__.py | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/spacy/en/__init__.py b/spacy/en/__init__.py index 45c5c6cf1..439be6c12 100644 --- a/spacy/en/__init__.py +++ b/spacy/en/__init__.py @@ -153,15 +153,14 @@ class English(object): self.tagger.model.end_training() self.vocab.strings.dump(path.join(data_dir, 'vocab', 'strings.txt')) - packer = Packer(self.vocab, [ - (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()) - ]) - - packer.dump(path.join(data_dir, 'vocab')) + with open(path.join(data_dir, 'vocab', 'serializer.json'), 'w') as file_: + file_.write( + json.dumps([ + (TAG, self.tagger.freqs[TAG].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()), + (HEAD, self.parser.moves.freqs[HEAD].items())])) @property def tags(self):