PageRenderTime 42ms CodeModel.GetById 24ms RepoModel.GetById 0ms app.codeStats 0ms

/src/spelling/corrector/SpellingCorrectorHelper.java

https://github.com/juliengrenier/java-spelling-corrector
Java | 57 lines | 11 code | 10 blank | 36 comment | 0 complexity | 339765e8c66ed44f15e719be79d24228 MD5 | raw file
  1. package spelling.corrector;
  2. import java.util.Collection;
  3. import java.util.List;
  4. public interface SpellingCorrectorHelper {
  5. /**
  6. * Create a list of all deletions possible for the <code>word</code>.
  7. * Example : <b>good</b> will return {ood, god,goo}
  8. * @param word
  9. * @return
  10. */
  11. public List<String> getDeletion(final String word);
  12. /**
  13. * Create a list of all transpositions for the <code>word</code>
  14. * Example : <b>case</b> will return {acse, csae, caes}
  15. * @param word
  16. * @return
  17. */
  18. public List<String> getTransposition(final String word);
  19. /**
  20. * Create a list of all alterations for the <code>word</word>
  21. * It will replace every letter of the word with all the letters of the alphabet.
  22. * Example : <b>god</b> will return {aod,...,zod,gad,...gzd,gad,...,gzd,goa,goz}
  23. * @param word
  24. * @return
  25. */
  26. public List<String> getAlterations(final String word);
  27. /**
  28. * Create a list of all insertions for the <code>word</word>
  29. * It will insert every letter of the alphabet at every possible position of the word.
  30. * Example : <b>god</b> will return {agod,...,zgod,gaod,...gzod,goad,...,gozd,goda,godz}
  31. * @param word
  32. * @return
  33. */
  34. public List<String> getInsertions(final String word);
  35. /**
  36. * Return a set of alternative word of edit distance of 1
  37. * @param word
  38. * @return a Set of word
  39. */
  40. public Collection<String> getFirstDegreeAlternatives(final String word);
  41. /**
  42. * Return a set of alternative word of edit distance of 2
  43. * @param word
  44. * @return a Set of word
  45. */
  46. public Collection<String> getSecondDegreeAlternatives(final Collection<String> words);
  47. }