Package nltk :: Module tree :: Class ProbabilisticTree
[hide private]
[frames] | no frames]

type ProbabilisticTree

source code

                object --+        
                         |        
                      list --+    
                             |    
                          Tree --+
                                 |
                    object --+   |
                             |   |
probability.ProbabilisticMixIn --+
                                 |
                                ProbabilisticTree

Instance Methods [hide private]
new list
__init__(self, node_or_str, children=None, **prob_kwargs)
Construct a new tree.
source code
 
_frozen_class(self) source code
 
__repr__(self)
repr(x)
source code
 
__str__(self) source code
 
__cmp__(self, other) source code
 
__eq__(self, other)
x==y
source code
 
__ne__(self, other)
x!=y
source code
 
copy(self, deep=False) source code

Inherited from Tree: __add__, __delitem__, __ge__, __getitem__, __gt__, __le__, __lt__, __mul__, __radd__, __rmul__, __setitem__, chomsky_normal_form, collapse_unary, draw, flatten, freeze, height, leaf_treeposition, leaves, pos, pprint, pprint_latex_qtree, productions, subtrees, treeposition_spanning_leaves, treepositions, un_chomsky_normal_form

Inherited from Tree (private): _pprint_flat

Inherited from list: __contains__, __delslice__, __getattribute__, __getslice__, __hash__, __iadd__, __imul__, __iter__, __len__, __reversed__, __setslice__, append, count, extend, index, insert, pop, remove, reverse, sort

Inherited from probability.ProbabilisticMixIn: logprob, prob, set_logprob, set_prob

Class Methods [hide private]
 
convert(cls, val)
Convert a tree between different subtypes of Tree.
source code

Inherited from Tree: parse

Inherited from Tree (private): _parse_error

Static Methods [hide private]
a new object with type S, a subtype of T
__new__(cls, node_or_str, children=None, **prob_kwargs) source code
Method Details [hide private]

__new__(cls, node_or_str, children=None, **prob_kwargs)
Static Method

source code 
Returns: a new object with type S, a subtype of T
Overrides: list.__new__
(inherited documentation)

__init__(self, node_or_str, children=None, **prob_kwargs)
(Constructor)

source code 

Construct a new tree. This constructor can be called in one of two ways:

  • Tree(node, children) constructs a new tree with the specified node value and list of children.
  • Tree(s) constructs a new tree by parsing the string s. It is equivalent to calling the class method Tree.parse(s).
Parameters:
  • prob - The probability associated with the object.
  • logprob - The log of the probability associated with the object.
Returns: new list
Overrides: probability.ProbabilisticMixIn.__init__
(inherited documentation)

_frozen_class(self)

source code 
Overrides: Tree._frozen_class

__repr__(self)
(Representation operator)

source code 

repr(x)

Overrides: list.__repr__
(inherited documentation)

__str__(self)
(Informal representation operator)

source code 
Overrides: Tree.__str__

__eq__(self, other)
(Equality operator)

source code 

x==y

Overrides: list.__eq__
(inherited documentation)

__ne__(self, other)

source code 

x!=y

Overrides: list.__ne__
(inherited documentation)

copy(self, deep=False)

source code 
Overrides: Tree.copy

convert(cls, val)
Class Method

source code 

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

Parameters:
  • val - The tree that should be converted.
Returns:
The new Tree.
Overrides: Tree.convert
(inherited documentation)