Python Forum

Full Version: Database search
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I would like to have a search function in my app where the user types in a name and the database is searched for the record that matches that name however, the user may not know the correct spelling of the name that they are looking for. For example, the database may contain the name of Anomalocaris but the user enters Anamalacares into the search box. How can you get the proper record in this case?

I have looked at libraries such as FuzzyWuzzy but documentation is sparse and examples that I have seen need the name that is entered as well as the string to compare it with and then simply returns a number indicating the number of differences between the two.

What is the best way to resolve the problem of finding a record based upon a misspelled name?
Thank you for your response. Being new to Python, and looking at the code in their example, it is still not clear to me how it works when searching a database based upon the user's input which may not have the proper spelling. Again, it is talking about returning numbers as weights. Are you supposed to select the record with the highest number?