private ArrayList obtainCandidateList ( String [ ] tTokens , String [ ] uTokens , double [ ] tIdfArray , double [ ] uIdfArray ) { ArrayList candidateList = new ArrayList ( ) ; double minStringSize = getMinStringSize ( tTokens , uTokens ) ; for ( int t = 0 ; t < tTokens . length ; t ++ ) { int lastTr = - 1 ; for ( int u = 0 , flag = 0 ; u < uTokens . length && flag == 0 ; u ++ ) { int tr = Math . abs ( t - u ) ; if ( lastTr >= 0 && lastTr < tr ) { flag = 1 ; } else { String tTok = tTokens [ t ] , uTok = uTokens [ u ] ; double innerScore = tokenDistance . score ( tTok , uTok ) ; if ( innerScore >= 0.0 ) { double matched = 0.0 ; if ( innerScore == 1.0 ) { matched = tTokens [ t ] . length ( ) ; } else { matched = ( ( TagLinkToken ) tokenDistance ) . getMatched ( ) ; } double weightMatched = matched / minStringSize , weightTFIDF = tIdfArray [ t ] * uIdfArray [ u ] , weight = ( weightTFIDF + weightMatched ) / 2.0 ; if ( innerScore == 1 ) { lastTr = tr ; } candidateList . add ( new Candidates ( t , u , innerScore * weight ) ) ; } } } } return candidateList ; }
obtainCandidateList set a candidate list of pair of tokens . Sometimes it will not compute all candidate pairs in oder to reduce the computational cost .