Is there any text similarity algorithm in javascript? I want to compare too essays to determine how similar they are. I was thinking about edit distance, but I don't know how to translate it into percentage.
Take a look at jsdifflib, a javascript implementation of python's SequenceMatcher. You can get the similar percentage: difflib.ratio(string1, string2) * 100. Here is the demo. Hope this is what you want.
Yes there is!
In PHP, there's a convenient inbuilt string comparison function called levenshtein based on the (widely adopted) algorithm Levenshtein. In JavaScript, it isn't builtin, but it can be easily programmed, and has been.
Here is an implementation of the Levenshtein distance metric:
http://andrew.hedges.name/experiments/levenshtein/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With