SpellChecker is a Java-based command-line spell-checking tool that allows users to check the spelling of words in a given text file against a predefined dictionary. It provides suggestions for misspelled words and allows users to update the dictionary or choose alternative words.
- Spell Checking: The program compares words in a text file against a dictionary to identify misspelled words.
- Suggestions: For each misspelled word, the program suggests alternative words based on the Levenshtein distance.
- Dictionary Management: Users can choose to add new words to the dictionary or provide alternative spellings.
- File Handling: The tool reads input from a text file and outputs results to another file.
- Java Development Kit (JDK) installed on your machine.
- Text file with content for spell checking.
- Compile Java Files:
Open a terminal or command prompt and navigate to the project directory. Compile both Java files:
javac Spellchecker.java
javac SpellCheckerSuggestion.java
2. Run SpellChecker:
Execute the SpellChecker program by providing the text file as an argument:
java Spellchecker Text1.txt
If no file is provided, the program will prompt you to enter a valid file.
- Review Suggestions:
For each misspelled word, the program will prompt you with suggestions. Choose from the presented options:
- +) Add the word to the dictionary.
- -) Enter an alternative spelling.
- Any other input terminates the program.
- Run SpellCheckerSuggestion:
Execute the SpellCheckerSuggestion program similarly:
java SpellCheckerSuggestion Text1.txt
Follow the prompts to review suggestions and update the dictionary or provide alternatives.
- Updating the Dictionary
The program maintains a dictionary in the dictionary.txt file. Newly added words or alternative spellings are appended to this file.
Feel free to contribute to the project by submitting pull requests or reporting issues. Your feedback is valuable in enhancing the functionality of the SpellChecker tool.
This project is licensed under the MIT License.
Note: Ensure you have appropriate permissions to read and write files in the project directory. If you encounter any issues, check file permissions and provide the necessary access.