/** Called by {@link AbstractDEPParser#getGoldLabel()}. */ private DEPLabel getGoldLabelArc() { StringIntPair head = g_heads[i_lambda]; if (head.i == i_beta) return new DEPLabel(LB_LEFT, head.s); head = g_heads[i_beta]; if (head.i == i_lambda) return new DEPLabel(LB_RIGHT, head.s); return new DEPLabel(LB_NO, ""); }
public DEPLabel(String label) { set(label); }
n_trans++; if (label.isArc(LB_LEFT)) else if (beta.isDescendentOf(lambda)) noPass(); else if (label.isList(LB_REDUCE)) leftReduce(lambda, beta, label.deprel); else leftPass(lambda, beta, label.deprel); else if (label.isArc(LB_RIGHT)) else if (label.isList(LB_SHIFT)) rightShift(lambda, beta, label.deprel); else if (label.isList(LB_SHIFT)) noShift(); else if (label.isList(LB_REDUCE) && lambda.hasHead()) noReduce(); else
/** Called by {@link AbstractDEPParser#getLabel()}. */ protected 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; else label.list = LB_PASS; } return label; }
/** Called by {@link AbstractDEPParser#parse()}. */ protected DEPLabel getLabel(List<Pair<String,StringFeatureVector>> insts, List<DEPState> states) { StringFeatureVector vector = getFeatureVector(f_xmls[0]); DEPLabel label = null; if (i_flag == FLAG_TRAIN) { label = getGoldLabel(); insts.add(new Pair<String,StringFeatureVector>(label.toString(), vector)); } else if (i_flag == FLAG_DECODE || i_flag == FLAG_DEVELOP) { label = getAutoLabel(vector, states); } else if (i_flag == FLAG_BOOTSTRAP) { label = getAutoLabel(vector, states); insts.add(new Pair<String,StringFeatureVector>(getGoldLabel().toString(), vector)); } return label; }
public DEPLabel(String label, double score) { set(label); this.score = score; }