当前位置: 首页>>代码示例>>Java>>正文


Java FeatureFactory.cliqueCp5C方法代码示例

本文整理汇总了Java中edu.stanford.nlp.sequences.FeatureFactory.cliqueCp5C方法的典型用法代码示例。如果您正苦于以下问题:Java FeatureFactory.cliqueCp5C方法的具体用法?Java FeatureFactory.cliqueCp5C怎么用?Java FeatureFactory.cliqueCp5C使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在edu.stanford.nlp.sequences.FeatureFactory的用法示例。


在下文中一共展示了FeatureFactory.cliqueCp5C方法的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;
}
 
开发者ID:paulirwin,项目名称:Stanford.NER.Net,代码行数:52,代码来源:CMMClassifier.java


注:本文中的edu.stanford.nlp.sequences.FeatureFactory.cliqueCp5C方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。