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 Jaccard index to measure the similarity between two strings based on n-grams. The Jaccard index is defined as the size of the intersection divided by the size of the union of the sample sets.
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, resulting in two sets—one for each string. These sets are then compared to determine the intersection and union of their n-grams, which are used to calculate the Jaccard similarity score.
Users can choose whether to include spaces in the n-grams. By default, n = 3, and spaces are included in the n-grams.
The algorithm’s time complexity is
O(n)