W
W
w_b_x2017-10-02 15:03:08
JavaScript
w_b_x, 2017-10-02 15:03:08

How to compare two texts in JS?

Good day, friends!
I am making a parser on nodeJs, there is an event, but on two different sites, it names differently, for example:
Robin Haase VS Fabio Fognini
And on the second site:
Hase Robin VS Fognini Fabio
Problem:
Visually we can see that this is one event, but written differently. If you look in detail, they differ significantly, for example, the surname Haase and Hase, as well as the order of the first and last names.
I don’t know how to write an algorithm that can calculate how similar these lines are without taking into account the word order and cut off by a coefficient if, for example, it is less than 60%.
Task:
In other words, the algorithm must clearly tell us that the two lines given in the example are most likely representations of the same event.
Who has ideas?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
R
RidgeA, 2017-10-02
@w_b_x

here is a package for analyzing natural languages
​​https://www.npmjs.com/package/natural
Including there is a number of functions for analyzing the similarity of strings (the same Levenshtein distance and others). It is necessary to select what is best suited, perhaps a combination of different metrics.

D
davidnum95, 2017-10-02
@davidnum95

Here is another fuzzy-search library

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question