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
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final FragmentChecker
private static final int
private final String
private final LinkedHashSet<Suggestion>
private final Hunspell
private final char[]
private final WordCase
-
Constructor Summary
ConstructorsConstructorDescriptionModifyingSuggester
(Hunspell speller, LinkedHashSet<Suggestion> result, String misspelled, WordCase wordCase, FragmentChecker checker) -
Method Summary
Modifier and TypeMethodDescriptionprivate Suggestion
capitalizeAfterSpace
(String candidate) private List<Suggestion>
private boolean
checkSimpleWord
(String part) private Suggestion
createSuggestion
(String candidate) private void
enumerateMapReplacements
(String word, String accumulated, int offset) private boolean
(package private) boolean
suggest()
private void
tryAddingChar
(String word) private void
tryDoubleSwapForShortWords
(String word, int length) private void
tryLongSwap
(String word) private void
tryModifiedSuggestions
(int modOffset, String candidate) private void
tryMovingChar
(String word) private void
tryNeighborKeys
(String word) private void
tryRemovingChar
(String word) private boolean
private void
tryReplacingChar
(String word) private void
trySplitting
(String word) private boolean
trySuggestion
(String candidate) private void
trySwappingChars
(String word) private void
tryTwoDuplicateChars
(String word) private boolean
tryVariationsOf
(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
-