PageRenderTime 53ms CodeModel.GetById 25ms RepoModel.GetById 1ms app.codeStats 0ms

/spelling-corrector/src/spell/Main.java

https://gitlab.com/mountain01/cs240-labs
Java | 33 lines | 13 code | 9 blank | 11 comment | 0 complexity | 6db5b5d1c0863c2e625a2dfcc24fc024 MD5 | raw file
  1. package spell;
  2. import java.io.IOException;
  3. import spell.ISpellCorrector.NoSimilarWordFoundException;
  4. /**
  5. * A simple main class for running the spelling corrector. This class is not
  6. * used by the passoff program.
  7. */
  8. public class Main {
  9. /**
  10. * Give the dictionary file name as the first argument and the word to correct
  11. * as the second argument.
  12. */
  13. public static void main(String[] args) throws NoSimilarWordFoundException, IOException {
  14. String dictionaryFileName = args[0];
  15. String inputWord = args[1];
  16. /**
  17. * Create an instance of your corrector here
  18. */
  19. ISpellCorrector corrector = new Spell();
  20. corrector.useDictionary(dictionaryFileName);
  21. String suggestion = corrector.suggestSimilarWord(inputWord);
  22. System.out.println("Suggestion is: " + suggestion);
  23. }
  24. }