852d7bd6143faa1acdd4ef47a2fe84372f3b48c9,src/beamsearch.py,,write_translation_preds,#Any#Any#Any#Any#,245
Before Change
def write_translation_preds(hyps, relevant_targets, preds_file_path, decoder_vocab):
with open(preds_file_path, "a") as f:
for i in range(len(hyps)):
hyp, target = hyps [i], relevant_targets[i]
hyp_sentence = " ".join([_get_word(decoder_vocab, i) for i in hyp])
target_sentence = " ".join([_get_word(decoder_vocab, i) for i in target])
f.write("{}\t{}\n".format(hyp_sentence, target_sentence))
After Change
for i in range(len(hyps)):
// form hyp sentence
hyp_sentence = []
for word_idx in hyps[i, 1:]:
hyp_sentence.append(
_get_word(decoder_vocab, word_idx)
)
if word_idx == decoder_vocab.get_token_index(END_SYMBOL, "targets"):
break
hyp_sentence = " ".join(hyp_sentence)
target = relevant_targets[i]
target_sentence = " ".join([_get_word(decoder_vocab, i) for i in target])
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances Project Name: jsalt18-sentence-repl/jiant
Commit Name: 852d7bd6143faa1acdd4ef47a2fe84372f3b48c9
Time: 2018-07-26
Author: yu.katherin@gmail.com
File Name: src/beamsearch.py
Class Name:
Method Name: write_translation_preds
Project Name: jsalt18-sentence-repl/jiant
Commit Name: 852d7bd6143faa1acdd4ef47a2fe84372f3b48c9
Time: 2018-07-26
Author: yu.katherin@gmail.com
File Name: src/beamsearch.py
Class Name:
Method Name: write_translation_preds
Project Name: jsalt18-sentence-repl/jiant
Commit Name: c2d5bde2b2d100b5d11e2c7f2e58186bca296f0d
Time: 2018-07-26
Author: wang.alex.c@gmail.com
File Name: src/beamsearch.py
Class Name:
Method Name: write_translation_preds
Project Name: jsalt18-sentence-repl/jiant
Commit Name: 2573c649518391ada6214cfc72d20421dfac4072
Time: 2018-03-16
Author: wang.alex.c@gmail.com
File Name: src/preprocess.py
Class Name:
Method Name: get_embeddings