Examples of CyclicCoreLabel


Examples of edu.stanford.nlp.ling.CyclicCoreLabel

   * @return the <code>Set</code> of <code>Object</code>s which
   *         label arcs between this node and <code>destNode</code>
   */
  public Set<Class<? extends GrammaticalRelationAnnotation>> arcLabelsToNode(TreeGraphNode destNode) {
    Set<Class<? extends GrammaticalRelationAnnotation>> arcLabels = Generics.newHashSet();
    CyclicCoreLabel cl = label();
    for (Iterator<Class<?>> it = cl.keySet().iterator(); it.hasNext();) {
      Class<? extends CoreAnnotation> key = (Class<? extends CoreAnnotation>) it.next();//javac doesn't compile properly if generics are fully specified (but eclipse does...)
      Object val = cl.get(key);
      if (val != null && val instanceof Set) {
        if (((Set) val).contains(destNode)) {
          if (key != null) {
            arcLabels.add((Class<? extends GrammaticalRelationAnnotation>) key);
          }
View Full Code Here

Examples of edu.stanford.nlp.ling.CyclicCoreLabel

    if (isLeaf()) {
      // lexical leaves do not add any Constituents
      // but increment position
      // System.err.println("In bracketing trees leaf is " + label());

      CyclicCoreLabel l = (CyclicCoreLabel) label();
      l.set(SpanAnnotation.class, new IntPair(left, left));
      return (left + 1);
    }
    int position = left;

    // System.err.println("In bracketing trees left is " + left);
    // System.err.println("  label is " + label() +
    //                       "; num daughters: " + children().length);
    // enumerate through daughter trees
    Tree[] kids = children();
    for (int i = 0; i < kids.length; i++) {
      // compute bracketings for daughter tree
      // update position to end of daughter tree
      position = kids[i].constituentsNodes(position);
      // System.err.println("  position went to " + position);
    }
    // need to wait until result position is known in order to
    // calculate span of whole tree
    CyclicCoreLabel l = (CyclicCoreLabel) label();
    l.set(SpanAnnotation.class, new IntPair(left, position - 1));

    return position;
  }
View Full Code Here

Examples of edu.stanford.nlp.ling.CyclicCoreLabel

   */
  public Set<Dependency<Label, Label, Object>> mapDependencies(Filter<Dependency<Label, Label, Object>> f, HeadFinder hf, String rootName) {
    Set<Dependency<Label, Label, Object>> deps = mapDependencies(f, hf);
    if(rootName != null) {
      Label hl = headTerminal(hf).label();
      CyclicCoreLabel rl = new CyclicCoreLabel();
      rl.set(WordAnnotation.class, rootName);
      rl.set(IndexAnnotation.class, 0);
      deps.add(new NamedDependency(rl, hl, rootName));
    }
    return deps;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.