63871d5ab3301d015805abddd8f4259680d6a24a,translate.py,,main,#,68
Before Change
index += 1
os.write(1, bytes("PRED %d: %s\n" %
(count, " ".join(pred_sents[0])), "UTF-8"))
print("PRED SCORE: %.4f" % pred_score[0])
if opt.tgt:
tgtSent = " ".join(gold_sent)
os.write(1, bytes("GOLD %d: %s\n" %
After Change
(sent.squeeze(1) for sent in src.split(1, dim=1)))
for pred_sents, gold_sent, pred_score, gold_score, src_sent in z_batch:
n_best_preds = [" ".join(pred) for pred in pred_sents[:opt.n_best]]
count += 1
out_file.write("\n".join(n_best_preds))
out_file.write("\n")
out_file.flush()
if opt.verbose:
words = get_src_words(
src_sent, translator.fields["src"].vocab.itos)
os.write(1, bytes("\nSENT %d: %s\n" %
(count, words), "UTF-8"))
index += 1
best_pred = n_best_preds[0]
best_score = pred_score[0]
os.write(1, bytes("PRED %d: %s\n" %
(count, best_pred), "UTF-8"))
print("PRED SCORE: %.4f" % best_score)
if opt.tgt:
tgt_sent = " ".join(gold_sent)
os.write(1, bytes("GOLD %d: %s\n" %
(count, tgt_sent), "UTF-8"))
print("GOLD SCORE: %.4f" % gold_score)
if opt.n_best > 1:
print("\nBEST HYP:")
for score, sent in zip(pred_score, n_best_preds):
os.write(1, bytes("[%.4f] %s\n" % (score, sent),
"UTF-8"))
report_score("PRED", pred_score_total, pred_words_total)
if opt.tgt:
report_score("GOLD", gold_score_total, gold_words_total)
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 8
Instances
Project Name: OpenNMT/OpenNMT-py
Commit Name: 63871d5ab3301d015805abddd8f4259680d6a24a
Time: 2017-09-21
Author: bpeters@coli.uni-saarland.de
File Name: translate.py
Class Name:
Method Name: main
Project Name: arnomoonens/yarll
Commit Name: bb72c5b102a74486036d849b44f80ab3772a18f9
Time: 2018-02-23
Author: arno.moonens@outlook.com
File Name: agents/ppo/dppo_worker.py
Class Name: DPPOWorker
Method Name: run
Project Name: merenlab/anvio
Commit Name: 0aeab91fc279f18a7dec94c945d29c4026579e49
Time: 2020-02-26
Author: kiefl.evan@gmail.com
File Name: anvio/contigops.py
Class Name: Auxiliary
Method Name: run_SCVs
Project Name: pliablepixels/zmeventnotification
Commit Name: 1e619d91956c813d2328a5460da0a273fe135905
Time: 2019-11-15
Author: pliablepixels@gmail.com
File Name: hook/zmes_hook_helpers/face.py
Class Name: Face
Method Name: detect