@Override protected List<Double> computeRelatedness(Page page1,Page page2) throws WikiApiException {
  List<String> tokens1=tokenizeText(getTextToTokenize(page1));
  List<String> tokens2=tokenizeText(getTextToTokenize(page2));
  Map<String,Integer> tokenMap1=getTokenMap(tokens1);
  Map<String,Integer> tokenMap2=getTokenMap(tokens2);
  logger.debug("Token map sizes: " + tokenMap1.size() + " "+ tokenMap2.size());
  double relatedness;
  if (tokenMap1.size() == 0 || tokenMap2.size() == 0) {
    relatedness=0.0;
  }
 else {
    logger.debug(CommonUtilities.getMapContents(tokenMap1));
    logger.debug(CommonUtilities.getMapContents(tokenMap2));
    double overlap=getOverlap(tokenMap1,tokenMap2);
    List<Double> lengthList=new ArrayList<Double>();
    lengthList.add((double)tokenMap1.size());
    lengthList.add((double)tokenMap2.size());
    relatedness=overlap / getMinimum(lengthList);
  }
  List<Double> returnList=new ArrayList<Double>();
  returnList.add(relatedness);
  return returnList;
}

@ Override protected List < Double > computeRelatedness ( Page page1 , Page page2 ) throws WikiApiException { List < String > tokens1 = tokenizeText ( getTextToTokenize ( page1 ) ) ; List < String > tokens2 = tokenizeText ( getTextToTokenize ( page2 ) ) ; Map < String , Integer > tokenMap1 = getTokenMap ( tokens1 ) ; Map < String , Integer > tokenMap2 = getTokenMap ( tokens2 ) ; logger . debug ( "Token map sizes: " + tokenMap1 . size ( ) + " " + tokenMap2 . size ( ) ) ; double relatedness ; if ( tokenMap1 . size ( ) == 0 || tokenMap2 . size ( ) == 0 ) { relatedness = 0.0 ; } else { logger . debug ( CommonUtilities . getMapContents ( tokenMap1 ) ) ; logger . debug ( CommonUtilities . getMapContents ( tokenMap2 ) ) ; double overlap = getOverlap ( tokenMap1 , tokenMap2 ) ; List < Double > lengthList = new ArrayList < Double > ( ) ; lengthList . add ( ( double ) tokenMap1 . size ( ) ) ; lengthList . add ( ( double ) tokenMap2 . size ( ) ) ; relatedness = overlap / getMinimum ( lengthList ) ; } List < Double > returnList = new ArrayList < Double > ( ) ; returnList . add ( relatedness ) ; return returnList ; }
implements the distance measure by lesk ( 1986 ) lesk ( c1 , c2 ) = overlap ( t1 , t2 ) / max ( length ( t1 ) , length ( t2 ) ) the overlap is normalized by the maximum length of two texts to fall into [ 0 , 1 ] . there can only be max ( length ( t1 ) , length ( t2 ) overlaps .
