Package org.apache.ctakes.typesystem.type.textsem

Examples of org.apache.ctakes.typesystem.type.textsem.EventMention


  @Override
  public List<Feature> extract(JCas jCas, IdentifiedAnnotation arg1,
      IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
    ArrayList<Feature> feats = new ArrayList<>();
    EventMention event = null;
    TimeMention time = null;

    // swap the order if necessary:
//    if(arg2.getBegin() <= arg1.getBegin() && arg2.getEnd() <= arg1.getEnd()){
//      IdentifiedAnnotation temp = arg1;
//      arg1 = arg2;
//      arg2 = temp;
//    }

    if(arg1 instanceof EventMention && arg2 instanceof TimeMention){
      event = JCasUtil.selectCovering(jCas, EventMention.class, arg1.getBegin(), arg1.getEnd()).get(0);
      time = (TimeMention)arg2;
      if(event!=null && event.getEvent()!=null)
        feats.add(new Feature("Event-Modality-", event.getEvent().getProperties().getContextualModality()));
      feats.add(new Feature("Time-Class-", time.getTimeClass()));
    }else if(arg2 instanceof EventMention && arg1 instanceof TimeMention){
      time = (TimeMention)arg1;
      event = JCasUtil.selectCovering(jCas, EventMention.class, arg2.getBegin(), arg2.getEnd()).get(0);
      feats.add(new Feature("Timex-Class-", time.getTimeClass()));
      if(event!=null && event.getEvent()!=null)
        feats.add(new Feature("Event-Modality-", event.getEvent().getProperties().getContextualModality()));
    }
   
   
    return feats;
  }
