Пример #1
0
  private EnsembleMentionEntitySimilarity prepapreMES() {
    Entities entities = new Entities();
    for (Mention mention : input.getMentions().getMentions()) {
      MentionTracer mt = new MentionTracer(mention);
      tracer.addMentionForDocId(docId, mention, mt);
      for (Entity entity : mention.getCandidateEntities()) {
        EntityTracer et = new EntityTracer(entity.getName());
        tracer.addEntityForMention(mention, entity.getName(), et);
      }
      entities.addAll(mention.getCandidateEntities());
    }

    logger.info(
        "Disambiguating '"
            + docId
            + "' ("
            + input.getMentions().getMentions().size()
            + " mentions, "
            + entities.size()
            + " entities)");

    if (includeNullAsEntityCandidate) {
      entities.setIncludesNmeEntities(true);
    }

    EnsembleMentionEntitySimilarity mes = null;
    try {
      mes = new EnsembleMentionEntitySimilarity(input.getMentions(), entities, ss, docId, tracer);
      return mes;
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
  }
Пример #2
0
 @Override
 protected void setupEntities(Entities e) throws SQLException {
   inlinkImportance = new TIntDoubleHashMap();
   TIntObjectHashMap<int[]> neighbors = DataAccess.getInlinkNeighbors(e);
   double collectionSize = (double) DataAccess.getCollectionSize();
   for (int eId : e.getUniqueIds()) {
     double importance = (double) neighbors.get(eId).length / (double) collectionSize;
     inlinkImportance.put(eId, importance);
   }
 }