|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrita.support.RiLexiconImpl
public class RiLexiconImpl
Provides an implementation of a user-customizable Lexicon using CMU-style pronunciation tags and Penn-style part-of-speech tags.
Note: this is a support class, public access is provided through rita.RiLexicon.
The implementation also allows users to define their own addenda that will be addenda, it values will be added to the system addenda, overriding any existing elements in the system addenda.
| Field Summary | |
|---|---|
static java.lang.String |
DATA_DELIM
|
| Method Summary | |
|---|---|
void |
addAddendum(java.lang.String word,
java.lang.String pos,
java.lang.String[] phones)
returns a '0' (no-stress) or 1 (stressed) for each phoneme public String[] getRawStresses(String word) { String phones = lookupPhonemesAndStresses(word); if (phones == null) return null; String[] p = phones.split(Featured.PHONEME_BOUNDARY); for (int i = 0; i < p .length; i++) { String s = p[i]; char c = s.charAt(s.length()-1); System.err.println("Checking: "+s+"/"+c); if (c == RiLexicon.STRESSED) p[i] = "1"; else p[i] = "0"; } return p; } static final char[] STRESS_MARKS = { RiLexicon.STRESSED, RiLexicon.UNSTRESSED }; |
int |
getAddendaCount()
Returns the number of user addenda items added to the lexicon |
java.util.Map |
getFeatures(java.lang.String word)
|
static RiLexiconImpl |
getInstance()
Deprecated. |
static RiLexiconImpl |
getInstance(processing.core.PApplet p)
Creates, loads and returns the singleton lexicon instance. |
static RiLexiconImpl |
getInstance(processing.core.PApplet p,
java.lang.String pathToLexicon)
Creates, loads and returns the singleton lexicon instance. |
java.util.Map |
getLexicalData()
Returns the raw data (as a Map) used in the lexicon. |
java.lang.String[] |
getPhonemeArr(java.lang.String word,
boolean useLTS)
Gets the phoneme list for a given word, either via lookup or, if not found, (and useLTS is true), generated via the letter-to-sound
engine, else null. |
java.lang.String |
getPhonemes(java.lang.String word,
boolean useLTS)
Gets the phoneme list for a given word, either via lookup or, if not found, (and useLTS is true), generated via the letter-to-sound
engine, else null. |
java.lang.String[] |
getPhones(java.lang.String word,
java.lang.String partOfSpeech)
Gets the phone list (+ stresses) for a given word. |
java.lang.String[] |
getPhones(java.lang.String word,
java.lang.String partOfSpeech,
boolean useLTS)
Gets the phone list (+ stresses) for a given word. |
java.lang.String[] |
getPosArr(java.lang.String word)
|
java.lang.String |
getPosStr(java.lang.String word)
|
java.lang.String |
getPosStrOld(java.lang.String word)
|
java.lang.String |
getRawPhones(java.lang.String word)
|
java.lang.String |
getRawPhones(java.lang.String word,
boolean useLTS)
|
java.util.Set |
getWords()
|
java.util.Set |
getWords(java.lang.String regex)
|
java.util.Set |
getWordsWithPos(java.lang.String pos)
|
static boolean |
isCaching()
|
boolean |
isLoaded()
Determines if this lexicon is loaded. |
boolean |
isSyllableBoundary(java.util.List syllablePhones,
java.lang.String[] wordPhones,
int currentWordPhone)
Determines if the currentPhone represents a new syllable boundary. |
java.util.Iterator |
iterator()
|
java.util.Set |
keySet()
|
void |
load()
Loads the data into this lexicon. |
java.lang.String |
lookupRaw(java.lang.String word)
|
static void |
main(java.lang.String[] args)
|
java.util.Iterator |
posIterator(java.lang.String pos)
|
void |
preloadFeatures()
|
java.util.Iterator |
randomIterator()
|
java.util.Iterator |
randomPosIterator(java.lang.String pos)
|
void |
removeAddendum(java.lang.String word,
java.lang.String partOfSpeech)
Removes a word from the lexicon. |
void |
setLexicalData(java.util.Map lexicalData)
Sets the raw data (a Map) used in the lexicon, replacing all default words and features. |
int |
size()
|
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String DATA_DELIM
| Method Detail |
|---|
public static RiLexiconImpl getInstance()
public static RiLexiconImpl getInstance(processing.core.PApplet p)
public static RiLexiconImpl getInstance(processing.core.PApplet p,
java.lang.String pathToLexicon)
public java.util.Map getLexicalData()
public void setLexicalData(java.util.Map lexicalData)
public int getAddendaCount()
public boolean isLoaded()
isLoaded in interface com.sun.speech.freetts.lexicon.Lexicontrue if the lexicon is loaded
public void load()
throws java.io.IOException
load in interface com.sun.speech.freetts.lexicon.Lexiconjava.io.IOException - if errors occur during loading
public java.lang.String[] getPhones(java.lang.String word,
java.lang.String partOfSpeech)
null. The partOfSpeech is
optional, but null always matches.
getPhones in interface com.sun.speech.freetts.lexicon.Lexicon
public java.lang.String[] getPhones(java.lang.String word,
java.lang.String partOfSpeech,
boolean useLTS)
null is returned. The partOfSpeech is
optional, but null always matches.
getPhones in interface com.sun.speech.freetts.lexicon.Lexicon
public java.lang.String getPhonemes(java.lang.String word,
boolean useLTS)
useLTS is true), generated via the letter-to-sound
engine, else null.
public java.lang.String[] getPhonemeArr(java.lang.String word,
boolean useLTS)
useLTS is true), generated via the letter-to-sound
engine, else null.
public void removeAddendum(java.lang.String word,
java.lang.String partOfSpeech)
removeAddendum in interface com.sun.speech.freetts.lexicon.Lexiconword - the word to removepartOfSpeech - the part of speechpublic int size()
public java.util.Set getWords()
public java.lang.String lookupRaw(java.lang.String word)
public java.util.Iterator iterator()
public java.util.Iterator randomIterator()
public java.util.Iterator randomPosIterator(java.lang.String pos)
public java.util.Iterator posIterator(java.lang.String pos)
public java.util.Set keySet()
public java.util.Set getWords(java.lang.String regex)
public java.util.Set getWordsWithPos(java.lang.String pos)
public java.util.Map getFeatures(java.lang.String word)
public void addAddendum(java.lang.String word,
java.lang.String pos,
java.lang.String[] phones)
addAddendum in interface com.sun.speech.freetts.lexicon.Lexicon
public boolean isSyllableBoundary(java.util.List syllablePhones,
java.lang.String[] wordPhones,
int currentWordPhone)
isSyllableBoundary in interface com.sun.speech.freetts.lexicon.LexiconsyllablePhones - the phones in the current syllable so farwordPhones - the phones for the whole wordcurrentWordPhone - the word phone in question
true if the word phone in question is on a syllable
boundary; otherwise false.public static boolean isCaching()
public void preloadFeatures()
public java.lang.String getRawPhones(java.lang.String word)
public java.lang.String getRawPhones(java.lang.String word,
boolean useLTS)
public java.lang.String getPosStr(java.lang.String word)
public java.lang.String getPosStrOld(java.lang.String word)
public java.lang.String[] getPosArr(java.lang.String word)
getPosArr in interface RiLexiconIFpublic static void main(java.lang.String[] args)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||