code: def _ref_implementation(
      preds, target, substitution_cost=1, reduction="mean"
  ):
      costs = [
          nltk_edit_distance(p, t, substitution_cost=substitution_cost)
          for p, t in zip(preds, target)
      ]
      if reduction == "mean":
          return sum(costs) / len(costs)
      if reduction == "sum":
          return sum(costs)
      return costs
  
file_path: torchmetrics/tests/unittests/text/test_edit.py
imports: from functools import partial
  import pytest
  from nltk.metrics.distance import edit_distance
  from torchmetrics.functional.text.edit import edit_distance
  from torchmetrics.text.edit import EditDistance
  from unittests.text.helpers import TextTester
  from unittests.text.inputs import _inputs_single_reference
label_desc: Use image node_id 2 for calling a global function with example usage: _ref_implementation(preds, target, substitution_cost, reduction) and returns: costs, unknown, sum