class_docstr: Gotoh score
  Gotoh's algorithm is essentially Needleman-Wunsch with affine gap
  penalties:
  https://www.cs.umd.edu/class/spring2003/cmsc838t/papers/gotoh1982.pdf
class_docstr_tok: ["Gotoh","score","Gotoh","'s","algorithm","is","essentially","Needleman-Wunsch","with","affine","gap","penalties",":","https",":","\/\/www.cs.umd.edu\/class\/spring2003\/cmsc838t\/papers\/gotoh1982.pdf"]
code: def __call__(self, s1: Sequence[T], s2: Sequence[T]) -> float:
      if not numpy:
          raise ImportError("Please, install numpy for Gotoh measure")
  
      s1, s2 = self._get_sequences(s1, s2)
  
      # result = self.quick_answer(s1, s2)
      # if result is not None:
      #     return result * self.maximum(s1, s2)
  
      len_s1 = len(s1)
      len_s2 = len(s2)
      d_mat = numpy.zeros((len_s1 + 1, len_s2 + 1), dtype=float)
      p_mat = numpy.zeros((len_s1 + 1, len_s2 + 1), dtype=float)
      q_mat = numpy.zeros((len_s1 + 1, len_s2 + 1), dtype=float)
  
      d_mat[0, 0] = 0
      p_mat[0, 0] = float("-inf")
      q_mat[0, 0] = float("-inf")
      for i in range(1, len_s1 + 1):
          d_mat[i, 0] = float("-inf")
          p_mat[i, 0] = -self.gap_open - self.gap_ext * (i - 1)
          q_mat[i, 0] = float("-inf")
          q_mat[i, 1] = -self.gap_open
      for j in range(1, len_s2 + 1):
          d_mat[0, j] = float("-inf")
          p_mat[0, j] = float("-inf")
          p_mat[1, j] = -self.gap_open
          q_mat[0, j] = -self.gap_open - self.gap_ext * (j - 1)
  
      for i, sc1 in enumerate(s1, start=1):
          for j, sc2 in enumerate(s2, start=1):
              sim_val = self.sim_func(sc1, sc2)
              d_mat[i, j] = max(
                  d_mat[i - 1, j - 1] + sim_val,
                  p_mat[i - 1, j - 1] + sim_val,
                  q_mat[i - 1, j - 1] + sim_val,
              )
              p_mat[i, j] = max(
                  d_mat[i - 1, j] - self.gap_open,
                  p_mat[i - 1, j] - self.gap_ext,
              )
              q_mat[i, j] = max(
                  d_mat[i, j - 1] - self.gap_open,
                  q_mat[i, j - 1] - self.gap_ext,
              )
  
      i, j = (n - 1 for n in d_mat.shape)
      return max(d_mat[i, j], p_mat[i, j], q_mat[i, j])
  
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 4 for calling the Gotoh obj's underlying member method code with example usage: obj.__call__(s1, s2) and returns: max