@Override
  public void collectionProcessComplete(ProcessTrace arg0) throws ResourceProcessException,
          IOException {

    super.collectionProcessComplete(arg0);
    
    // TODO :: compute the cosine similarity measure
    for(queryAnswers qa: QAList){
      HashMap<String, Integer> queryVector = qa.queryTermFreqMap;
      for(HashMap<String, Integer> docVector: qa.answersTermfreqMapList){
        double sim = computeCosineSimilarity(queryVector, docVector);
        qa.answersScoreList.add(sim);
      }
      
    }
    
    // TODO :: compute the rank of retrieved sentences
    for(queryAnswers qa: QAList){
      int correctAnswerRank=1;
      
      /*find index of correct answer in AnswerLists*/
      int correctAnswerIndex=0;
      for(Integer rel: qa.AnswerRelList){
        if(rel != 1)
          correctAnswerIndex++;
        else
          break;
      }

      /*compute rank*/
      Double correctAnswerSim = qa.answersScoreList.get(correctAnswerIndex);
      for(int i=0; i<qa.answersScoreList.size(); i++){
        if(i != correctAnswerIndex){
          if(correctAnswerSim < qa.answersScoreList.get(i))
            correctAnswerRank++;
        }
      }
      
      /*save rank to qa.rankList*/
      qa.correctAnswerRank = correctAnswerRank;
      
      System.out.println("Score: "+correctAnswerSim+" rank="+correctAnswerRank+" rel=1 qid="+qa.qid+" sent"+(correctAnswerIndex+1));
    }    

    // TODO :: compute the metric:: mean reciprocal rank
    double metric_mrr = compute_mrr();
    System.out.println(" (MRR) Mean Reciprocal Rank ::" + metric_mrr);
  }