Home | Trees | Index | Help |
|
---|
Package nltk_lite :: Package parse :: Module chart :: Class Chart |
|
object
--+
|
Chart
A blackboard for hypotheses about the syntactic constituents of a sentence. A chart contains a set of edges, and each edge encodes a single hypothesis about the structure of some portion of the sentence.
The select
method can be used to select a
specific collection of edges. For example
chart.select(is_complete=True, start=0)
yields all complete
edges whose start indices are 0. To ensure the efficiency of these
selection operations, Chart
dynamically creates and
maintains an index for each set of attributes that have been selected
on.
Method Summary | |
---|---|
Construct a new empty chart. | |
iter of EdgeI
|
Return an iterator over the edges in this chart. |
list of list of
Edge
|
Return the set of child pointer lists for the given edge. |
dot_digraph(self)
| |
list of EdgeI
|
Return a list of all edges in this chart. |
bool
|
Add a new edge to the chart. |
iter of EdgeI
|
Return an iterator over the edges in this chart. |
string
|
Return the leaf value of the word at the given index. |
list of string
|
Return a list of the leaf values of each word in the chart's sentence. |
int
|
Return the number of edges contained in this chart. |
int
|
Return the number of words in this chart's sentence. |
Return a list of the complete tree structures that span the entire chart, and whose root node is root . | |
string
|
Return a pretty-printed string representation of this chart. |
string
|
Return a pretty-printed string representation of a given edge in this chart. |
Return a pretty-printed string representation of this chart's leaves. | |
iter of EdgeI
|
Return an iterator over the edges in this chart. |
list of Tree
|
Return a list of the tree structures that are associated with edge . |
A helper function for select , which creates a new index for a
given set of attributes (aka restriction keys). | |
A helper function for _trees that finds the possible sets of
subtrees for a new tree. | |
A helper function for trees . | |
Inherited from object :
__delattr__ ,
__getattribute__ ,
__hash__ ,
__new__ ,
__reduce__ ,
__reduce_ex__ ,
__repr__ ,
__setattr__ ,
__str__
|
Instance Variable Summary | |
---|---|
_edge_to_cpls : A dictionary mapping each edge to a set of child pointer lists that
are associated with that edge. | |
_edges : A list of the edges in the chart | |
_indexes : A dictionary mapping tuples of edge attributes to indices, where each
index maps the corresponding edge attribute values to lists of edges. | |
_num_leaves : The number of tokens. | |
_tokens : The sentence that the chart covers. |
Method Details |
---|
__init__(self,
tokens)
Construct a new empty chart.
|
__iter__(self) |
child_pointer_lists(self, edge)
|
edges(self) |
insert(self, edge, child_pointer_list)Add a new edge to the chart.
|
iteredges(self) |
leaf(self, index)
|
leaves(self)
|
num_edges(self)
|
num_leaves(self)
|
parses(self, root, tree_class=<class 'nltk_lite.parse.tree.Tree'>)
|
pp(self, width=None)
|
pp_edge(self, edge, width=None)
|
pp_leaves(self, width=None)
|
select(self, **restrictions)
|
trees(self, edge, tree_class=<class 'nltk_lite.parse.tree.Tree'>, complete=False)
|
_add_index(self, restr_keys)A helper function forselect , which creates a new index for a
given set of attributes (aka restriction keys).
|
_choose_children(self, child_choices)A helper function for_trees that finds the possible sets of
subtrees for a new tree.
|
_trees(self, edge, complete, memo, tree_class)A helper function fortrees .
|
Instance Variable Details |
---|
_edge_to_cplsA dictionary mapping each edge to a set of child pointer lists that are associated with that edge. |
_edgesA list of the edges in the chart |
_indexesA dictionary mapping tuples of edge attributes to indices, where each index maps the corresponding edge attribute values to lists of edges. |
_num_leavesThe number of tokens. |
_tokensThe sentence that the chart covers. |
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1 on Tue Sep 5 09:37:21 2006 | http://epydoc.sf.net |