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