Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

BreakDictionary Class Reference

This is the class that represents the list of known words used by DictionaryBasedBreakIterator. More...

#include <brkdict.h>

List of all members.

Public Methods

 BreakDictionary (char* dictionaryFilename, UErrorCode& status)
 Constructor. More...

 ~BreakDictionary ()
 Destructor.

void readDictionaryFile (UMemoryStream* in)
 Reads the dictionary file on the disk and constructs the appropriate in-memory representation.

int16_t at (int32_t row, UChar ch) const
 Uses the column map to map the character to a column number, then passes the row and column number to the other version of at(). More...

int16_t at (int32_t row, int32_t col) const
 Returns the value in the cell with the specified (logical) row and column numbers. More...


Detailed Description

This is the class that represents the list of known words used by DictionaryBasedBreakIterator.

The conceptual data structure used here is a trie: there is a node hanging off the root node for every letter that can start a word. Each of these nodes has a node hanging off of it for every letter that can be the second letter of a word if this node is the first letter, and so on. The trie is represented as a two-dimensional array that can be treated as a table of state transitions. Indexes are used to compress this array, taking advantage of the fact that this array will always be very sparse.

Definition at line 28 of file brkdict.h.


Constructor & Destructor Documentation

BreakDictionary::BreakDictionary ( char * dictionaryFilename,
UErrorCode & status )
 

Constructor.

Creates the BreakDictionary by using readDictionaryFile() to load the dictionary tables from the disk.

BreakDictionary::~BreakDictionary ( )
 

Destructor.


Member Function Documentation

int16_t BreakDictionary::at ( int32_t row,
int32_t col ) const
 

Returns the value in the cell with the specified (logical) row and column numbers.

In DictionaryBasedBreakIterator, the row number is a state number, the column number is an input, and the return value is the row number of the new state to transition to. (0 is the "error" state, and -1 is the "end of word" state in a dictionary)

Parameters:
row   The row number of the current state
col   The column number of the input character (0 means "not a dictionary character")
Returns:
The row number of the new state to transition to

int16_t BreakDictionary::at ( int32_t row,
UChar ch ) const
 

Uses the column map to map the character to a column number, then passes the row and column number to the other version of at().

Parameters:
row   The current state
ch   The character whose column we're interested in
Returns:
The new state to transition to

void BreakDictionary::readDictionaryFile ( UMemoryStream * in )
 

Reads the dictionary file on the disk and constructs the appropriate in-memory representation.


The documentation for this class was generated from the following file:
Generated at Tue Dec 5 17:55:55 2000 for ICU by doxygen1.2.3 written by Dimitri van Heesch, © 1997-2000