public final boolean getFinalUnificationValue ( Map < String , List < String > > uFeatures ) { int tokUnified = 0 ; for ( int j = 0 ; j < tokSequence . size ( ) ; j ++ ) { boolean unifiedTokensFound = false ; // assume that nothing has been found for ( int i = 0 ; i < tokSequenceEquivalences . get ( j ) . size ( ) ; i ++ ) { int featUnified = 0 ; if ( tokSequenceEquivalences . get ( j ) . get ( i ) . containsKey ( UNIFY_IGNORE ) ) { if ( i == 0 ) { tokUnified ++ ; } unifiedTokensFound = true ; continue ; } else { for ( Map . Entry < String , List < String > > feat : uFeatures . entrySet ( ) ) { if ( tokSequenceEquivalences . get ( j ) . get ( i ) . containsKey ( feat . getKey ( ) ) && tokSequenceEquivalences . get ( j ) . get ( i ) . get ( feat . getKey ( ) ) . isEmpty ( ) ) { featUnified = 0 ; } else { featUnified ++ ; } if ( featUnified == unificationFeats . entrySet ( ) . size ( ) && tokUnified <= j ) { tokUnified ++ ; unifiedTokensFound = true ; break ; } } } } if ( ! unifiedTokensFound ) { return false ; } } if ( tokUnified == tokSequence . size ( ) ) { return true ; } return false ; }
Make sure that we really matched all the required features of the unification .