Shortcuts

Translation Edit Rate (TER)

Module Interface

torchmetrics.TranslationEditRate[source]

alias of _TranslationEditRate

Functional Interface

torchmetrics.functional.translation_edit_rate(preds, target, normalize=False, no_punctuation=False, lowercase=True, asian_support=False, return_sentence_level_score=False)[source]

Wrapper for deprecated import.

>>> preds = ['the cat is on the mat']
>>> target = [['there is a cat on the mat', 'a cat is on the mat']]
:rtype: :py:data:`~typing.Union`\[:py:class:`~torch.Tensor`, :py:data:`~typing.Tuple`\[:py:class:`~torch.Tensor`, :py:class:`~typing.List`\[:py:class:`~torch.Tensor`]]]
>>> _translation_edit_rate(preds, target)
tensor(0.1538)