class FeatureTreeEdge(TreeEdge): (source)
Constructor: FeatureTreeEdge(span, lhs, rhs, dot, bindings)
A specialized tree edge that allows shared variable bindings between nonterminals on the left-hand side and right-hand side.
Each FeatureTreeEdge contains a set of bindings, i.e., a dictionary mapping from variables to values. If the edge is not complete, then these bindings are simply stored. However, if the edge is complete, then the constructor applies these bindings to every nonterminal in the edge whose symbol implements the interface SubstituteBindingsI.
Static Method | from |
No summary |
Method | __init__ |
Construct a new edge. If the edge is incomplete (i.e., if dot<len(rhs)), then store the bindings as-is. If the edge is complete (i.e., if dot==len(rhs)), then apply the bindings to all nonterminals in ... |
Method | __str__ |
Undocumented |
Method | bindings |
Return a copy of this edge's bindings dictionary. |
Method | move |
No summary |
Method | next |
Undocumented |
Method | variables |
No summary |
Method | _bind |
Undocumented |
Instance Variable | _bindings |
Undocumented |
Instance Variable | _comparison |
Undocumented |
Inherited from TreeEdge
:
Method | __repr__ |
Undocumented |
Method | dot |
Return this edge's dot position, which indicates how much of the hypothesized structure is consistent with the sentence. In particular, self.rhs[:dot] is consistent with tokens[self.start():self.end()]... |
Method | end |
Return the end index of this edge's span. |
Method | is |
Return True if this edge's structure is fully consistent with the text. |
Method | is |
Return True if this edge's structure is partially consistent with the text. |
Method | length |
Return the length of this edge's span. |
Method | lhs |
Return this edge's left-hand side, which specifies what kind of structure is hypothesized by this edge. |
Method | nextsym |
Return the element of this edge's right-hand side that immediately follows its dot. |
Method | rhs |
Return this edge's right-hand side, which specifies the content of the structure hypothesized by this edge. |
Method | span |
Return a tuple (s, e), where tokens[s:e] is the portion of the sentence that is consistent with this edge's structure. |
Method | start |
Return the start index of this edge's span. |
Instance Variable | _dot |
Undocumented |
Instance Variable | _lhs |
Undocumented |
Instance Variable | _rhs |
Undocumented |
Instance Variable | _span |
Undocumented |
Inherited from EdgeI
(via TreeEdge
):
Method | __eq__ |
Undocumented |
Method | __hash__ |
Undocumented |
Method | __lt__ |
Undocumented |
Method | __ne__ |
Undocumented |
Instance Variable | _hash |
Undocumented |
Returns | |
TreeEdge | A new TreeEdge formed from the given production. The new edge's left-hand side and right-hand side will be taken from production; its span will be (index,index); and its dot position will be 0. |
nltk.parse.chart.TreeEdge.__init__
Construct a new edge. If the edge is incomplete (i.e., if dot<len(rhs)), then store the bindings as-is. If the edge is complete (i.e., if dot==len(rhs)), then apply the bindings to all nonterminals in lhs and rhs, and then clear the bindings. See TreeEdge for a description of the other arguments.