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

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


        Event event = new Event(jCas);
        event.setConfidence(1.0f);
        event.setDiscoveryTechnique(CONST.NE_DISCOVERY_TECH_GOLD_ANNOTATION);

        // create the event mention
        EventMention eventMention = new EventMention(jCas, coveringSpan.begin, coveringSpan.end);
        eventMention.setConfidence(1.0f);
        eventMention.setDiscoveryTechnique(CONST.NE_DISCOVERY_TECH_GOLD_ANNOTATION);

        // add the links between event, mention and properties
        event.setProperties(eventProperties);
        event.setMentions(new FSArray(jCas, 1));
        event.setMentions(0, eventMention);
        eventMention.setEvent(event);

        // add the annotations to the indexes
        eventProperties.addToIndexes();
        event.addToIndexes();
        eventMention.addToIndexes();
        idAnnotationMap.put(annotation.id, eventMention);

      } else if ("DOCTIME".equals(annotation.type)) {
        // TODO
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 DateX
    if (sentList != null && !sentList.isEmpty()){
      for(Sentence sent : sentList) {
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);
   
    Map<Integer, WordToken> verbDistMap = null;
   
    //2 get all Verbs within the same sentence as target event lies
View Full Code Here

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

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

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

    return feats;
  }
View Full Code Here

  @Override
  public List<Feature> extract(JCas view, Annotation annotation) throws CleartkExtractorException {
    List<Feature> features = new ArrayList<Feature>();
   
    //1 get event:
    EventMention event = (EventMention)annotation;
    String contextModal = event.getEvent().getProperties().getContextualModality();
    if ( "GENERIC".equals(contextModal) ){
      Feature contexmod = new Feature(this.name, contextModal);
      features.add(contexmod);
//      logger.info("found a event: "+ contextModal);
    }
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(arg1 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;
   
    // 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){
      event = (EventMention) arg1;
      time = (TimeMention) arg2;
    }else{
      time = (TimeMention) arg1;
      event = (EventMention) arg2;
    }
   
    //1 get covering sentence:
    Map<EventMention, Collection<Sentence>> eventCoveringMap =
        JCasUtil.indexCovering(jCas, EventMention.class, Sentence.class);
    Collection<Sentence> eventSentList = eventCoveringMap.get(event);
    Map<TimeMention, Collection<Sentence>> timeCoveringMap =
        JCasUtil.indexCovering(jCas, TimeMention.class, Sentence.class);
    Collection<Sentence> timeSentList = timeCoveringMap.get(time);

    //2 get TimeX
    Map<Integer, TimeMention> timeDistMap = null;
    Map<Integer, EventMention> eventDistMap = null;
   
    if (eventSentList != null && !eventSentList.isEmpty()){
      timeDistMap = new TreeMap<Integer, TimeMention>();

      for(Sentence sent : eventSentList) {
        for (TimeMention atime : JCasUtil.selectCovered(jCas, TimeMention.class, sent)) {
          timeDistMap.put(Math.abs(atime.getBegin() - event.getBegin()), atime);
        }
      }

      //get the closest Time Expression feature
      for (Map.Entry<Integer, TimeMention> entry : timeDistMap.entrySet()) {
View Full Code Here

              if ( i == systemEvents.size()){
                break;
              }
              String systemOutcome = getProperty.apply(systemEvents.get(i));
              if (!goldOutcome.equals(systemOutcome)) {
                EventMention event = goldEvents.get(i);
                int begin = event.getBegin();
                int end = event.getEnd();
                int windowBegin = Math.max(0, begin - 50);
                int windowEnd = Math.min(text.length(), end + 50);
                this.loggers.get(name).fine(String.format(
                    "%s was %s but should be %s, in  ...%s[!%s!]%s...",
                    name,
View Full Code Here

      if(event.getClass().equals(EventMention.class)){
        realEvents.add(event);
      }
    }
    events = realEvents;
    EventMention anchor = events.get(0);
   
    if(arg1.getBegin() == anchor.getBegin() && arg1.getEnd() == anchor.getEnd()){
      feats.add(new Feature("Arg1LeftmostEvent"));
    }else if(arg2.getBegin() == anchor.getBegin() && arg2.getEnd() == anchor.getEnd()){
      feats.add(new Feature("Arg2LeftmostEvent"));
    }
   
    if(arg1 instanceof EventMention){
      feats.addAll(getEventFeats("mention1property", (EventMention)arg1));
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(arg1 instanceof EventMention){
      event = (EventMention) arg2;
    }else{
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.