本文整理汇总了Java中edu.stanford.nlp.sequences.FeatureFactory.cliqueCp2C方法的典型用法代码示例。如果您正苦于以下问题:Java FeatureFactory.cliqueCp2C方法的具体用法?Java FeatureFactory.cliqueCp2C怎么用?Java FeatureFactory.cliqueCp2C使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类edu.stanford.nlp.sequences.FeatureFactory
的用法示例。
在下文中一共展示了FeatureFactory.cliqueCp2C方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addOtherClasses
import edu.stanford.nlp.sequences.FeatureFactory; //导入方法依赖的package包/类
/** This adds to the feature name the name of classes that are other than
* the current class that are involved in the clique. In the CMM, these
* other classes become part of the conditioning feature, and only the
* class of the current position is being predicted.
*
* @return A collection of features with extra class information put
* into the feature name.
*/
private static Collection<String> addOtherClasses(Collection<String> feats, List<? extends CoreLabel> info,
int loc, Clique c) {
String addend = null;
String pAnswer = info.get(loc - 1).get(CoreAnnotations.AnswerAnnotation.class);
String p2Answer = info.get(loc - 2).get(CoreAnnotations.AnswerAnnotation.class);
String p3Answer = info.get(loc - 3).get(CoreAnnotations.AnswerAnnotation.class);
String p4Answer = info.get(loc - 4).get(CoreAnnotations.AnswerAnnotation.class);
String p5Answer = info.get(loc - 5).get(CoreAnnotations.AnswerAnnotation.class);
String nAnswer = info.get(loc + 1).get(CoreAnnotations.AnswerAnnotation.class);
// cdm 2009: Is this really right? Do we not need to differentiate names that would collide???
if (c == FeatureFactory.cliqueCpC) {
addend = '|' + pAnswer;
} else if (c == FeatureFactory.cliqueCp2C) {
addend = '|' + p2Answer;
} else if (c == FeatureFactory.cliqueCp3C) {
addend = '|' + p3Answer;
} else if (c == FeatureFactory.cliqueCp4C) {
addend = '|' + p4Answer;
} else if (c == FeatureFactory.cliqueCp5C) {
addend = '|' + p5Answer;
} else if (c == FeatureFactory.cliqueCpCp2C) {
addend = '|' + pAnswer + '-' + p2Answer;
} else if (c == FeatureFactory.cliqueCpCp2Cp3C) {
addend = '|' + pAnswer + '-' + p2Answer + '-' + p3Answer;
} else if (c == FeatureFactory.cliqueCpCp2Cp3Cp4C) {
addend = '|' + pAnswer + '-' + p2Answer + '-' + p3Answer + '-' + p4Answer;
} else if (c == FeatureFactory.cliqueCpCp2Cp3Cp4Cp5C) {
addend = '|' + pAnswer + '-' + p2Answer + '-' + p3Answer + '-' + p4Answer + '-' + p5Answer;
} else if (c == FeatureFactory.cliqueCnC) {
addend = '|' + nAnswer;
} else if (c == FeatureFactory.cliqueCpCnC) {
addend = '|' + pAnswer + '-' + nAnswer;
}
if (addend == null) {
return feats;
}
Collection<String> newFeats = Generics.newHashSet();
for (String feat : feats) {
String newFeat = feat + addend;
newFeats.add(newFeat);
}
return newFeats;
}