Author - Adrian Tarantino (@AdrianTheHacker)
Here is where you can find all code relating to the real world problem in How do Phones Understand Your Typos? | Overview of Fuzzy Search Algorithms & Implementation - AdrianTheHacker. I encourage you to watch that video before attempting this problem.
If you have any testcases you'd like to contribute, or any corrections, feel free to create a pull request or leave a comment on the video!
Let’s just say a recipe app contains a search bar where users can type in the name of their favourite recipe, and the app will return the instructions for that recipe.
One of our clients really wants to make a given recipe. However, in his eagerness to start cooking he makes many typos and forgets to write one of the words in the name. Write an algorithm that would recommend the most likely food our client is looking for (hint: use a combination of Levenshtein distance and Cosine Similarity).
- Python 3 must be install
- All code must be written in Python3 and a Python3 interpreter must be used
- Pip is installed
- Clone the repository.
- Navigate to the cloned directory in your command terminal of choice.
- (Optional) Create a virtual environment inside of the project directory.
- Install project dependencies by typing in
pip install -r requirements.txt
- Navigate to
./src
directory in your command terminal of choice. - Run
Python test_RecipeManager.py
to test your code.
- In your code editor of choice, navigate to
./src/RecipeManager.py
. - Write your code inside
RecipeManager.matchRecipe(self, userInputtedRecipeName: str, recipesList: list[str])
.- Make sure to read through the specifications, parameters, and returns thoroughly before attempting.
- Navigate to
./src
in the terminal of your choice. - Test your function using by typing
python test_RecipeManager.py
in your terminal of choice.
- In your code editor of choice, navigate to
./src/test_RecipeManager.py
. - Change
from RecipeManager import RecipeManager
tofrom ExampleRecipeManager import RecipeManager
.- Note that in order to run your own code later, you must revert this change.
- In your terminal of choice, navigate to
./src
. - Test my demo-solution my typing
python test_RecipeManager.py
in your terminal of choice.