|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.sun.speech.freetts.Utterance
Holds all the data for an utterance to be spoken. It is incrementally modified by various UtteranceProcessor implementations. An utterance contains a set of Features (essential a set of properties) and a set of Relations. A Relation is an ordered set of Item graphs. The utterance contains a set of features and implements FeatureSet so that applications can set/get features directly from the utterance. If a feature query is not found in the utterance feature set, the query is forwarded to the FeatureSet of the voice associated with the utterance.
Constructor Summary | |
Utterance(Voice voice)
Creates a new, empty utterance. |
|
Utterance(Voice voice,
java.util.List tokenList)
Creates an utterance with the given set of tokenized text. |
Method Summary | |
Relation |
createRelation(java.lang.String name)
Creates a new relation with the given name and adds it to this utterance. |
void |
dump(java.io.PrintWriter output,
int pad,
java.lang.String title)
Dumps this utterance in textual form. |
void |
dump(java.io.PrintWriter output,
int pad,
java.lang.String title,
boolean justRelations)
Dumps this utterance in textual form. |
void |
dump(java.io.PrintWriter output,
java.lang.String title)
Dumps this utterance in textual form. |
void |
dump(java.lang.String title)
Dumps this utterance in textual form. |
void |
dumpRelations(java.lang.String title)
Dumps the utterance in textual form |
float |
getDuration()
Returns the duration of this Utterance in seconds. |
float |
getFloat(java.lang.String name)
Convenience method that returns the named feature as a float. |
int |
getInt(java.lang.String name)
Convenience method that returns the named feature as a int. |
Item |
getItem(java.lang.String relation,
float time)
Returns the Item in the given Relation associated with the given time. |
java.lang.Object |
getObject(java.lang.String name)
Returns the named feature as an object. |
Relation |
getRelation(java.lang.String name)
Retrieves a relation from this utterance. |
FreeTTSSpeakable |
getSpeakable()
Returns the queueitem associated with this utterance. |
java.lang.String |
getString(java.lang.String name)
Convenience method that returns the named feature as a string. |
Voice |
getVoice()
Retrieves the Voice associated with this Utterance. |
boolean |
hasRelation(java.lang.String name)
Determines if this utterance contains a relation with the given name. |
boolean |
isFirst()
Returns true if this utterance is the first is a series of utterances. |
boolean |
isLast()
Returns true if this utterance is the last is a series of utterances. |
boolean |
isPresent(java.lang.String name)
Determines if the given feature is present. |
void |
remove(java.lang.String name)
Removes the named feature from this set of features. |
void |
setFirst(boolean first)
Sets this utterance as the first in a series. |
void |
setFloat(java.lang.String name,
float value)
Convenience method that sets the named feature as a float. |
void |
setInt(java.lang.String name,
int value)
Convenience method that sets the named feature as an int. |
void |
setLast(boolean last)
Sets this utterance as the last in a series. |
void |
setObject(java.lang.String name,
java.lang.Object value)
Sets the named feature. |
void |
setSpeakable(FreeTTSSpeakable speakable)
Sets the speakable item for this utterance. |
void |
setString(java.lang.String name,
java.lang.String value)
Convenience method that sets the named feature as a String. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public Utterance(Voice voice)
voice
- the voice associated with the utterancepublic Utterance(Voice voice, java.util.List tokenList)
voice
- the voice associated with the utterancetokenList
- the list of tokens for this utteranceMethod Detail |
public void setSpeakable(FreeTTSSpeakable speakable)
speakable
- the speakable item for this utterancepublic FreeTTSSpeakable getSpeakable()
public Relation createRelation(java.lang.String name)
name
- the name of the new relation
public Relation getRelation(java.lang.String name)
name
- the name of the Relation
public boolean hasRelation(java.lang.String name)
name
- the name of the relation of interest.public Voice getVoice()
public void dump(java.io.PrintWriter output, int pad, java.lang.String title, boolean justRelations)
output
- where to send the formatted outputpad
- the initial paddingtitle
- the title to print when dumping out the utterancejustRelations
- if true don't print voice featurespublic void dump(java.io.PrintWriter output, int pad, java.lang.String title)
dump
in interface FeatureSet
output
- where to send the formatted outputpad
- the initial paddingtitle
- the title to print when dumping out the utterancepublic void dump(java.io.PrintWriter output, java.lang.String title)
output
- where to send the formatted outputtitle
- the title to print when dumping out the utterancepublic void dump(java.lang.String title)
title
- the title to print when dumping out the utterancepublic void dumpRelations(java.lang.String title)
title
- the title to print when dumping out the utterancepublic boolean isPresent(java.lang.String name)
isPresent
in interface FeatureSet
name
- the name of the feature of interest
public void remove(java.lang.String name)
remove
in interface FeatureSet
name
- the name of the feature of interestpublic java.lang.String getString(java.lang.String name)
getString
in interface FeatureSet
name
- the name of the feature
java.lang.ClassCastException
- if theassociated value is not a
Stringpublic int getInt(java.lang.String name)
getInt
in interface FeatureSet
name
- the name of the feature
java.lang.ClassCastException
- if the associated value is not an
intpublic float getFloat(java.lang.String name)
getFloat
in interface FeatureSet
name
- the name of the feature
java.lang.ClassCastException
- if the associated value is not a
floatpublic java.lang.Object getObject(java.lang.String name)
getObject
in interface FeatureSet
name
- the name of the feature
public void setInt(java.lang.String name, int value)
setInt
in interface FeatureSet
name
- the name of the featurevalue
- the value of the featurepublic void setFloat(java.lang.String name, float value)
setFloat
in interface FeatureSet
name
- the name of the featurevalue
- the value of the featurepublic void setString(java.lang.String name, java.lang.String value)
setString
in interface FeatureSet
name
- the name of the featurevalue
- the value of the featurepublic void setObject(java.lang.String name, java.lang.Object value)
setObject
in interface FeatureSet
name
- the name of the featurevalue
- the value of the featurepublic Item getItem(java.lang.String relation, float time)
relation
- the name of the relationtime
- the time
java.lang.IllegalStateException
- if the Segment durations
have not been calculated in the Utterance or if the
given relation is not present in the Utterancepublic float getDuration()
public boolean isFirst()
public void setFirst(boolean first)
first
- if true, the item is the first in a seriespublic boolean isLast()
public void setLast(boolean last)
last
- if true, the item is the last in a series
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |