58cb18761fc72e5f9b8dd92a222a14b0240d8436,onmt/Translator.py,Translator,translate,#Translator#Any#Any#,246
Before Change
// (2) translate
pred, predScore, attn, goldScore = self.translateBatch(batch)
pred, predScore, attn, goldScore = list(zip(
*sorted(zip(pred, predScore, attn, goldScore, batch.indices),
key=lambda x: x[-1])))[:-1]
// (3) convert indexes to words
predBatch = []
for b in range(batchSize):
After Change
// (3) convert indexes to words
predBatch = []
src = batch.src[0].data.index_select(1, perm)
for b in range(batchSize):
src_vocab = data.src_vocabs[inds[b]]
predBatch.append(
[self.buildTargetTokens(pred[b][n], src[:, b],
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: OpenNMT/OpenNMT-py
Commit Name: 58cb18761fc72e5f9b8dd92a222a14b0240d8436
Time: 2017-08-20
Author: srush@seas.harvard.edu
File Name: onmt/Translator.py
Class Name: Translator
Method Name: translate
Project Name: allenai/allennlp
Commit Name: 058c2e6963c597d8c613d85646e200c38c059971
Time: 2019-12-16
Author: eladsegal@users.noreply.github.com
File Name: allennlp/modules/conditional_random_field.py
Class Name: ConditionalRandomField
Method Name: viterbi_tags
Project Name: OpenNMT/OpenNMT-py
Commit Name: dbd4344f433498232ab26da5af3ba142f9accb51
Time: 2018-02-01
Author: s.gehrmann@outlook.com
File Name: onmt/io/TextDataset.py
Class Name: TextDataset
Method Name: collapse_copy_scores