MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / ter

Function ter

test/general/lm_eval/metrics.py:142–154  ·  view source on GitHub ↗

Translation Error Rate is an error metric for machine translation that measures the number of edits required to change a system output into one of the references Source: http://www.cs.umd.edu/~snover/tercom/ Paper: http://mt-archive.info/AMTA-2006-Snover.pdf Lower is better

(items)

Source from the content-addressed store, hash-verified

140
141
142def ter(items):
143 """Translation Error Rate is an error metric for machine translation that
144 measures the number of edits required to change a system output into one
145 of the references
146 Source: http://www.cs.umd.edu/~snover/tercom/
147 Paper: http://mt-archive.info/AMTA-2006-Snover.pdf
148
149 Lower is better
150 """
151 refs = list(zip(*items))[0]
152 preds = list(zip(*items))[1]
153 refs, preds = _sacreformat(refs, preds)
154 return sacrebleu.corpus_ter(preds, refs).score
155
156
157def is_non_str_iterable(obj):

Callers

nothing calls this directly

Calls 1

_sacreformatFunction · 0.85

Tested by

no test coverage detected