com.sun.speech.freetts.lexicon
Interface Lexicon

All Known Implementing Classes:
LexiconImpl

public interface Lexicon

Provides the phone list for words. A Lexicon is composed of three pieces: an addenda, the compiled form, and the letter to sound rules.


Method Summary
 void addAddendum(java.lang.String word, java.lang.String partOfSpeech, java.lang.String[] phones)
          Adds a word to the addenda.
 java.lang.String[] getPhones(java.lang.String word, java.lang.String partOfSpeech)
          Gets the phone list for a given word.
 java.lang.String[] getPhones(java.lang.String word, java.lang.String partOfSpeech, boolean useLTS)
          Gets the phone list for a given word.
 boolean isLoaded()
          Determines if this lexicon is loaded.
 boolean isSyllableBoundary(java.util.List syllablePhones, java.lang.String[] wordPhones, int currentWordPhone)
          Determines if the currentWordPhone represents a new syllable boundary.
 void load()
          Loads this lexicon.
 void removeAddendum(java.lang.String word, java.lang.String partOfSpeech)
          Removes a word from the addenda.
 

Method Detail

getPhones

public java.lang.String[] getPhones(java.lang.String word,
                                    java.lang.String partOfSpeech)
Gets the phone list for a given word. If a phone list cannot be found, null is returned. The partOfSpeech is implementation dependent, but null always matches.

Parameters:
word - the word to find
partOfSpeech - the part of speech or null
Returns:
the list of phones for word or null

getPhones

public java.lang.String[] getPhones(java.lang.String word,
                                    java.lang.String partOfSpeech,
                                    boolean useLTS)
Gets the phone list for a given word. If a phone list cannot be found, null is returned. The partOfSpeech is implementation dependent, but null always matches.

Parameters:
word - the word to find
partOfSpeech - the part of speech or null
useLTS - whether to use the letter-to-sound rules when the word is not in the lexicon.
Returns:
the list of phones for word or null

addAddendum

public void addAddendum(java.lang.String word,
                        java.lang.String partOfSpeech,
                        java.lang.String[] phones)
Adds a word to the addenda. The part of speech is implementation dependent.

Parameters:
word - the word to add
partOfSpeech - the part of speech or null

removeAddendum

public void removeAddendum(java.lang.String word,
                           java.lang.String partOfSpeech)
Removes a word from the addenda. Both the part of speech and word must be an exact match.

Parameters:
word - the word to add
partOfSpeech - the part of speech

isSyllableBoundary

public boolean isSyllableBoundary(java.util.List syllablePhones,
                                  java.lang.String[] wordPhones,
                                  int currentWordPhone)
Determines if the currentWordPhone represents a new syllable boundary.

Parameters:
syllablePhones - the phones in the current syllable so far
wordPhones - the phones for the whole word
currentWordPhone - the word phone in question
Returns:
true if the phone is a new boundary

load

public void load()
          throws java.io.IOException
Loads this lexicon. The loading of a lexicon need not be done in the constructor.

Throws:
java.io.IOException - if an error occurs while loading

isLoaded

public boolean isLoaded()
Determines if this lexicon is loaded.

Returns:
true if the lexicon is loaded