code: def _edit_similarity(
      s1: np.ndarray,
      s2: np.ndarray,
      previous_best: Optional[float] = None,
  ) -> float:
      """Compute the edit similarity between two lists of strings.
  
      Edit similarity is also used in the paper
          Lee, Katherine, et al.
          "Deduplicating training data makes language models better."
          arXiv preprint arXiv:2107.06499 (2021).
      """
      edist = _edit_distance(s1, s2)  # Don't feed `previous_best`!
  
      # Some models can return an empty completion e.g., openai/text-davinci-002
      # returns '<|endoftext|>' token immediately for a certain request.
      esim = (
          1.0 - edist / max(len(s1), len(s2))
          if len(s1) > 0 and len(s2) > 0
          else 0
      )
      return (
          max(esim, previous_best)
          if previous_best is not None
          else esim
      )
  
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 4 for calling a global function with example usage: _edit_similarity(s1, s2, previous_best) and returns: unknown