public List < String > replaceRunOnWords ( final String original ) { final List < String > candidates = new ArrayList < String > ( ) ; String wordToCheck = original ; if ( ! dictionaryMetadata . getInputConversionPairs ( ) . isEmpty ( ) ) { wordToCheck = DictionaryLookup . applyReplacements ( original , dictionaryMetadata . getInputConversionPairs ( ) ) ; } if ( ! isInDictionary ( wordToCheck ) && dictionaryMetadata . isSupportingRunOnWords ( ) ) { for ( int i = 1 ; i < wordToCheck . length ( ) ; i ++ ) { // chop from left to right final CharSequence firstCh = wordToCheck . subSequence ( 0 , i ) ; if ( isInDictionary ( firstCh ) && isInDictionary ( wordToCheck . subSequence ( i , wordToCheck . length ( ) ) ) ) { if ( dictionaryMetadata . getOutputConversionPairs ( ) . isEmpty ( ) ) { candidates . add ( firstCh + " " + wordToCheck . subSequence ( i , wordToCheck . length ( ) ) ) ; } else { candidates . add ( DictionaryLookup . applyReplacements ( firstCh + " " + wordToCheck . subSequence ( i , wordToCheck . length ( ) ) , dictionaryMetadata . getOutputConversionPairs ( ) ) . toString ( ) ) ; } } } } return candidates ; }
Propose suggestions for misspelled run - on words . This algorithm is inspired by spell . cc in s_fsa package by Jan Daciuk .