/** * Get the list of all subtrees inside the tree by returning a tree * rooted at each node. These are <i>not</i> copies, but all share * structure. The tree is regarded as a subtree of itself. * * <i>Note:</i> If you only want to form this Collection so that you can * iterate over it, it is more efficient to simply use the Tree class's * own {@code iterator()} method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @return the {@code List} of all subtrees in the tree. */ public List<Tree> subTreeList() { return subTrees(new ArrayList<>()); }
/** * Verifies if this mention's tree is dominated by the tree of the given mention */ public boolean includedIn(Mention m) { if (!m.sameSentence(this)) { return false; } if(this.startIndex < m.startIndex || this.endIndex > m.endIndex) return false; for (Tree t : m.mentionSubTree.subTrees()) { if (t == mentionSubTree) { return true; } } return false; }
/** * Get the set of all subtrees inside the tree by returning a tree * rooted at each node. These are <i>not</i> copies, but all share * structure. The tree is regarded as a subtree of itself. * * <i>Note:</i> If you only want to form this Set so that you can * iterate over it, it is more efficient to simply use the Tree class's * own {@code iterator()} method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @return the {@code Set} of all subtrees in the tree. */ public Set<Tree> subTrees() { return subTrees(Generics.newHashSet()); }
/** * Add the set of all subtrees inside a tree (including the tree itself) * to the given {@code Collection}. * * <i>Note:</i> If you only want to form this Collection so that you can * iterate over it, it is more efficient to simply use the Tree class's * own {@code iterator()} method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @param n A collection of nodes to which the subtrees will be added. * @return The collection parameter with the subtrees added. */ public <T extends Collection<Tree>> T subTrees(T n) { n.add(this); Tree[] kids = children(); for (Tree kid : kids) { kid.subTrees(n); } return n; }
Map<Pair<Integer,Integer>,String> sentenceInfo = Generics.newHashMap(); Set<Tree> sentenceSubTrees = sentenceTree.subTrees(); sentenceTree.setSpans(); Map<Pair<Integer,Integer>,Tree> treeSpanMap = Generics.newHashMap();
Map<Pair<Integer,Integer>,String> sentenceInfo = Generics.newHashMap(); Set<Tree> sentenceSubTrees = sentenceTree.subTrees(); sentenceTree.setSpans(); Map<Pair<Integer,Integer>,Tree> treeSpanMap = Generics.newHashMap();
/** * Get the list of all subtrees inside the tree by returning a tree * rooted at each node. These are <i>not</i> copies, but all share * structure. The tree is regarded as a subtree of itself. * * <i>Note:</i> If you only want to form this Collection so that you can * iterate over it, it is more efficient to simply use the Tree class's * own {@code iterator()} method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @return the {@code List} of all subtrees in the tree. */ public List<Tree> subTreeList() { return subTrees(new ArrayList<>()); }
/** * Get the list of all subtrees inside the tree by returning a tree * rooted at each node. These are <i>not</i> copies, but all share * structure. The tree is regarded as a subtree of itself. * <p/> * <i>Note:</i> If you only want to form this Collection so that you can * iterate over it, it is more efficient to simply use the Tree class's * own <code>iterator() method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @return the <code>List</code> of all subtrees in the tree. */ public List<Tree> subTreeList() { return subTrees(new ArrayList<Tree>()); }
/** * Get the set of all subtrees inside the tree by returning a tree * rooted at each node. These are <i>not</i> copies, but all share * structure. The tree is regarded as a subtree of itself. * <p/> * <i>Note:</i> If you only want to form this Set so that you can * iterate over it, it is more efficient to simply use the Tree class's * own <code>iterator() method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @return the <code>Set</code> of all subtrees in the tree. */ public Set<Tree> subTrees() { return subTrees(new HashSet<Tree>()); }
/** * Get the list of all subtrees inside the tree by returning a tree * rooted at each node. These are <i>not</i> copies, but all share * structure. The tree is regarded as a subtree of itself. * <p/> * <i>Note:</i> If you only want to form this Collection so that you can * iterate over it, it is more efficient to simply use the Tree class's * own <code>iterator() method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @return the <code>List</code> of all subtrees in the tree. */ public List<Tree> subTreeList() { return subTrees(new ArrayList<Tree>()); }
/** * Get the list of all subtrees inside the tree by returning a tree * rooted at each node. These are <i>not</i> copies, but all share * structure. The tree is regarded as a subtree of itself. * * <i>Note:</i> If you only want to form this Collection so that you can * iterate over it, it is more efficient to simply use the Tree class's * own {@code iterator()} method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @return the {@code List} of all subtrees in the tree. */ public List<Tree> subTreeList() { return subTrees(new ArrayList<>()); }
/** * Get the set of all subtrees inside the tree by returning a tree * rooted at each node. These are <i>not</i> copies, but all share * structure. The tree is regarded as a subtree of itself. * * <i>Note:</i> If you only want to form this Set so that you can * iterate over it, it is more efficient to simply use the Tree class's * own {@code iterator()} method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @return the {@code Set} of all subtrees in the tree. */ public Set<Tree> subTrees() { return subTrees(Generics.newHashSet()); }
/** * Verifies if this mention's tree is dominated by the tree of the given mention */ public boolean includedIn(Mention m) { if (!m.sameSentence(this)) { return false; } if(this.startIndex < m.startIndex || this.endIndex > m.endIndex) return false; for (Tree t : m.mentionSubTree.subTrees()) { if (t == mentionSubTree) { return true; } } return false; }
/** * Verifies if this mention's tree is dominated by the tree of the given mention */ public boolean includedIn(Mention m) { if (!m.sameSentence(this)) { return false; } if(this.startIndex < m.startIndex || this.endIndex > m.endIndex) return false; for (Tree t : m.mentionSubTree.subTrees()) { if (t == mentionSubTree) { return true; } } return false; }
/** * Get the set of all subtrees inside the tree by returning a tree * rooted at each node. These are <i>not</i> copies, but all share * structure. The tree is regarded as a subtree of itself. * * <i>Note:</i> If you only want to form this Set so that you can * iterate over it, it is more efficient to simply use the Tree class's * own {@code iterator()} method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @return the {@code Set} of all subtrees in the tree. */ public Set<Tree> subTrees() { return subTrees(Generics.newHashSet()); }
/** * Verifies if this mention's tree is dominated by the tree of the given mention */ public boolean includedIn(Mention m) { if (!m.sameSentence(this)) { return false; } if(this.startIndex < m.startIndex || this.endIndex > m.endIndex) return false; for (Tree t : m.mentionSubTree.subTrees()) { if (t == mentionSubTree) { return true; } } return false; }
/** * Get the set of all subtrees inside the tree by returning a tree * rooted at each node. These are <i>not</i> copies, but all share * structure. The tree is regarded as a subtree of itself. * <p/> * <i>Note:</i> If you only want to form this Set so that you can * iterate over it, it is more efficient to simply use the Tree class's * own <code>iterator() method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @return the <code>Set</code> of all subtrees in the tree. */ public Set<Tree> subTrees() { return subTrees(Generics.<Tree>newHashSet()); }
/** * Add the set of all subtrees inside a tree (including the tree itself) * to the given {@code Collection}. * * <i>Note:</i> If you only want to form this Collection so that you can * iterate over it, it is more efficient to simply use the Tree class's * own {@code iterator()} method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @param n A collection of nodes to which the subtrees will be added. * @return The collection parameter with the subtrees added. */ public <T extends Collection<Tree>> T subTrees(T n) { n.add(this); Tree[] kids = children(); for (Tree kid : kids) { kid.subTrees(n); } return n; }
/** * Add the set of all subtrees inside a tree (including the tree itself) * to the given {@code Collection}. * * <i>Note:</i> If you only want to form this Collection so that you can * iterate over it, it is more efficient to simply use the Tree class's * own {@code iterator()} method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @param n A collection of nodes to which the subtrees will be added. * @return The collection parameter with the subtrees added. */ public <T extends Collection<Tree>> T subTrees(T n) { n.add(this); Tree[] kids = children(); for (Tree kid : kids) { kid.subTrees(n); } return n; }
/** * Add the set of all subtrees inside a tree (including the tree itself) * to the given <code>Collection</code>. * <p/> * <i>Note:</i> If you only want to form this Collection so that you can * iterate over it, it is more efficient to simply use the Tree class's * own <code>iterator() method. This will iterate over the exact same * elements (but perhaps/probably in a different order). * * @param n A collection of nodes to which the subtrees will be added. * @return The collection parameter with the subtrees added. */ public <T extends Collection<Tree>> T subTrees(T n) { n.add(this); Tree[] kids = children(); for (Tree kid : kids) { kid.subTrees(n); } return n; }