Examples of CTNode


Examples of com.clearnlp.constituent.CTNode

 
  private boolean isXcomp(CTNode node)
  {
    if (node.isPTag(CTLibEn.PTAG_S))
    {
      CTNode sbj = node.getFirstChild("-"+CTLibEn.FTAG_SBJ);
     
      if (node.containsTags(CTLibEn.PTAG_VP) && (sbj == null || sbj.isEmptyCategoryRec()))
        return true;
    }
    else if (node.hasFTag(DEPLibEn.DEP_RCMOD))
    {
      CTNode s = node.getFirstChild(CTLibEn.PTAG_S);
      if (s != nullreturn isXcomp(s);
    }

    return false;
  }
View Full Code Here

Examples of com.clearnlp.constituent.CTNode

    if (node.isPTagAny(CTLibEn.PTAG_S, CTLibEn.PTAG_SQ, CTLibEn.PTAG_SINV, CTLibEn.PTAG_SBARQ))
      return true;
   
    if (node.isPTag(CTLibEn.PTAG_SBAR))
    {
      CTNode comp;
     
      if ((comp = node.getFirstChild(CTLib.POS_NONE)) != null && comp.isForm("0"))
        return true;
     
      if ((comp = node.getFirstChild("+IN|DT")) != null)
      {
        if (comp.form.equalsIgnoreCase("that") || comp.form.equalsIgnoreCase("if") || comp.form.equalsIgnoreCase("whether"))
View Full Code Here

Examples of com.clearnlp.constituent.CTNode

    return isXcomp(curr) || curr.isPTag(CTLibEn.PTAG_VP);
  }
 
  private boolean isInfMod(CTNode curr)
  {
    CTNode vp = curr.isPTag(CTLibEn.PTAG_VP) ? curr : curr.getFirstDescendant(CTLibEn.PTAG_VP);
   
    if (vp != null)
    {
      CTNode vc = vp.getFirstChild(CTLibEn.PTAG_VP);
     
      while (vc != null)
      {
        vp = vc;
       
View Full Code Here

Examples of com.clearnlp.constituent.CTNode

 
  /** Adds dependency heads. */
  private void addDEPHeads(DEPTree dTree, CTTree cTree)
  {
    int currId, headId, size = dTree.size(), rootCount = 0;
    CTNode cNode, ante;
    DEPNode dNode;
    String label;
   
    for (currId=1; currId<size; currId++)
    {
      dNode  = dTree.get(currId);
      cNode  = cTree.getToken(currId-1);
      headId = cNode.c2d.d_head.getTokenId() + 1;
     
      if (currId == headId// root
      {
        dNode.setHead(dTree.get(DEPLib.ROOT_ID), DEPLibEn.DEP_ROOT);
        rootCount++;
      }
      else
      {
        label = cNode.c2d.s_label;
       
        if (cNode.isPTagAny(CTLibEn.POS_IN, CTLibEn.POS_TO, CTLibEn.POS_DT) && cNode.getParent().isPTag(CTLibEn.PTAG_SBAR) && !label.equals(DEPLibEn.DEP_COMPLM))
          label = DEPLibEn.DEP_MARK;
       
        dNode.setHead(dTree.get(headId), label);
      }
     
      if ((ante = cNode.getAntecedent()) != null)
        dNode.addXHead(getDEPNode(dTree, ante), DEPLibEn.DEP_REF);
    }
   
    if (rootCount > 1System.err.println("Warning: multiple roots exist");
  }
View Full Code Here

Examples of com.clearnlp.constituent.CTNode

  }
 
  /** Add extra features. */
  private void addFeats(DEPTree dTree, CTTree cTree, CTNode cNode)
  {
    CTNode ante;
    String feat;
   
    if (cNode.gapIndex != -1 && cNode.getParent().gapIndex == -1 && (ante = cTree.getCoIndexedAntecedent(cNode.gapIndex)) != null)
    {
      DEPNode dNode = getDEPNode(dTree, cNode);
View Full Code Here

Examples of com.clearnlp.constituent.CTNode

 
  // ============================= Add PropBank arguments =============================
 
  private void addPBArgs(DEPTree dTree, CTTree cTree)
  {
    CTNode root = cTree.getRoot();
    dTree.initSHeads();
   
    if (root.pbArgs != null)
    {
      initPBArgs(dTree, cTree, root);
View Full Code Here

Examples of com.clearnlp.constituent.CTNode

    int[] flags = new int[size];
   
    for (i=0; i<size; i++)
      flags[i] = getHeadFlag(nodes.get(i));
   
    CTNode head = null, child;
   
    outer: for (flag=0; flag<flagSize; flag++)
    {
      for (HeadTagSet tagset : rule.getHeadTags())
      {
        for (i=0; i<size; i++)
        {
          child = nodes.get(i);
         
          if (flags[i] == flag && tagset.matches(child))
          {
            head = child;
            break outer;
          }
        }
      }
    }

    if (head == null)
    {
      System.err.println("Error: head not found.");
      System.exit(1);
    }
   
    CTNode parent = head.getParent();
   
    for (CTNode node : nodes)
    {
      if (node != head && !node.c2d.hasHead())
        node.c2d.setHead(head, getDEPLabel(node, parent, head));
View Full Code Here

Examples of com.clearnlp.constituent.CTNode

  @Override
  protected void setHeadsAux(HeadRule rule, CTNode curr)
  {
    findConjuncts(rule, curr);

    CTNode head = getHead(rule, curr.getChildren(), SIZE_HEAD_FLAGS);
    curr.c2d = new C2DInfo(head);
  }
View Full Code Here

Examples of com.clearnlp.constituent.CTNode

  private void findConjuncts(HeadRule rule, CTNode curr)
  {
    List<CTNode> children = curr.getChildren();
    int i, size = children.size();
    String label;
    CTNode child;
   
    for (i=0; i<size; i++)
    {
      child = children.get(i);
     
      if ((label = getSpecialLabel(child)) != null)
        child.addFTag(label);
      else
        break;
    }
   
    if (CTLibKaist.containsCoordination(children.subList(i,size), DELIM_PLUS))
    {
      for (; i<size; i++)
      {
        child = children.get(i);
       
        if ((label = getConjunctLabel(curr, child)) != null)
          child.addFTag(label);
      }
    }
  }
View Full Code Here

Examples of com.clearnlp.constituent.CTNode

      return label;
   
    if ((label = getSimpleLabel(C)) != null)
      return label;
   
    CTNode d = C.c2d.getDependencyHead();

    if ((label = getSimpleLabel(d)) != null)
      return label;
   
    if (P.isPTag(CTLibKaist.PTAG_ADJP))
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.