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

Class ImmutableTree

source code

object --+        
         |        
      list --+    
             |    
          Tree --+
                 |
                ImmutableTree
Known Subclasses:

Instance Methods [hide private]
 
__init__(self, node_or_str, children=None)
Construct a new tree.
source code
 
__setitem__(self) source code
 
__setslice__(self)
x[i:j]=y
source code
 
__delitem__(self) source code
 
__delslice__(self)
del x[i:j]
source code
 
__iadd__(self)
x+=y
source code
 
__imul__(self)
x*=y
source code
 
append(self, v)
append object to end
source code
 
extend(self, v)
extend list by appending elements from the iterable
source code
item
pop(self, v=None)
remove and return item at index (default last)
source code
 
remove(self, v)
remove first occurrence of value
source code
 
reverse(self)
reverse *IN PLACE*
source code
 
sort(self)
stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1
source code
 
__hash__(self)
hash(x)
source code
 
_set_node(self, node)
Set self._node.
source code
 
_get_node(self) source code

Inherited from Tree: __add__, __eq__, __ge__, __getitem__, __gt__, __le__, __lt__, __mul__, __ne__, __radd__, __repr__, __rmul__, __str__, chomsky_normal_form, collapse_unary, copy, 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): _frozen_class, _pprint_flat

Inherited from list: __contains__, __getattribute__, __getslice__, __iter__, __len__, __reversed__, count, index, insert

Inherited from object: __delattr__, __reduce__, __reduce_ex__, __setattr__

Class Methods [hide private]

Inherited from Tree: convert, parse

Inherited from Tree (private): _parse_error

Static Methods [hide private]

Inherited from Tree: __new__

Properties [hide private]
  node

Inherited from object: __class__

Method Details [hide private]

__init__(self, node_or_str, children=None)
(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).
Overrides: Tree.__init__
(inherited documentation)

__setitem__(self)
(Index assignment operator)

source code 
Overrides: Tree.__setitem__

__setslice__(self)
(Slice assignment operator)

source code 

x[i:j]=y

Use of negative indices is not supported.

Overrides: list.__setslice__
(inherited documentation)

__delitem__(self)
(Index deletion operator)

source code 
Overrides: Tree.__delitem__

__delslice__(self)
(Slice deletion operator)

source code 

del x[i:j]

Use of negative indices is not supported.

Overrides: list.__delslice__
(inherited documentation)

__iadd__(self)

source code 

x+=y

Overrides: list.__iadd__
(inherited documentation)

__imul__(self)

source code 

x*=y

Overrides: list.__imul__
(inherited documentation)

append(self, v)

source code 

append object to end

Overrides: list.append
(inherited documentation)

extend(self, v)

source code 

extend list by appending elements from the iterable

Overrides: list.extend
(inherited documentation)

pop(self, v=None)

source code 

remove and return item at index (default last)

Returns: item
Overrides: list.pop
(inherited documentation)

remove(self, v)

source code 

remove first occurrence of value

Overrides: list.remove
(inherited documentation)

reverse(self)

source code 

reverse *IN PLACE*

Overrides: list.reverse
(inherited documentation)

sort(self)

source code 

stable sort *IN PLACE*; cmp(x, y) -> -1, 0, 1

Overrides: list.sort
(inherited documentation)

__hash__(self)
(Hashing function)

source code 

hash(x)

Overrides: list.__hash__
(inherited documentation)

_set_node(self, node)

source code 

Set self._node. This will only succeed the first time the node value is set, which should occur in Tree.__init__().


Property Details [hide private]

node

Get Method:
_get_node(self)
Set Method:
_set_node(self, node) - Set self._node.