class_docstr: Calculates the Levenshtein edit distance between two sequences.
  
  The edit distance is the number of characters that need to be substituted, inserted, or deleted, to transform the
  predicted text into the reference text. The lower the distance, the more accurate the model is considered to be.
  
  Implementation is similar to `nltk.edit_distance <https://www.nltk.org/_modules/nltk/metrics/distance.html>`_.
  
  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:
  
  - ``eed`` (:class:`~torch.Tensor`): A tensor with the extended edit distance score. If `reduction` is set to
    ``'none'`` or ``None``, this has shape ``(N, )``, where ``N`` is the batch size. Otherwise, this is a scalar.
  
  Args:
      substitution_cost: The cost of substituting one character for another.
      reduction: a method to reduce metric score over samples.
  
          - ``'mean'``: takes the mean over samples
          - ``'sum'``: takes the sum over samples
          - ``None`` or ``'none'``: return the score per sample
  
      kwargs: Additional keyword arguments, see :ref:`Metric kwargs` for more info.
  
  Example::
      Basic example with two strings. Going from “rain” -> “sain” -> “shin” -> “shine” takes 3 edits:
  
      >>> from torchmetrics.text import EditDistance
      >>> metric = EditDistance()
      >>> metric(["rain"], ["shine"])
      tensor(3.)
  
  Example::
      Basic example with two strings and substitution cost of 2. Going from “rain” -> “sain” -> “shin” -> “shine”
      takes 3 edits, where two of them are substitutions:
  
      >>> from torchmetrics.text import EditDistance
      >>> metric = EditDistance(substitution_cost=2)
      >>> metric(["rain"], ["shine"])
      tensor(5.)
  
  Example::
      Multiple strings example:
  
      >>> from torchmetrics.text import EditDistance
      >>> metric = EditDistance(reduction=None)
      >>> metric(["rain", "lnaguaeg"], ["shine", "language"])
      tensor([3, 4], dtype=torch.int32)
      >>> metric = EditDistance(reduction="mean")
      >>> metric(["rain", "lnaguaeg"], ["shine", "language"])
      tensor(3.5000)
docstr: Compute the edit distance over state.
docstr_tok: ["Compute","the","edit","distance","over","state","."]
code: def compute(self) -> torch.Tensor:
      """Compute the edit distance over state."""
      if self.reduction == "none" or self.reduction is None:
          return _edit_distance_compute(
              dim_zero_cat(self.edit_scores_list), 1, self.reduction
          )
      return _edit_distance_compute(
          self.edit_scores, self.num_elements, self.reduction
      )
  
file_path: torchmetrics/src/torchmetrics/text/edit.py
imports: from typing import Any, List, Literal, Optional, Sequence, Union
  import torch
  from torch import Tensor
  from torchmetrics.functional.text.edit import _edit_distance_compute, _edit_distance_update
  from torchmetrics.metric import Metric
  from torchmetrics.utilities.data import dim_zero_cat
  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 EditDistance obj's underlying member method code with example usage: obj.compute() and returns: _edit_distance_compute, _edit_distance_compute