org.allenai.nlpstack.parse.poly.polyparser
the parsed sentence (the zeroth token of which should be the nexus)
the breadcrumb of each token (see above definition)
the set of children of each token in the polytree
the set of labeled neighbors of each token in the undirected tree
Maps a set of token indices (the set should contain exactly two elements) to the label of the arc that connects them (regardless of directionality).
the set of labeled neighbors of each token in the undirected tree
Returns whether the two argument token indices have a connecting arc (regardless of directionality) in the polytree.
Returns whether the two argument token indices have a connecting arc (regardless of directionality) in the polytree.
the first token index
the second token index
true iff the argument token indices have a connecting arc in the polytree
Converts the dependency parse into a constituency parse (i.e.
Converts the dependency parse into a constituency parse (i.e. a tree for which the leaves, rather than the entire node set, are labeled with the words of a sentence).
It does so by making each node sprout a child. This child is labeled with its parent's word. Then its parent is relabeled with the label of the arc leading to its breadcrumb.
the breadcrumb of each token (see above definition)
Maps each token index to the arclabel between itself and its breadcrumb.
the set of children of each token in the polytree
Return the set of gretels for a particular token.
Return the set of gretels for a particular token.
Definition: if x is the breadcrumb of y, then y is a gretel of x.
the token (index) for which we want to identify the gretels
the gretels of the specified token
If x is the breadcrumb of y, then y is a gretel of x.
The nth element of this vector is the "path" of the nth node (see getPath()).
the parsed sentence (the zeroth token of which should be the nexus)
A PolytreeParse is a polytree-structured dependency parse. A polytree is a directed graph whose undirected structure is a tree. The nodes of this graph will correspond to an indexed sequence of tokens (think the words from a sentence), whose zeroth element is a reserved 'nexus' token which does not correspond to a word in the original sentence. The nexus must be one of the roots of the directed graph (i.e. it cannot be the child of any node).
Since the undirected structure is a tree, every node (other than the nexus) has a unique neighbor which is one step closer to the nexus than itself (this may be the nexus itself). This neighbor is referred to as the node's 'breadcrumb'.
It has four major fields: -
tokens
is a vector of Token objects (in the order that they appear in the associated sentence). The zeroth element is assumed to be the nexus. -breadcrumb
tells you the unique neighbor that is closer to the nexus in the undirected tree (this can be the nexus itself); for instance, if breadcrumb(5) = 3, then token 3 is one step closer to the nexus from token 5. The breadcrumb of the nexus should be -1. -children
tells you the set of children of a node in the polytree; for instance, if children(5) = Set(3,6,7), then token 5 has three children: tokens 3, 6, and 7 -arclabels
tells you the labeled neighbors of a node in the undirected tree; for instance, if arclabels(5) = Set((4, 'det), (7, 'amod)), then token 5 has two neighbors, reached with arcs labeled 'det and 'amod (the labels are scala Symbol objects)the parsed sentence (the zeroth token of which should be the nexus)
the breadcrumb of each token (see above definition)
the set of children of each token in the polytree
the set of labeled neighbors of each token in the undirected tree