Examples of DEPLabel


Examples of com.clearnlp.dependency.DEPLabel

 
  @Override
  public Set<String> getLabels()
  {
    Set<String> set = Sets.newHashSet();
    DEPLabel lb;
   
    for (StringModel model : s_models)
    {
      for (String label : model.getLabels())
      {
        lb = new DEPLabel(label);
        set.add(lb.deprel);
      }
    }
   
    return set;
View Full Code Here

Examples of com.clearnlp.dependency.DEPLabel

 
  protected List<StringInstance> parseOne(DEPState state)
  {
    List<StringInstance> insts = Lists.newArrayList();
    DEPNode  lambda, beta;
    DEPLabel label;
   
    while (state.isBetaValid())
    {
      if (!state.isLambdaValid())
      {
View Full Code Here

Examples of com.clearnlp.dependency.DEPLabel

 
  /** Called by {@link #parse()}. */
  protected DEPLabel getLabel(List<StringInstance> insts, DEPState state)
  {
    StringFeatureVector vector = getFeatureVector(f_xmls[0], state);
    DEPLabel label = null;
   
    if (isTrain())
    {
      label = state.getGoldLabel();
      insts.add(new StringInstance(label.toString(), vector));
    }
    else if (isDevelopOrDecode())
    {
      label = getAutoLabel(vector, state);
    }
View Full Code Here

Examples of com.clearnlp.dependency.DEPLabel

  /** Called by {@link #getLabel()}. */
  private DEPLabel getAutoLabel(StringFeatureVector vector, DEPState state)
  {
    List<StringPrediction> ps = getPredictions(vector, state);

    DEPLabel fst = new DEPLabel(ps.get(0).label, ps.get(0).score);
    DEPLabel snd = new DEPLabel(ps.get(1).label, ps.get(1).score);
   
    if (fst.score - snd.score < d_margin)
    {
      if (fst.isArc(LB_NO))
        state.add2ndHead(snd);
View Full Code Here

Examples of com.clearnlp.dependency.DEPLabel

 
  protected void processHeadlessAux(DEPNode node, int dir, Triple<DEPNode,String,Double> max, DEPState state)
  {
    int i, size = state.getTreeSize();
    List<StringPrediction> ps;
    DEPLabel label;
    DEPNode  head;
   
    if (dir < 0state.setBeta(node.id);
    else      state.setLambda(node.id);
   
    for (i=node.id+dir; 0<=i && i<size; i+=dir)
    {
      head = state.getNode(i);     
      if (head.isDescendentOf(node))  continue;
     
      if (dir < 0state.setLambda(i);
      else      state.setBeta(i);
     
      ps = getPredictions(getFeatureVector(f_xmls[0], state), state);
     
      for (StringPrediction p : ps)
      {
        if (p.score <= max.o3)
          break;
       
        label = new DEPLabel(p.label);
       
        if ((dir < 0 && label.isArc(LB_RIGHT)) || (dir > 0 && label.isArc(LB_LEFT)))
        {
          max.set(head, label.deprel, p.score);
          break;
        }
      }
View Full Code Here

Examples of com.clearnlp.dependency.DEPLabel

  }
 
  private void branch(DEPState state)
  {
    state.disableBranching();
    DEPLabel label;
   
    while ((label = state.setToNextState()) != null)
    {
      parseAux(label, state);
      parseOne(state);
View Full Code Here

Examples of com.clearnlp.dependency.DEPLabel

    return g_labels;
  }
 
  public DEPLabel getGoldLabel()
  {
    DEPLabel label = getGoldLabelArc();
   
    if (label.isArc(LB_LEFT))
      label.list = isGoldReduce(true) ? LB_REDUCE : LB_PASS;
    else if (label.isArc(LB_RIGHT))
      label.list = isGoldShift() ? LB_SHIFT : LB_PASS;
    else
    {
      if      (isGoldShift())      label.list = LB_SHIFT;
      else if (isGoldReduce(false))  label.list = LB_REDUCE;
View Full Code Here

Examples of com.clearnlp.dependency.DEPLabel

  private DEPLabel getGoldLabelArc()
  {
    StringIntPair head = g_labels[i_lambda];
   
    if (head.i == i_beta)
      return new DEPLabel(LB_LEFT, head.s);
   
    head = g_labels[i_beta];
   
    if (head.i == i_lambda)
      return new DEPLabel(LB_RIGHT, head.s);
   
    return new DEPLabel(LB_NO, "");
  }
View Full Code Here

Examples of com.clearnlp.dependency.DEPLabel

    DEPNode beta   = state.getBeta();
   
    int i, size = ps.size(), count = 0;
    boolean lChanged, gChanged = false;
    StringPrediction prediction;
    DEPLabel label;
   
    for (i=0; i<size; i++)
    {
      lChanged = false;
      prediction = ps.get(i);
      label = new DEPLabel(prediction.label, prediction.score);
     
      if (label.isArc(LB_LEFT))
      {
        if (rerankUnique(prediction, label, beta, DEPLibEn.P_SBJ, lambda.id+1, beta.id, state))
          lChanged = true;
        else if (rerankNonHead(prediction, beta))
          lChanged = true;
      }
      else if (label.isArc(LB_RIGHT))
      {
        if (rerankUnique(prediction, label, lambda, DEPLibEn.P_SBJ, 1, beta.id, state))
          lChanged = true;
        else if (rerankNonHead(prediction, lambda))
          lChanged = true;
View Full Code Here

Examples of com.clearnlp.dependency.DEPLabel

    return g_labels;
  }
 
  public DEPLabel getGoldLabel()
  {
    DEPLabel label = getGoldLabelArc();
   
    if (label.isArc(LB_LEFT))
      label.list = isGoldReduce(true) ? LB_REDUCE : LB_PASS;
    else if (label.isArc(LB_RIGHT))
      label.list = isGoldShift() ? LB_SHIFT : LB_PASS;
    else
    {
      if      (isGoldShift())      label.list = LB_SHIFT;
      else if (isGoldReduce(false))  label.list = LB_REDUCE;
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.