The CompareFuzzy()
function compares two texts and returns a number between 0 and 1
(inclusive) that indicates the similarity between the two texts.
Syntax
CompareFuzzy(text1, text2)
Returns
A number that indicates the similarity of text1
and text2
, where a number close to
1 means very similar and a number close to 0 means very different.
Parameters
text1
the first text to compare.text2
the second text to compare.
Note: this function is not case-sensitive and ignores diacritics (accents).
Examples
CompareFuzzy("new york", "New York")
/* returns 1, the comparison is not case sensitive */
CompareFuzzy("Geneva", "Genèva")
/* returns 1, the comparison ignores diacritics */
CompareFuzzy("are you good?", "are you god?")
/* returns 0.9166666667 */
CompareFuzzy("evaluate", "salute")
/* returns 0.3333333333 */
CompareFuzzy("", "")
/* returns 1, empty texts are completely similar */
CompareFuzzy("a", "b")
/* returns 0, there is no similarity