java-string-similarity

Hi everybody I am trying to calculate the Ratcliff-Obershelp string similarity between two pairs of column names using the Java Snippet node using this library, which was added in the Additional Libraries tab.

The website implementation shows this code:

import info.debatty.java.stringsimilarity.*;

public class MyApp {

public static void main(String[] args) {
    RatcliffObershelp ro = new RatcliffObershelp();
    
    // substitution of s and t
    System.out.println(ro.similarity("My string", "My tsring"));
    
    // substitution of s and n
    System.out.println(ro.similarity("My string", "My ntrisg"));
}

}

The attached workflow that come from here, uses the Jaccard, but I am unable to use the Ratcliff-Obershelp metric.

jaccard_forum_fixed.knwf (17.1 KB)

Thank you

Hi,
The workflow you linked uses version 0.19 of the library. The Ratcliff Obershelp distance was only added in the most recent 2.0.0 version, though. You’ll need to download a new jar from here and it should work.
Kind regards,
Alexander

1 Like

Hi Alex thank you, I added the code, but got an error

I beg if you can help me in this bit

Cheers

jaccard_forum_fixed.knwf (30.7 KB)

Hi @mauuuuu5

You appear to have introduced a 2 into the constructor since your first post. I looked at the website link from your initial post and don’t see an example of this.

Removing the 2 again removes the compilation error.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.