class documentation

Undocumented

Class Method convert Convert a tree between different subtypes of Tree. cls determines which class will be used to encode the new tree.
Method __eq__ Undocumented
Method __init__ Initialize this object's probability. This initializer should be called by subclass constructors. prob should generally be the first argument for those constructors.
Method __lt__ Undocumented
Method __repr__ Undocumented
Method __str__ Undocumented
Method copy Undocumented
Method _frozen_class Undocumented

Inherited from Tree:

Class Method fromlist Convert nested lists to a NLTK Tree
Class Method fromstring Read a bracketed tree string and return the resulting tree. Trees are represented as nested brackettings, such as:
Method __add__ Undocumented
Method __copy__ Undocumented
Method __deepcopy__ Undocumented
Method __delitem__ Undocumented
Method __getitem__ Undocumented
Method __mul__ Undocumented
Method __radd__ Undocumented
Method __rmul__ Undocumented
Method __setitem__ Undocumented
Method chomsky_normal_form This method can modify a tree in three ways:
Method collapse_unary Collapse subtrees with a single child (ie. unary productions) into a new non-terminal (Tree node) joined by 'joinChar'. This is useful when working with algorithms that do not allow unary productions, and completely removing the unary productions would require loss of useful information...
Method draw Open a new window containing a graphical diagram of this tree.
Method flatten Return a flat version of the tree, with all non-root non-terminals removed.
Method freeze Undocumented
Method height Return the height of the tree.
Method label Return the node label of the tree.
Method leaf_treeposition No summary
Method leaves Return the leaves of the tree.
Method pformat No summary
Method pformat_latex_qtree Returns a representation of the tree compatible with the LaTeX qtree package. This consists of the string \Tree followed by the tree represented in bracketed notation.
Method pos Return a sequence of pos-tagged words extracted from the tree.
Method pprint Print a string representation of this Tree to 'stream'
Method pretty_print Pretty-print this tree as ASCII or Unicode art. For explanation of the arguments, see the documentation for nltk.treeprettyprinter.TreePrettyPrinter.
Method productions Generate the productions that correspond to the non-terminal nodes of the tree. For each subtree of the form (P: C1 C2 ... Cn) this produces a production of the form P -> C1 C2 ... Cn.
Method set_label Set the node label of the tree.
Method subtrees Generate all the subtrees of this tree, optionally restricted to trees matching the filter function.
Method treeposition_spanning_leaves No summary
Method treepositions No summary
Method un_chomsky_normal_form This method modifies the tree in three ways:
Class Variable __ge__ Undocumented
Class Variable __gt__ Undocumented
Class Variable __le__ Undocumented
Class Variable __ne__ Undocumented
Class Variable node Undocumented
Class Method _parse_error Display a friendly error message when parsing a tree string fails. :param s: The string we're parsing. :param match: regexp match of the problem token. :param expecting: what we expected to see instead.
Method _get_node Outdated method to access the node value; use the label() method instead.
Method _pformat_flat Undocumented
Method _repr_png_ Draws and outputs in PNG for ipython. PNG is used instead of PDF, since it can be displayed in the qt console and has wider browser support.
Method _set_node Outdated method to set the node value; use the set_label() method instead.
Instance Variable _label Undocumented

Inherited from ProbabilisticMixIn (via Tree):

Method logprob Return log(p), where p is the probability associated with this object.
Method prob Return the probability associated with this object.
Method set_logprob Set the log probability associated with this object to logprob. I.e., set the probability associated with this object to 2**(logprob).
Method set_prob Set the probability associated with this object to prob.
Instance Variable __logprob Undocumented
Instance Variable __prob Undocumented
@classmethod
def convert(cls, val): (source)

Convert a tree between different subtypes of Tree. cls determines which class will be used to encode the new tree.

Parameters
valUndocumented
tree:TreeThe tree that should be converted.
Returns
The new Tree.
def __eq__(self, other): (source)

Undocumented

def __init__(self, node, children=None, **prob_kwargs): (source)

Initialize this object's probability. This initializer should be called by subclass constructors. prob should generally be the first argument for those constructors.

Parameters
nodeUndocumented
childrenUndocumented
prob:floatThe probability associated with the object.
logprob:floatThe log of the probability associated with the object.
**prob_kwargsUndocumented
def __lt__(self, other): (source)

Undocumented

def __repr__(self): (source)

Undocumented

def __str__(self): (source)

Undocumented

def copy(self, deep=False): (source)

Undocumented

def _frozen_class(self): (source)

Undocumented