Package org.apache.ctakes.relationextractor.knowtator

Examples of org.apache.ctakes.relationextractor.knowtator.Span


      HashMap<String, String> entityTypes = XMLReader.getEntityTypes(document);
     
      for(Map.Entry<String, ArrayList<Span>> entry : entityMentions.entrySet()) {

        // for disjoint spans, just ignore the gap
        Span first = entry.getValue().get(0);
        Span last = entry.getValue().get(entry.getValue().size() - 1);
       
        EntityMention entityMention = new EntityMention(initView, first.start, last.end);
        entityMention.setTypeID(Mapper.getEntityTypeId(entityTypes.get(entry.getKey())));
        entityMention.setId(identifiedAnnotationId++);
        entityMention.setDiscoveryTechnique(CONST.NE_DISCOVERY_TECH_GOLD_ANNOTATION);
View Full Code Here


      if(uniqueRelations.contains(relationInfo)) {
        continue;
      }
      uniqueRelations.add(relationInfo);

      Span modifierSpan;
      int modifierType;
      // need to find out which of the two arguments is the modifier
      if(Constants.modifierClasses.contains(entityTypes.get(relationInfo.id1))) {
        Span first = entityMentions.get(relationInfo.id1).get(0);
        Span last = entityMentions.get(relationInfo.id1).get(entityMentions.get(relationInfo.id1).size() - 1);
        modifierSpan = new Span(first.start, last.end);
        modifierType = Mapper.getModifierTypeId(entityTypes.get(relationInfo.id1));
      }
      else if(Constants.modifierClasses.contains(entityTypes.get(relationInfo.id2))) {
        Span first = entityMentions.get(relationInfo.id2).get(0);
        Span last = entityMentions.get(relationInfo.id2).get(entityMentions.get(relationInfo.id2).size() - 1);
        modifierSpan = new Span(first.start, last.end);
        modifierType = Mapper.getModifierTypeId(entityTypes.get(relationInfo.id2));
      }
      else {
        continue; // neither of the arguments is a modifier; probably an annotation error
      }
     
      Span entityMentionSpan;
      int entityMentionType;
      // need to find out which of the two arguments is the entity mention
      if(! Constants.modifierClasses.contains(entityTypes.get(relationInfo.id1))) {
        Span first = entityMentions.get(relationInfo.id1).get(0);
        Span last = entityMentions.get(relationInfo.id1).get(entityMentions.get(relationInfo.id1).size() - 1);
        entityMentionSpan = new Span(first.start, last.end);
        entityMentionType = Mapper.getEntityTypeId(entityTypes.get(relationInfo.id1));
      }
      else if(! Constants.modifierClasses.contains(entityTypes.get(relationInfo.id2))) {
        Span first = entityMentions.get(relationInfo.id2).get(0);
        Span last = entityMentions.get(relationInfo.id2).get(entityMentions.get(relationInfo.id2).size() - 1);
        entityMentionSpan = new Span(first.start, last.end);
        entityMentionType = Mapper.getEntityTypeId(entityTypes.get(relationInfo.id2));
      }
      else {
        continue; // neither of the arguments is an entity mention; probably an annotation error
      }
View Full Code Here

        continue;
      }
      uniqueRelations.add(relationInfo);

      // for disjoint spans, just ignore the gap
      Span first1 = entityMentions.get(relationInfo.id1).get(0);
      Span last1 = entityMentions.get(relationInfo.id1).get(entityMentions.get(relationInfo.id1).size() - 1);
      Span span1 = new Span(first1.start, last1.end);

      EntityMention entityMention1 = null;
      if(spanToEntity.containsKey(span1)) {
        // an entity with the same span has already been added to the cas
        entityMention1 = spanToEntity.get(span1);
      }
      else {
        // this entity still needs to be addded to the cas
        entityMention1 = new EntityMention(jCas, span1.start, span1.end);
        entityMention1.setTypeID(Mapper.getEntityTypeId(entityTypes.get(relationInfo.id1)));
        entityMention1.setId(identifiedAnnotationId++);
        entityMention1.setDiscoveryTechnique(CONST.NE_DISCOVERY_TECH_GOLD_ANNOTATION);
        entityMention1.setConfidence(1);
        entityMention1.addToIndexes();
        spanToEntity.put(span1, entityMention1);
      }

      // again, rememeber that some entities have disjoint spans
      Span first2 = entityMentions.get(relationInfo.id2).get(0);
      Span last2 = entityMentions.get(relationInfo.id2).get(entityMentions.get(relationInfo.id2).size() - 1);
      Span span2 = new Span(first2.start, last2.end);

      EntityMention entityMention2 = null;
      if(spanToEntity.containsKey(span2)) {
        // an entity with this span already exists in the cas
        entityMention2 = spanToEntity.get(span2);
View Full Code Here

      HashMap<Span, EntityMention> spanToEntity) {

    // add the rest of entities to the cas
    for(Map.Entry<String, ArrayList<Span>> entry : entityMentions.entrySet()) {

      Span first = entry.getValue().get(0);
      Span last = entry.getValue().get(entry.getValue().size() - 1);
      Span span = new Span(first.start, last.end);

      // has this span been added already?
      if(spanToEntity.containsKey(span)) {
        continue;
      }
View Full Code Here

TOP

Related Classes of org.apache.ctakes.relationextractor.knowtator.Span

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.