edu.stanford.nlp.trees
Class EnglishGrammaticalStructure
java.lang.Object
edu.stanford.nlp.trees.TreeGraph
edu.stanford.nlp.trees.GrammaticalStructure
edu.stanford.nlp.trees.EnglishGrammaticalStructure
- All Implemented Interfaces:
- Serializable
public class EnglishGrammaticalStructure
- extends GrammaticalStructure
A GrammaticalStructure for English.
Caveat emptor! This is a work in progress.
Nothing in here should be relied upon to function perfectly.
Feedback welcome.
- Author:
- Bill MacCartney
- See Also:
- Serialized Form
Fields inherited from class edu.stanford.nlp.trees.TreeGraph |
root |
Method Summary |
protected void |
collapseDependencies(TypedDependencyList list)
Destructively modifies this TypedDepedencyList by
collapsing two types of transitive pairs of dependencies:
prepositional dependencies
dep(cat, in) and
dep(in, hat) are collapsed to
in(cat, hat)
possessive dependencies
dep(revenge, 's) and
dep('s, Montezuma) are collapsed to
poss(revenge, Montezuma)
|
TreeGraphNode |
getSubject(TreeGraphNode t)
Tries to return a node representing the SUBJECT (whether
nominal or clausal) of the given node t . |
static void |
main(String[] args)
Just for testing. |
protected TypedDependencyList |
moreTypedDependencies()
Get "extra" dependencies. |
Methods inherited from class edu.stanford.nlp.trees.GrammaticalStructure |
dependencies, getDependencyPath, getDependencyPath, getDependents, getGovernor, getGrammaticalRelation, getGrammaticalRelation, getNodeInRelation, toString, typedDependencies, typedDependencies, typedDependenciesCollapsed, typedDependenciesCollapsed |
moreTypedDependencies
protected TypedDependencyList moreTypedDependencies
EnglishGrammaticalStructure
public EnglishGrammaticalStructure(Tree t)
- Construct a new
GrammaticalStructure
from an
existing parse tree. The new GrammaticalStructure
has the same tree structure and label values as the given tree
(but no shared storage). As part of construction, the parse tree
is analyzed using definitions from GrammaticalRelation
to populate the new
GrammaticalStructure
with as many labeled
grammatical relations as it can.
moreTypedDependencies
protected TypedDependencyList moreTypedDependencies()
- Get "extra" dependencies. Currently, the only "extra"
implemented is the controlling subject relation. For example,
in the sentence "Tom likes to eat fish", requesting extras will
cause "xsubj(eat, Tom)" to be added to the typed dependency
list.
- Overrides:
moreTypedDependencies
in class GrammaticalStructure
getSubject
public TreeGraphNode getSubject(TreeGraphNode t)
- Tries to return a node representing the
SUBJECT
(whether
nominal or clausal) of the given node t
.
Probably, node t
should represent a clause or
verb phrase.
- Parameters:
t
- a node in this GrammaticalStructure
- Returns:
- a node which is the subject of node
t
, or else null
collapseDependencies
protected void collapseDependencies(TypedDependencyList list)
- Destructively modifies this
TypedDepedencyList
by
collapsing two types of transitive pairs of dependencies:
- prepositional dependencies
-
dep(cat, in)
and
dep(in, hat)
are collapsed to
in(cat, hat)
- possessive dependencies
-
dep(revenge, 's)
and
dep('s, Montezuma)
are collapsed to
poss(revenge, Montezuma)
- Overrides:
collapseDependencies
in class GrammaticalStructure
main
public static void main(String[] args)
- Just for testing.
Usage: java GrammaticalStructure [treeFile]
Stanford NLP Group