private boolean isNotCompound ( String word ) throws IOException { List < String > probablyCorrectWords = new ArrayList <> ( ) ; List < String > testedTokens = new ArrayList <> ( 2 ) ; for ( int i = 2 ; i < word . length ( ) ; i ++ ) { // chop from left to right final String first = word . substring ( 0 , i ) ; final String second = word . substring ( i , word . length ( ) ) ; if ( prefixes . contains ( first . toLowerCase ( conversionLocale ) ) && ! isMisspelled ( speller1 , second ) && second . length ( ) > first . length ( ) ) { // but not for short words such as "premoc" // ignore this match, it's fine probablyCorrectWords . add ( word ) ; // FIXME: some strange words are being accepted, like prekupa } else { testedTokens . clear ( ) ; testedTokens . add ( first ) ; testedTokens . add ( second ) ; List < AnalyzedTokenReadings > taggedToks = language . getTagger ( ) . tag ( testedTokens ) ; if ( taggedToks . size ( ) == 2 // "białozielony", trzynastobitowy && ( taggedToks . get ( 0 ) . hasPosTag ( "adja" ) || ( taggedToks . get ( 0 ) . hasPosTag ( "num:comp" ) && ! taggedToks . get ( 0 ) . hasPosTag ( "adv" ) ) ) && taggedToks . get ( 1 ) . hasPartialPosTag ( "adj:" ) ) { probablyCorrectWords . add ( word ) ; } } } if ( ! probablyCorrectWords . isEmpty ( ) ) { addIgnoreTokens ( probablyCorrectWords ) ; return false ; } return true ; }
Check whether the word is a compound adjective or contains a non - splitting prefix . Used to suppress false positives .