Examples of RelationArgument


Examples of org.apache.ctakes.typesystem.type.relation.RelationArgument

              arg1 = arg2;
              arg2 = temp;
            }

            // add the relation to the CAS
            RelationArgument relArg1 = new RelationArgument(relationView);
            relArg1.setArgument(arg1);
            relArg1.setRole("Argument");
            relArg1.addToIndexes();
            RelationArgument relArg2 = new RelationArgument(relationView);
            relArg2.setArgument(arg2);
            relArg2.setRole("Related_to");
            relArg2.addToIndexes();
            BinaryTextRelation relation = new BinaryTextRelation(relationView);
            relation.setArg1(relArg1);
            relation.setArg2(relArg2);
            relation.setCategory(predictedCategory);
            relation.addToIndexes();
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.relation.RelationArgument

        entityMention.setConfidence(1);
        entityMention.addToIndexes();
        spanToEntity.put(entityMentionSpan, entityMention);
      }

      RelationArgument relationArgument1 = new RelationArgument(jCas);
      relationArgument1.setId(relationArgumentId++);
      relationArgument1.setArgument(modifier);
      relationArgument1.setRole(Constants.shareModifierRole);

      RelationArgument relationArgument2 = new RelationArgument(jCas);
      relationArgument2.setId(relationArgumentId++);
      relationArgument2.setArgument(entityMention);
      relationArgument2.setRole(Constants.shareEntityMentionRole);

      BinaryTextRelation binaryTextRelation = new BinaryTextRelation(jCas);
      binaryTextRelation.setArg1(relationArgument1);
      binaryTextRelation.setArg2(relationArgument2);
      binaryTextRelation.setId(relationId++);
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.relation.RelationArgument

        entityMention2.setConfidence(1);
        entityMention2.addToIndexes();
        spanToEntity.put(span2, entityMention2);
      }

      RelationArgument relationArgument1 = new RelationArgument(jCas);
      relationArgument1.setId(relationArgumentId++);
      relationArgument1.setArgument(entityMention1);
      relationArgument1.setRole(relationInfo.role1);

      RelationArgument relationArgument2 = new RelationArgument(jCas);
      relationArgument2.setId(relationArgumentId++);
      relationArgument2.setArgument(entityMention2);
      relationArgument2.setRole(relationInfo.role2);

      BinaryTextRelation binaryTextRelation = new BinaryTextRelation(jCas);
      binaryTextRelation.setArg1(relationArgument1);
      binaryTextRelation.setArg2(relationArgument2);
      binaryTextRelation.setId(relationId++);
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.relation.RelationArgument

              this.sourceFile));
        }
      }

      // add the relation to the CAS
      RelationArgument sourceRA = new RelationArgument(jCas);
      sourceRA.setArgument(sourceMention);
      sourceRA.addToIndexes();
      RelationArgument targetRA = new RelationArgument(jCas);
      targetRA.setArgument(targetMention);
      targetRA.addToIndexes();
      BinaryTextRelation relation = new BinaryTextRelation(jCas);
      if (this.type != null) {
        // TODO: do something better with knowtatorRelation.annotation.type
        relation.setCategory(this.annotation.type + '_' + this.type);
      } else {
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.relation.RelationArgument

        bestAnte = processDem(anaphor, ll, jcas);
      }

      if(bestAnte.prob > CorefConsts.COREF_THRESHOLD){
        CoreferenceRelation cr = new CoreferenceRelation(jcas);
        RelationArgument ra1 = new RelationArgument(jcas);
        ra1.setId(bestAnte.m.getId());
        ra1.setArgument(bestAnte.m.getContent());
        ra1.setRole("antecedent");
        RelationArgument ra2 = new RelationArgument(jcas);
        ra2.setId(anaphor.getId());
        ra2.setArgument(anaphor.getContent());
        ra2.setRole("anaphor");
        cr.setArg1(ra1);
        cr.setArg2(ra2);
        cr.setConfidence(bestAnte.prob);
        ra1.addToIndexes();
        ra2.addToIndexes();
        cr.addToIndexes();
        ppt.union(m2q.get(anaphor), m2q.get(bestAnte.m));
        if(anaphor instanceof PronounMarkable){
          // if the anaphor is a pronoun then it won't be in the cas as an identifiedannotation so we need to add it.
          IdentifiedAnnotation ia = new IdentifiedAnnotation(jcas);
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.relation.RelationArgument

      for(BinaryTextRelation goldrel : goldRelations){
        Annotation goldArg1 = goldrel.getArg1().getArgument();
        Annotation goldArg2 = goldrel.getArg2().getArgument();
        if (matchSpan(sysArg2, goldArg1) && matchSpan(sysArg1, goldArg2)){//the order of system pair was flipped
          if(sysrel.getCategory().equals("OVERLAP")){ //if the relation is overlap, and the arg order was flipped, then change back the order
            RelationArgument tempArg = (RelationArgument) sysrel.getArg1().clone();
            sysrel.setArg1((RelationArgument) sysrel.getArg2().clone());
            sysrel.setArg2(tempArg);
          }//for other types of relation, still maintain the type.
          continue;
        }
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.relation.RelationArgument

        throw new AnalysisEngineProcessException(e);
      }

      for(BinaryTextRelation relation : Lists.newArrayList(JCasUtil.select(relationView, BinaryTextRelation.class))){
        //          if(relation.getCategory().equals("CONTAINS")){
        RelationArgument arg1 = relation.getArg1();
        RelationArgument arg2 = relation.getArg2();
        if(arg1.getArgument() instanceof TimeMention && arg2.getArgument() instanceof EventMention ||
            arg1.getArgument() instanceof EventMention && arg2.getArgument() instanceof TimeMention){
          // these are the kind we keep.
          continue;
        }
        //            if(arg1.getArgument() instanceof EventMention && arg2.getArgument() instanceof EventMention){
        arg1.removeFromIndexes();
        arg2.removeFromIndexes();
        relation.removeFromIndexes();
      }
      //        }

    }
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.relation.RelationArgument

      }

      // add new, transitive relations
      for (Annotation contained : isContainedIn.keySet()) {
        for (Annotation container : isContainedIn.get(contained)) {
          RelationArgument arg1 = new RelationArgument(jCas);
          arg1.setArgument(container);
          RelationArgument arg2 = new RelationArgument(jCas);
          arg2.setArgument(contained);
          BinaryTextRelation relation = new BinaryTextRelation(jCas);
          relation.setArg1(arg1);
          relation.setArg2(arg2);
          relation.setCategory("CONTAINS");
          arg1.addToIndexes();
          arg2.addToIndexes();
          relation.addToIndexes();
        }
      }
    }
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.relation.RelationArgument

          containsRelations.add(relation);
        }
      }

      for (BinaryTextRelation relation : containsRelations) {
        RelationArgument arg1 = (RelationArgument) relation.getArg1().clone();
        RelationArgument arg2 = (RelationArgument) relation.getArg2().clone();
        BinaryTextRelation newrelation = new BinaryTextRelation(jCas);
        newrelation.setArg1(arg1);
        newrelation.setArg2(arg2);
        newrelation.setCategory("OVERLAP");
        arg1.addToIndexes();
        arg2.addToIndexes();
        newrelation.addToIndexes();
      }
    }
View Full Code Here

Examples of org.apache.ctakes.typesystem.type.relation.RelationArgument

        Annotation argA = orelation.getArg1().getArgument();
        Annotation argB = orelation.getArg2().getArgument();
        //add overlap
        if (!overlaps.containsEntry(argB, argA)) {
          //create a new flipped relation:
          RelationArgument arg1 = new RelationArgument(jCas);
          arg1.setArgument(argB);
          RelationArgument arg2 = new RelationArgument(jCas);
          arg2.setArgument(argA);
          BinaryTextRelation relation = new BinaryTextRelation(jCas);
          relation.setArg1(arg1);
          relation.setArg2(arg2);
          relation.setCategory("OVERLAP");
          arg1.addToIndexes();
          arg2.addToIndexes();
          relation.addToIndexes();
          overlaps.put(argB, argA);
        }

      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.