apoc.text.levenshteinSimilarity

Details

Syntax

apoc.text.levenshteinSimilarity(text1, text2)

Description

Returns the similarity (a value within 0 and 1) between the two given STRING values based on the Levenshtein distance algorithm.

Arguments

Name

Type

Description

text1

STRING

The first string to be compared against the second.

text2

STRING

The second string to be compared against the first.

Returns

FLOAT

Usage Examples

RETURN apoc.text.levenshteinSimilarity("Neo4j", "Neo4j") AS output;
Results
output

1.0

RETURN apoc.text.levenshteinSimilarity("Neo4j", "Neoj4") AS output;
Results
output

0.6

RETURN apoc.text.levenshteinSimilarity("Neo4j Aura", "Neo4j Graph Database") AS output;
Results
output

0.35