コード例 #1
0
  @Override
  protected StringFeatureVector createStringFeatureVector(FCState state) {
    StringFeatureVector vector = new StringFeatureVector();
    String delim = StringConst.UNDERSCORE;
    DEPTree tree = state.getTree();

    int type = 0;
    for (String s : tree.getNgrams(DEPNode::getSimplifiedWordForm, delim, 2))
      vector.addFeature(type, s);

    type++;
    for (String s : tree.getNgrams(DEPNode::getSimplifiedWordForm, DEPNode::getPOSTag, delim, 2))
      vector.addFeature(type, s);

    type++;
    DEPNode node = tree.get(FCEval.INFO_NODE);
    String feat, s;

    for (int i = 3; i < 100; i++) {
      s = Integer.toString(i);
      feat = node.getFeat(s);
      if (feat != null) vector.addFeature(type, s);
    }

    return vector;
  }