in simuleval/scorer/scorer.py [0:0]
def gather_translation(self):
not_finish_write_id = [i for i in range(
len(self)) if not self.instances[i].finish_hypo]
empty_hypo_id = [str(i) for i in range(len(self)) if len(
self.instances[i].prediction(no_space=self.no_space)) == 0]
if len(not_finish_write_id) > 0:
print(
"Warning: these hypothesis don't have EOS in predictions",
file=sys.stderr)
print(
", ".join((str(x) for x in not_finish_write_id)),
file=sys.stderr
)
for idx in not_finish_write_id:
self.instances[idx].sentence_level_eval()
if len(empty_hypo_id) > 0:
print("Warning: these hypothesis are empty", file=sys.stderr)
print(", ".join(empty_hypo_id), file=sys.stderr)
translations = [self.instances[i].prediction(
eos=False, no_space=self.no_space) for i in range(len(self))]
return translations