|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectedu.cmu.sphinx.linguist.WordSequence
public final class WordSequence
This class can be used to keep track of a word sequence. This class is an immutable class. It can never be modified once it is created (except, perhaps for transient, cached things such as a precalculated hashcode).
| Field Summary | |
|---|---|
static WordSequence |
EMPTY
an empty word sequence, that is, it has no words. |
| Constructor Summary | |
|---|---|
WordSequence(java.util.List<Word> list)
Constructs a word sequence from the list of words |
|
WordSequence(Word[] words)
Constructs a word sequence with the given word IDs |
|
| Method Summary | |
|---|---|
WordSequence |
addWord(Word word,
int maxSize)
Returns a new word sequence with the given word added to the sequence |
boolean |
equals(java.lang.Object o)
compares the given object to see if it is identical to this WordSequence |
WordSequence |
getNewest()
Returns the newest words in the sequence (the old word is omitted) |
WordSequence |
getOldest()
Returns the oldest words in the sequence (the newest word is omitted) |
WordSequence |
getSubSequence(int startIndex,
int stopIndex)
Returns a subsequence with both startIndex and stopIndex exclusive. |
Word |
getWord(int n)
Returns the nth word in this sequence |
Word[] |
getWords()
Returns the words of the WordSequence. |
int |
hashCode()
Calculates the hashcode for this object |
int |
size()
Returns the number of words in this sequence |
java.lang.String |
toString()
Returns a string represntation of this word sequence. |
WordSequence |
trim(int maxSize)
Returns a word sequence that is no longer than the given size, that is filled in with the newest words from this sequence |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final WordSequence EMPTY
| Constructor Detail |
|---|
public WordSequence(Word[] words)
words - the word IDs of the word sequencepublic WordSequence(java.util.List<Word> list)
list - the list of words| Method Detail |
|---|
public WordSequence addWord(Word word,
int maxSize)
word - the word to add to the sequencemaxSize - the maximum size of the generated sequence
public WordSequence getOldest()
public WordSequence getNewest()
public WordSequence trim(int maxSize)
maxSize - the maximum size of the sequence
public Word getWord(int n)
n - which word to return
public int size()
public java.lang.String toString()
toString in class java.lang.Objectpublic int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object o)
equals in class java.lang.Objecto - the object to compare this to
public WordSequence getSubSequence(int startIndex,
int stopIndex)
startIndex and stopIndex exclusive.
public Word[] getWords()
WordSequence.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||