View Full Code Here


  public List<Feature> extract(JCas jcas, IdentifiedAnnotation arg1,
      IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
    List<Feature> feats = new ArrayList<Feature>();

    //find event
    EventMention event = null;
    if(arg1 instanceof EventMention){
      event = (EventMention) arg1;
    }else if(arg2 instanceof EventMention){
      event = (EventMention) arg2;
    }else{
View Full Code Here

  @Override
  public List<Feature> extract(JCas jCas, IdentifiedAnnotation arg1,
      IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
    ArrayList<Feature> feats = new ArrayList<Feature>();
    EventMention event = null;
    TimeMention time = null;
   
    if(arg1 instanceof EventMention){
      event = (EventMention) arg1;
      time = (TimeMention) arg2;
View Full Code Here

      throws AnalysisEngineProcessException {

    List<Feature> features = new ArrayList<Feature>();
   
    if(arg1 instanceof EventMention) {
      EventMention event = (EventMention) arg1;
      String docTimeRel = event.getEvent().getProperties().getDocTimeRel();
      features.add(new Feature("arg1DocTimeRel", docTimeRel));
    }
   
    if(arg2 instanceof EventMention) {
      EventMention event = (EventMention) arg2;
      String docTimeRel = event.getEvent().getProperties().getDocTimeRel();
      features.add(new Feature("arg2DocTimeRel", docTimeRel));
    }
   
    return features;
  }
View Full Code Here

    String a1type="", a2type="";
    String eventModality="";
    String timeClass="";

    if(arg1 instanceof EventMention){
      EventMention mention = (EventMention) arg1;
      if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
        eventModality = mention.getEvent().getProperties().getContextualModality();
      }
      a1type = "EVENT-"+eventModality;
    }else if(arg1 instanceof TimeMention){
      timeClass = ((TimeMention)arg1).getTimeClass();
      a1type = "TIMEX-"+timeClass;
    }
   
    if(arg2 instanceof EventMention){
      EventMention mention = (EventMention) arg2;
      if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
        eventModality = mention.getEvent().getProperties().getContextualModality();
      }
      a2type = "EVENT"+eventModality;     
    }else if(arg2 instanceof TimeMention){
      timeClass = ((TimeMention)arg2).getTimeClass();
      a2type = "TIMEX-"+timeClass;     
View Full Code Here

    List<Feature> features = new ArrayList<Feature>();
   
    //1 get covering sentence:
    Map<EventMention, Collection<Segment>> coveringMap =
        JCasUtil.indexCovering(view, EventMention.class, Segment.class);
    EventMention targetTokenAnnotation = (EventMention)annotation;
    Collection<Segment> segList = coveringMap.get(targetTokenAnnotation);
   
    //2 get Verb Tense
    if (segList != null && !segList.isEmpty()){
      for(Segment seg : segList) {
View Full Code Here

    List<Feature> features = new ArrayList<Feature>();
   
    //1 get covering sentence:
    Map<EventMention, Collection<Sentence>> coveringMap =
        JCasUtil.indexCovering(view, EventMention.class, Sentence.class);
    EventMention targetTokenAnnotation = (EventMention)annotation;
    Collection<Sentence> sentList = coveringMap.get(targetTokenAnnotation);
   
    //2 get TimeX
    Map<Integer, IdentifiedAnnotation> timeDistMap = null;
   
View Full Code Here

    String a1type="", a2type="";
    String eventModality="";
    String timeClass;
   
    if(arg1 instanceof EventMention){
      EventMention mention = (EventMention) arg1;
      if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
        eventModality = mention.getEvent().getProperties().getContextualModality();
      }
      a1type = "EVENT-"+eventModality;
    }else if(arg1 instanceof TimeMention){
      timeClass = ((TimeMention)arg1).getTimeClass()
      a1type = "TIMEX-"+timeClass;
    }
   
    if(arg2 instanceof EventMention){
      EventMention mention = (EventMention) arg2;
      if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
        eventModality = mention.getEvent().getProperties().getContextualModality();
      }
      a2type = "EVENT-"+eventModality;     
    }else if(arg2 instanceof TimeMention){
      timeClass = ((TimeMention)arg2).getTimeClass();
      a2type = "TIMEX-"+timeClass;     
View Full Code Here

    String eventModality="";
    String timeClass="";
 
    // make sure we have the right classes
    if(arg1 instanceof EventMention){
      EventMention mention = (EventMention) arg1;
      if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
        eventModality = mention.getEvent().getProperties().getContextualModality();
      }
      arg1Tree = new SimpleTree("EVENT-"+eventModality);
    }else if(arg1 instanceof TimeMention){
      timeClass = ((TimeMention)arg1).getTimeClass();
      arg1Tree = new SimpleTree("TIMEX-"+timeClass);
    }else{
      throw new AnalysisEngineProcessException("Argument type not recognized (arg1) -- must be EventMention or TimeMention", null);
    }
   
    if(arg2 instanceof EventMention){
      EventMention mention = (EventMention) arg2;
      if(mention.getEvent() != null && mention.getEvent().getProperties() != null){
        eventModality = mention.getEvent().getProperties().getContextualModality();
      }
      arg2Tree = new SimpleTree("EVENT-"+eventModality);     
    }else if(arg2 instanceof TimeMention){
      timeClass = ((TimeMention)arg2).getTimeClass();
      arg2Tree = new SimpleTree("TIMEX-"+timeClass);     
View Full Code Here

      // create the event object
      Event event = new Event(jCas);
      event.setConfidence(1.0f);

      // create the event mention
      EventMention eventMention = new EventMention(jCas, neMention.getBegin(), neMention.getEnd());
      eventMention.setConfidence(1.0f);

      // add the links between event, mention and properties
      //        event.setProperties(eventProperties);
      //        event.setMentions(neMention.getOntologyConceptArr());
      eventMention.setEvent(event);
      eventMention.setOntologyConceptArr(neMention.getOntologyConceptArr());

      // add the annotations to the indexes
      //        eventProperties.addToIndexes();
      event.addToIndexes();
      eventMention.addToIndexes();
    }

    //add predicates
    for (Predicate predicate : JCasUtil.select(jCas, Predicate.class)) {
      // create the event object
      Event event = new Event(jCas);
      event.setConfidence(1.0f);

      // create the event mention
      EventMention eventMention = new EventMention(jCas, predicate.getBegin(), predicate.getEnd());
      eventMention.setConfidence(1.0f);

      // add the links between event, mention and properties
      //          event.setProperties(eventProperties);
      //          event.setMentions(neMention.getOntologyConceptArr());
      eventMention.setEvent(event);

      // add the annotations to the indexes
      //          eventProperties.addToIndexes();
      event.addToIndexes();
      eventMention.addToIndexes();
    }

  }
View Full Code Here

TOP

Related Classes of org.apache.ctakes.typesystem.type.textsem.EventMention

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.