public int getPositionAmongParentsChildren() { if (this.isRoot()) return 0; return this.parent.getChildren().indexOf(this); }
public int getPositionAmongParentsChildren() { if (this.isRoot()) return 0; return this.parent.getChildren().indexOf(this); }
public static Tree<String> getTreeCovering(Tree<String> parse, int start, int end) { Tree<String> tree = parse.getYield().get(start); while (!tree.isRoot()) { if (tree.getYield().size() >= (end - start)) { break; } tree = tree.getParent(); } return tree; }
public static Tree<String> getTreeCovering(Tree<String> parse, int start, int end) { Tree<String> tree = parse.getYield().get(start); while (!tree.isRoot()) { if (tree.getYield().size() >= (end - start)) { break; } tree = tree.getParent(); } return tree; }
public static Tree<String> getTreeCovering(Tree<String> parse, int start, int end) { Tree<String> tree = parse.getYield().get(start); while (!tree.isRoot()) { if (tree.getYield().size() >= (end - start)) { break; } tree = tree.getParent(); } return tree; }
public static Tree<String> getTreeCovering(Tree<String> parse, int start, int end) { Tree<String> tree = parse.getYield().get(start); while (!tree.isRoot()) { if (tree.getYield().size() >= (end - start)) { break; } tree = tree.getParent(); } return tree; }
/** * Get the labels of all siblings of a given tree node. * * @param node The node whose siblings are required. * @return The labels of the siblings of the input node, as an array of strings. If the input is * the root of the tree, then a string array of size zero is returned to indicate that * the corresponding parse tree node does not have any siblings. */ public static String[] getAllSiblingLabels(Tree<String> node) { List<String> siblings = new ArrayList<>(); if (node.isRoot()) return new String[0]; Tree<String> parent = node.getParent(); for (Tree<String> child : parent.childrenIterator()) { siblings.add(child.getLabel()); } return siblings.toArray(new String[siblings.size()]); }
/** * Get the labels of all siblings of a given tree node. * * @param node The node whose siblings are required. * @return The labels of the siblings of the input node, as an array of strings. If the input is * the root of the tree, then a string array of size zero is returned to indicate that * the corresponding parse tree node does not have any siblings. */ public static String[] getAllSiblingLabels(Tree<String> node) { List<String> siblings = new ArrayList<>(); if (node.isRoot()) return new String[0]; Tree<String> parent = node.getParent(); for (Tree<String> child : parent.childrenIterator()) { siblings.add(child.getLabel()); } return siblings.toArray(new String[siblings.size()]); }
/** * Get the labels of all siblings of a given tree node. * * @param node The node whose siblings are required. * @return The labels of the siblings of the input node, as an array of strings. If the input is * the root of the tree, then a string array of size zero is returned to indicate that * the corresponding parse tree node does not have any siblings. */ public static String[] getAllSiblingLabels(Tree<String> node) { List<String> siblings = new ArrayList<>(); if (node.isRoot()) return new String[0]; Tree<String> parent = node.getParent(); for (Tree<String> child : parent.childrenIterator()) { siblings.add(child.getLabel()); } return siblings.toArray(new String[siblings.size()]); }
/** * Get the labels of all siblings of a given tree node. * * @param node The node whose siblings are required. * @return The labels of the siblings of the input node, as an array of strings. If the input is * the root of the tree, then a string array of size zero is returned to indicate that * the corresponding parse tree node does not have any siblings. */ public static String[] getAllSiblingLabels(Tree<String> node) { List<String> siblings = new ArrayList<>(); if (node.isRoot()) return new String[0]; Tree<String> parent = node.getParent(); for (Tree<String> child : parent.childrenIterator()) { siblings.add(child.getLabel()); } return siblings.toArray(new String[siblings.size()]); }
if (currentNode.isRoot()) done = true; else {
if (currentNode.isRoot()) done = true; else {
if (!c.isRoot() && !c.isLeaf() && !c.getChild(0).isLeaf()) { int start = c.getLabel().getSecond().getFirst() + predicateSentenceStart; int end = c.getLabel().getSecond().getSecond() + predicateSentenceStart; while (!node.isRoot() && !ParseTreeProperties.isNonTerminalVerb(node.getLabel().getFirst())) node = node.getParent(); while (!node.isRoot()) { String label = node.getLabel().getFirst(); if (label.startsWith("S")) while (!node.isRoot()) { String label = node.getLabel().getFirst(); if (ParseTreeProperties.isNonTerminalPP(label)) {