public class UniversalEnglishGrammaticalStructure extends GrammaticalStructure
| Modifier and Type | Class and Description |
|---|---|
static class |
UniversalEnglishGrammaticalStructure.FromDependenciesFactory |
GrammaticalStructure.Extras| Modifier and Type | Field and Description |
|---|---|
static EnhancementOptions |
COLLAPSED_OPTIONS
Deprecated.
|
static EnhancementOptions |
ENHANCED_OPTIONS |
static EnhancementOptions |
ENHANCED_PLUS_PLUS_OPTIONS |
allTypedDependencies, CoNLLX_FieldCount, CoNLLX_GovField, CoNLLX_POSField, CoNLLX_RelnField, CoNLLX_WordField, puncFilter, tagFilter, typedDependencies| Constructor and Description |
|---|
UniversalEnglishGrammaticalStructure(java.util.List<TypedDependency> projectiveDependencies,
TreeGraphNode root)
Used for postprocessing CoNLL X dependencies
|
UniversalEnglishGrammaticalStructure(Tree t)
Construct a new
EnglishGrammaticalStructure from an existing parse
tree. |
UniversalEnglishGrammaticalStructure(Tree t,
java.util.function.Predicate<java.lang.String> tagFilter)
This gets used by GrammaticalStructureFactory (by reflection).
|
UniversalEnglishGrammaticalStructure(Tree t,
java.util.function.Predicate<java.lang.String> tagFilter,
HeadFinder hf)
Construct a new
GrammaticalStructure from an existing parse
tree. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addEnhancements(java.util.List<TypedDependency> list,
EnhancementOptions options)
Destructively applies different enhancements to the dependency graph.
|
static UniversalEnglishGrammaticalStructure |
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 or
by adding additional information from the dependents to the relation
of the governor. |
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 static void |
correctDependencies(SemanticGraph sg) |
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.
|
protected void |
getTreeDeps(java.util.List<TypedDependency> deps,
DirectedMultiGraph<TreeGraphNode,GrammaticalRelation> completeGraph,
java.util.function.Predicate<TypedDependency> puncTypedDepFilter,
java.util.function.Predicate<TypedDependency> extraTreeDepFilter)
Look through the tree t and adds to the List basicDep
additional dependencies which aren't
in the List but which satisfy the filter puncTypedDepFilter.
|
protected void |
postProcessDependencies(java.util.List<TypedDependency> list)
Post process the dependencies in whatever way this language
requires.
|
protected static void |
postProcessDependencies(SemanticGraph sg) |
static java.util.List<GrammaticalStructure> |
readCoNLLXGrammaticalStructureCollection(java.lang.String fileName) |
allTypedDependencies, buildCoNLLXGrammaticalStructure, fromStringReps, getGrammaticalRelation, getGrammaticalRelation, getRoots, isConnected, main, readCoNLLXGrammaticalStructureCollection, root, toString, typedDependencies, typedDependencies, typedDependencies, typedDependenciesCCprocessed, typedDependenciesCCprocessed, typedDependenciesCCprocessed, typedDependenciesCollapsed, typedDependenciesCollapsed, typedDependenciesCollapsed, typedDependenciesCollapsedTree, typedDependenciesEnhanced, typedDependenciesEnhancedPlusPluspublic static final EnhancementOptions ENHANCED_OPTIONS
public static final EnhancementOptions ENHANCED_PLUS_PLUS_OPTIONS
@Deprecated public static final EnhancementOptions COLLAPSED_OPTIONS
public UniversalEnglishGrammaticalStructure(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 UniversalEnglishGrammaticalStructure(Tree t, java.util.function.Predicate<java.lang.String> tagFilter)
t - Parse tree to make grammatical structure fromtagFilter - Filter to remove punctuation dependenciespublic UniversalEnglishGrammaticalStructure(Tree t, java.util.function.Predicate<java.lang.String> tagFilter, 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.
This gets used by GrammaticalStructureFactory (by reflection). DON'T DELETE.t - Parse tree to make grammatical structure fromtagFilter - Filter for punctuation tagshf - HeadFinder to use when building itpublic UniversalEnglishGrammaticalStructure(java.util.List<TypedDependency> projectiveDependencies, TreeGraphNode root)
protected java.util.function.Predicate<TypedDependency> extraTreeDepFilter()
extraTreeDepFilter in class GrammaticalStructureprotected void getTreeDeps(java.util.List<TypedDependency> deps, DirectedMultiGraph<TreeGraphNode,GrammaticalRelation> completeGraph, java.util.function.Predicate<TypedDependency> puncTypedDepFilter, java.util.function.Predicate<TypedDependency> extraTreeDepFilter)
GrammaticalStructuregetTreeDeps in class GrammaticalStructuredeps - The list of dependencies which may be augmentedcompleteGraph - a graph of all the tree dependencies found earlierpuncTypedDepFilter - The filter that may skip punctuation dependenciesextraTreeDepFilter - Additional dependencies are added only if they pass this filterprotected void correctDependencies(java.util.List<TypedDependency> list)
GrammaticalStructureTypedDependencyGraph to correct
language-dependent dependencies. (e.g., nsubjpass in a relative clause)
correctDependencies in class GrammaticalStructureprotected static void correctDependencies(SemanticGraph sg)
protected void postProcessDependencies(java.util.List<TypedDependency> list)
GrammaticalStructurepostProcessDependencies in class GrammaticalStructureprotected static void postProcessDependencies(SemanticGraph sg)
protected void getExtras(java.util.List<TypedDependency> list)
GrammaticalStructuregetExtras in class GrammaticalStructureprotected void addEnhancements(java.util.List<TypedDependency> list, EnhancementOptions options)
GrammaticalStructureaddEnhancements in class GrammaticalStructurelist - A list of dependenciesoptions - Options that determine which enhancements are applied to the dependency graph.protected void collapseDependencies(java.util.List<TypedDependency> list, boolean CCprocess, GrammaticalStructure.Extras includeExtras)
Collection<TypedDependency>
by collapsing several types of transitive pairs of dependencies or
by adding additional information from the dependents to the relation
of the governor.
If called with a tree of dependencies and both CCprocess and
includeExtras set to false, then the tree structure is preserved.
case(hat, in) and nmod(in, hat) then
the nmod relation is enhanced to nmod:in(cat, hat).
The case(hat, in) relation is preserved.case(attacking, of) and advcl(heard, attacking) then
the nmod relation is enhanced to nmod:of(heard, attacking).
The case(attacking, of) relation is preserved.cc(investors, and) and
conj(investors, regulators), then the conj relation is
enhanced to
conj:and(investors, regulators)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)
GrammaticalStructureCollection<TypedDependency> to collapse
language-dependent transitive dependencies but keeping a tree structure.
collapseDependenciesTree in class GrammaticalStructurelist - 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.IOExceptionpublic static UniversalEnglishGrammaticalStructure buildCoNLLXGrammaticalStructure(java.util.List<java.util.List<java.lang.String>> tokenFields)