How to compare two text in JS?

Good day, friends!

Make the parser in nodeJs, there is an event, but on two different sites, it is called differently, for example:
Robin Haase VS Fabio Fognini
And on the second site:
Khase Robin VS Fabio Fognini

Problem:
Visually we can see that this one event, but written differently. If you look in detail, they vary considerably, such as the name of Haase and the Khas, and the procedure name.
Don't know how to write the algorithm that will be able to calculate how these strings are similar without considering the word order and make the cut by the index, if it is for example less than 60%.

Task:
In other words, the algorithm should clearly be able to tell us what is most likely given the example of two strings - a view of the same events.

Anyone have any ideas?
June 14th 19 at 20:56
3 answers
June 14th 19 at 20:58
Solution
here is a package for the analysis of natural languages
https://www.npmjs.com/package/natural
Including there are a number of function for analyzing the string similarity (same Levenshtein distance, etc.). Need to find what works best, maybe a combination of different metrics.
June 14th 19 at 21:00
Solution
You can try to parse the phrase into words, to sort in one direction, to merge the result back into a single string, then calculate the distance Levenstein and it is compared with some threshold value
June 14th 19 at 21:02
Here there is a library fuzzy-search

Find more questions by tags JavaScriptRegular expressions