|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |
java.lang.Objectjava.lang.Enum<GrammaticalRelation>
edu.stanford.nlp.trees.GrammaticalRelation
public enum GrammaticalRelation
GrammaticalRelation
is used to define a
standardized, hierarchical set of grammatical relations for the
English language, together with patterns for identifying them in
parse trees.
Each GrammaticalRelation
has:
String
short name, which should be a lowercase
abbreviation of some kind,String
long name, which should be descriptive,GrammaticalRelation
hierarchy,Pattern
called
sourcePattern
which matches nodes from which
this GrammaticalRelation
could hold, andTregexPattern
s
called targetPatterns
,
which describe the local tree structure which must hold between
the source node and a target node for the
GrammaticalRelation
to apply.targetPatterns
associated
with a GrammaticalRelation
are designed as follows.
In order to recognize a grammatical relation X holding between
nodes A and B in a parse tree, we want to associate with
GrammaticalRelation
X a TregexPattern
such that:
PREDICATE
which holds between a clause and its primary verb phrase, we might
want to use the pattern "S < VP=target"
, in which the
root will match a clause and the node labeled "target"
will match the verb phrase.
For a given grammatical relation, the method
takes a getRelatedNodes()
Tree
node as an argument and attempts to
return other nodes which have this grammatical relation to the
argument node. By default, this method operates as follows: it
steps through the patterns in the pattern list, trying to match
each pattern against the argument node, until it finds some
matches. If a pattern matches, all matching nodes (that is, each
node which corresponds to node label "target" in some match) are
returned as a list; otherwise the next pattern is tried.
For some grammatical relations, we need more sophisticated logic to
identify related nodes. In such cases,
can be overridden on a per-relation basis using anonymous subclassing.getRelatedNodes()
This set of English grammatical relations is not intended to be exhaustive or immutable. It's just where we're at now.
Enum Constant Summary | |
---|---|
ADJECTIVAL_COMPLEMENT
The "adjectival complement" grammatical relation. |
|
ADJECTIVAL_MODIFIER
The "adjectival modifier" grammatical relation. |
|
ADVERBIAL_MODIFIER
The "adverbial modifier" grammatical relation. |
|
APPOSITIONAL_MODIFIER
The "appositional modifier" grammatical relation. |
|
ARGUMENT
The "argument" grammatical relation. |
|
AUX_MODIFIER
The auxiliary grammatical relation. |
|
CLAUSAL_COMPLEMENT
The "clausal complement" grammatical relation. |
|
CLAUSAL_SUBJECT
The "clausal subject" grammatical relation. |
|
COMPLEMENT
The "complement" grammatical relation. |
|
DEPENDENT
The "dependent" grammatical relation, which is the inverse of "governor". |
|
DETERMINER
The "determiner" grammatical relation. |
|
DIRECT_OBJECT
The "direct object" grammatical relation. |
|
GOVERNOR
The "governor" grammatical relation, which is the inverse of "dependent". |
|
INDIRECT_OBJECT
The "indirect object" grammatical relation. |
|
INFINITIVAL_MODIFIER
The "infinitval modifier" grammatical relation. |
|
MODIFIER
The "modifier" grammatical relation. |
|
NOMINAL_PASSIVE_SUBJECT
The "nominal passive subject" grammatical relation. |
|
NOMINAL_SUBJECT
The "nominal subject" grammatical relation. |
|
NOUN_COMPOUND_MODIFIER
The "noun compound modifier" grammatical relation. |
|
NUMERIC_MODIFIER
The "numeric modifier" grammatical relation. |
|
OBJECT
The "object" grammatical relation. |
|
PARTICIPIAL_MODIFIER
The "participial modifier" grammatical relation. |
|
PREDICATE
The "predicate" grammatical relation. |
|
SUBJECT
The "subject" grammatical relation. |
|
TEMPORAL_MODIFIER
The "temporal modifier" grammatical relation. |
Method Summary | |
---|---|
java.util.List<Tree> |
getRelatedNodes(Tree t)
Given a Tree node t , attempts to
return a list of nodes to which node t has this
grammatical relation. |
boolean |
isAncestor(GrammaticalRelation gr)
|
boolean |
isApplicable(Tree t)
Returns true iff the value of Tree
node t matches the sourcePattern for
this GrammaticalRelation , indicating that this
GrammaticalRelation is one that could hold between
Tree node t and some other node. |
static void |
main(java.lang.String[] args)
|
java.lang.String |
toPrettyString()
Returns a String representation of this
GrammaticalRelation and the hierarchy below
it, with one node per line, indented according to level. |
java.lang.String |
toString()
Returns short name (abbreviation) for this GrammaticalRelation . |
static GrammaticalRelation |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. |
static GrammaticalRelation[] |
values()
Returns an array containing the constants of this enum type, in the order they're declared. |
Methods inherited from class java.lang.Enum |
---|
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, valueOf |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Enum Constant Detail |
---|
public static final GrammaticalRelation GOVERNOR
Example: "the red car" →
gov
(red, car)
public static final GrammaticalRelation DEPENDENT
Example: "the red car" →
dep
(car, red)
public static final GrammaticalRelation PREDICATE
Example: "Reagan died" →
pred
(Reagan, died)
public static final GrammaticalRelation AUX_MODIFIER
Example: "Reagan has died" →
aux
(died, has)
public static final GrammaticalRelation ARGUMENT
Example: "Clinton defeated Dole" →
arg
(defeated, Clinton),
arg
(defeated, Dole)
public static final GrammaticalRelation SUBJECT
Examples: "Clinton defeated Dole" →
subj
(defeated, Clinton),
"What she said is untrue" → subj
(is, What she said)
public static final GrammaticalRelation NOMINAL_SUBJECT
Example: "Clinton defeated Dole" →
nsubj
(defeated, Clinton),
public static final GrammaticalRelation NOMINAL_PASSIVE_SUBJECT
Example: "Dole was defeated by Clinton" →
nsubjpass
(defeated, Dole)
public static final GrammaticalRelation CLAUSAL_SUBJECT
Example: "What she said is untrue" →
csubj
(is, What she said)
public static final GrammaticalRelation COMPLEMENT
Examples: "She gave me a raise" →
comp
(gave, me),
comp
(gave, a raise);
"I like to swim" →
comp
(like, to swim)
public static final GrammaticalRelation OBJECT
Examples: "She gave me a raise" →
obj
(gave, me),
obj
(gave, a raise)
public static final GrammaticalRelation DIRECT_OBJECT
Example: "She gave me a raise" →
dobj
(gave, a raise)
public static final GrammaticalRelation INDIRECT_OBJECT
Example: "She gave me a raise" →
iobj
(gave, me)
public static final GrammaticalRelation CLAUSAL_COMPLEMENT
Example: "I like to swim" →
ccomp
(like, to swim)
public static final GrammaticalRelation ADJECTIVAL_COMPLEMENT
Example: "She looks very beautiful" →
acomp
(looks, very beautiful)
public static final GrammaticalRelation MODIFIER
ARGUMENT
of that
VP); a modifier of a clause is an modifier of the VP which is
the predicate of that clause.Examples: "I swam in the pool last night" →
mod
(swam, in the pool),
mod
(swam, last night)
public static final GrammaticalRelation TEMPORAL_MODIFIER
Examples: "I swam in the pool last night" →
tmod
(swam, last night)
public static final GrammaticalRelation ADJECTIVAL_MODIFIER
Examples: "Sam eats red meat" →
amod
(meat, red)
public static final GrammaticalRelation NUMERIC_MODIFIER
Examples: "Sam eats 3 sheep" →
num
(sheep, 3)
public static final GrammaticalRelation NOUN_COMPOUND_MODIFIER
Example: "Oil price futures"
nn
(futures, oil)
nn
(futures, price)
public static final GrammaticalRelation APPOSITIONAL_MODIFIER
Examples: "Sam, my brother, eats red meat" →
appos
(Sam, brother)
public static final GrammaticalRelation PARTICIPIAL_MODIFIER
Examples: "truffles picked during the spring are tasty" →
partmod
(truffles, picked)
public static final GrammaticalRelation INFINITIVAL_MODIFIER
Examples: "points to establish are ..." →
infmod
(points, establish)
public static final GrammaticalRelation ADVERBIAL_MODIFIER
Examples:
"genetically modified food" →
advmod
(modified, genetically)
public static final GrammaticalRelation DETERMINER
Method Detail |
---|
public static final GrammaticalRelation[] values()
for(GrammaticalRelation c : GrammaticalRelation.values()) System.out.println(c);
public static GrammaticalRelation valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.
java.lang.IllegalArgumentException
- if this enum type has no constant
with the specified namepublic java.util.List<Tree> getRelatedNodes(Tree t)
Tree
node t
, attempts to
return a list of nodes to which node t
has this
grammatical relation.
public boolean isApplicable(Tree t)
true
iff the value of Tree
node t
matches the sourcePattern
for
this GrammaticalRelation
, indicating that this
GrammaticalRelation
is one that could hold between
Tree
node t
and some other node.
public boolean isAncestor(GrammaticalRelation gr)
public java.lang.String toString()
GrammaticalRelation
.
toString
in class java.lang.Enum<GrammaticalRelation>
public java.lang.String toPrettyString()
String
representation of this
GrammaticalRelation
and the hierarchy below
it, with one node per line, indented according to level.
String
representation of this
GrammaticalRelation
public static void main(java.lang.String[] args)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | ENUM CONSTANTS | FIELD | METHOD | DETAIL: ENUM CONSTANTS | FIELD | METHOD |