Package nltk_lite :: Package parse :: Module chart :: Class TreeEdge
[show private | hide private]
[frames | no frames]

Type TreeEdge

object --+    
         |    
     EdgeI --+
             |
            TreeEdge

Known Subclasses:
FeatureTreeEdge, ProbabilisticTreeEdge

An edge that records the fact that a tree is (partially) consistent with the sentence. A tree edge consists of: For more information about edges, see the EdgeI interface.
Method Summary
  __init__(self, span, lhs, rhs, dot)
Construct a new TreeEdge.
  __cmp__(self, other)
  __hash__(self)
  __repr__(self)
  __str__(self)
int dot(self)
Return this edge's dot position, which indicates how much of the hypothesized structure is consistent with the sentence.
int end(self)
Return the end index of this edge's span.
TreeEdge from_production(production, index)
Return a new TreeEdge formed from the given production. (Static method)
boolean is_complete(self)
Return true if this edge's structure is fully consistent with the text.
boolean is_incomplete(self)
Return true if this edge's structure is partially consistent with the text.
int length(self)
Return the length of this edge's span.
  lhs(self)
Return this edge's left-hand side, which specifies what kind of structure is hypothesized by this edge.
Nonterminal or terminal or None next(self)
Return the element of this edge's right-hand side that immediately follows its dot.
  rhs(self)
Return this edge's right-hand side, which specifies the content of the structure hypothesized by this edge.
(int, int) span(self)
Return a tuple (s,e), where subtokens[s:e] is the portion of the sentence that is consistent with this edge's structure.
int start(self)
Return the start index of this edge's span.
Inherited from object: __delattr__, __getattribute__, __new__, __reduce__, __reduce_ex__, __setattr__

Instance Method Details

__init__(self, span, lhs, rhs, dot=0)
(Constructor)

Construct a new TreeEdge.
Parameters:
span - A tuple (s,e), where subtokens[s:e] is the portion of the sentence that is consistent with the new edge's structure.
           (type=(int, int))
lhs - The new edge's left-hand side, specifying the hypothesized tree's node value.
           (type=Nonterminal)
rhs - The new edge's right-hand side, specifying the hypothesized tree's children.
           (type=list of (Nonterminal and string))
dot - The position of the new edge's dot. This position specifies what prefix of the production's right hand side is consistent with the text. In particular, if sentence is the list of subtokens in the sentence, then subtokens[span[0]:span[1]] can be spanned by the children specified by rhs[:dot].
           (type=int)
Overrides:
nltk_lite.parse.chart.EdgeI.__init__

dot(self)

Returns:
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 subtoks[self.start():self.end()].
           (type=int)
Overrides:
nltk_lite.parse.chart.EdgeI.dot (inherited documentation)

end(self)

Returns:
The end index of this edge's span.
           (type=int)
Overrides:
nltk_lite.parse.chart.EdgeI.end (inherited documentation)

is_complete(self)

Returns:
True if this edge's structure is fully consistent with the text.
           (type=boolean)
Overrides:
nltk_lite.parse.chart.EdgeI.is_complete (inherited documentation)

is_incomplete(self)

Returns:
True if this edge's structure is partially consistent with the text.
           (type=boolean)
Overrides:
nltk_lite.parse.chart.EdgeI.is_incomplete (inherited documentation)

length(self)

Returns:
The length of this edge's span.
           (type=int)
Overrides:
nltk_lite.parse.chart.EdgeI.length (inherited documentation)

lhs(self)

Returns:
This edge's left-hand side, which specifies what kind of structure is hypothesized by this edge.
Overrides:
nltk_lite.parse.chart.EdgeI.lhs (inherited documentation)

See Also: TreeEdge and LeafEdge for a description of the left-hand side values for each edge type.

next(self)

Returns:
The element of this edge's right-hand side that immediately follows its dot.
           (type=Nonterminal or terminal or None)
Overrides:
nltk_lite.parse.chart.EdgeI.next (inherited documentation)

rhs(self)

Returns:
This edge's right-hand side, which specifies the content of the structure hypothesized by this edge.
Overrides:
nltk_lite.parse.chart.EdgeI.rhs (inherited documentation)

See Also: TreeEdge and LeafEdge for a description of the right-hand side values for each edge type.

span(self)

Returns:
A tuple (s,e), where subtokens[s:e] is the portion of the sentence that is consistent with this edge's structure.
           (type=(int, int))
Overrides:
nltk_lite.parse.chart.EdgeI.span (inherited documentation)

start(self)

Returns:
The start index of this edge's span.
           (type=int)
Overrides:
nltk_lite.parse.chart.EdgeI.start (inherited documentation)

Static Method Details

from_production(production, index)

Returns:
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.
           (type=TreeEdge)

Generated by Epydoc 2.1 on Tue Sep 5 09:37:22 2006 http://epydoc.sf.net