本文整理了Java中org.cleartk.ml.Feature.getValue()
方法的一些代码示例,展示了Feature.getValue()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Feature.getValue()
方法的具体详情如下:
包路径:org.cleartk.ml.Feature
类名称:Feature
方法名:getValue
暂无
代码示例来源:origin: ClearTK/cleartk
public boolean encodes(Feature feature) {
if (!(feature.getValue() instanceof Counts))
return false;
Counts counts = (Counts) feature.getValue();
if (identifier == null)
return true;
if (identifier.equals(counts.getIdentifier()))
return true;
return false;
}
代码示例来源:origin: ClearTK/cleartk
public boolean encodes(Feature feature) {
if (feature.getValue() instanceof FeatureCollection) {
FeatureCollection f = (FeatureCollection) feature.getValue();
if (identifier == null || identifier.equals(f.getIdentifier()))
return true;
else
return false;
}
return false;
}
代码示例来源:origin: ClearTK/cleartk
public boolean encodes(Feature feature) {
if (!(feature.getValue() instanceof Counts))
return false;
Counts counts = (Counts) feature.getValue();
if (identifier == null)
return true;
if (identifier.equals(counts.getIdentifier()))
return true;
return false;
}
代码示例来源: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
public String nameFeature(Feature feature) {
return (feature.getValue() instanceof Number)
? feature.getName()
: feature.getName() + ":" + feature.getValue();
}
代码示例来源: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: 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 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<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<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 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
@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 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() );
}
内容来源于网络,如有侵权,请联系作者删除!