If context is not provided, its score is 0 in NeuralDecoder memory
@@ -49,10 +49,11 @@ public class F1BleuRescorer implements Rescorer {
}
}
- // Apply context scores if possible
+ // Apply context scores
+ HashMap<Long, Float> contextScores = new HashMap<>();
+
if (context != null && context.size() > 0) {
- HashMap<Long, Float> contextScores = new HashMap<>(context.size());
- for (ContextVector.Entry ce : context) {
+ for (ContextVector.Entry ce : context)
contextScores.put(ce.memory.getId(), ce.score);
}
@@ -62,7 +63,6 @@ public class F1BleuRescorer implements Rescorer {
entry.score = entry.score * .5f + (contextScore == null ? 0.f : contextScore) * .5f;
}
}
- }
for (ScoreEntry entry : entries) {
if (entry.score < 0)
