Class ModifyingSuggester


  • class ModifyingSuggester
    extends java.lang.Object
    A class that modifies the given misspelled word in various ways to get correct suggestions
    • Field Detail

      • result

        private final java.util.LinkedHashSet<Suggestion> result
      • misspelled

        private final java.lang.String misspelled
      • wordCase

        private final WordCase wordCase
      • tryChars

        private final char[] tryChars
      • speller

        private final Hunspell speller
      • tried

        private final java.util.Set<java.lang.String> tried
    • Method Detail

      • suggest

        boolean suggest()
        Returns:
        whether any of the added suggestions are considered "good"
      • createSuggestion

        private Suggestion createSuggestion​(java.lang.String candidate)
      • capitalizeAfterSpace

        private Suggestion capitalizeAfterSpace​(java.lang.String candidate)
      • tryVariationsOf

        private boolean tryVariationsOf​(java.lang.String word)
      • tryRep

        private boolean tryRep​(java.lang.String word)
      • enumerateMapReplacements

        private void enumerateMapReplacements​(java.lang.String word,
                                              java.lang.String accumulated,
                                              int offset)
      • checkSimpleWord

        private boolean checkSimpleWord​(java.lang.String part)
      • trySwappingChars

        private void trySwappingChars​(java.lang.String word)
      • tryDoubleSwapForShortWords

        private void tryDoubleSwapForShortWords​(java.lang.String word,
                                                int length)
      • tryNeighborKeys

        private void tryNeighborKeys​(java.lang.String word)
      • tryModifiedSuggestions

        private void tryModifiedSuggestions​(int modOffset,
                                            java.lang.String candidate)
      • tryLongSwap

        private void tryLongSwap​(java.lang.String word)
      • tryRemovingChar

        private void tryRemovingChar​(java.lang.String word)
      • tryAddingChar

        private void tryAddingChar​(java.lang.String word)
      • tryMovingChar

        private void tryMovingChar​(java.lang.String word)
      • tryReplacingChar

        private void tryReplacingChar​(java.lang.String word)
      • tryTwoDuplicateChars

        private void tryTwoDuplicateChars​(java.lang.String word)
      • checkDictionaryForSplitSuggestions

        private java.util.List<Suggestion> checkDictionaryForSplitSuggestions​(java.lang.String word)
      • trySplitting

        private void trySplitting​(java.lang.String word)
      • shouldSplitByDash

        private boolean shouldSplitByDash()
      • trySuggestion

        private boolean trySuggestion​(java.lang.String candidate)