W
W
Wyan2018-02-20 16:33:49
JavaScript
Wyan, 2018-02-20 16:33:49

How to implement a search for words with typos or minor discrepancies?

There is a corpus of words, for each of which you need to find inexact matches in the text, with the possibility of typos or differences in one or two characters. For example: color - colour, gray - gray, etc. For long words, there may be more differences.
Thanks in advance for your reply!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xmoonlight, 2018-02-20
@xmoonlight

Count consecutive correct letters and mismatch letters (missing, any extra, another instead of the right one), remember the distances for all erroneous chains.
Then subtract all error distances from the minimum line length and divide by the length of this minimum line. Get the coefficient of mismatch. Multiplying it by 100 will give you the percentage of string mismatch.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question