Skip to content

Used Java to develop a spell checker; which goes through all words in a .txt file, correcting them and publishing the updated version to a new .txt file

Notifications You must be signed in to change notification settings

butrinto/Spell-Checker

Repository files navigation

SpellChecker Project

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.

Features

  • 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.

How to Run

Prerequisites:

  • Java Development Kit (JDK) installed on your machine.
  • Text file with content for spell checking.

Steps

  1. 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.

  1. 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.

  1. Run SpellCheckerSuggestion:
    Execute the SpellCheckerSuggestion program similarly:
java SpellCheckerSuggestion Text1.txt

Follow the prompts to review suggestions and update the dictionary or provide alternatives.

  1. Updating the Dictionary
    The program maintains a dictionary in the dictionary.txt file. Newly added words or alternative spellings are appended to this file.

Contributions and Issues

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.

License

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.

About

Used Java to develop a spell checker; which goes through all words in a .txt file, correcting them and publishing the updated version to a new .txt file

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages