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"]
docstr: Find the already calculated rows of the Levenshtein edit distance metric.
  
  Args:
      prediction_tokens: A tokenized predicted sentence.
  
  Return:
      A tuple of a start hypothesis position and `edit_distance` matrix.
  
      prediction_start: An index where a predicted sentence to be considered from.
      edit_distance:
          A matrix of the cached Levenshtedin edit distance. The element part of the matrix is a tuple of an edit
          operation cost and an edit operation itself.
docstr_tok: ["Find","the","already","calculated","rows","of","the","Levenshtein","edit","distance","metric",".","Args",":","prediction_tokens",":","A","tokenized","predicted","sentence",".","Return",":","A","tuple","of","a","start","hypothesis","position","and","`","edit_distance","`","matrix",".","prediction_start",":","An","index","where","a","predicted","sentence","to","be","considered","from",".","edit_distance",":","A","matrix","of","the","cached","Levenshtedin","edit","distance",".","The","element","part","of","the","matrix","is","a","tuple","of","an","edit","operation","cost","and","an","edit","operation","itself","."]
code: def _find_cache(
      self, prediction_tokens: List[str]
  ) -> Tuple[int, List[List[Tuple[int, _EditOperations]]]]:
      """Find the already calculated rows of the Levenshtein edit distance metric.
  
      Args:
          prediction_tokens: A tokenized predicted sentence.
  
      Return:
          A tuple of a start hypothesis position and `edit_distance` matrix.
  
          prediction_start: An index where a predicted sentence to be considered from.
          edit_distance:
              A matrix of the cached Levenshtedin edit distance. The element part of the matrix is a tuple of an edit
              operation cost and an edit operation itself.
  
      """
      node = self.cache
      start_position = 0
      edit_distance: List[List[Tuple[int, _EditOperations]]] = [
          self._get_initial_row(self.reference_len)
      ]
      for word in prediction_tokens:
          if word in node:
              start_position += 1
              node, row = node[word]  # type: ignore
              edit_distance.append(row)  # type: ignore
          else:
              break
  
      return start_position, edit_distance
  
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 6 for calling the _LevenshteinEditDistance obj's underlying member method code with example usage: obj._find_cache(prediction_tokens) and returns: start_position,  edit_distance