Fix conllu script

This commit is contained in:
Matthew Honnibal 2018-02-21 14:46:54 +01:00
parent 24fb2c246f
commit 97164b1763

View File

@ -153,7 +153,7 @@ def parse_dev_data(nlp, text_loc, conllu_loc):
return docs, scorer return docs, scorer
def print_progress(itn, losses, scores): def print_progress(itn, losses, scorer):
scores = {} scores = {}
for col in ['dep_loss', 'tag_loss', 'uas', 'tags_acc', 'token_acc', for col in ['dep_loss', 'tag_loss', 'uas', 'tags_acc', 'token_acc',
'ents_p', 'ents_r', 'ents_f', 'cpu_wps', 'gpu_wps']: 'ents_p', 'ents_r', 'ents_f', 'cpu_wps', 'gpu_wps']:
@ -228,7 +228,7 @@ def main(spacy_model, conllu_train_loc, text_train_loc, conllu_dev_loc, text_dev
with nlp.use_params(optimizer.averages): with nlp.use_params(optimizer.averages):
dev_docs, scorer = parse_dev_data(nlp, text_dev_loc, conllu_dev_loc) dev_docs, scorer = parse_dev_data(nlp, text_dev_loc, conllu_dev_loc)
print_progress(i, losses, scorer.scores) print_progress(i, losses, scorer)
with open(output_loc, 'w') as file_: with open(output_loc, 'w') as file_:
print_conllu(dev_docs, file_) print_conllu(dev_docs, file_)