org.cleartk.ml.Feature.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.0k)|赞(0)|评价(0)|浏览(105)

本文整理了Java中org.cleartk.ml.Feature.<init>()方法的一些代码示例,展示了Feature.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feature.<init>()方法的具体详情如下:
包路径:org.cleartk.ml.Feature
类名称:Feature
方法名:<init>

Feature.<init>介绍

暂无

代码示例

代码示例来源:origin: org.apache.ctakes/ctakes-core

public static List<Feature> getCharFeatures(char ch, String prefix){
 List<Feature> feats = new ArrayList<>();
 feats.add(new Feature(prefix+"_Id", ch == '\n' ? "<LF>" : ch));
 feats.add(new Feature(prefix+"_Upper", Character.isUpperCase(ch)));
 feats.add(new Feature(prefix+"_Lower", Character.isLowerCase(ch)));
 feats.add(new Feature(prefix+"_Digit", Character.isDigit(ch)));
 feats.add(new Feature(prefix+"_Space", Character.isWhitespace(ch)));
 feats.add(new Feature(prefix+"_Type"+Character.getType(ch), true));
 return feats;
}

代码示例来源:origin: org.apache.ctakes/ctakes-assertion

private static Collection<? extends Feature> hashToFeatureList(
    HashMap<String, Boolean> featsIn) {
  
  Collection<Feature> featsOut = new HashSet<>();
  for (String featName : featsIn.keySet()) {
    featsOut.add(new Feature(featName,featsIn.get(featName)));
  }
  
  return featsOut;
}

代码示例来源:origin: org.apache.ctakes/ctakes-assertion

private static Collection<? extends Feature> hashToFeatureList(
    HashMap<String, Boolean> featsIn) {
  
  Collection<Feature> featsOut = new HashSet<>();
  for (String featName : featsIn.keySet()) {
    featsOut.add(new Feature(featName,featsIn.get(featName)));
  }
  
  return featsOut;
}

代码示例来源:origin: apache/ctakes

private static Collection<? extends Feature> hashToFeatureList(
   HashMap<String, Boolean> featsIn ) {
 Collection<Feature> featsOut = new HashSet<>();
 for ( String featName : featsIn.keySet() ) {
   featsOut.add( new Feature( featName, featsIn.get( featName ) ) );
 }
 return featsOut;
}

代码示例来源:origin: apache/ctakes

private static Collection<? extends Feature> hashToFeatureList(
    HashMap<String, Boolean> featsIn) {
  
  Collection<Feature> featsOut = new HashSet<>();
  for (String featName : featsIn.keySet()) {
    featsOut.add(new Feature(featName,featsIn.get(featName)));
  }
  
  return featsOut;
}

代码示例来源:origin: apache/ctakes

private static Collection<? extends Feature> hashToFeatureList(
  HashMap<String, Boolean> featsIn) {
 
 Collection<Feature> featsOut = new HashSet<>();
 for (String featName : featsIn.keySet()) {
  featsOut.add(new Feature(featName,featsIn.get(featName)));
 }
 
 return featsOut;
}

代码示例来源:origin: apache/ctakes

private static Collection<? extends Feature> hashToFeatureList(
    HashMap<String, Boolean> featsIn) {
  
  Collection<Feature> featsOut = new HashSet<>();
  for (String featName : featsIn.keySet()) {
    featsOut.add(new Feature(featName,featsIn.get(featName)));
  }
  
  return featsOut;
}

代码示例来源:origin: de.unistuttgart.ims/cleartk-util

public List<Feature> extract(JCas view, T focusAnnotation) throws CleartkExtractorException {
  if (strList.contains(focusAnnotation.getCoveredText()))
    return Arrays.asList(new Feature(fName));
  else
    return Arrays.asList();
}

代码示例来源:origin: org.apache.ctakes/ctakes-coreference

@Override
public List<Feature> extract(JCas jCas, Markable mention) throws CleartkExtractorException {
 List<Feature> feats = new ArrayList<>();
 
 feats.add(new Feature("MC_MENTION_SALIENCE", mention.getConfidence()));
 return feats;
}

代码示例来源:origin: apache/ctakes

@Override
 public List<Feature> extract(JCas jCas, Annotation ann) throws CleartkExtractorException {
  IdentifiedAnnotation idAnn = (IdentifiedAnnotation)ann;
  return Arrays.asList(new Feature("TypeID", String.valueOf(idAnn.getTypeID())));
 }
};

代码示例来源:origin: org.apache.ctakes/ctakes-assertion

@Override
public List<Feature> extract(JCas view, IdentifiedAnnotation focusAnnotation)
  throws CleartkExtractorException {
 List<Feature> featList = new ArrayList<>();
 
 IdentifiedAnnotation mention = focusAnnotation;
 featList.add(new Feature("IsNegated", mention.getPolarity() == CONST.NE_POLARITY_NEGATION_PRESENT));
 return featList;
}

代码示例来源:origin: org.apache.ctakes/ctakes-relation-extractor

@Override
 public List<Feature> extract(JCas jCas, Annotation ann) throws CleartkExtractorException {
  IdentifiedAnnotation idAnn = (IdentifiedAnnotation)ann;
  return Arrays.asList(new Feature("TypeID", String.valueOf(idAnn.getTypeID())));
 }
};

代码示例来源:origin: apache/ctakes

@Override
public List<Feature> apply(@Nullable Feature input) {
 String featureName = Feature.createName(DEFAULT_NAME, input.getName());
 Object featureValue = input.getValue();
 if(featureValue instanceof String){
  return Collections.singletonList(new Feature(featureName, word2class.containsKey(featureValue) ? word2class.get(featureValue) : "NoCluster"));
 }
 return Collections.emptyList();
}

代码示例来源:origin: org.apache.ctakes/ctakes-assertion

@Override
public List<Feature> apply(@Nullable Feature input) {
 String featureName = Feature.createName(DEFAULT_NAME, input.getName());
 Object featureValue = input.getValue();
 if(featureValue instanceof String){
  return Collections.singletonList(new Feature(featureName, word2class.containsKey(featureValue) ? word2class.get(featureValue) : "NoCluster"));
 }
 return Collections.emptyList();
}

代码示例来源:origin: apache/ctakes

@Override
public List<Feature> extract(JCas jCas, IdentifiedAnnotation arg1,
    IdentifiedAnnotation arg2) throws AnalysisEngineProcessException {
  List<Feature> feats = new ArrayList<>();
  feats.add(new Feature("TOK_DIST",
       JCasUtil.selectCovered(jCas, BaseToken.class, arg1.getBegin(), arg2.getEnd()).size() / (double)CorefConsts.TOKDIST));
  feats.add(new Feature("SENT_DIST",
      JCasUtil.selectCovered(jCas, Sentence.class, arg1.getBegin(), arg2.getEnd()).size() / (double) CorefConsts.NEDIST));
  return feats;
}

代码示例来源:origin: org.apache.ctakes/ctakes-coreference

@Override
public List<Feature> extract(JCas jCas, Markable mention) throws CleartkExtractorException {
 List<Feature> feats = new ArrayList<>();
 ConllDependencyNode mentionHead = MapFactory.get(getKey(jCas), mention);
 if(mentionHead != null){
  feats.add(new Feature("MentionRel", mentionHead.getDeprel()));
 }
 
 return feats;
}

代码示例来源:origin: ClearTK/cleartk

@Override
public List<Feature> extract(JCas view, Annotation focusAnnotation)
  throws CleartkExtractorException {
 String text = focusAnnotation.getCoveredText();
 return ccpf.apply(new Feature(null, text));
}

代码示例来源:origin: ClearTK/cleartk

public ContextFeature(String baseName, int position, int oobPosition, String featureName) {
 this.feature = new Feature(featureName, String.format(Locale.ROOT, "OOB%d", oobPosition));
 this.setName(Feature.createName(baseName, String.valueOf(position), featureName));
 this.setValue(this.feature.getValue());
}

代码示例来源:origin: apache/ctakes

public WindowedContextFeature( String baseName, int position, int oobPosition, String featureName ) {
 this.feature = new Feature( featureName, String.format( Locale.ROOT, "OOB%d", oobPosition ) );
 this.setName( Feature.createName( baseName, String.valueOf( position ), featureName ) );
 this.setValue( this.feature.getValue() );
}

代码示例来源:origin: ClearTK/cleartk

@Override
protected Feature transform(Feature feature) {
 int tf = (Integer) feature.getValue();
 double tfidf = tf * this.idfMap.getIDF(feature.getName());
 return new Feature("TF-IDF_" + feature.getName(), tfidf);
}

相关文章