63871d5ab3301d015805abddd8f4259680d6a24a,translate.py,,main,#,68
Before Change
out_file.flush()
if opt.verbose:
words = []
for f in src_sent:
word = translator.fields["src"].vocab.itos[f]
if word == onmt.IO.PAD_WORD:
break
words.append(word)
os.write(1, bytes("\nSENT %d: %s\n" %
(count, " ".join(words)), "UTF-8"))
index += 1
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)
In pattern: SUPERPATTERN
Frequency: 4
Non-data size: 11
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: NTMC-Community/MatchZoo
Commit Name: 458a29dbd25a137372374ba4e039a24fa383f6aa
Time: 2019-05-29
Author: 469413628@qq.com
File Name: matchzoo/utils/bert_utils.py
Class Name:
Method Name: run_strip_accents
Project Name: NifTK/NiftyNet
Commit Name: c8b28432a637a780eed96547260722ff3dede57e
Time: 2017-10-04
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/engine/sampler_selective.py
Class Name:
Method Name: rand_choice_coordinates
Project Name: evilsocket/pwnagotchi
Commit Name: 6a97476732c4029c701a3d0d448eb2ffe3ac706b
Time: 2019-12-02
Author: alanyee@users.noreply.github.com
File Name: setup.py
Class Name:
Method Name: