class LeafEdge(EdgeI): (source)
Known subclasses: nltk.parse.pchart.ProbabilisticLeafEdge
Constructor: LeafEdge(leaf, index)
An edge that records the fact that a leaf value is consistent with a word in the sentence. A leaf edge consists of:
- An index, indicating the position of the word.
- A leaf, specifying the word's content.
A leaf edge's left-hand side is its leaf value, and its right hand side is (). Its span is [index, index+1], and its dot position is 0.
Method | __init__ |
Construct a new LeafEdge. |
Method | __repr__ |
Undocumented |
Method | __str__ |
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 | _comparison |
Undocumented |
Instance Variable | _index |
Undocumented |
Instance Variable | _leaf |
Undocumented |
Inherited from EdgeI
:
Method | __eq__ |
Undocumented |
Method | __hash__ |
Undocumented |
Method | __lt__ |
Undocumented |
Method | __ne__ |
Undocumented |
Instance Variable | _hash |
Undocumented |
nltk.parse.chart.EdgeI.__init__
Construct a new LeafEdge.
Parameters | |
leaf | The new edge's leaf value, specifying the word that is recorded by this edge. |
index | The new edge's index, specifying the position of the word that is recorded by this edge. |
nltk.parse.chart.EdgeI.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()].
Returns | |
int | Undocumented |
nltk.parse.chart.EdgeI.end
Return the end index of this edge's span.
Returns | |
int | Undocumented |
nltk.parse.chart.EdgeI.is_complete
Return True if this edge's structure is fully consistent with the text.
Returns | |
bool | Undocumented |
nltk.parse.chart.EdgeI.is_incomplete
Return True if this edge's structure is partially consistent with the text.
Returns | |
bool | Undocumented |
nltk.parse.chart.EdgeI.length
Return the length of this edge's span.
Returns | |
int | Undocumented |
nltk.parse.chart.EdgeI.lhs
Return this edge's left-hand side, which specifies what kind of structure is hypothesized by this edge.
See Also | |
TreeEdge and LeafEdge for a description of the left-hand side values for each edge type. |
nltk.parse.chart.EdgeI.nextsym
Return the element of this edge's right-hand side that immediately follows its dot.
Returns | |
Nonterminal or terminal or None | Undocumented |
nltk.parse.chart.EdgeI.rhs
Return this edge's right-hand side, which specifies the content of the structure hypothesized by this edge.
See Also | |
TreeEdge and LeafEdge for a description of the right-hand side values for each edge type. |
nltk.parse.chart.EdgeI.span
Return a tuple (s, e), where tokens[s:e] is the portion of the sentence that is consistent with this edge's structure.
Returns | |
tuple(int, int) | Undocumented |
nltk.parse.chart.EdgeI.start
Return the start index of this edge's span.
Returns | |
int | Undocumented |