Package org.cleartk.classifier

Examples of org.cleartk.classifier.Feature


            if (pos.startsWith("VB")){
              verbTP = verbTP + "_" + pos;
            }
          }
        }
        Feature feature = new Feature("VerbTenseFeature", verbTP);
        feats.add(feature);
        //logger.info("found nearby verb's pos tag: "+ verbTP);
      }

    }
View Full Code Here


      Annotation etcA2 = etc.getArg2().getArgument();
      if(etcA1 instanceof TimeMention || etcA2 instanceof TimeMention){
        if(etc.getCategory().equalsIgnoreCase("CONTAINS")){
          if(etcA1.getBegin() == arg1.getBegin() && etcA1.getEnd() == arg1.getEnd() ||
              etcA2.getBegin() == arg1.getBegin() && etcA2.getEnd() == arg1.getEnd()){
            feats.add(new Feature("ARG1_IN_NC"));
          }
          if(etcA1.getBegin() == arg2.getBegin() && etcA1.getEnd() == arg2.getEnd() ||
              etcA2.getBegin() == arg2.getBegin() && etcA2.getEnd() == arg2.getEnd()){
            feats.add(new Feature("ARG2_IN_NC"));
          }
        }
      }
    }
   
View Full Code Here

    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

      for(Sentence sent : sentList) {
        for ( WordToken wt : JCasUtil.selectCovered(jcas, WordToken.class, sent)) {
          if (wt != null){
            String wdtext = wt.getCoveredText().toLowerCase();
            if (specialWd.contains(wdtext)){
              Feature feature = new Feature("SpecialWd", wdtext);
              feats.add(feature);
            }
          }
        }
       
View Full Code Here

        ConllDependencyNode headOfTime = timeNode.getHead();
        for (ConllDependencyNode eventNode : eventDNodeList) {
          if ( timeNode.getPostag() != null && eventNode.getPostag() != null){//make sure the covering nodes are not root sentences
            while( headOfTime != null ){
              if (headOfTime.equals(eventNode)) {
                Feature indicator = new Feature("DependentTo", "DependentTo");
                feats.add(indicator);
                return feats;
//              }else if (headOfTime.getHead() == null){//if one of the node is dependent to the root sentence
//                Feature indicator = new Feature("OpenDependentTo", "OpenDependentTo");
//                feats.add(indicator);
//                return feats;
              }
              headOfTime = headOfTime.getHead();
            }
          }
        }
      }

    }

    Feature indicator = new Feature("NotDependent", "NotDependent");
    feats.add(indicator);
    return feats;
  }
View Full Code Here

    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

   
    //2 get Verb Tense
    if (segList != null && !segList.isEmpty()){
      for(Segment seg : segList) {
        String segname = seg.getId();
        Feature feature = new Feature(this.name, segname);
        features.add(feature);
//        logger.info("found segment id: "+ segname);
      }
     
    }
View Full Code Here

        }
      }
     
      //get the closest Time Expression feature
      for (Map.Entry<Integer, IdentifiedAnnotation> entry : timeDistMap.entrySet()) {
        Feature feature = new Feature(this.name, entry.getValue().getCoveredText());
        features.add(feature);
        //        logger.info("add time feature: "+ entry.getValue().getCoveredText() + entry.getValue().getTimeClass());
        Feature indicator = new Feature("TimeXNearby", this.name);
        features.add(indicator);
        Feature type = new Feature("TimeXType", entry.getValue().getClass());
        features.add(type);

        //add PP get Heading preposition
        for(TreebankNode treebankNode : JCasUtil.selectCovering(
            view,
            TreebankNode.class,
            entry.getValue().getBegin(),
            entry.getValue().getEnd())) {

          if(treebankNode.getNodeType().equals("PP")) {
            Feature PPNodeType = new Feature("Timex_PPNodeType", treebankNode.getNodeType());
            features.add(PPNodeType);
            break;
          }
        }
View Full Code Here

    String type = this.wordTypes.get(focusAnnotation.getCoveredText().toLowerCase());
    List<Feature> features;
    if (type == null) {
      features = Collections.emptyList();
    } else {
      features = Collections.singletonList(new Feature(FEATURE_NAME, type));
    }
    return features;
  }
View Full Code Here

        score += (weight * termVals.get(key));
      }
    }

    score /= z;  // weight by actual amount of context so we don't penalize begin/end of sentence.
    feats.add(new Feature("WORD_SCORE", score));
    return feats;
  }
View Full Code Here

TOP

Related Classes of org.cleartk.classifier.Feature

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.