class_docstr: Compute the absolute Damerau-Levenshtein distance between the two sequences.
  The Damerau-Levenshtein distance is the minimum number of edit operations necessary
  for transforming one sequence into the other. The edit operations allowed are:
  
      * deletion:      ABC -> BC, AC, AB
      * insertion:     ABC -> ABCD, EABC, AEBC..
      * substitution:  ABC -> ABE, ADC, FBC..
      * transposition: ABC -> ACB, BAC
  
  If `restricted=False`, it will calculate unrestricted distance,
  where the same character can be touched more than once.
  So the distance between BA and ACB is 2: BA -> AB -> ACB.
  
  https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance
class_docstr_tok: ["Compute","the","absolute","Damerau-Levenshtein","distance","between","the","two","sequences",".","The","Damerau-Levenshtein","distance","is","the","minimum","number","of","edit","operations","necessary","for","transforming","one","sequence","into","the","other",".","The","edit","operations","allowed","are",":","*","deletion",":","ABC","-",">","BC",",","AC",",","AB","*","insertion",":","ABC","-",">","ABCD",",","EABC",",","AEBC","..","*","substitution",":","ABC","-",">","ABE",",","ADC",",","FBC","..","*","transposition",":","ABC","-",">","ACB",",","BAC","If","`","restricted=False","`",",","it","will","calculate","unrestricted","distance",",","where","the","same","character","can","be","touched","more","than","once",".","So","the","distance","between","BA","and","ACB","is","2",":","BA","-",">","AB","-",">","ACB",".","https",":","\/\/en.wikipedia.org\/wiki\/Damerau","%","E2","%","80","%","93Levenshtein_distance"]
code: def _numpy(self, s1: Sequence[T], s2: Sequence[T]) -> int:
      # TODO: doesn't pass tests, need improve
      d = numpy.zeros([len(s1) + 1, len(s2) + 1], dtype=int)
  
      # matrix
      for i in range(-1, len(s1) + 1):
          d[i][-1] = i + 1
      for j in range(-1, len(s2) + 1):
          d[-1][j] = j + 1
  
      for i, cs1 in enumerate(s1):
          for j, cs2 in enumerate(s2):
              cost = int(not self.test_func(cs1, cs2))
              # ^ 0 if equal, 1 otherwise
  
              d[i][j] = min(
                  d[i - 1][j] + 1,  # deletion
                  d[i][j - 1] + 1,  # insertion
                  d[i - 1][j - 1] + cost,  # substitution
              )
  
              # transposition
              if not i or not j:
                  continue
              if not self.test_func(cs1, s2[j - 1]):
                  continue
              d[i][j] = min(
                  d[i][j],
                  d[i - 2][j - 2] + cost,
              )
  
      return d[len(s1) - 1][len(s2) - 1]
  
imports: from __future__ import annotations
  from collections import defaultdict
  from itertools import zip_longest
  from typing import Any, Sequence, TypeVar
  from .base import Base, BaseSimilarity
  from .types import SimFunc, TestFunc
label_desc: Use image node_id 2 for calling the DamerauLevenshtein obj's underlying member method code with example usage: obj._numpy(s1, s2) and returns: d