code: def _edit_distance(
      s1: np.ndarray,
      s2: np.ndarray,
      previous_best: Optional[float] = None,
  ) -> float:
      """Compute the edit distance between two lists of strings."""
      # Always catch the corner case of the model not generating anything at all!
      l1, l2 = len(s1), len(s2)
      min_len, max_len = min(l1, l2), max(l1, l2)
      if min_len == 0:
          return max_len
  
      similarity_mat: np.ndarray = (
          s1[:, None] == s2[None, :]
      )  # Speed up this through vectorization.
      result = _edit_distance_helper(s1, s2, similarity_mat)
      return (
          result
          if previous_best is None
          else min(previous_best, result)
      )
  
imports: import re
  from typing import List, Optional
  import numba
  import numpy
  from nltk.tokenize.treebank import TreebankWordTokenizer
  from helm.benchmark.adaptation.request_state import RequestState
  from helm.benchmark.adaptation.adapter_spec import AdapterSpec
  from helm.benchmark.scenarios.scenario import Reference
  from helm.common.request import RequestResult
  from .metric import Metric
  from .metric_name import MetricName
  from .metric_service import MetricService
  from .statistic import Stat
label_desc: Use image node_id 3 for calling a global function with example usage: _edit_distance(s1, s2, previous_best) and returns: unknown, max_len