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

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

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

Feature.getFeatureKey介绍

[英]Return the feature that should be used to index this feature into a lexicon. This method simply calls getFeatureKey(lexicon, true, -1).
[中]返回应用于将此功能索引到词典中的功能。此方法只调用getFeatureKey(lexicon, true, -1)

代码示例

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

/**
 * Return the feature that should be used to index this feature into a lexicon. This method
 * simply calls <code>getFeatureKey(lexicon, true,
 * -1)</code>.
 *
 * @see #getFeatureKey(Lexicon,boolean,int)
 * @param lexicon The lexicon into which this feature will be indexed.
 * @return A feature object appropriate for use as the key of a map.
 **/
public Feature getFeatureKey(Lexicon lexicon) {
  return getFeatureKey(lexicon, true, -1);
}

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

/**
 * A helper method for {@link #getFeatureKey(Lexicon,boolean,int)}, this method computes the
 * feature keys corresponding to the arguments of the conjunction. Here, we lookup the arguments
 * to the conjunction in the lexicon so that their counts are never less than the conjunction's,
 * and we return the actual feature object that's already a key in the lexicon.
 *
 * @param f The argument feature for which a key will be computed.
 * @param lexicon The lexicon into which this feature will be indexed.
 * @param training Whether or not the learner is currently training.
 * @param label The label of the example containing this feature, or -1 if we aren't doing per
 *        class feature counting.
 * @return A feature object appropriate for use as the key of a map.
 **/
protected Feature getArgumentKey(Feature f, Lexicon lexicon, boolean training, int label) {
  if (f.isDiscrete()) {
    if (!training)
      return f;
    if (!f.isPrimitive())
      f = f.getFeatureKey(lexicon, true, label);
  } else {
    f = f.getFeatureKey(lexicon, training, label);
    if (!training)
      return f;
  }
  return lexicon.getChildFeature(f, label);
}

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

/**
 * A helper method for {@link #getFeatureKey(Lexicon,boolean,int)}, this method computes the
 * feature keys corresponding to the arguments of the conjunction. Here, we lookup the arguments
 * to the conjunction in the lexicon so that their counts are never less than the conjunction's,
 * and we return the actual feature object that's already a key in the lexicon.
 *
 * @param f The argument feature for which a key will be computed.
 * @param lexicon The lexicon into which this feature will be indexed.
 * @param label The label of the example containing this feature, or -1 if we aren't doing per
 *        class feature counting.
 * @return A feature object appropriate for use as the key of a map.
 **/
protected DiscreteFeature getArgumentKey(Feature f, Lexicon lexicon, int label) {
  if (!f.isPrimitive())
    f = f.getFeatureKey(lexicon, true, label);
  return (DiscreteFeature) lexicon.getChildFeature(f, label);
}

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

f = f.getFeatureKey(lexicon, trainingMode, -1);

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

f = f.getFeatureKey(lexicon, trainingMode, -1);

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

labelArray[f] = labelLexicon.lookup(label, true);
  else
    labelArray[f] = labelLexicon.lookup(label.getFeatureKey(labelLexicon), true);
  labelValues[f] += label.getStrength();
  createPrediction(labelArray[f]);
Feature feature = featureVector.getFeature(f);
exampleArrayFeatures[f] =
    lexicon.lookup(feature.getFeatureKey(lexicon, training, labelIndex), training,
        labelIndex);
exampleArrayValues[f] += feature.getStrength();

相关文章