public class Utterance extends Object implements FeatureSet, Serializable
Modifier and Type | Field and Description |
---|---|
private FeatureSet |
features |
private boolean |
first |
private boolean |
last |
private FeatureSet |
relations |
private FreeTTSSpeakable |
speakable |
private Voice |
voice |
Constructor and Description |
---|
Utterance(Voice voice)
Creates a new, empty utterance.
|
Utterance(Voice voice,
List<Token> tokenList)
Creates an utterance with the given set of tokenized text.
|
Modifier and Type | Method and Description |
---|---|
Relation |
createRelation(String name)
Creates a new relation with the given name and adds it to this
utterance.
|
void |
dump(PrintWriter output,
int pad,
String title)
Dumps this utterance in textual form.
|
void |
dump(PrintWriter output,
int pad,
String title,
boolean justRelations)
Dumps this utterance in textual form.
|
void |
dump(PrintWriter output,
String title)
Dumps this utterance in textual form.
|
void |
dump(String title)
Dumps this utterance in textual form.
|
void |
dumpRelations(String title)
Dumps the utterance in textual form
|
float |
getDuration()
Returns the duration of this Utterance in seconds.
|
float |
getFloat(String name)
Convenience method that returns the named feature as a float.
|
int |
getInt(String name)
Convenience method that returns the named feature as a int.
|
Item |
getItem(String relation,
float time)
Returns the Item in the given Relation associated with the given time.
|
private float |
getLastFloat(String relationName,
String feature)
Returns the float feature of the last Item in the named
Relation.
|
Object |
getObject(String name)
Returns the named feature as an object.
|
Relation |
getRelation(String name)
Retrieves a relation from this utterance.
|
FreeTTSSpeakable |
getSpeakable()
Returns the queueitem associated with this utterance.
|
String |
getString(String name)
Convenience method that returns the named feature as a string.
|
Voice |
getVoice()
Retrieves the Voice associated with this Utterance.
|
boolean |
hasRelation(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(String name)
Determines if the given feature is present.
|
void |
remove(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(String name,
float value)
Convenience method that sets the named feature as a float.
|
private void |
setInputText(List<Token> tokenList)
Sets the input text for this utterance
|
void |
setInt(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(String name,
Object value)
Sets the named feature.
|
void |
setSpeakable(FreeTTSSpeakable speakable)
Sets the speakable item for this utterance.
|
void |
setString(String name,
String value)
Convenience method that sets the named feature as a String.
|
private void |
setTokenList(List<Token> tokenList)
Sets the token list for this utterance.
|
private FeatureSet features
private FeatureSet relations
private boolean first
private boolean last
private FreeTTSSpeakable speakable
public Utterance(Voice voice)
voice
- the voice associated with the utterancepublic void setSpeakable(FreeTTSSpeakable speakable)
speakable
- the speakable item for this utterancepublic FreeTTSSpeakable getSpeakable()
public Relation createRelation(String name)
name
- the name of the new relationpublic Relation getRelation(String name)
name
- the name of the Relationpublic boolean hasRelation(String name)
name
- the name of the relation of interest.public Voice getVoice()
public void dump(PrintWriter output, int pad, 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(PrintWriter output, int pad, String title)
dump
in interface Dumpable
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(PrintWriter output, String title)
output
- where to send the formatted outputtitle
- the title to print when dumping out the utterancepublic void dump(String title)
title
- the title to print when dumping out the utterancepublic void dumpRelations(String title)
title
- the title to print when dumping out the utterancepublic boolean isPresent(String name)
isPresent
in interface FeatureSet
name
- the name of the feature of interestpublic void remove(String name)
remove
in interface FeatureSet
name
- the name of the feature of interestpublic String getString(String name)
getString
in interface FeatureSet
name
- the name of the featureClassCastException
- if the associated value is not a
Stringpublic int getInt(String name)
getInt
in interface FeatureSet
name
- the name of the featureClassCastException
- if the associated value is not an
intpublic float getFloat(String name)
getFloat
in interface FeatureSet
name
- the name of the featureClassCastException
- if the associated value is not a
floatpublic Object getObject(String name)
getObject
in interface FeatureSet
name
- the name of the featurepublic void setInt(String name, int value)
setInt
in interface FeatureSet
name
- the name of the featurevalue
- the value of the featurepublic void setFloat(String name, float value)
setFloat
in interface FeatureSet
name
- the name of the featurevalue
- the value of the featurepublic void setString(String name, String value)
setString
in interface FeatureSet
name
- the name of the featurevalue
- the value of the featurepublic void setObject(String name, Object value)
setObject
in interface FeatureSet
name
- the name of the featurevalue
- the value of the featurepublic Item getItem(String relation, float time)
relation
- the name of the relationtime
- the timeIllegalStateException
- if the Segment durations
have not been calculated in the Utterance or if the
given relation is not present in the Utterancepublic float getDuration()
private float getLastFloat(String relationName, String feature)
private void setInputText(List<Token> tokenList)
tokenList
- the set of tokens for this utteranceprivate void setTokenList(List<Token> tokenList)
tokenList
- the tokenListpublic 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 seriesWebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses