question: private LinkedHashMap < Term , Integer > repeatingTerms ( ) { LinkedHashMap < Term , Integer > tord = new LinkedHashMap < > ( ) ; HashMap < Term , Integer > tcnt = new HashMap < > ( ) ; for ( PhrasePositions pp : phrasePositions ) { for ( Term t : pp . terms ) { Integer cnt0 = tcnt . get ( t ) ; Integer cnt = cnt0 == null ? new Integer ( 1 ) : new Integer ( 1 + cnt0 . intValue ( ) ) ; tcnt . put ( t , cnt ) ; if ( cnt == 2 ) { tord . put ( t , tord . size ( ) ) ; } } } return tord ; }
target:  find repeating terms and assign them ordinal values 