locutusjs / locutus

Bringing stdlibs of other programming languages to JavaScript for educational purposes

Home Page:https://locutus.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

php similar_text performance

LordVersA opened this issue · comments

hi is there anyway to make this function's performance better?
src/php/strings/similar_text.js

I can check if I can squeeze some more microseconds out of the code, but it's going to be difficult because even the PHPs function has O(N**3) complexity.

thanks for your answer,
is there any javascript function that work like this? and can get percentage of similarity? a more efficient way @kukawski

Not exactly what you're looking for, but in this repository you will find function for calculating Levenshtein distance (src/php/strings/levenshtein.js).
Otherwise you can try out Jaro-Winkler similarity (https://www.geeksforgeeks.org/jaro-and-jaro-winkler-similarity/) which is O(n*m).

Not exactly what you're looking for, but in this repository you will find function for calculating Levenshtein distance (src/php/strings/levenshtein.js). Otherwise you can try out Jaro-Winkler similarity (https://www.geeksforgeeks.org/jaro-and-jaro-winkler-similarity/) which is O(n*m).

thanks for your time <3