public void addIfNoOverlap( WeightedPhraseInfo wpi ){ for( WeightedPhraseInfo existWpi : getPhraseList() ){ if( existWpi.isOffsetOverlap( wpi ) ) { // WeightedPhraseInfo.addIfNoOverlap() dumps the second part of, for example, hyphenated words (social-economics). // The result is that all informations in TermInfo are lost and not available for further operations. existWpi.getTermsInfos().addAll( wpi.getTermsInfos() ); return; } } getPhraseList().add( wpi ); }
for ( TermInfo ti : phraseInfo.getTermsInfos()) { if ( distinctTerms.add( ti.getText() ) ) phraseTotalBoost += ti.getWeight() * phraseInfo.getBoost();