Package com.clearnlp.propbank

Examples of com.clearnlp.propbank.PBLoc


   
    for (CTNode node : ls_termainals)
    {
      terminalId  = node.i_terminalId;
      height      = 0;
      node.pb_loc = new PBLoc(terminalId, height);
     
      while (node.parent != null && node.parent.pb_loc == null)
      {
        node = node.parent;
        node.pb_loc = new PBLoc(terminalId, ++height);
      }
    }
  }
View Full Code Here


      }
      else
      {
        nInst.addArgs(args);
        rel = nInst.getFirstArg(PBLib.PB_REL);
        rel.addLoc(new PBLoc(instance.predId, 0, ","));
       
        args.clear();
       
        for (PBArg arg : instance.getArgs())
        {
View Full Code Here

        {
          node = parent;
          height++;
        }
       
        lNew.add(new PBLoc(terminalId, height, ","));
        ids.removeAll(node.getSubTerminalIdSet());
      }
     
      if (lNew.size() < arg.getLocSize())
      {
View Full Code Here

   * PRE: {@link PBInstance#sortArgs()} is called.
   */
  private void removeRedundantLocs(PBInstance instance)
  {
    List<PBLoc> lDel = new ArrayList<PBLoc>();
    PBLoc curr, next;
    int i, size;
   
    for (PBArg arg : instance.getArgs())
    {
      size = arg.getLocSize() - 1;
View Full Code Here

  private void getLinks(PBInstance instance)
  {
    CTTree tree = instance.getTree();
    CTNode node, link;
    List<PBArg> lLinks = new ArrayList<PBArg>();
    PBLoc loc; int i;
   
    for (PBArg arg : instance.getArgs())
    {
      if (arg.label.startsWith("LINK"))
        lLinks.add(arg);
     
      for (i=arg.getLocSize()-1; i>0; i--)
      {
        loc  = arg.getLoc(i);
        node = tree.getNode(loc);
       
        if (node.pTag.startsWith("WH"))
        {
          link = CTLibEn.getComplementizer(node);

          if (link.getAntecedent() == null)
          {
            link.setAntecedent(tree.getNode(arg.getLoc(i-1)));
            break;
          }
        }
        else if (CTLibEn.isComplementizer(node))
        {
          if (node.getAntecedent() == null)
          {
            node.setAntecedent(tree.getNode(arg.getLoc(i-1)));
            break;
          }
        }
        else if (node.isEmptyCategoryRec() && loc.isType("*"))
        {
          link = node.getFirstTerminal();
         
          if (link.getAntecedent() == null)
            link.setAntecedent(tree.getNode(arg.getLoc(i-1)));
View Full Code Here

  private void normalizeLinks(PBInstance instance)
  {
    List<PBLoc> lDel = new ArrayList<PBLoc>();
    CTTree tree = instance.getTree();
    CTNode curr, node, ante;
    PBLoc  cLoc; int i;
    List<CTNode> list;
    CTNode pred = tree.getTerminal(instance.predId);
   
    for (PBArg arg : instance.getArgs())
    {
      if (arg.isLabel(PBLib.PB_REL))  continue;
      lDel.clear();
     
      for (i=0; i<arg.getLocSize(); i++// size() gets changed dynamically
      {
        cLoc = arg.getLoc(i);
        curr = tree.getNode(cLoc);
       
        if (CTLibEn.isComplementizer(curr))
        {
          if ((ante = curr.getAntecedent()) != null)
            arg.addLoc(new PBLoc(ante.getPBLoc(), "*"));
         
          if ((node = getCoIndexedWHNode(curr)) != null)
            cLoc.set(node.getPBLoc(), "*");
        }
        else if (curr.pTag.startsWith("WH"))
        {
          if ((node = CTLibEn.getComplementizer(curr)) != null && (ante = node.getAntecedent()) != null)
            arg.addLoc(new PBLoc(ante.getPBLoc(), "*"));
        }
        else if (curr.isEmptyCategoryRec())    // *T*, *
        {
          cLoc.height = 0;
          node = tree.getTerminal(cLoc.terminalId);
         
          if ((ante = node.getAntecedent()) != null)
            arg.addLoc(new PBLoc(ante.getPBLoc(), "*"));
        }
        else if (!(list = curr.getIncludedEmptyCategory("\\*(ICH|RNR)\\*.*")).isEmpty())
        {
          for (CTNode ec : list)
          {
            lDel.add(new PBLoc(ec.getPBLoc(), ""));
           
            if ((ante = ec.getAntecedent()) != null)
            {
              if (ante.isDescendantOf(curr) || pred.isDescendantOf(ante))
                lDel.add(new PBLoc(ante.getPBLoc(), ""));
              else
                arg.addLoc(new PBLoc(ante.getPBLoc(), ";"));
            }
          }
        }
        else if (curr.isPTag(CTLibEn.PTAG_S) && (node = curr.getFirstChild("-"+CTLibEn.FTAG_SBJ)) != null && node.isEmptyCategoryRec() && curr.containsTags(CTLibEn.PTAG_VP))
        {
          node = node.getFirstTerminal();
         
          if (CTLibEn.RE_NULL.matcher(node.form).find() && (ante = node.getAntecedent()) != null && ante.hasFTag(CTLibEn.FTAG_SBJ) && !ante.isEmptyCategoryRec() && !existsLoc(instance, ante.getPBLoc()))
            arg.addLoc(new PBLoc(ante.getPBLoc(), "*"));
        }
      }
     
      // removes errorneous arguments
      for (PBLoc rLoc : lDel)
View Full Code Here

       
        if (label != null)
        {
          nArg = new PBArg();
          nArg.label = label;
          nArg.addLoc(new PBLoc(ante.getPBLoc(), ""));
          nArg.addLoc(new PBLoc(node.getPBLoc(), "*"));
         
          lAdd.add(nArg);
        }
      }
    }
 
View Full Code Here

  private void raiseEmptyArguments(PBInstance instance)
  {
    CTTree tree = instance.getTree();
    CTNode node, parent;
    int i, size;
    PBLoc loc;
   
    for (PBArg arg : instance.getArgs())
    {
      if (arg.isLabel(PBLib.PB_REL))  continue;
      size = arg.getLocSize();
     
      for (i=0; i<size; i++)
      {
        loc  = arg.getLoc(i);
        node = tree.getNode(loc);
        parent = node.getParent();
       
        if (parent != null && !parent.isPTag(CTLib.PTAG_TOP) && parent.getChildrenSize() == 1)
          node = parent;
       
        loc.set(node.getPBLoc(), loc.type);
      }
    }
  }
View Full Code Here

   
    for (CTNode node : ls_termainals)
    {
      terminalId  = node.i_terminalId;
      height      = 0;
      node.pb_loc = new PBLoc(terminalId, height);
     
      while (node.parent != null && node.parent.pb_loc == null)
      {
        node = node.parent;
        node.pb_loc = new PBLoc(terminalId, ++height);
      }
    }
  }
View Full Code Here

TOP

Related Classes of com.clearnlp.propbank.PBLoc

Copyright © 2018 www.massapicom. 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.