class_docstr: Calculate Translation edit rate (`TER`_)  of machine translated text with one or more references.
  
  This implementation follows the one from `SacreBleu_ter`_, which is a
  near-exact reimplementation of the Tercom algorithm, produces identical results on all "sane" outputs.
  
  As input to ``forward`` and ``update`` the metric accepts the following input:
  
  - ``preds`` (:class:`~Sequence`): An iterable of hypothesis corpus
  - ``target`` (:class:`~Sequence`): An iterable of iterables of reference corpus
  
  As output of ``forward`` and ``compute`` the metric returns the following output:
  
  - ``ter`` (:class:`~torch.Tensor`): if ``return_sentence_level_score=True`` return a corpus-level translation
    edit rate with a list of sentence-level translation_edit_rate, else return a corpus-level translation edit rate
  
  Args:
      normalize: An indication whether a general tokenization to be applied.
      no_punctuation: An indication whteher a punctuation to be removed from the sentences.
      lowercase: An indication whether to enable case-insensitivity.
      asian_support: An indication whether asian characters to be processed.
      return_sentence_level_score: An indication whether a sentence-level TER to be returned.
      kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
  
  Example:
      >>> from torchmetrics.text import TranslationEditRate
      >>> preds = ['the cat is on the mat']
      >>> target = [['there is a cat on the mat', 'a cat is on the mat']]
      >>> ter = TranslationEditRate()
      >>> ter(preds, target)
      tensor(0.1538)
class_docstr_tok: ["Calculate","Translation","edit","rate","(","`","TER","`","_",")","of","machine","translated","text","with","one","or","more","references",".","This","implementation","follows","the","one","from","`","SacreBleu_ter","`","_",",","which","is","a","near-exact","reimplementation","of","the","Tercom","algorithm",",","produces","identical","results","on","all","``","sane","''","outputs",".","As","input","to","``","forward","``","and","``","update","``","the","metric","accepts","the","following","input",":","-","``","preds","``","(",":","class",":","`","~Sequence","`",")",":","An","iterable","of","hypothesis","corpus","-","``","target","``","(",":","class",":","`","~Sequence","`",")",":","An","iterable","of","iterables","of","reference","corpus","As","output","of","``","forward","``","and","``","compute","``","the","metric","returns","the","following","output",":","-","``","ter","``","(",":","class",":","`","~torch.Tensor","`",")",":","if","``","return_sentence_level_score=True","``","return","a","corpus-level","translation","edit","rate","with","a","list","of","sentence-level","translation_edit_rate",",","else","return","a","corpus-level","translation","edit","rate","Args",":","normalize",":","An","indication","whether","a","general","tokenization","to","be","applied",".","no_punctuation",":","An","indication","whteher","a","punctuation","to","be","removed","from","the","sentences",".","lowercase",":","An","indication","whether","to","enable","case-insensitivity",".","asian_support",":","An","indication","whether","asian","characters","to","be","processed",".","return_sentence_level_score",":","An","indication","whether","a","sentence-level","TER","to","be","returned",".","kwargs",":","Additional","keyword","arguments",",","see",":","ref",":","`","Metric","kwargs","`","for","more","info",".","Example",":",">",">",">","from","torchmetrics.text","import","TranslationEditRate",">",">",">","preds","=","[","'the","cat","is","on","the","mat","'","]",">",">",">","target","=","[","[","'there","is","a","cat","on","the","mat","'",",","'","a","cat","is","on","the","mat","'","]","]",">",">",">","ter","=","TranslationEditRate","(",")",">",">",">","ter","(","preds",",","target",")","tensor","(","0.1538",")"]
docstr: Calculate the translate error rate (TER).
docstr_tok: ["Calculate","the","translate","error","rate","(","TER",")","."]
code: def compute(self) -> Union[Tensor, Tuple[Tensor, Tensor]]:
      """Calculate the translate error rate (TER)."""
      ter = _ter_compute(self.total_num_edits, self.total_tgt_len)
      if self.sentence_ter is not None:
          return ter, torch.cat(self.sentence_ter)
      return ter
  
file_path: torchmetrics/src/torchmetrics/text/ter.py
imports: from typing import Any, List, Optional, Sequence, Tuple, Union
  import torch
  from torch import Tensor, tensor
  from torchmetrics.functional.text.ter import _ter_compute, _ter_update, _TercomTokenizer
  from torchmetrics.metric import Metric
  from torchmetrics.utilities.imports import _MATPLOTLIB_AVAILABLE
  from torchmetrics.utilities.plot import _AX_TYPE, _PLOT_OUT_TYPE
label_desc: Use image node_id 3 for calling the TranslationEditRate obj's underlying member method code with example usage: obj.compute() and returns: ter, ter,  torch