nltk.tree.immutable module

class nltk.tree.immutable.ImmutableProbabilisticTree[source]

Bases: nltk.tree.immutable.ImmutableTree, nltk.probability.ProbabilisticMixIn

__init__(node, children=None, **prob_kwargs)[source]
copy(deep=False)[source]

Return a shallow copy of the list.

classmethod convert(val)[source]
class nltk.tree.immutable.ImmutableTree[source]

Bases: nltk.tree.tree.Tree

__init__(node, children=None)[source]
append(v)[source]

Append object to the end of the list.

extend(v)[source]

Extend list by appending elements from the iterable.

pop(v=None)[source]

Remove and return item at index (default last).

Raises IndexError if list is empty or index is out of range.

remove(v)[source]

Remove first occurrence of value.

Raises ValueError if the value is not present.

reverse()[source]

Reverse IN PLACE.

sort()[source]

Sort the list in ascending order and return None.

The sort is in-place (i.e. the list itself is modified) and stable (i.e. the order of two equal elements is maintained).

If a key function is given, apply it once to each list item and sort them, ascending or descending, according to their function values.

The reverse flag can be set to sort in descending order.

set_label(value)[source]

Set the node label. This will only succeed the first time the node label is set, which should occur in ImmutableTree.__init__().

class nltk.tree.immutable.ImmutableParentedTree[source]

Bases: nltk.tree.immutable.ImmutableTree, nltk.tree.parented.ParentedTree

class nltk.tree.immutable.ImmutableMultiParentedTree[source]

Bases: nltk.tree.immutable.ImmutableTree, nltk.tree.parented.MultiParentedTree