A small Python project that finds similar fruit names using the Levenshtein distance algorithm — detects typos, spelling mistakes, and close matches.
You can try the Fruit AI project online here:
🔗 Fruit AI Live Demo
fruit-ai/
│
├── data/
│ └── fruits.json # list of fruits
│
├── ai/
│ └── levenshtein.py # Levenshtein algorithm
│
├── core/
│ └── matcher.py # match and group similar fruits
│
└── main.py # user interface
- Python 3.9+
- No third-party packages needed
git clone https://github.com/itzpremsingh/fruit-ai.git
cd fruit-ai
python -m fruit-ai.main
python /path/to/fruit-ai/main.py
Replace /path/to/fruit-ai/
with the actual path on your system.
-
Uses Levenshtein distance to compare the input word with each fruit name.
-
Groups results by distance value:
Distance Meaning 0 Exact match 1 Small typo 2 Close match 3 Similar word
- Add confidence score (similarity %).
- Show top auto-suggestion.
- Support multiple datasets (e.g., animals, cities).
This project is open source under the MIT License.