1fefd71cd95534089b9c0fbcb3c6f9dd40eee44b,src/beamsearch.py,,write_translation_preds,#Any#Any#Any#Any#,297

Before Change


            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])
            f.write("{}\t{}\n".format(hyp_sentence, target_sentence))

After 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))
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: jsalt18-sentence-repl/jiant
Commit Name: 1fefd71cd95534089b9c0fbcb3c6f9dd40eee44b
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: 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