Package nltk_lite :: Package cluster :: Class Dendogram
[show private | hide private]
[frames | no frames]

Class Dendogram


Represents a dendogram, a tree with a specified branching order. This must be initialised with the leaf items, then iteratively call merge for each branch. This class constructs a tree representing the order of calls to the merge function.
Method Summary
  __init__(self, items)
  __repr__(self)
  groups(self, n)
Finds the n-groups of items (leaves) reachable from a cut at depth n.
  merge(self, *indices)
Merges nodes at given indices in the dendogram.
  show(self)
Print the dendogram in ASCII art to standard out.

Method Details

__init__(self, items=[])
(Constructor)

Parameters:
items - the items at the leaves of the dendogram
           (type=sequence of (any))

groups(self, n)

Finds the n-groups of items (leaves) reachable from a cut at depth n.
Parameters:
n - number of groups
           (type=int)

merge(self, *indices)

Merges nodes at given indices in the dendogram. The nodes will be combined which then replaces the first node specified. All other nodes involved in the merge will be removed.
Parameters:
indices - indices of the items to merge (at least two)
           (type=seq of int)

show(self)

Print the dendogram in ASCII art to standard out.

Generated by Epydoc 2.1 on Tue Sep 5 09:37:22 2006 http://epydoc.sf.net