Class ModifyingSuggester
java.lang.Object
org.apache.lucene.analysis.hunspell.ModifyingSuggester
A class that modifies the given misspelled word in various ways to get correct suggestions
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FragmentCheckerprivate static final intprivate final Stringprivate final LinkedHashSet<Suggestion> private final Hunspellprivate final char[]private final WordCase -
Constructor Summary
ConstructorsConstructorDescriptionModifyingSuggester(Hunspell speller, LinkedHashSet<Suggestion> result, String misspelled, WordCase wordCase, FragmentChecker checker) -
Method Summary
Modifier and TypeMethodDescriptionprivate SuggestioncapitalizeAfterSpace(String candidate) private List<Suggestion> private booleancheckSimpleWord(String part) private SuggestioncreateSuggestion(String candidate) private voidenumerateMapReplacements(String word, String accumulated, int offset) private boolean(package private) booleansuggest()private voidtryAddingChar(String word) private voidtryDoubleSwapForShortWords(String word, int length) private voidtryLongSwap(String word) private voidtryModifiedSuggestions(int modOffset, String candidate) private voidtryMovingChar(String word) private voidtryNeighborKeys(String word) private voidtryRemovingChar(String word) private voidtryReplacingChar(String word) private voidtrySplitting(String word) private booleantrySuggestion(String candidate) private voidtrySwappingChars(String word) private voidtryTwoDuplicateChars(String word) private booleantryVariationsOf(String word)
-
Field Details
-
MAX_CHAR_DISTANCE
private static final int MAX_CHAR_DISTANCE- See Also:
-
result
-
misspelled
-
wordCase
-
fragmentChecker
-
tryChars
private final char[] tryChars -
speller
-
tried
-
-
Constructor Details
-
ModifyingSuggester
ModifyingSuggester(Hunspell speller, LinkedHashSet<Suggestion> result, String misspelled, WordCase wordCase, FragmentChecker checker)
-
-
Method Details
-
suggest
boolean suggest()- Returns:
- whether any of the added suggestions are considered "good"
-
createSuggestion
-
capitalizeAfterSpace
-
tryVariationsOf
-
tryRep
-
enumerateMapReplacements
-
checkSimpleWord
-
trySwappingChars
-
tryDoubleSwapForShortWords
-
tryNeighborKeys
-
tryModifiedSuggestions
-
tryLongSwap
-
tryRemovingChar
-
tryAddingChar
-
tryMovingChar
-
tryReplacingChar
-
tryTwoDuplicateChars
-
checkDictionaryForSplitSuggestions
-
trySplitting
-
shouldSplitByDash
private boolean shouldSplitByDash() -
trySuggestion
-