|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.cmu.sphinx.linguist.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. |
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) |
Word |
getWord(int n)
Returns the nth word in this sequence |
static WordSequence |
getWordSequence(java.util.List list)
Constructs a word sequence from the list of words |
static WordSequence |
getWordSequence(Word[] words)
Returns a WordSequence with the given word IDs. |
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. |
java.lang.String |
toText()
Returns an English text form of this word sequence, e.g., "this is a". |
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
Method Detail |
public static WordSequence getWordSequence(Word[] words)
words
- the array of words for the sequence
public static WordSequence getWordSequence(java.util.List list)
list
- the list of words
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()
public java.lang.String toText()
public int hashCode()
public boolean equals(java.lang.Object o)
o
- the object to compare this to
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |