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

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

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

Feature.createName介绍

暂无

代码示例

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

public SubCategorizationExtractor(String name) {
 this.featureName = Feature.createName(name, "SubCategorization");
}

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

public Context_ImplBase(int begin, int end) {
 if (begin > end) {
  String message = "expected begin < end, found begin=%d end=%d";
  throw new IllegalArgumentException(String.format(message, begin, end));
 }
 this.begin = begin;
 this.end = end;
 this.name = Feature.createName(
   this.getClass().getSimpleName(),
   String.valueOf(this.begin),
   String.valueOf(this.end));
}

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

public AbstractWindowedContext( int begin, int end ) {
 if ( begin > end ) {
   String message = "expected begin < end, found begin=%d end=%d";
   throw new IllegalArgumentException( String.format( message, begin, end ) );
 } else {
   this.begin = begin;
   this.end = end;
   this.name = Feature.createName( this.getClass().getSimpleName(),
      String.valueOf( this.begin ), String.valueOf( this.end ) );
 }
}

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

public ContinuousBag(File vecFile, Context... contexts) throws FileNotFoundException {
  this.contexts = contexts;
  this.vectors = readVectorFile(vecFile);
//    String[] names = new String[contexts.length + 1];
//    names[0] = "ContinuousBag";
//    for (int i = 1; i < names.length; ++i) {
//      names[i] = contexts[i - 1].getName();
//    }
  this.name = Feature.createName("ContinuousBag");
 }

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

private String createName(boolean specialCasePP, Feature subFeature) {
  StringBuffer buffer = new StringBuffer();

  if (specialCasePP)
   buffer.append("PP");

  buffer.append("HeadWord");

  return Feature.createName(buffer.toString(), subFeature.getName());
 }
}

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

public ContinuousBag(File vecFile, Context... contexts) throws FileNotFoundException {
  this.contexts = contexts;
  this.vectors = readVectorFile(vecFile);
//    String[] names = new String[contexts.length + 1];
//    names[0] = "ContinuousBag";
//    for (int i = 1; i < names.length; ++i) {
//      names[i] = contexts[i - 1].getName();
//    }
  this.name = Feature.createName("ContinuousBag");
 }

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

public static Feature createFeature(String namePrefix, Feature feature) {
 return new Feature(createName(namePrefix, feature.name), feature.value);
}

代码示例来源: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> 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: 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

public List<Feature> extract(JCas view, T focusAnnotation) throws CleartkExtractorException {
 List<Feature> features = subExtractor.extract(view, focusAnnotation);
 for (Feature feature : features) {
  feature.setName(Feature.createName(name, feature.getName()));
 }
 return features;
}

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

public List<NameNumber> encode(Feature feature) {
 List<NameNumber> fves = new ArrayList<NameNumber>();
 Counts frequencies = (Counts) feature.getValue();
 String prefix = frequencies.getFeatureName();
 for (Object key : frequencies.getValues()) {
  String name = Feature.createName(prefix, key.toString());
  NameNumber fve = new NameNumber(name, frequencies.getCount(key));
  fves.add(fve);
 }
 normalizer.normalize(fves);
 return fves;
}

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

public List<Feature> extract(JCas jCas, TreebankNode node)
  throws CleartkExtractorException {
 TreebankNode parent = node.getParent();
 if (parent == null)
  return Collections.emptyList();
 List<Feature> features = subExtractor.extract(jCas, parent);
 for (Feature feature : features) {
  feature.setName(Feature.createName("Parent", feature.getName()));
 }
 return features;
}

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

public ContextFeature(String baseName, int position, Feature feature) {
 this.feature = feature;
 this.setName(Feature.createName(baseName, String.valueOf(position), feature.getName()));
 this.setValue(feature.getValue());
}

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

public WindowedContextFeature( String baseName, int position, Feature feature ) {
 this.feature = feature;
 this.setName( Feature.createName( baseName, String.valueOf( position ), feature.getName() ) );
 this.setValue( feature.getValue() );
}

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

public List<NameNumber> encode(Feature feature) {
 List<NameNumber> fves = new ArrayList<NameNumber>();
 Counts frequencies = (Counts) feature.getValue();
 String prefix = frequencies.getFeatureName();
 for (Object key : frequencies.getValues()) {
  if (frequencies.getCount(key) > 0) {
   String name = Feature.createName(prefix, key.toString());
   NameNumber fve = new NameNumber(name, 1);
   fves.add(fve);
  }
 }
 normalizer.normalize(fves);
 return fves;
}

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

public List<NameNumber> encode(Feature feature) throws CleartkEncoderException {
 FeatureCollection fc = (FeatureCollection) feature.getValue();
 List<NameNumber> fves = new ArrayList<NameNumber>();
 if (identifier != null && !identifier.equals(fc.getIdentifier()))
  return Collections.emptyList();
 for (Feature f : fc.getFeatures()) {
  Feature f1 = new Feature(Feature.createName(feature.getName(), f.getName()), f.getValue());
  fves.addAll(subEncoder.encode(f1));
 }
 normalizer.normalize(fves);
 return fves;
}

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

public ContextFeature(String baseName, Feature feature) {
 this.feature = feature;
 this.setName(Feature.createName(baseName, feature.getName()));
 this.setValue(this.feature.getValue());
}

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

public WindowedContextFeature( String baseName, Feature feature ) {
 this.feature = feature;
 this.setName( Feature.createName( baseName, feature.getName() ) );
 this.setValue( this.feature.getValue() );
}

相关文章