rita.support
Class RiLetterToSound

java.lang.Object
  extended by rita.support.RiLetterToSound
All Implemented Interfaces:
com.sun.speech.freetts.lexicon.LetterToSound

public class RiLetterToSound
extends java.lang.Object
implements com.sun.speech.freetts.lexicon.LetterToSound

Provides the phone list for words using the CMU6 letter-to-sound (LTS) rules, which are based on the Black, Lenzo, and Pagel paper, "Issues in Building General Letter-to-Sound Rules." Proceedings of ECSA Workshop on Speech Synthesis, pages 77-80, Australia, 1998.


Field Summary
static boolean VERBOSE
          Whether LTS notifications are output to the console
 
Constructor Summary
RiLetterToSound(java.net.URL ltsRules)
           
RiLetterToSound(java.net.URL ltsRules, boolean binary)
          Class constructor.
 
Method Summary
 boolean compare(RiLetterToSound other)
          Compares this LTS to another for debugging purposes.
 void dumpBinary(java.lang.String path)
          Dumps a binary form of the letter to sound rules.
 java.lang.String[] getPhones(java.lang.String word, java.lang.String partOfSpeech)
          Calculates the phone list for a given word.
static void main(java.lang.String[] args)
          Translates between text and binary forms of the CMU6 LTS rules.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

VERBOSE

public static boolean VERBOSE
Whether LTS notifications are output to the console

Constructor Detail

RiLetterToSound

public RiLetterToSound(java.net.URL ltsRules)
                throws java.io.IOException
Throws:
java.io.IOException

RiLetterToSound

public RiLetterToSound(java.net.URL ltsRules,
                       boolean binary)
                throws java.io.IOException
Class constructor.

Parameters:
ltsRules - a URL pointing to the text containing the letter to sound rules
binary - if true, the URL is a binary source
Throws:
java.lang.NullPointerException - if the ltsRules are null
java.io.IOException - if errors are encountered while reading the compiled form or the addenda
Method Detail

dumpBinary

public void dumpBinary(java.lang.String path)
                throws java.io.IOException
Dumps a binary form of the letter to sound rules. This method is not thread-safe.

Binary format is:

    MAGIC
    VERSION
    NUM STATES
    for each state ...
 

Parameters:
path - the path to dump the file to
Throws:
java.io.IOException - if a problem occurs during the dump

getPhones

public java.lang.String[] getPhones(java.lang.String word,
                                    java.lang.String partOfSpeech)
Calculates the phone list for a given word. If a phone list cannot be determined, null is returned. This particular implementation ignores the part of speech.

Specified by:
getPhones in interface com.sun.speech.freetts.lexicon.LetterToSound
Parameters:
word - the word to find
partOfSpeech - the part of speech.
Returns:
the list of phones for word or null

compare

public boolean compare(RiLetterToSound other)
Compares this LTS to another for debugging purposes.

Parameters:
other - the other LTS to compare to
Returns:
true if these are equivalent

main

public static void main(java.lang.String[] args)
Translates between text and binary forms of the CMU6 LTS rules.