/** * Initializes the values of this node. * @param id the ID of this node. * @param form the word-form of this node. * @param lemma the lemma of the word-form. * @param pos the part-of-speech tag of this node. * @param feats the extra features of this node. */ public void init(int id, String form, String lemma, String pos, DEPFeat feats) { this.id = id; this.form = form; this.lemma = lemma; this.pos = pos; this.nament = AbstractColumnReader.BLANK_COLUMN; this.d_feats = feats; this.d_head = new DEPArc(); }
/** Constructs an empty dependency arc. */ public DEPArc() { clear(); }
/** * If both the specific node and label match, returns 1. * If only the specific node matches, returns 2. * Otherwise, returns 0. * @param node the node to be compared. * @param label the label to be compared. * @return If both the specific node and label match, returns 1. * If only the specific node matches, returns 2. * Otherwise, returns 0. */ public int compareTo(DEPNode node, String label) { if (isNode(node)) return isLabel(label) ? 1 : 2; return 0; }
dep = arc.getNode(); dep = dArc.getNode(); DEPNode rDep = ref.getNode(); DEPArc rHead = rDep.getSHead(pred); DEPArc whose = rDep.getAnyDescendentArcByPOS(CTLibEn.POS_WPS); DEPNode tmp = whose.getNode(); arg.setHead(tmp.getHead(), tmp.getLabel()); arg.id = tmp.id; whose.setNode(arg); rHead.setLabel(sArc.getLabel()); arg.removeSHead(pred); else if (ref.isLabel(DEPLibEn.DEP_PREP)) DEPArc tmp = new DEPArc(arg, DEPLibEn.DEP_POBJ); arg.setHead(rDep, tmp.getLabel()); arg.id = rDep.id + 1; rDep.clearDependents(); rDep.addDependent(tmp); rHead.setLabel(sArc.getLabel()); arg.removeSHead(pred); else if (ref.isLabel(DEPLibEn.P_SBJ)) arg.setHead(pred, ref.getLabel());
public List<List<DEPArc>> getArgumentList() { int i, size = size(); List<DEPArc> args; DEPNode node; List<List<DEPArc>> list = new ArrayList<List<DEPArc>>(); for (i=0; i<size; i++) list.add(new ArrayList<DEPArc>()); for (i=1; i<size; i++) { node = get(i); for (DEPArc arc : node.getSHeads()) { args = list.get(arc.getNode().id); args.add(new DEPArc(node, arc.getLabel())); } } return list; }
if ((pvRoleset = pvRolesets[arc.getNode().id]) != null) if (MPLib.containsOnlyDigits(n = arc.getLabel().substring(1, 2))) arc.appendLabel(pvRole.vntheta);
dep = arcs.get(i).getNode(); sArc = dep.getSHead(pred); if (noSbj && (dep.isLabel(DEPLibEn.P_SBJ) || dep.isLabel(DEPLibEn.P_AUX)) || (sArc != null && sArc.isLabel(ARGM_NEG))) pred.addDependentFront(new DEPArc(dep, dep.getLabel())); pred.addDependent(new DEPArc(dep, dep.getLabel())); dep = arc.getNode(); pred.addDependent(new DEPArc(dep, dep.getLabel()));
@Override public int compareTo(DEPArc arc) { return label.compareTo(arc.getLabel()); } }
/** * Returns {@code true} if the dependency label of this node equals to the specific label. * @param label the dependency label to be compared. * @return {@code true} if the dependency label of this node equals to the specific label. */ public boolean isLabel(String label) { return d_head.label != null && d_head.isLabel(label); }
/** * Returns {@code true} if this node is a dependent of the specific node. * @param node the potential head. * @return {@code true} if this node is a dependent of the specific node. */ public boolean isDependentOf(DEPNode node) { return d_head.isNode(node); }
/** * Constructs a dependency arc. * @param node the linking node. * @param label the dependency label for the linking node. */ public DEPArc(DEPNode node, String label) { set(node, label); }
/** * Sets the dependency label of this node to the specific label. * @param label the dependency label to be assigned. */ public void setLabel(String label) { d_head.setLabel(label); }
public void setHead(DEPNode head) { d_head.setNode(head); }