|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.stanford.nlp.trees.semgraph.SemanticGraphFactory
public class SemanticGraphFactory
Refactoring of static makers of SemanticGraphs in order to simplify the SemanticGraph class.
| Method Summary | |
|---|---|
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 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 gs,
boolean collapse,
boolean tree,
boolean ccProcess,
boolean includeExtras,
boolean lemmatize,
boolean threadSafe,
Filter<TypedDependency> filter,
java.lang.String docID,
int sentIndex)
|
static SemanticGraph |
makeFromTree(GrammaticalStructure structure,
java.lang.String docID,
int sentIndex)
|
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,
boolean collapse,
boolean ccProcess,
boolean includeExtras,
boolean lemmatize,
boolean threadSafe)
|
static SemanticGraph |
makeFromTree(Tree tree,
boolean collapse,
boolean ccProcess,
boolean includeExtras,
boolean lemmatize,
boolean threadSafe,
Filter<TypedDependency> filter)
Returns a new SemanticGraph constructed from a given Tree with given options. |
static SemanticGraph |
makeFromTree(Tree tree,
boolean collapse,
boolean ccProcess,
boolean includeExtras,
boolean lemmatize,
boolean threadSafe,
Filter<TypedDependency> filter,
java.lang.String docID,
int sentIndex)
Returns a new SemanticGraph constructed from a given Tree with given options. |
static SemanticGraph |
makeFromTree(Tree tree,
boolean collapse,
boolean ccProcess,
boolean includeExtras,
Filter<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. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
|---|
public static SemanticGraph makeFromTree(Tree tree,
boolean collapse,
boolean ccProcess,
boolean includeExtras,
boolean lemmatize,
boolean threadSafe,
Filter<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 parsecollapse - Whether to do "collapsing" of pairs of dependencies into
single dependencies, e.g., for prepositions and conjunctionsccProcess - Whether to do processing of CC complements resulting from
collapsing. This argument is ignored unless collapse is
trueincludeExtras - Whether to include extra dependencies, which may
result in a non-treelemmatize - Whether to compute lemma for each nodethreadSafe - Whether to make sure processing is thread-safefilter - A filter to exclude certain dependencies; ignored if null
public static SemanticGraph makeFromTree(Tree tree,
boolean collapse,
boolean ccProcess,
boolean includeExtras,
boolean lemmatize,
boolean threadSafe,
Filter<TypedDependency> filter,
java.lang.String docID,
int sentIndex)
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 parsecollapse - Whether to do "collapsing" of pairs of dependencies into
single dependencies, e.g., for prepositions and conjunctionsccProcess - Whether to do processing of CC complements resulting from
collapsing. This argument is ignored unless collapse is
trueincludeExtras - Whether to include extra dependencies, which may
result in a non-treelemmatize - Whether to compute lemma for each nodethreadSafe - Whether to make sure processing is thread-safefilter - A filter to exclude certain dependencies; ignored if nulldocID - The docID that the tree came fromsentIndex - The sentence number of the tree in the document
public static SemanticGraph makeFromTree(GrammaticalStructure gs,
boolean collapse,
boolean tree,
boolean ccProcess,
boolean includeExtras,
boolean lemmatize,
boolean threadSafe,
Filter<TypedDependency> filter,
java.lang.String docID,
int sentIndex)
public static SemanticGraph makeFromTree(GrammaticalStructure structure,
java.lang.String docID,
int sentIndex)
public static SemanticGraph makeFromTree(Tree tree,
boolean collapse,
boolean ccProcess,
boolean includeExtras,
Filter<TypedDependency> filter)
public static SemanticGraph makeFromTree(Tree tree,
boolean collapse,
boolean ccProcess,
boolean includeExtras,
boolean lemmatize,
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.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||