Package org.cleartk.classifier

Examples of org.cleartk.classifier.Feature


   
    if(stems.size() > 0) {
      HashSet<String> hypernyms = WordNetUtils.getHypernyms(iDictionary, stems.get(0), pos, true);
   
      for(String hypernym : hypernyms) {
        features.add(new Feature("wn_hypernym", hypernym));
      }
    }
   
    return features;
  }
View Full Code Here


        tree.addChild(termTree);
      }
    }
    tree.addChild(arg2Tree);
   
    features.add(new Feature("TK_BOP", tree.toString()));
    return features;
  }
View Full Code Here

    List<Feature> features = new ArrayList<Feature>();
   
    // entity1 ... entity2 scenario
    if(arg1.getEnd() < arg2.getBegin()) {
      for(PunctuationToken token : JCasUtil.selectCovered(jCas, PunctuationToken.class, arg1.getEnd(), arg2.getBegin())) {
        features.add(new Feature("arg1_punctuation_arg2", token.getCoveredText()));
        break;
      }
    }
   
    // entity2 ... entity1 scenario
    if(arg2.getEnd() < arg1.getBegin()) {
      for(PunctuationToken token : JCasUtil.selectCovered(jCas, PunctuationToken.class, arg2.getEnd(), arg1.getBegin())) {
        features.add(new Feature("arg2_punctuation_arg1", token.getCoveredText()));
        break;
      }
    }
   
    return features;
View Full Code Here

      ConllDependencyNode mentionHeadNode = DependencyParseUtils.findAnnotationHead(jCas, mention);
   
      if (mentionHeadNode != null) {
        ConllDependencyNode dependsOn = mentionHeadNode.getHead();
        if (dependsOn != null) {
          features.add(new Feature(ftrPrefix + "_DEPENDS_ON_WORD", dependsOn.getCoveredText()));
          features.add(new Feature(ftrPrefix + "_DEPENDS_ON_POS", dependsOn.getPostag()));
          // Following features come from Zhou et al. 2005
          // ET1DW1: combination of the entity type and the dependent word for M1
          features.add(new Feature(ftrPrefix + "_TYPE-GOVERNING_WORD", String.format("%d-%s", mention.getTypeID(), dependsOn.getCoveredText())));
          // H1DW1: combination of the head word and the dependent word for M1
          features.add(new Feature(ftrPrefix + "_HEAD_WORD-GOVERNING_WORD", String.format("%s-%s", mentionHeadNode.getCoveredText(), dependsOn.getCoveredText())));
          features.add(new Feature(ftrPrefix + "_TYPE-GOVERNING_POS", String.format("%d-%s", mention.getTypeID(), dependsOn.getPostag())));
          features.add(new Feature(ftrPrefix + "_HEAD_POS-GOVERNING_POS", String.format("%s-%s", mentionHeadNode.getPostag(), dependsOn.getPostag())));
        }
      }
      return features;
  }
View Full Code Here

      for (BaseToken token : tokens) {
        ++outcomeIndex;

        // extract token features
        List<Feature> features = new ArrayList<Feature>();
        features.add(new Feature(token.getCoveredText()));
        features.add(new Feature("PartOfSpeech", token.getPartOfSpeech()));

        // extract previous classification features
        for (int i = this.nPreviousClassifications; i > 0; --i) {
          int index = outcomeIndex - i;
          String previousOutcome = index < 0 ? "O" : outcomes.get(index);
          features.add(new Feature("PreviousOutcome_" + i, previousOutcome));
        }

        // extract length of Modifier that is currently being created (if any)
        // int length = 0;
        // for (int i = outcomeIndex - 1; i > 0 && !"O".equals(outcomes.get(i)); --i) {
View Full Code Here

   
    // entity1 ... entity2 scenario
    if(arg1.getEnd() < arg2.getBegin()) {
      for(BaseToken token : JCasUtil.selectCovered(jCas, BaseToken.class, arg1.getEnd(), arg2.getBegin())) {
        if(prepositions.contains(token.getCoveredText())) {
          features.add(new Feature("arg1_preposition_arg2", token.getCoveredText()));
        }
      }
    }
   
    // entity2 ... entity1 scenario
    if(arg2.getEnd() < arg1.getBegin()) {
      for(BaseToken token : JCasUtil.selectCovered(jCas, BaseToken.class, arg2.getEnd(), arg1.getBegin())) {
        if(prepositions.contains(token.getCoveredText())) {
          features.add(new Feature("arg2_preposition_arg1", token.getCoveredText()));
        }
      }
    }
   
    return features;
View Full Code Here

    // run the feature extractor over the JCas
    NamedEntityFeaturesExtractor extractor = new NamedEntityFeaturesExtractor();
    List<Feature> features = extractor.extract(jCas, e1, e2);
   
    // make sure that the features that we expect are there
    assertTrue(features.contains(new Feature("mention1_TypeID", "42")));
    assertTrue(features.contains(new Feature("mention2_TypeID", "1")));
    assertTrue(features.contains(new Feature("Distance_EntityMention", 1)));
    assertTrue(features.contains(new Feature("type1type2", "42_1")));
    assertTrue(features.contains(new Feature("mention1InMention2", false)));
    assertTrue(features.contains(new Feature("mention2InMention1", false)));
  }
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.