class documentation

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_production 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_dot_forward No summary
Method next_with_bindings Undocumented
Method variables No summary
Method _bind Undocumented
Instance Variable _bindings Undocumented
Instance Variable _comparison_key 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_complete Return True if this edge's structure is fully consistent with the text.
Method is_incomplete 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
@staticmethod
def from_production(production, index): (source)
Returns
TreeEdgeA 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.
def __init__(self, span, lhs, rhs, dot=0, bindings=None): (source)

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.

def __str__(self): (source)

Undocumented

def bindings(self): (source)

Return a copy of this edge's bindings dictionary.

def move_dot_forward(self, new_end, bindings=None): (source)
Parameters
new_end:intThe new end index.
bindings:dictBindings for the new edge.
Returns
FeatureTreeEdgeA new FeatureTreeEdge formed from this edge. The new edge's dot position is increased by 1, and its end index will be replaced by new_end.
def next_with_bindings(self): (source)

Undocumented

def variables(self): (source)
Returns
set(Variable)The set of variables used by this edge.
def _bind(self, nt, bindings): (source)

Undocumented

_bindings = (source)

Undocumented

_comparison_key = (source)