public class TreeView extends View
View
by providing functions to get and
set Tree
objects.Modifier and Type | Field and Description |
---|---|
protected boolean |
firstTree |
protected boolean |
isDependencyTree |
protected List<edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<String>> |
trees |
constituents, endSpan, relations, score, startSpan, textAnnotation, tokensToConstituents, viewGenerator, viewName
Constructor and Description |
---|
TreeView(String viewName,
String viewGenerator,
TextAnnotation text,
double score) |
Modifier and Type | Method and Description |
---|---|
protected void |
addDependencyTree(edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<edu.illinois.cs.cogcomp.core.datastructures.Pair<String,Integer>> depTree,
Constituent parent,
int sentenceStart) |
protected void |
addParseTree(edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<edu.illinois.cs.cogcomp.core.datastructures.Pair<String,edu.illinois.cs.cogcomp.core.datastructures.IntPair>> spanLabeledTree,
Constituent root,
int sentenceStartPosition)
Transforms an unscored input tree into the constituent-relation graph
|
protected void |
addScoredParseTree(edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<edu.illinois.cs.cogcomp.core.datastructures.Pair<String,edu.illinois.cs.cogcomp.core.datastructures.IntPair>> spanLabeledTree,
edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<Double> scores,
Constituent root,
int sentenceStartPosition)
Transforms a scored input tree into the constituent-relation graph
|
protected edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<String> |
buildTree(Constituent root) |
static Constituent |
getParent(Constituent constituent)
Gets the parent of a constituent.
|
Constituent |
getParsePhrase(Constituent c)
Finds the highest node in the parse tree that contains the input
constituent.
|
Constituent |
getRootConstituent(int sentenceId)
Gets the root constituent of the tree for the given sentence
|
Constituent |
getRootConstituent(Sentence sentence)
Gets the root constituent of the tree for the given sentence
|
edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<String> |
getTree(int sentenceId)
Get the
Tree representation of the tree for the given sentence. |
Constituent |
getTreeRoot(int sentenceId)
Get the root constituent of the tree that covers a sentence
|
Constituent |
getTreeRoot(Sentence s)
Get the root constituent of the tree that covers a sentence
|
static boolean |
isLeaf(Constituent c)
Checks if a constituent is a leaf of a tree.
|
static boolean |
isRoot(Constituent c)
Checks if a constituent is a root node of a tree.
|
protected edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<String> |
makeTree(Constituent root) |
protected void |
makeTrees()
Makes the tree objects.
|
void |
setDependencyTree(int sentenceId,
edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<edu.illinois.cs.cogcomp.core.datastructures.Pair<String,Integer>> depTree)
Set the dependency tree of hte
sentenceId th sentence. |
void |
setDependencyTree(int sentenceId,
edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<edu.illinois.cs.cogcomp.core.datastructures.Pair<String,Integer>> depTree,
double treeScore)
Set the dependency tree for a specified sentence.
|
protected void |
setDependencyTreeSwitch(Constituent root) |
void |
setParseTree(int sentenceId,
edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<String> tree)
Set the parse tree of the
sentenceId th sentence. |
void |
setScoredParseTree(int sentenceId,
edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<String> tree,
edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<Double> scores) |
String |
toString() |
addConstituent, addRelation, containsConstituent, count, getConstituents, getConstituentsCovering, getConstituentsCoveringSpan, getConstituentsCoveringToken, getConstituentsCoveringTokens, getEndSpan, getFilteredConstituents, getLabelsCovering, getLabelsCoveringSpan, getLabelsCoveringToken, getLabelsCoveringTokens, getNumberOfConstituents, getRelations, getRestrictedView, getScore, getStartSpan, getTextAnnotation, getViewCoveringSpan, getViewCoveringToken, getViewCoveringTokens, getViewGenerator, getViewName, iterator, orderBy, select, unique, where
protected boolean isDependencyTree
protected boolean firstTree
public TreeView(String viewName, String viewGenerator, TextAnnotation text, double score)
viewName
- text
- score
- protected edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<String> buildTree(Constituent root)
root
- public Constituent getRootConstituent(int sentenceId)
sentenceId
- public Constituent getRootConstituent(Sentence sentence)
sentence
- public edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<String> getTree(int sentenceId)
Tree
representation of the tree for the given sentence.sentenceId
- protected edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<String> makeTree(Constituent root)
protected void setDependencyTreeSwitch(Constituent root)
protected void makeTrees()
public Constituent getTreeRoot(int sentenceId)
sentenceId
- public Constituent getTreeRoot(Sentence s)
s
- public void setParseTree(int sentenceId, edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<String> tree)
sentenceId
th sentence.
Note: The same TreeView cannot contain both the parse tree and the dependency tree and will throw an exception if an attempt is made to set the parse tree in a view that has a dependency tree.
sentenceId
- tree
- public void setDependencyTree(int sentenceId, edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<edu.illinois.cs.cogcomp.core.datastructures.Pair<String,Integer>> depTree)
sentenceId
th sentence.
Each node in the dependency tree specifies both the token and its
position with respect to the start of the sentence, not the entire
TextAnnotation.
Note: The same TreeView cannot contain both the parse tree and the dependency tree and will throw an exception if an attempt is made to set the dependency tree of a view that has a phrase-structure tree.
sentenceId
- depTree
- public void setDependencyTree(int sentenceId, edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<edu.illinois.cs.cogcomp.core.datastructures.Pair<String,Integer>> depTree, double treeScore)
Note: The same TreeView cannot contain both the parse tree and the dependency tree and will throw an exception if an attempt is made to set the dependency tree of a view that has a phrase-structure tree.
sentenceId
- depTree
- treeScore
- protected void addDependencyTree(edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<edu.illinois.cs.cogcomp.core.datastructures.Pair<String,Integer>> depTree, Constituent parent, int sentenceStart)
depTree
- parent
- sentenceStart
- public void setScoredParseTree(int sentenceId, edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<String> tree, edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<Double> scores)
sentenceId
- tree
- scores
- protected void addScoredParseTree(edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<edu.illinois.cs.cogcomp.core.datastructures.Pair<String,edu.illinois.cs.cogcomp.core.datastructures.IntPair>> spanLabeledTree, edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<Double> scores, Constituent root, int sentenceStartPosition)
spanLabeledTree
- scores
- root
- sentenceStartPosition
- protected void addParseTree(edu.illinois.cs.cogcomp.core.datastructures.trees.Tree<edu.illinois.cs.cogcomp.core.datastructures.Pair<String,edu.illinois.cs.cogcomp.core.datastructures.IntPair>> spanLabeledTree, Constituent root, int sentenceStartPosition)
spanLabeledTree
- root
- sentenceStartPosition
- public Constituent getParsePhrase(Constituent c) throws EdisonException
c
- The input constituent. This could be from any view.EdisonException
public static boolean isRoot(Constituent c)
c
- public static boolean isLeaf(Constituent c)
c
- public static Constituent getParent(Constituent constituent)
constituent
- Copyright © 2015. All rights reserved.