Package com.clearnlp.dependency

Examples of com.clearnlp.dependency.DEPNode


  }

  @Override
  protected String getHardLabel(SRLState state, String label)
  {
    DEPNode pred = state.getCurrentPredicate();
    DEPNode arg  = state.getCurrentArgument();
    DEPNode dep;
   
    if (arg.isLemma(ENPrep.FOR))
    {
      if (pred.isLemma("search") && PBLib.isCoreNumberedArgument(label))
        return SRLLib.ARG2;
    }
    else if (arg.isLemma(ENPrep.AT))
    {
      if ((dep = state.getRightmostDependent(arg.id)) != null && dep.isPos(CTLibEn.POS_NN) && (ENTime.isTemporalSuffix(dep.lemma)))
        return SRLLib.ARGM_TMP;
    }
   
    return null;
  }
View Full Code Here


  }
 
  @Override
  protected DEPNode getPossibleDescendent(DEPNode pred, DEPNode arg)
  {
    DEPNode pobj;
   
    if (arg.isLabel(DEPLibEn.DEP_POBJ))
      return arg;

    if (arg.isPos(CTLibEn.POS_IN) && (pobj = arg.getFirstDependentByLabel(DEPLibEn.DEP_POBJ)) != null)
View Full Code Here

    return null;
  }
 
  private void postLabelReferent(DEPTree tree, List<List<DEPArc>> argLists)
  {
    DEPNode pred = tree.get(0);
    List<DEPArc> args;
    PBRoleset roleset;
    String label, n;
    DEPNode node;
    int i, size;
    DEPArc arg;
   
    while ((pred = tree.getNextPredicate(pred.id)) != null)
    {
      args = argLists.get(pred.id);
      size = args.size();
     
      for (i=0; i<size; i++)
      {
        arg   = args.get(i);
        label = arg.getLabel();
       
        if (SRLLib.P_ARG_REF.matcher(label).find())
        {
          if ((n = PBLib.getNumber(label)) != null && !containsNumberedArugment(args, n, 0, i) && containsNumberedArugment(args, n, i+1, size))
          {
            roleset = m_frames.getRoleset(getPBType(pred), pred.lemma, pred.getFeat(DEPLibEn.FEAT_PB));
            n = Integer.toString(Integer.parseInt(n)+1);
           
            if (roleset.isValidArgumentNumber(n) && !containsNumberedArugment(args, n, i+1, size))
            {
              node = arg.getNode();
              node.getSHead(pred).setLabel(SRLLib.PREFIX_REFERENT+"A"+n);
            }
          }
         
          break;
        }
View Full Code Here

 
  protected List<StringInstance> identify(POSState state)
  {
    List<StringInstance> insts = Lists.newArrayList();
    String label;
    DEPNode node;
   
    while ((node = state.shift()) != null)
    {
      if (f_xmls[0].isPredicate(node))
      {
        label = getLabel(insts, state);
       
        if (AbstractModel.toBoolean(label))
        {
          resetNode(node);
          node.addFeat(DEPLib.FEAT_PB, node.lemma+".XX");
        }
      }
    }
   
    return insts;
View Full Code Here

//  ====================================== FEATURE EXTRACTION ======================================

  @Override
  protected String getField(FtrToken token, POSState state)
  {
    DEPNode node = state.getNode(token);
    if (node == nullreturn null;
    Matcher m;
   
    if (token.isField(JointFtrXml.F_FORM))
    {
      return node.form;
    }
    else if (token.isField(JointFtrXml.F_LEMMA))
    {
      return node.lemma;
    }
    else if (token.isField(JointFtrXml.F_POS))
    {
      return node.pos;
    }
    else if (token.isField(JointFtrXml.F_DEPREL))
    {
      return node.getLabel();
    }
    else if ((m = JointFtrXml.P_FEAT.matcher(token.field)).find())
    {
      return node.getFeat(m.group(1));
    }
   
    return null;
  }
View Full Code Here

  }
 
  @Override
  protected String[] getFields(FtrToken token, POSState state)
  {
    DEPNode node = state.getNode(token);
    if (node == nullreturn null;
   
    if (token.isField(JointFtrXml.F_DEPREL_SET))
    {
      return getDeprelSet(node.getDependents());
    }
   
    return null;
  }
View Full Code Here

 
  protected void addLexica(POSState state)
  {
    String roleset, lemma;
    Set<String> set;
    DEPNode pred;
   
    while ((pred = state.shift()) != null)
    {
      roleset = state.getGoldLabel();
      lemma   = pred.lemma;
View Full Code Here

 
  /** Called by {@link AbstractRolesetClassifier#processAux()}. */
  protected void classify(POSState state)
  {
    String roleset;
    DEPNode node;
   
    while ((node = state.shift()) != null)
    {
      if (node.getFeat(DEPLib.FEAT_PB) != null)
      {
        if ((roleset = m_rolesets.get(node.lemma)) == null)
        {
          if (m_lemmas.containsKey(node.lemma))
            roleset = getLabel(m_lemmas.get(node.lemma), state);
          else
            roleset = getDefaultLabel(node);
        }
       
        node.addFeat(DEPLib.FEAT_PB, roleset);       
      }
    }
  }
View Full Code Here

//  ====================================== FEATURE EXTRACTION ======================================

  @Override
  protected String getField(FtrToken token, POSState state)
  {
    DEPNode node = state.getNode(token);
    if (node == nullreturn null;
    Matcher m;
   
    if (token.isField(JointFtrXml.F_FORM))
    {
      return node.form;
    }
    else if (token.isField(JointFtrXml.F_LEMMA))
    {
      return node.lemma;
    }
    else if (token.isField(JointFtrXml.F_POS))
    {
      return node.pos;
    }
    else if (token.isField(JointFtrXml.F_DEPREL))
    {
      return node.getLabel();
    }
    else if ((m = JointFtrXml.P_FEAT.matcher(token.field)).find())
    {
      return node.getFeat(m.group(1));
    }
   
    return null;
  }
View Full Code Here

  }
 
  @Override
  protected String[] getFields(FtrToken token, POSState state)
  {
    DEPNode node = state.getNode(token);
    if (node == nullreturn null;
   
    if (token.isField(JointFtrXml.F_DEPREL_SET))
    {
      return getDeprelSet(node.getDependents());
    }
   
    return null;
  }
View Full Code Here

TOP

Related Classes of com.clearnlp.dependency.DEPNode

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.