* Update train_pos_tagger example

This commit is contained in:
Matthew Honnibal 2016-02-02 22:30:00 +01:00
parent a676d66807
commit bf5a7cc598
1 changed files with 4 additions and 2 deletions

View File

@ -62,8 +62,10 @@ def main(output_dir):
tokens = tokenizer.tokens_from_list(words) tokens = tokenizer.tokens_from_list(words)
tagger.train(tokens, tags) tagger.train(tokens, tags)
random.shuffle(DATA) random.shuffle(DATA)
tagger.model.end_training(path.join(output_dir, 'pos', 'model')) tagger.model.end_training()
vocab.strings.dump(path.join(output_dir, 'vocab', 'strings.txt')) tagger.model.dump(path.join(output_dir, 'pos', 'model'))
with io.open(output_dir, 'vocab', 'strings.json') as file_:
tagger.vocab.strings.dump(file_)
if __name__ == '__main__': if __name__ == '__main__':