SpellChecker is a FastAPI-based application designed to efficiently manage and check the spelling of words. It utilizes a Trie data structure for quick word lookup and a JSON file to store words permanently.
- Word Suggestions: Get word suggestions based on a provided prefix.
- Word Validation: Check if a word exists in the dictionary.
- Insert Word: Add new words to the dictionary.
This project can be integrated into applications requiring auto-fill and auto-suggestions functionalities, enhancing user experience by providing real-time word suggestions and validations.
-
Clone the repository:
git clone https://github.com/dev-vivekkumarverma/SpellChecker.git cd spellchecker
-
Install the required packages:
pip install -r requirements.txt
-
Run the FastAPI server:
uvicorn main:app --reload
- URL:
/suggest/{word_prefix}
- Method:
GET
- Description: Get word suggestions based on the provided prefix.
- Example:
curl --location 'localhost:8000/suggest/hel'
- Response:
{ "given_pref": "hel", "suggestions_count": 545, "suggestions": ["hel", "hela", "helain", "helaina", "helaine", ...] }
- Response:
- URL:
/{word}
- Method:
GET
- Description: Check if a word exists in the dictionary.
- Example:
curl --location 'localhost:8000/Methionylthreonylthreonylglutaminylarginyltyrosylglutamylserine'
- Response:
{ "searched_word": "methionylthreonylthreonylglutaminylarginyltyrosylglutamylserine", "is_found": true }
- Response:
- URL:
/insert/{word}
- Method:
POST
- Description: Add a new word to the dictionary.
- Example:
curl --location --request POST 'localhost:8000/insert/pneumonoultramicroscopicsilicovolcanoconiosis'
- Response:
{ "word": "pneumonoultramicroscopicsilicovolcanoconiosis", "is_inserted": true }
- Response:
The application uses a Trie data structure for efficient word storage and retrieval, ensuring fast operations even with a large dataset.
Words are stored in a JSON file, allowing the dictionary to persist between restarts of the application.
For detailed API documentation, visit Postman API Documentation.
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Commit your changes (
git commit -am 'Add new feature'
). - Push to the branch (
git push origin feature-branch
). - Create a new Pull Request.
This project is licensed and reserved by the author (dev-vivekkumarverma) Vivek Kumar Verma.