public class SemanticGraphFactory
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
SemanticGraphFactory.Mode |
Modifier and Type | Method and Description |
---|---|
static SemanticGraph |
allTypedDependencies(Tree tree,
boolean collapse)
Returns a new SemanticGraph constructed from the given tree.
|
static SemanticGraph |
deepCopyFromGraphs(java.util.List<SemanticGraph> graphs,
java.util.List<java.lang.Integer> lengths)
Like makeFromGraphs, but it makes a deep copy of the graphs and
renumbers the index words.
|
static SemanticGraph |
duplicateKeepNodes(SemanticGraph sg)
This creates a new graph based off the given, but uses the existing nodes objects.
|
static SemanticGraph |
generateCCProcessedDependencies(GrammaticalStructure gs)
Produces a CCProcessed SemanticGraph with no extras.
|
static SemanticGraph |
generateCCProcessedDependencies(GrammaticalStructure gs,
GrammaticalStructure.Extras extras)
Produces a CCProcessed SemanticGraph with optional extras.
|
static SemanticGraph |
generateCCProcessedDependencies(Tree tree)
Produces a CCProcessed SemanticGraph with no extras.
|
static SemanticGraph |
generateCollapsedDependencies(GrammaticalStructure gs)
Produces a Collapsed SemanticGraph with no extras.
|
static SemanticGraph |
generateCollapsedDependencies(GrammaticalStructure gs,
GrammaticalStructure.Extras extras)
Produces a Collapsed SemanticGraph with optional extras.
|
static SemanticGraph |
generateCollapsedDependencies(Tree tree)
Produces a Collapsed SemanticGraph with no extras.
|
static SemanticGraph |
generateUncollapsedDependencies(GrammaticalStructure gs)
Produces an Uncollapsed SemanticGraph with no extras.
|
static SemanticGraph |
generateUncollapsedDependencies(GrammaticalStructure gs,
GrammaticalStructure.Extras extras)
Produces an Uncollapsed SemanticGraph with optional extras.
|
static SemanticGraph |
generateUncollapsedDependencies(Tree tree)
Produces an Uncollapsed SemanticGraph with no extras.
|
static java.util.Set<IndexedWord> |
getVerticesFromEdgeSet(java.lang.Iterable<SemanticGraphEdge> edges)
Given an iterable set of edges, returns the set of vertices covered by these edges.
|
static SemanticGraph |
makeFromEdges(java.lang.Iterable<SemanticGraphEdge> edges)
Given a list of edges, attempts to create and return a rooted SemanticGraph.
|
static SemanticGraph |
makeFromGraphs(java.util.Collection<SemanticGraph> sgList)
Given a list of graphs, constructs a new graph combined from the
collection of graphs.
|
static SemanticGraph |
makeFromTree(GrammaticalStructure structure) |
static SemanticGraph |
makeFromTree(GrammaticalStructure tree,
SemanticGraphFactory.Mode mode,
boolean includeExtras,
boolean threadSafe,
java.util.function.Predicate<TypedDependency> filter)
Deprecated.
|
static SemanticGraph |
makeFromTree(GrammaticalStructure gs,
SemanticGraphFactory.Mode mode,
GrammaticalStructure.Extras includeExtras,
boolean threadSafe,
java.util.function.Predicate<TypedDependency> filter) |
static SemanticGraph |
makeFromTree(Tree tree)
Returns a new SemanticGraph constructed from the given tree.
|
static SemanticGraph |
makeFromTree(Tree tree,
boolean collapse)
Returns a new SemanticGraph constructed from the given tree.
|
static SemanticGraph |
makeFromTree(Tree tree,
SemanticGraphFactory.Mode mode,
boolean includeExtras,
boolean threadSafe)
Deprecated.
|
static SemanticGraph |
makeFromTree(Tree tree,
SemanticGraphFactory.Mode mode,
boolean includeExtras,
boolean threadSafe,
java.util.function.Predicate<TypedDependency> filter)
Deprecated.
|
static SemanticGraph |
makeFromTree(Tree tree,
SemanticGraphFactory.Mode mode,
boolean includeExtras,
java.util.function.Predicate<TypedDependency> filter)
Deprecated.
|
static SemanticGraph |
makeFromTree(Tree tree,
SemanticGraphFactory.Mode mode,
GrammaticalStructure.Extras includeExtras,
boolean threadSafe) |
static SemanticGraph |
makeFromTree(Tree tree,
SemanticGraphFactory.Mode mode,
GrammaticalStructure.Extras includeExtras,
boolean threadSafe,
java.util.function.Predicate<TypedDependency> filter,
boolean originalDependencies)
Returns a new
SemanticGraph constructed from a given Tree with given options. |
static SemanticGraph |
makeFromTree(Tree tree,
SemanticGraphFactory.Mode mode,
GrammaticalStructure.Extras includeExtras,
java.util.function.Predicate<TypedDependency> filter) |
static SemanticGraph |
makeFromVertices(SemanticGraph sg,
java.util.Collection<IndexedWord> nodes)
Given a set of vertices, and the source graph they are drawn from, create a path composed
of the minimum paths between the vertices.
|
public static SemanticGraph generateUncollapsedDependencies(Tree tree)
public static SemanticGraph generateCollapsedDependencies(Tree tree)
public static SemanticGraph generateCCProcessedDependencies(Tree tree)
public static SemanticGraph generateUncollapsedDependencies(GrammaticalStructure gs)
public static SemanticGraph generateCollapsedDependencies(GrammaticalStructure gs)
public static SemanticGraph generateCCProcessedDependencies(GrammaticalStructure gs)
public static SemanticGraph generateUncollapsedDependencies(GrammaticalStructure gs, GrammaticalStructure.Extras extras)
public static SemanticGraph generateCollapsedDependencies(GrammaticalStructure gs, GrammaticalStructure.Extras extras)
public static SemanticGraph generateCCProcessedDependencies(GrammaticalStructure gs, GrammaticalStructure.Extras extras)
public static SemanticGraph makeFromTree(Tree tree, SemanticGraphFactory.Mode mode, GrammaticalStructure.Extras includeExtras, boolean threadSafe, java.util.function.Predicate<TypedDependency> filter, boolean originalDependencies)
SemanticGraph
constructed from a given Tree
with given options.
This factory method is intended to replace a profusion of highly similar
factory methods, such as
typedDependencies()
,
typedDependenciesCollapsed()
,
allTypedDependencies()
,
allTypedDependenciesCollapsed()
, etc.
For a fuller explanation of the meaning of the boolean arguments, see
GrammaticalStructure
. tree
- A tree representing a phrase structure parseincludeExtras
- Whether to include extra dependencies, which may
result in a non-treethreadSafe
- Whether to make sure processing is thread-safefilter
- A filter to exclude certain dependencies; ignored if nulloriginalDependencies
- generate original Stanford dependencies instead of new
Universal Dependencies@Deprecated public static SemanticGraph makeFromTree(Tree tree, SemanticGraphFactory.Mode mode, boolean includeExtras, boolean threadSafe, java.util.function.Predicate<TypedDependency> filter)
edu.stanford.nlp.semgraph.SemanticGraphFactory#makeFromTree(edu.stanford.nlp.trees.Tree, edu.stanford.nlp.semgraph.SemanticGraphFactory.Mode, edu.stanford.nlp.trees.GrammaticalStructure.Extras, boolean, java.util.function.Predicate)
public static SemanticGraph makeFromTree(GrammaticalStructure gs, SemanticGraphFactory.Mode mode, GrammaticalStructure.Extras includeExtras, boolean threadSafe, java.util.function.Predicate<TypedDependency> filter)
@Deprecated public static SemanticGraph makeFromTree(GrammaticalStructure tree, SemanticGraphFactory.Mode mode, boolean includeExtras, boolean threadSafe, java.util.function.Predicate<TypedDependency> filter)
public static SemanticGraph makeFromTree(GrammaticalStructure structure)
public static SemanticGraph makeFromTree(Tree tree, SemanticGraphFactory.Mode mode, GrammaticalStructure.Extras includeExtras, java.util.function.Predicate<TypedDependency> filter)
edu.stanford.nlp.semgraph.SemanticGraphFactory#makeFromTree(edu.stanford.nlp.trees.Tree, edu.stanford.nlp.semgraph.SemanticGraphFactory.Mode, edu.stanford.nlp.trees.GrammaticalStructure.Extras, boolean, java.util.function.Predicate)
@Deprecated public static SemanticGraph makeFromTree(Tree tree, SemanticGraphFactory.Mode mode, boolean includeExtras, java.util.function.Predicate<TypedDependency> filter)
public static SemanticGraph makeFromTree(Tree tree, SemanticGraphFactory.Mode mode, GrammaticalStructure.Extras includeExtras, boolean threadSafe)
edu.stanford.nlp.semgraph.SemanticGraphFactory#makeFromTree(edu.stanford.nlp.trees.Tree, edu.stanford.nlp.semgraph.SemanticGraphFactory.Mode, edu.stanford.nlp.trees.GrammaticalStructure.Extras, boolean, java.util.function.Predicate)
@Deprecated public static SemanticGraph makeFromTree(Tree tree, SemanticGraphFactory.Mode mode, boolean includeExtras, boolean threadSafe)
public static SemanticGraph makeFromTree(Tree tree, boolean collapse)
tree
- tree from which to make new semantic graphcollapse
- collapse dependencies iff this parameter is truepublic static SemanticGraph makeFromTree(Tree tree)
public static SemanticGraph allTypedDependencies(Tree tree, boolean collapse)
tree
- tree from which to make new semantic graphcollapse
- collapse dependencies iff this parameter is truepublic static SemanticGraph makeFromEdges(java.lang.Iterable<SemanticGraphEdge> edges)
TODO: throw Exceptions, or flag warnings on conditions for concern (no root, etc)
public static java.util.Set<IndexedWord> getVerticesFromEdgeSet(java.lang.Iterable<SemanticGraphEdge> edges)
Note: CDM changed the return of this from a List to a Set in 2011. This seemed more sensible. Hopefully it doesn't break anything....
public static SemanticGraph makeFromVertices(SemanticGraph sg, java.util.Collection<IndexedWord> nodes)
public static SemanticGraph duplicateKeepNodes(SemanticGraph sg)
public static SemanticGraph makeFromGraphs(java.util.Collection<SemanticGraph> sgList)
public static SemanticGraph deepCopyFromGraphs(java.util.List<SemanticGraph> graphs, java.util.List<java.lang.Integer> lengths)
lengths
must be a vector containing the number of
tokens in each sentence. This is used to reindex the tokens.