|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectarch.Lexicon
public class Lexicon
Nested Class Summary | |
---|---|
static class |
Lexicon.Entry
The Entry class stores a lexicon entry by its word and transcription |
Field Summary | |
---|---|
java.util.LinkedList<Lexicon.Entry> |
entries
lexicon entries, supposedly sorted |
Constructor Summary | |
---|---|
Lexicon(java.util.ArrayList<java.lang.String> alphabet)
Generate a Lexicon using the given phonetic alphabet. |
Method Summary | |
---|---|
void |
addEntry(java.lang.String word,
java.lang.String transcription)
Add an entry using the word and its transcription. |
Lexicon.Entry |
getEntry(java.lang.String word)
Retrieve the corresponding Lexicon entry for the given word |
void |
insertEntry(Lexicon.Entry e)
Insert an entry without sorting the lexicon afterwards |
void |
insertEntrySorted(Lexicon.Entry e)
Insert an entry to the lexicon and sort it |
static void |
main(java.lang.String[] args)
Use the main program to verify a lexicon alongside with its alphabet |
static Lexicon |
readLexiconFromFile(java.lang.String alphabetFile,
java.lang.String lexiconFile)
|
void |
sortEntries()
Sort the lexicon |
java.lang.String |
toString()
Get a String representation of the Lexicon |
java.lang.String[] |
translate(java.lang.String word)
Use the lexicon to obtain a transcription for a given word. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public java.util.LinkedList<Lexicon.Entry> entries
Constructor Detail |
---|
public Lexicon(java.util.ArrayList<java.lang.String> alphabet)
alphabet
- list of Strings, representing the alphabetMethod Detail |
---|
public void addEntry(java.lang.String word, java.lang.String transcription) throws InvalidFormatException
word
- transcription
-
InvalidFormatException
- on error, however file and line number are wrongpublic Lexicon.Entry getEntry(java.lang.String word)
word
-
public void insertEntry(Lexicon.Entry e)
e
- public void insertEntrySorted(Lexicon.Entry e)
e
- public static void main(java.lang.String[] args)
args
- public static Lexicon readLexiconFromFile(java.lang.String alphabetFile, java.lang.String lexiconFile) throws InvalidFormatException, java.io.IOException
InvalidFormatException
java.io.IOException
public void sortEntries()
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String[] translate(java.lang.String word) throws OutOfVocabularyException
word
- requested word
OutOfVocabularyException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |