Number of input and output field
| Number of input field |
: |
Two |
| Number of output field |
: |
One |
A measure of similarity between two strings. It returns a value in the interval [0.0, 1.0], where 0.0 indicates that the two strings are completely different and 1.0 indicates that they are identical.
This transformation function uses the Sørensen–Dice coefficient to measure the similarity between two strings based on n-grams.
An n-gram is a contiguous sequence of n characters from a given text. For example, if n = 3, the n-grams for the phrase “good morning” are:
goo, ood, od_, d_m, _mo, mor, orn, rni, nin, ing.
Each unique n-gram from each string is stored in a separate set. The two sets are then compared to determine the intersection of their n-grams. The Sørensen–Dice coefficient is calculated using the following formula:
2 × |intersection| / (|set
1| + |set
2|)
This value represents the similarity between the two strings.
Users can choose whether to include spaces in the n-grams. The default value of n is 3, and by default, spaces are included in the n-grams.
The algorithm’s time complexity is
O(n
2)