cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Fuzzy matching of node properties?

Hi,

is there a way I can do fuzzy matching on node propertiesI? I have 2 kind of nodes a and b, and the description-property could be similar.

I need a way to match a.description with b.description possibly with a ranking of similarity
and if the similarity is high enough create a relationship (a)-:[:SAME_AS]->(b)

Thanks,
Bent

1 ACCEPTED SOLUTION

@bent.s.lund

If you can use the Apoc Procedures,
you could use one of these function to get the score.
For example, with 2 nodes like: (:First {description: "Test"}), (:Second {description: "T&st"}),
I could do:

MATCH (n:First) match (m:Second)
WHERE apoc.text.levenshteinSimilarity(n.description, m.description) > 0.7 // if similarity score is greater than 0.7
CREATE (n)-[:SAME_AS]->(m)

View solution in original post

1 REPLY 1

@bent.s.lund

If you can use the Apoc Procedures,
you could use one of these function to get the score.
For example, with 2 nodes like: (:First {description: "Test"}), (:Second {description: "T&st"}),
I could do:

MATCH (n:First) match (m:Second)
WHERE apoc.text.levenshteinSimilarity(n.description, m.description) > 0.7 // if similarity score is greater than 0.7
CREATE (n)-[:SAME_AS]->(m)