|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.stanford.nlp.trees.TreeGraph
edu.stanford.nlp.trees.GrammaticalStructure
edu.stanford.nlp.trees.EnglishGrammaticalStructure
public class EnglishGrammaticalStructure
A GrammaticalStructure for English.
The Stanford parser should be run with the "-retainNPTmpSubcategories" option! Caveat emptor! This is a work in progress. Suggestions welcome.
| Nested Class Summary | |
|---|---|
static class |
EnglishGrammaticalStructure.FromDependenciesFactory
|
| Field Summary |
|---|
| Fields inherited from class edu.stanford.nlp.trees.GrammaticalStructure |
|---|
allTypedDependencies, CoNLLX_FieldCount, CoNLLX_GovField, CoNLLX_POSField, CoNLLX_RelnField, CoNLLX_WordField, DEFAULT_PARSER_FILE, dependencies, typedDependencies |
| Fields inherited from class edu.stanford.nlp.trees.TreeGraph |
|---|
root |
| Constructor Summary | |
|---|---|
EnglishGrammaticalStructure(java.util.List<TypedDependency> projectiveDependencies,
TreeGraphNode root)
Used for postprocessing CoNLL X dependencies |
|
EnglishGrammaticalStructure(Tree t)
Construct a new GrammaticalStructure from an existing parse
tree. |
|
EnglishGrammaticalStructure(Tree t,
Filter<java.lang.String> puncFilter)
This gets used by GrammaticalStructureFactory (by reflection). |
|
EnglishGrammaticalStructure(Tree t,
Filter<java.lang.String> puncFilter,
HeadFinder hf)
This gets used by GrammaticalStructureFactory (by reflection). |
|
EnglishGrammaticalStructure(Tree t,
Filter<java.lang.String> puncFilter,
HeadFinder hf,
boolean threadSafe)
Construct a new GrammaticalStructure from an existing parse
tree. |
|
| Method Summary | |
|---|---|
static EnglishGrammaticalStructure |
buildCoNNLXGrammaticStructure(java.util.List<java.util.List<java.lang.String>> tokenFields)
|
protected void |
collapseDependencies(java.util.List<TypedDependency> list,
boolean CCprocess)
Destructively modifies this Collection<TypedDependency>
by collapsing several types of transitive pairs of dependencies. |
protected void |
collapseDependenciesTree(java.util.List<TypedDependency> list)
Destructively modifies this Collection<TypedDependency>
by collapsing several types of transitive pairs of dependencies, but
keeping the tree structure. |
protected static GrammaticalRelation |
conjValue(java.lang.String conj)
Does some hard coding to deal with relation in CONJP. |
protected void |
correctDependencies(java.util.Collection<TypedDependency> list)
Destructively modify the TypedDependencyGraph to correct
language-dependent dependencies. |
static TreeGraphNode |
getSubject(TreeGraphNode t)
Tries to return a node representing the SUBJECT (whether
nominal or clausal) of the given node t. |
static java.util.List<GrammaticalStructure> |
readCoNLLXGrammaticStructureCollection(java.lang.String fileName)
|
| Methods inherited from class edu.stanford.nlp.trees.TreeGraph |
|---|
addNodeToIndexMap, getNodeByIndex, getNodes, root, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public EnglishGrammaticalStructure(Tree t)
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.
t - Parse tree to make grammatical structure from
public EnglishGrammaticalStructure(Tree t,
Filter<java.lang.String> puncFilter)
t - Parse tree to make grammatical structure frompuncFilter - Filter to remove punctuation dependencies
public EnglishGrammaticalStructure(Tree t,
Filter<java.lang.String> puncFilter,
HeadFinder hf)
t - Parse tree to make grammatical structure frompuncFilter - Filter to remove punctuation dependencieshf - HeadFinder to use when building it
public EnglishGrammaticalStructure(Tree t,
Filter<java.lang.String> puncFilter,
HeadFinder hf,
boolean threadSafe)
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.
t - Parse tree to make grammatical structure frompuncFilter - Filter for punctuation wordshf - HeadFinder to use when building itthreadSafe - Whether or not to support simultaneous instances among multiple
threads
public EnglishGrammaticalStructure(java.util.List<TypedDependency> projectiveDependencies,
TreeGraphNode root)
| Method Detail |
|---|
public static TreeGraphNode getSubject(TreeGraphNode t)
SUBJECT (whether
nominal or clausal) of the given node t. Probably, node
t should represent a clause or verb phrase.
t - a node in this GrammaticalStructure
t, or else
nullprotected void correctDependencies(java.util.Collection<TypedDependency> list)
GrammaticalStructureTypedDependencyGraph to correct
language-dependent dependencies. (e.g., nsubjpass in a relative clause)
Default is no-op; to be over-ridden in subclasses.
correctDependencies in class GrammaticalStructure
protected void collapseDependencies(java.util.List<TypedDependency> list,
boolean CCprocess)
Collection<TypedDependency>
by collapsing several types of transitive pairs of dependencies.
prep(cat, in) and pobj(in, hat) are collapsed to
prep_in(cat, hat)prep(heard, of) and pcomp(of, attacking) are
collapsed to prepc_of(heard, attacking)cc(investors, and) and
conj(investors, regulators) are collapsed to
conj_and(investors,regulators)possessive(Montezuma, 's) will be erased. This is like a collapsing, but
due to the flatness of NPs, two dependencies are not actually composed.ref(man, that) and dobj(love, that) are collapsed
to dobj(love, man)
collapseDependencies in class GrammaticalStructurelist - A list of dependencies to process for possible collapsingCCprocess - apply CC process?protected void collapseDependenciesTree(java.util.List<TypedDependency> list)
Collection<TypedDependency>
by collapsing several types of transitive pairs of dependencies, but
keeping the tree structure.
prep(cat, in) and pobj(in, hat) are collapsed to
prep_in(cat, hat)prep(heard, of) and pcomp(of, attacking) are
collapsed to prepc_of(heard, attacking)cc(investors, and) and
conj(investors, regulators) are collapsed to
conj_and(investors,regulators)possessive(Montezuma, 's) will be erased. This is like a collapsing, but
due to the flatness of NPs, two dependencies are not actually composed.
collapseDependenciesTree in class GrammaticalStructurelist - A list of dependencies to process for possible collapsingprotected static GrammaticalRelation conjValue(java.lang.String conj)
conj - The head dependency of the conjunction marker
public static java.util.List<GrammaticalStructure> readCoNLLXGrammaticStructureCollection(java.lang.String fileName)
throws java.io.IOException
java.io.IOExceptionpublic static EnglishGrammaticalStructure buildCoNNLXGrammaticStructure(java.util.List<java.util.List<java.lang.String>> tokenFields)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||