Package com.sun.speech.freetts.lexicon
Interface Lexicon
- All Known Implementing Classes:
CMULexicon,CMUTimeLexicon,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.
- The addenda either contains Word instances that are not in the compiled form, or it contains Word instances that replace definitions in the compiled form. The addenda is meant to be relatively small (e.g., 10's of words).
- The compiled form is meant to hold a large number of words (e.g., 10's of thousands of words) and provide a very efficient means for finding those words.
- The letter to sound rules will attempt to find a definition for a word not found in either the addenda or compiled form.
-
Method Summary
Modifier and TypeMethodDescriptionvoidaddAddendum(String word, String partOfSpeech, String[] phones) Adds a word to the addenda.String[]Gets the phone list for a given word.String[]Gets the phone list for a given word.booleanisLoaded()Determines if this lexicon is loaded.booleanisSyllableBoundary(List syllablePhones, String[] wordPhones, int currentWordPhone) Determines if thecurrentWordPhonerepresents a new syllable boundary.voidload()Loads this lexicon.voidremoveAddendum(String word, String partOfSpeech) Removes a word from the addenda.
-
Method Details
-
getPhones
Gets the phone list for a given word. If a phone list cannot be found,nullis returned. ThepartOfSpeechis implementation dependent, butnullalways matches.- Parameters:
word- the word to findpartOfSpeech- the part of speech ornull- Returns:
- the list of phones for word or null
-
getPhones
Gets the phone list for a given word. If a phone list cannot be found,nullis returned. ThepartOfSpeechis implementation dependent, butnullalways matches.- Parameters:
word- the word to findpartOfSpeech- the part of speech ornulluseLTS- 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
Adds a word to the addenda. The part of speech is implementation dependent.- Parameters:
word- the word to addpartOfSpeech- the part of speech ornull
-
removeAddendum
Removes a word from the addenda. Both the part of speech and word must be an exact match.- Parameters:
word- the word to addpartOfSpeech- the part of speech
-
isSyllableBoundary
Determines if thecurrentWordPhonerepresents a new syllable boundary.- Parameters:
syllablePhones- the phones in the current syllable so farwordPhones- the phones for the whole wordcurrentWordPhone- the word phone in question- Returns:
trueif the phone is a new boundary
-
load
Loads this lexicon. The loading of a lexicon need not be done in the constructor.- Throws:
IOException- if an error occurs while loading
-
isLoaded
boolean isLoaded()Determines if this lexicon is loaded.- Returns:
trueif the lexicon is loaded
-