public class SemanticGraphFactory extends 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(List<SemanticGraph> graphs,
List<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(Tree tree)
Produces a CCProcessed SemanticGraph with no extras.
|
static SemanticGraph |
generateCollapsedDependencies(GrammaticalStructure gs)
Produces a Collapsed SemanticGraph with no 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(Tree tree)
Produces an Uncollapsed SemanticGraph with no extras.
|
static Set<IndexedWord> |
getVerticesFromEdgeSet(Iterable<SemanticGraphEdge> edges)
Given an iterable set of edges, returns the set of vertices covered by these edges.
|
static SemanticGraph |
makeFromEdges(Iterable<SemanticGraphEdge> edges)
Given a list of edges, attempts to create and return a rooted SemanticGraph.
|
static SemanticGraph |
makeFromGraphs(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 gs,
SemanticGraphFactory.Mode mode,
boolean 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) |
static SemanticGraph |
makeFromTree(Tree tree,
SemanticGraphFactory.Mode mode,
boolean includeExtras,
boolean threadSafe,
java.util.function.Predicate<TypedDependency> filter)
Returns a new
SemanticGraph constructed from a given Tree with given options. |
static SemanticGraph |
makeFromTree(Tree tree,
SemanticGraphFactory.Mode mode,
boolean includeExtras,
java.util.function.Predicate<TypedDependency> filter) |
static SemanticGraph |
makeFromVertices(SemanticGraph sg,
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 makeFromTree(Tree tree, SemanticGraphFactory.Mode mode, boolean includeExtras, boolean threadSafe, java.util.function.Predicate<TypedDependency> filter)
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 nullpublic static SemanticGraph makeFromTree(GrammaticalStructure gs, 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, boolean includeExtras, java.util.function.Predicate<TypedDependency> filter)
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(Iterable<SemanticGraphEdge> edges)
TODO: throw Exceptions, or flag warnings on conditions for concern (no root, etc)
public static Set<IndexedWord> getVerticesFromEdgeSet(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, Collection<IndexedWord> nodes)
public static SemanticGraph duplicateKeepNodes(SemanticGraph sg)
public static SemanticGraph makeFromGraphs(Collection<SemanticGraph> sgList)
public static SemanticGraph deepCopyFromGraphs(List<SemanticGraph> graphs, List<Integer> lengths)
lengths
must be a vector containing the number of
tokens in each sentence. This is used to reindex the tokens.