lengthSimilarity method Null safety
- Term other
Returns the similarity in length between this string and other where:
lengthSimilarity = 1 - lengthDistance if lengthDistance.
Returns:
- 1.0 if this and
otherare the same length; and - 0.0 if lengthDistance >= 1.0, i.e when
other.length is less than 50% or more than 200% of length.
Implementation
double lengthSimilarity(Term other) {
final ld = lengthDistance(other);
return ld > 1 ? 0 : 1 - ld;
}