edu.illinois.cs.cogcomp.lbjava.classify.Feature.toString()方法的使用及代码示例

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

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

Feature.toString介绍

[英]Returns a string representation of this Feature.
[中]返回此Feature的字符串表示形式。

代码示例

代码示例来源:origin: edu.illinois.cs.cogcomp/LBJava

/** Returns a text representation of this lexicon (for debugging). */
public String toString() {
  StringBuffer result = new StringBuffer();
  for (int i = 0; i < lexiconInv.size(); ++i) {
    result.append(", ");
    result.append(i);
    result.append(": ");
    result.append(lexiconInv.get(i).toString());
  }
  if (lexiconInv.size() > 0)
    return result.substring(2);
  return result.toString();
}

代码示例来源:origin: edu.illinois.cs.cogcomp/LBJava

data[i][1] = featureCounts.get(i);
rowLabels[i] =
    p ? lexiconInv.get(i).toString() : lexiconInv.get(i).toStringNoPackage();
  data[i][j + 1] = perClassFeatureCounts.get(j, i);
rowLabels[i] =
    p ? lexiconInv.get(i).toString() : lexiconInv.get(i).toStringNoPackage();
data[i][0] = i;
rowLabels[i] =
    p ? lexiconInv.get(i).toString() : lexiconInv.get(i).toStringNoPackage();

代码示例来源:origin: CogComp/cogcomp-nlp

FeatureVector fv2 = features2.classify(w);
for (int k = 0; k < fv1.size(); k++) {
  String s = fv1.getFeature(k).toString();
  out.print(" " + s.substring(s.indexOf(':') + 1, s.length()));
  String s = fv2.getFeature(k).toString();
  out.print(" " + s.substring(s.indexOf(':') + 1, s.length()));

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-ner

FeatureVector fv2 = features2.classify(w);
for (int k = 0; k < fv1.size(); k++) {
  String s = fv1.getFeature(k).toString();
  out.print(" " + s.substring(s.indexOf(':') + 1, s.length()));
  String s = fv2.getFeature(k).toString();
  out.print(" " + s.substring(s.indexOf(':') + 1, s.length()));

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-mlner

FeatureVector fv2 = features2.classify(w);
for (int k = 0; k < fv1.size(); k++) {
  String s = fv1.getFeature(k).toString();
  out.print(" " + s.substring(s.indexOf(':') + 1, s.length()));
  String s = fv2.getFeature(k).toString();
  out.print(" " + s.substring(s.indexOf(':') + 1, s.length()));

代码示例来源:origin: edu.illinois.cs.cogcomp/saul

if (!(att.name().equals(f.toString()))) {
  System.err.println("WekaWrapper: Error - makeInstance encountered a misaligned "
      + "attribute-feature pair.");
  System.err.println("  " + att.name() + " and " + f.toString()
      + " should have been identical.");
  new Exception().printStackTrace();

代码示例来源:origin: edu.illinois.cs.cogcomp/illinois-comma

public CommaSequence(List<Comma> commas, Lexiconer lexicon, List<Classifier> lbjExtractors) {
    Collections.sort(commas, new Comparator<Comma>() {
      @Override
      public int compare(Comma o1, Comma o2) {
        return o1.getPosition() - o2.getPosition();
      }
    });
    this.sortedCommas = commas;

    baseFeatures = new IFeatureVector[sortedCommas.size()];
    for (int i = 0; i < sortedCommas.size(); i++) {
      FeatureVector lbjFeatureVector = new FeatureVector();
      for (Classifier lbjExtractor : lbjExtractors)
        lbjFeatureVector.addFeatures(lbjExtractor.classify(sortedCommas.get(i)));
      FeatureVectorBuffer slFeatureVectorBuffer = new FeatureVectorBuffer();
      for (int j = 0; j < lbjFeatureVector.featuresSize(); j++) {
        String featureString = lbjFeatureVector.getFeature(j).toString();
        if (lexicon.isAllowNewFeatures())
          lexicon.addFeature(featureString);
        if (lexicon.containFeature(featureString))
          slFeatureVectorBuffer.addFeature(lexicon.getFeatureId(featureString), 1);
        else
          slFeatureVectorBuffer.addFeature(
              lexicon.getFeatureId(CommaIOManager.unknownFeature), 1);
      }
      baseFeatures[i] = slFeatureVectorBuffer.toFeatureVector();
    }
  }
}

代码示例来源:origin: CogComp/cogcomp-nlp

public CommaSequence(List<Comma> commas, Lexiconer lexicon, List<Classifier> lbjExtractors) {
    Collections.sort(commas, new Comparator<Comma>() {
      @Override
      public int compare(Comma o1, Comma o2) {
        return o1.getPosition() - o2.getPosition();
      }
    });
    this.sortedCommas = commas;

    baseFeatures = new IFeatureVector[sortedCommas.size()];
    for (int i = 0; i < sortedCommas.size(); i++) {
      FeatureVector lbjFeatureVector = new FeatureVector();
      for (Classifier lbjExtractor : lbjExtractors)
        lbjFeatureVector.addFeatures(lbjExtractor.classify(sortedCommas.get(i)));
      FeatureVectorBuffer slFeatureVectorBuffer = new FeatureVectorBuffer();
      for (int j = 0; j < lbjFeatureVector.featuresSize(); j++) {
        String featureString = lbjFeatureVector.getFeature(j).toString();
        if (lexicon.isAllowNewFeatures())
          lexicon.addFeature(featureString);
        if (lexicon.containFeature(featureString))
          slFeatureVectorBuffer.addFeature(lexicon.getFeatureId(featureString), 1);
        else
          slFeatureVectorBuffer.addFeature(
              lexicon.getFeatureId(CommaIOManager.unknownFeature), 1);
      }
      baseFeatures[i] = slFeatureVectorBuffer.toFeatureVector();
    }
  }
}

代码示例来源:origin: edu.illinois.cs.cogcomp/saul

Feature f = lexicon.lookupKey(featureIndex);
Attribute a = f.isDiscrete() ?
    new Attribute(f.toString(), binaryValues) :
    new Attribute(f.toString());

相关文章