termSimilarity method Null safety

double termSimilarity(
  1. Term other,
  2. [int k = 3]
)

Returns a similarity index value between 0.0 and 1.0, defined as the product of jaccardSimilarity and lengthSimilarity.

A term similarity of 1.0 means the two terms are:

  • equal in length; and
  • have an identical collection of k-grams.

Implementation

double termSimilarity(Term other, [int k = 3]) =>
    jaccardSimilarity(other, k) * lengthSimilarity(other);