WordTree Class Reference

Struct for holding a backtrace word tree. More...

#include <lab4_vit.H>

List of all members.

Public Member Functions

 WordTree ()
 Ctor; initializes object to just contain root node.
void clear ()
 Clears object except for root node.
unsigned size () const
 Returns number of nodes in tree.
unsigned get_root_node () const
 Returns index of root node.
unsigned insert_node (unsigned parentIdx, unsigned lastWord)
 Given an existing node parentIdx, returns index of child node reached when traversing arc labeled with word index lastWord.
unsigned get_parent_node (unsigned nodeIdx) const
 Returns index of parent node for node with index nodeIdx.
unsigned get_last_word (unsigned nodeIdx) const
 Returns index of word labeling arc from node nodeIdx to its parent node.


Detailed Description

Struct for holding a backtrace word tree.

This object can be used to hold a list of word sequences in the form of a tree. Each node in the tree is assigned an integer index, and each arc in the tree is labeled with an integer index corresponding to a word label. Each node in the tree can be viewed as representing the word sequence labeling the path from the root to that node.

To get the index of the root node, use get_root_node(). To find/create the node reached by extending a node with a word, use insert_node(). To recover the word sequence a node corresponds to, you can use get_parent_node() and get_last_word().


Constructor & Destructor Documentation

WordTree::WordTree (  )  [inline]

Ctor; initializes object to just contain root node.


Member Function Documentation

void WordTree::clear (  )  [inline]

Clears object except for root node.

unsigned WordTree::size (  )  const [inline]

Returns number of nodes in tree.

unsigned WordTree::get_root_node (  )  const [inline]

Returns index of root node.

unsigned WordTree::insert_node ( unsigned  parentIdx,
unsigned  lastWord 
) [inline]

Given an existing node parentIdx, returns index of child node reached when traversing arc labeled with word index lastWord.

If node doesn't exist, it is created.

unsigned WordTree::get_parent_node ( unsigned  nodeIdx  )  const [inline]

Returns index of parent node for node with index nodeIdx.


The documentation for this class was generated from the following file:

Generated on Thu Nov 5 09:26:37 2009 for asr_lib by  doxygen 1.5.5