Levenshtein Distance only from part of a line (Java)

I have an online application with a top menu tree for opening various widgets to perform various tasks. As the application becomes more powerful, this tree has become large and difficult to navigate. I implemented a search function where users can simply type the name of a menu or part of it, and I use a regular expression to search for all items in the menu tree that match the type of user. My regular expression allows partial words and swapped words, and also limits the search at the beginning of each word. The only thing he does not allow is the words with errors. I understand that to use misspelled words, it’s better not to use a regular expression and use the string distance method instead, but I still want to allow the partial word and the words swapped. Is it possible?

For example, right now, if the menu item "Tariff Maintenance", any of the following will correspond to this menu item: "finance", "finance", "interest financing", etc. "." will not match because "inance" does not appear at the beginning of any of the words for this menu item. I want searches such as "speed fnane" and "keeping speed" that were spelled incorrectly.

+3
source share
1 answer

. , , , . , . .

, .

( python) http://norvig.com/spell-correct.html

+1

Source: https://habr.com/ru/post/1758450/


All Articles