class_docstr: A convenience class for calculating the Levenshtein edit distance.
  
  Class will cache some intermediate values to hasten the calculation. The implementation follows the implementation
  from https://github.com/mjpost/sacrebleu/blob/master/sacrebleu/metrics/lib_ter.py,
  where the most of this implementation is adapted and copied from.
  
  Args:
      reference_tokens: list of reference tokens
      op_insert: cost of insertion operation
      op_delete: cost of deletion operation
      op_substitute: cost of substitution operation
class_docstr_tok: ["A","convenience","class","for","calculating","the","Levenshtein","edit","distance",".","Class","will","cache","some","intermediate","values","to","hasten","the","calculation",".","The","implementation","follows","the","implementation","from","https",":","\/\/github.com\/mjpost\/sacrebleu\/blob\/master\/sacrebleu\/metrics\/lib_ter.py",",","where","the","most","of","this","implementation","is","adapted","and","copied","from",".","Args",":","reference_tokens",":","list","of","reference","tokens","op_insert",":","cost","of","insertion","operation","op_delete",":","cost","of","deletion","operation","op_substitute",":","cost","of","substitution","operation"]
code: def __init__(
      self,
      reference_tokens: List[str],
      op_insert: int = 1,
      op_delete: int = 1,
      op_substitute: int = 1,
  ) -> None:
      self.reference_tokens = reference_tokens
      self.reference_len = len(reference_tokens)
  
      self.cache: Dict[str, Tuple[int, str]] = {}
      self.cache_size = 0
  
      self.op_insert = op_insert
      self.op_delete = op_delete
      self.op_substitute = op_substitute
      self.op_nothing = 0
      self.op_undefined = _INT_INFINITY
  
file_path: torchmetrics/src/torchmetrics/functional/text/helper.py
imports: import math
  from enum import Enum, unique
  from typing import Dict, List, Sequence, Tuple, Union
label_desc: Use image node_id 1 to create a new _LevenshteinEditDistance object  with example: obj = _LevenshteinEditDistance(reference_tokens, op_insert, op_delete, op_substitute)