Class G2PRuleReadProcessor

java.lang.Object
  extended byG2PRuleReadProcessor

public class G2PRuleReadProcessor
extends java.lang.Object

A G2PRuleReadProcessor reads in an XML representation of a tree, representing grapheme-2-phoneme translation rules. This class handles exactly one grapheme and the rules associated with it.


Constructor Summary
G2PRuleReadProcessor()
          Create an instance of G2PRuleReadProcessor.
 
Method Summary
 java.util.HashMap getValueHash()
           
 G2PRuleReadProcessor readTree(java.io.BufferedReader reader)
          Read in tree from XML file.
 java.lang.String translate(G2PRuleReadProcessor node, java.lang.String str, int position)
          Translate a grapheme into a phoneme.
 void walk(G2PRuleReadProcessor node)
          Print out the decision tree.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

G2PRuleReadProcessor

public G2PRuleReadProcessor()
Create an instance of G2PRuleReadProcessor.

Method Detail

getValueHash

public java.util.HashMap getValueHash()
Returns:
The hash of graphemes with associated translation rules.

readTree

public G2PRuleReadProcessor readTree(java.io.BufferedReader reader)
                              throws java.io.IOException
Read in tree from XML file.

Parameters:
reader - a bufferedReader that reads the XML file.
Returns:
a decision tree node.
Throws:
java.io.IOException

walk

public void walk(G2PRuleReadProcessor node)
Print out the decision tree.

Parameters:
node - the node containing the tree to print out.

translate

public java.lang.String translate(G2PRuleReadProcessor node,
                                  java.lang.String str,
                                  int position)
Translate a grapheme into a phoneme.

Parameters:
node - the node for the respective grapheme.
str - the str where the grapheme occurs.
position - the position of the grapheme in the string.
Returns:
the phoneme as a string.