public class EnglishGrammaticalStructure extends GrammaticalStructure
Modifier and Type | Class and Description |
---|---|
static class |
EnglishGrammaticalStructure.FromDependenciesFactory |
GrammaticalStructure.Extras
allTypedDependencies, CoNLLX_FieldCount, CoNLLX_GovField, CoNLLX_POSField, CoNLLX_RelnField, CoNLLX_WordField, puncFilter, tagFilter, typedDependencies
Constructor and Description |
---|
EnglishGrammaticalStructure(java.util.List<TypedDependency> projectiveDependencies,
TreeGraphNode root)
Used for postprocessing CoNLL X dependencies
|
EnglishGrammaticalStructure(Tree t)
Construct a new
EnglishGrammaticalStructure from an existing parse
tree. |
EnglishGrammaticalStructure(Tree t,
java.util.function.Predicate<java.lang.String> puncFilter)
This gets used by GrammaticalStructureFactory (by reflection).
|
EnglishGrammaticalStructure(Tree t,
java.util.function.Predicate<java.lang.String> puncFilter,
HeadFinder hf)
Construct a new
GrammaticalStructure from an existing parse
tree. |
Modifier and Type | Method and Description |
---|---|
static EnglishGrammaticalStructure |
buildCoNLLXGrammaticalStructure(java.util.List<java.util.List<java.lang.String>> tokenFields) |
protected void |
collapseDependencies(java.util.List<TypedDependency> list,
boolean CCprocess,
GrammaticalStructure.Extras includeExtras)
Destructively modifies this
Collection<TypedDependency>
by collapsing several types of transitive pairs of dependencies. |
protected void |
collapseDependenciesTree(java.util.List<TypedDependency> list)
Destructively modify the
Collection<TypedDependency> to collapse
language-dependent transitive dependencies but keeping a tree structure. |
protected void |
correctDependencies(java.util.List<TypedDependency> list)
Destructively modify the
TypedDependencyGraph to correct
language-dependent dependencies. |
protected java.util.function.Predicate<TypedDependency> |
extraTreeDepFilter()
Returns a Filter which checks dependencies for usefulness as
extra tree-based dependencies.
|
protected void |
getExtras(java.util.List<TypedDependency> list)
Get extra dependencies that do not depend on the tree structure,
but rather only depend on the existing dependency structure.
|
static void |
main(java.lang.String[] args) |
protected void |
postProcessDependencies(java.util.List<TypedDependency> list)
Post process the dependencies in whatever way this language
requires.
|
static java.util.List<GrammaticalStructure> |
readCoNLLXGrammaticalStructureCollection(java.lang.String fileName) |
addEnhancements, allTypedDependencies, buildCoNLLXGrammaticalStructure, fromStringReps, getGrammaticalRelation, getGrammaticalRelation, getRoots, getTreeDeps, isConnected, readCoNLLXGrammaticalStructureCollection, root, toString, typedDependencies, typedDependencies, typedDependencies, typedDependenciesCCprocessed, typedDependenciesCCprocessed, typedDependenciesCCprocessed, typedDependenciesCollapsed, typedDependenciesCollapsed, typedDependenciesCollapsed, typedDependenciesCollapsedTree, typedDependenciesEnhanced, typedDependenciesEnhancedPlusPlus
public EnglishGrammaticalStructure(Tree t)
EnglishGrammaticalStructure
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
{@code GrammaticalRelation}
to populate
the new GrammaticalStructure
with as many labeled grammatical
relations as it can.t
- Parse tree to make grammatical structure frompublic EnglishGrammaticalStructure(Tree t, java.util.function.Predicate<java.lang.String> puncFilter)
t
- Parse tree to make grammatical structure frompuncFilter
- Filter to remove punctuation dependenciespublic EnglishGrammaticalStructure(Tree t, java.util.function.Predicate<java.lang.String> puncFilter, HeadFinder hf)
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
{@code GrammaticalRelation}
to populate
the new GrammaticalStructure
with as many labeled grammatical
relations as it can.
Once upon a time this method had an extra parameter as to whether to operate
in a threadsafe manner. We decided that that was a really bad idea, and this
method now always acts in a threadsafe manner.
This method gets used by GrammaticalStructureFactory (by reflection). DON'T DELETE.t
- Parse tree to make grammatical structure frompuncFilter
- Filter for punctuation wordshf
- HeadFinder to use when building itpublic EnglishGrammaticalStructure(java.util.List<TypedDependency> projectiveDependencies, TreeGraphNode root)
protected java.util.function.Predicate<TypedDependency> extraTreeDepFilter()
extraTreeDepFilter
in class GrammaticalStructure
protected void correctDependencies(java.util.List<TypedDependency> list)
GrammaticalStructure
TypedDependencyGraph
to correct
language-dependent dependencies. (e.g., nsubjpass in a relative clause)
correctDependencies
in class GrammaticalStructure
protected void postProcessDependencies(java.util.List<TypedDependency> list)
GrammaticalStructure
postProcessDependencies
in class GrammaticalStructure
protected void getExtras(java.util.List<TypedDependency> list)
GrammaticalStructure
getExtras
in class GrammaticalStructure
protected void collapseDependencies(java.util.List<TypedDependency> list, boolean CCprocess, GrammaticalStructure.Extras includeExtras)
Collection<TypedDependency>
by collapsing several types of transitive pairs of dependencies.
If called with a tree of dependencies and both CCprocess and
includeExtras set to false, then the tree structure is preserved.
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 GrammaticalStructure
list
- A list of dependencies to process for possible collapsingCCprocess
- apply CC process?protected void collapseDependenciesTree(java.util.List<TypedDependency> list)
GrammaticalStructure
Collection<TypedDependency>
to collapse
language-dependent transitive dependencies but keeping a tree structure.
collapseDependenciesTree
in class GrammaticalStructure
list
- A list of dependencies to process for possible collapsingpublic static java.util.List<GrammaticalStructure> readCoNLLXGrammaticalStructureCollection(java.lang.String fileName) throws java.io.IOException
java.io.IOException
public static EnglishGrammaticalStructure buildCoNLLXGrammaticalStructure(java.util.List<java.util.List<java.lang.String>> tokenFields)
public static void main(java.lang.String[] args)