Exemple #1
0
  private void processMatchedConcepts(
      List<Concept> matchedConcepts,
      String matchedText,
      int tokenPosn,
      Map<Concept, Score> tokTable,
      PrintWriter pw) {
    // Increment match score of the matched concept and record information
    // about where in the article it was found
    for (Concept c : matchedConcepts) {
      Score cnt = tokTable.get(c);
      if (cnt == null) {
        tokTable.put(c, new Score(tokenPosn));
      } else {
        cnt.addMatch(tokenPosn);
      }

      // Output the concept to the token file for debugging purposes
      if (pw != null) {
        pw.println(c.getName() + "<" + c.getKey() + ">:" + tokenPosn + ":TEXT=" + matchedText);
      }
      System.out.println(
          c.getName() + "<" + c.getKey() + ">:" + tokenPosn + ":TEXT=" + matchedText);
    }
  }