class_docstr: longest common subsequence similarity
  
  https://en.wikipedia.org/wiki/Longest_common_subsequence_problem
class_docstr_tok: ["longest","common","subsequence","similarity","https",":","\/\/en.wikipedia.org\/wiki\/Longest_common_subsequence_problem"]
docstr: https://github.com/chrislit/abydos/blob/master/abydos/distance/_lcsseq.py
  http://www.dis.uniroma1.it/~bonifaci/algo/LCSSEQ.py
  http://rosettacode.org/wiki/Longest_common_subsequence#Dynamic_Programming_8
docstr_tok: ["https",":","\/\/github.com\/chrislit\/abydos\/blob\/master\/abydos\/distance\/_lcsseq.py","http",":","\/\/www.dis.uniroma1.it\/~bonifaci\/algo\/LCSSEQ.py","http",":","\/\/rosettacode.org\/wiki\/Longest_common_subsequence","#","Dynamic_Programming_8"]
code: def _dynamic(self, seq1: str, seq2: str) -> str:
      """
      https://github.com/chrislit/abydos/blob/master/abydos/distance/_lcsseq.py
      http://www.dis.uniroma1.it/~bonifaci/algo/LCSSEQ.py
      http://rosettacode.org/wiki/Longest_common_subsequence#Dynamic_Programming_8
      """
      lengths: Any
      if numpy:
          lengths = numpy.zeros(
              (len(seq1) + 1, len(seq2) + 1), dtype=int
          )
      else:
          lengths = [
              array("L", [0] * (len(seq2) + 1))
              for _ in range(len(seq1) + 1)
          ]
  
      # row 0 and column 0 are initialized to 0 already
      for i, char1 in enumerate(seq1):
          for j, char2 in enumerate(seq2):
              if char1 == char2:
                  lengths[i + 1][j + 1] = lengths[i][j] + 1
              else:
                  lengths[i + 1][j + 1] = max(
                      lengths[i + 1][j], lengths[i][j + 1]
                  )
  
      # read the substring out from the matrix
      result = ""
      i, j = len(seq1), len(seq2)
      while i != 0 and j != 0:
          if lengths[i][j] == lengths[i - 1][j]:
              i -= 1
          elif lengths[i][j] == lengths[i][j - 1]:
              j -= 1
          else:
              assert seq1[i - 1] == seq2[j - 1]
              result = seq1[i - 1] + result
              i -= 1
              j -= 1
      return result
  
imports: from __future__ import annotations
  from difflib import SequenceMatcher
  from typing import Any
  from ..utils import find_ngrams
  from .base import BaseSimilarity
  from .types import TestFunc
label_desc: Use image node_id 2 for calling the LCSSeq obj's underlying member method code with example usage: obj._dynamic(seq1, seq2) and returns: result