Answer the question
In order to leave comments, you need to log in
How to generate errors for a keyword?
Good afternoon, please tell me which library can be used to generate errors for a keyword? The task is to implement an inexact search using the Livenshtein algorithm. There are 1000 keywords in the input. It is necessary to generate errors for each keyword (typos, breaks, substitutions) to form a dictionary of errors. Can you tell me how this can be done? Thank you very much in advance!
Answer the question
In order to leave comments, you need to log in
There is no such library, do it yourself, with the usual enumeration.
- breaks: cycle by the number of letters in the word - 1: insert a space at the i-th place
- repeat if necessary two, three .. more breaks in the word, skipping more than one space
nearby character
- doubling characters: the same only instead of substituting a space, we substitute the current character
- typos and substitutions
in a bad version, by searching for each valid character we do the same as for a space
in a good version, for each character we set a list of characters that it can be replaced (adjacent on the keyboard)
as a result, for each word there will be an array of its modifications.
ps I do not understand how all this will help solve the problem?
The task is to implement an inexact search using the Livenshtein algorithmthis algorithm is quite specific and very simple, there are no generations of substitutions and typos in it
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question