Browse the docs

similarity

How alike two texts are, from 0 to 1.

Details #

similarity(a, b) is 1 for the same text and 0 for nothing in common: one minus the edit distance divided by the longer length. Case and accents are ignored, so Café and cafe are 1. Two empty texts are 1.

Parameters #

Takes 2 arguments. {{ similarity(text, b) }}

Examples #

similarity("kitten", "sitting")
→ 0.571
similarity(a, b) > 0.8
→ true
Sample variableValue
acolour
bcolor

Gotchas #

  • It counts characters, not meaning.