/** * returns the leaves in a Tree in the order that they're found. */ public static List<Tree> leaves(Tree t) { List<Tree> l = new ArrayList<>(); leaves(t, l); return l; }
private static void leaves(Tree t, List<Tree> l) { if (t.isLeaf()) { l.add(t); } else { for (Tree kid : t.children()) { leaves(kid, l); } } }
Oracle(List<Tree> binarizedTrees, boolean compoundUnaries, Set<String> rootStates) { this.binarizedTrees = binarizedTrees; parentMaps = Generics.newArrayList(binarizedTrees.size()); leafLists = Generics.newArrayList(); for (Tree tree : binarizedTrees) { parentMaps.add(buildParentMap(tree)); leafLists.add(Trees.leaves(tree)); } this.compoundUnaries = compoundUnaries; }
TreeGraphNode rootDep = root().headWordNode(); if (rootDep == null) { List<Tree> leaves = Trees.leaves(root()); if (leaves.size() > 0) { Tree leaf = leaves.get(0);
/** * returns the leaves in a Tree in the order that they're found. */ public static List<Tree> leaves(Tree t) { List<Tree> l = new ArrayList<>(); leaves(t, l); return l; }
/** * returns the leaves in a Tree in the order that they're found. */ public static List<Tree> leaves(Tree t) { List<Tree> l = new ArrayList<>(); leaves(t, l); return l; }
/** * returns the leaves in a Tree in the order that they're found. */ public static List<Tree> leaves(Tree t) { List<Tree> l = new ArrayList<Tree>(); leaves(t, l); return l; }
/** * returns the leaves in a Tree in the order that they're found. */ public static List<Tree> leaves(Tree t) { List<Tree> l = new ArrayList<Tree>(); leaves(t, l); return l; }
private static void leaves(Tree t, List<Tree> l) { if (t.isLeaf()) { l.add(t); } else { for (Tree kid : t.children()) { leaves(kid, l); } } }
private static void leaves(Tree t, List<Tree> l) { if (t.isLeaf()) { l.add(t); } else { for (Tree kid : t.children()) { leaves(kid, l); } } }
private static void leaves(Tree t, List<Tree> l) { if (t.isLeaf()) { l.add(t); } else { Tree[] kids = t.children(); for (int j = 0, n = kids.length; j < n; j++) { leaves(kids[j], l); } } }
private static void leaves(Tree t, List<Tree> l) { if (t.isLeaf()) { l.add(t); } else { for (Tree kid : t.children()) { leaves(kid, l); } } }
Oracle(List<Tree> binarizedTrees, boolean compoundUnaries) { this.binarizedTrees = binarizedTrees; parentMaps = Generics.newArrayList(binarizedTrees.size()); leafLists = Generics.newArrayList(); for (Tree tree : binarizedTrees) { parentMaps.add(buildParentMap(tree)); leafLists.add(Trees.leaves(tree)); } this.compoundUnaries = compoundUnaries; }
Oracle(List<Tree> binarizedTrees, boolean compoundUnaries, Set<String> rootStates) { this.binarizedTrees = binarizedTrees; parentMaps = Generics.newArrayList(binarizedTrees.size()); leafLists = Generics.newArrayList(); for (Tree tree : binarizedTrees) { parentMaps.add(buildParentMap(tree)); leafLists.add(Trees.leaves(tree)); } this.compoundUnaries = compoundUnaries; }
Oracle(List<Tree> binarizedTrees, boolean compoundUnaries, Set<String> rootStates) { this.binarizedTrees = binarizedTrees; parentMaps = Generics.newArrayList(binarizedTrees.size()); leafLists = Generics.newArrayList(); for (Tree tree : binarizedTrees) { parentMaps.add(buildParentMap(tree)); leafLists.add(Trees.leaves(tree)); } this.compoundUnaries = compoundUnaries; }
List<Tree> leaves = Trees.leaves(root()); if (leaves.size() > 0) { Tree leaf = leaves.get(0);
TreeGraphNode rootDep = root().headWordNode(); if (rootDep == null) { List<Tree> leaves = Trees.leaves(root()); if (leaves.size() > 0) { Tree leaf = leaves.get(0);
TreeGraphNode rootDep = root().headWordNode(); if (rootDep == null) { List<Tree> leaves = Trees.leaves(root()); if (leaves.size() > 0) { Tree leaf = leaves.get(0);