code: def tversky(
      seq1: Iterable[str],
      seq2: Iterable[str],
      *,
      alpha: float = 1.0,
      beta: float = 1.0,
  ) -> float:
      """
      Measure the similarity between two sequences of strings as sets
      using the (symmetric) Tversky index, which is a generalization of
      Jaccard (``alpha=0.5, beta=2.0``) and Sørensen-Dice (``alpha=0.5, beta=1.0``).
  
      Args:
          seq1
          seq2
          alpha
          beta
  
      Returns:
          Similarity between ``seq1`` and ``seq2`` in the interval [0.0, 1.0],
          where larger values correspond to more similar sequences
  
      Reference:
          https://en.wikipedia.org/wiki/Tversky_index
      """
      set1 = set(seq1)
      set2 = set(seq2)
      intersection = len(set1 & set2)
      set1_not_set2 = len(set1 - set2)
      set2_not_set1 = len(set2 - set1)
      a = min(set1_not_set2, set2_not_set1)
      b = max(set1_not_set2, set2_not_set1)
      try:
          return intersection / (
              intersection + (beta * (alpha * a + (1 - alpha) * b))
          )
      except ZeroDivisionError:
          return 0.0
  
imports: import collections
  import math
  from typing import Iterable
label_desc: Use image node_id 3 for calling a global function with example usage: tversky(seq1, seq2) and returns: unknown, int