public class TreeWithTokens extends Object
Constructor and Description |
---|
TreeWithTokens(edu.stanford.nlp.trees.Tree tree,
List<Token> tokens) |
Modifier and Type | Method and Description |
---|---|
edu.stanford.nlp.trees.Tree |
getBestFit(org.apache.uima.jcas.tcas.Annotation anno)
Finds the best-fitting node in the tree for a given annotation.
|
edu.stanford.nlp.util.IntPair |
getSpan()
Returns the span of the documentText that is covered by this
TreeWithTokens.
|
edu.stanford.nlp.util.IntPair |
getSpan(edu.stanford.nlp.trees.Tree subtree)
Returns the span of the documentText that is covered by a given subtree,
that has to be taken directly from the original tree.
|
List<Token> |
getTokens() |
edu.stanford.nlp.trees.Tree |
getTree() |
void |
setTokens(List<Token> tokens) |
void |
setTree(edu.stanford.nlp.trees.Tree tree) |
public void setTree(edu.stanford.nlp.trees.Tree tree)
public edu.stanford.nlp.trees.Tree getTree()
public edu.stanford.nlp.util.IntPair getSpan()
public edu.stanford.nlp.util.IntPair getSpan(edu.stanford.nlp.trees.Tree subtree)
NOTE: Possibly we could make this more general to also support general trees that are contained in the original tree, but are not directly taken from it (i.e. with different leaf-numbering). In order to do so, we would have to make a Tregex-Matching of the given subtree in the original tree to identify the positition of the given subtree.
This could be achieved by translating the subtree into a Tregex pattern and then matching this pattern against the original tree.
subtree
- a subtree of this TreeWithTokens (it has to be a real
subtree(!), because index numbering of subtree has to fit to
the numbering of the original tree)public edu.stanford.nlp.trees.Tree getBestFit(org.apache.uima.jcas.tcas.Annotation anno)
anno
- the annotation to find a best fit foranno
Copyright © 2007–2018 Ubiquitous Knowledge Processing (UKP) Lab, Technische Universität Darmstadt. All rights reserved.