Class G2PRuleReader

java.lang.Object
  extended byG2PRuleReader

public class G2PRuleReader
extends java.lang.Object

A G2PRuleReader reads in an XML representation of a tree that contains grapheme-2-phoneme translation rules. This class handles all graphemes in the XML file (unlike G2PRuleReadProcessor).


Constructor Summary
G2PRuleReader()
           
 
Method Summary
 java.util.HashMap makeNodes(java.io.BufferedReader b)
          Read in XML file and create a decision tree for each grapheme.
 java.lang.String translateString(java.util.HashMap nodesHash, java.lang.String str)
          Translate a string (!)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

G2PRuleReader

public G2PRuleReader()
Method Detail

makeNodes

public java.util.HashMap makeNodes(java.io.BufferedReader b)
                            throws java.io.IOException
Read in XML file and create a decision tree for each grapheme.

Parameters:
b - BufferedReader that reads the XML file.
Returns:
HashMap of (grapheme,decisionTree) pairs.
Throws:
java.io.IOException

translateString

public java.lang.String translateString(java.util.HashMap nodesHash,
                                        java.lang.String str)
Translate a string (!) of graphemes into a string of phonemes. Phonemes are seperated by white space.

Parameters:
nodesHash - a hash map with (grapheme,tree) pairs.
str - the grapheme string to be translated.
Returns:
the resulting phoneme string.