本文整理了Java中org.cleartk.ml.Feature.getName()
方法的一些代码示例,展示了Feature.getName()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feature.getName()
方法的具体详情如下:
包路径:org.cleartk.ml.Feature
类名称:Feature
方法名:getName
暂无
代码示例来源:origin: ClearTK/cleartk
protected boolean isTransformable(Feature feature) {
return feature instanceof TransformableFeature && this.name.equals(feature.getName());
}
代码示例来源:origin: ClearTK/cleartk
@Override
public Double apply(List<Feature> wordFeatures) {
double sentenceWeight = 1.0;
for (Feature feature : wordFeatures) {
if (this.seenWords.contains(feature.getName())) {
sentenceWeight *= this.seenWordProbability;
} else {
sentenceWeight *= this.tfMap.getProbability(feature.getName());
}
}
return sentenceWeight;
}
}
代码示例来源:origin: apache/ctakes
protected String getFeatureName(Feature feature) {
String featureName = feature.getName();
Object featureValue = feature.getValue();
return featureValue instanceof Number ? featureName : featureName + ":" + featureValue;
}
代码示例来源:origin: org.apache.ctakes/ctakes-assertion
protected String getFeatureName(Feature feature) {
String featureName = feature.getName();
Object featureValue = feature.getValue();
return featureValue instanceof Number ? featureName : featureName + ":" + featureValue;
}
代码示例来源:origin: CLLKazan/UIMA-Ext
@Override
public String apply(Feature f) {
if (f.getName() == null)
return String.valueOf(f.getValue());
return f.getName() + valueSep + f.getValue();
}
};
代码示例来源: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: ClearTK/cleartk
public String nameFeature(Feature feature) {
return (feature.getValue() instanceof Number)
? feature.getName()
: feature.getName() + ":" + 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);
}
代码示例来源:origin: ClearTK/cleartk
public Map<String, Double> featuresToFeatureMap(List<Feature> features) {
Map<String, Double> featureMap = new HashMap<String, Double>();
for (Feature feature : features) {
String termName = feature.getName();
int tf = (Integer) feature.getValue();
featureMap.put(termName, tf * this.idfMap.getIDF(termName));
}
return featureMap;
}
代码示例来源: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: ClearTK/cleartk
public List<NameNumber> encode(Feature feature) {
String name = feature.getName();
Number number = ((Boolean) feature.getValue()).booleanValue() ? 1.0 : 0.0;
return Collections.singletonList(new NameNumber(name, number));
}
代码示例来源: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 List<NameNumber> encode(Feature feature) {
String name = feature.getName();
Number number = (Number) feature.getValue();
return Collections.singletonList(new NameNumber(name, number));
}
代码示例来源: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 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<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 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() );
}
内容来源于网络,如有侵权,请联系作者删除!