Package edu.tufts.hrilab.slug.common
Class Utterance
java.lang.Object
edu.tufts.hrilab.slug.common.Utterance
- All Implemented Interfaces:
Serializable
An Utterance is used to transmit information between component, including the
semantic meaning, the dialogue act, the speaker, and the listener(s).
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBinding(Map<Variable, Symbol> binding) voidaddListener(Symbol listener) Add a listener to the utterance.voidaddTranslation(String language, String translatedWordsAsString) Add a translation of this utterance's wordsstatic UtterancecreateOutputUtterance(Symbol speaker, Symbol addressee) Convenience method for instantiating Utterance from ASL.booleanGet actor being addressed.Get bound indirect semantics.Get bound indirect semantics in Predicate form.Get bound semantics.Get bound semantics in Predicate form.Get bound supplemental semantics.Get bound supplemental semantics in Predicate form.Get BCP-47 code for the default representation of this UtteranceGet all actors known to be listeners of the utterance.Get semantic meaning of utterance.Get speaker of the utterance.Get supplemental semantic of utterance.Get String representation of this Utterance for the supplied language tagGet a Map of all present String representations of this Utterance (BCP-47 Code -> String)getType()Get type of utterance.getWords()Get copy of words list.Get words joined as a single String.inthashCode()booleanbooleanhasWords()Check if Utterance has words.booleanIs utterance an input utterance (true) or output utterance (false).booleanIf true, this utterance needs to be validated by a human user before it can be used by the rest of the system.voidsetAddressee(Symbol addressee) Set addressee of the utterance.voidsetBindings(List<Map<Variable, Symbol>> bindings) voidsetIndirectSemantics(List<Term> indirectSemantics) voidsetLanguage(String localeCode) Set BCP-47 code for the default representation of this UtterancevoidsetListener(Symbol listener) Set a listener of the utterance.voidsetListeners(Collection<Symbol> listeners) Sets listeners of the utterance.voidsetNeedsValidation(boolean validationFlag) Set the needsValidation flag.voidsetSemantics(Symbol semantics) Set the semantic meaning of the utterance.voidsetSupplementalSemantics(List<? extends Term> supplementalSemantics) Set the supplemental semantics of the utterance.voidsetType(UtteranceType type) voidSet words of this Utterance.voidSet the words of this Utterance.toString()
-
Constructor Details
-
Utterance
@Deprecated public Utterance(Symbol speaker, Symbol listener, List<String> words, UtteranceType type, boolean isInput) Deprecated.Use Builder instead of constructor.
-
-
Method Details
-
createOutputUtterance
Convenience method for instantiating Utterance from ASL.- Parameters:
speaker-addressee-- Returns:
-
isInputUtterance
public boolean isInputUtterance()Is utterance an input utterance (true) or output utterance (false).- Returns:
-
needsValidation
public boolean needsValidation()If true, this utterance needs to be validated by a human user before it can be used by the rest of the system. This is currently for verifying LLM generated parses.- Returns:
-
setNeedsValidation
public void setNeedsValidation(boolean validationFlag) Set the needsValidation flag.- Parameters:
validationFlag-
-
getSpeaker
Get speaker of the utterance.- Returns:
-
getAddressee
Get actor being addressed.- Returns:
-
setAddressee
Set addressee of the utterance. Also adds addressee as a listener.- Parameters:
addressee-
-
getListeners
Get all actors known to be listeners of the utterance.- Returns:
-
setListeners
Sets listeners of the utterance. This removes any existing listeners.- Parameters:
listeners-
-
setListener
Set a listener of the utterance. This removes any existing listeners.- Parameters:
listener-
-
addListener
Add a listener to the utterance.- Parameters:
listener-
-
getSemantics
Get semantic meaning of utterance.- Returns:
-
getSupplementalSemantics
Get supplemental semantic of utterance.- Returns:
-
getType
Get type of utterance. Defined by UtteranceType enum.- Returns:
-
hasWords
public boolean hasWords()Check if Utterance has words.- Returns:
-
getWords
Get copy of words list.- Returns:
-
getWordsAsString
Get words joined as a single String.- Returns:
-
getTierAssignments
-
setType
-
setWords
Set words of this Utterance. The input String will be split on spaces.- Parameters:
words-
-
setWords
Set the words of this Utterance.- Parameters:
words-
-
setSemantics
Set the semantic meaning of the utterance.- Parameters:
semantics-
-
setSupplementalSemantics
Set the supplemental semantics of the utterance.- Parameters:
supplementalSemantics-
-
getIndirectSemantics
-
setIndirectSemantics
-
addBinding
-
setBindings
-
getBindings
-
getBoundSemantics
Get bound semantics.- Returns:
-
getBoundIndirectSemantics
Get bound indirect semantics.- Returns:
-
getBoundSupplementalSemantics
Get bound supplemental semantics.- Returns:
-
getBoundSemanticsPredicate
Get bound semantics in Predicate form. e.g., semantics(boundOption1, ...)- Returns:
-
getBoundIndirectSemanticsPredicate
Get bound indirect semantics in Predicate form. e.g., indirectSemantics(semantics(boundOption1, ...),semantics(boundOption, ..),...)- Returns:
-
getBoundSupplementalSemanticsPredicate
Get bound supplemental semantics in Predicate form. e.g., suppSemantics(semantics(boundOption1, ...),semantics(boundOption, ..),...)- Returns:
-
hasSingleBinding
public boolean hasSingleBinding() -
addTranslation
Add a translation of this utterance's words- Parameters:
language- BCP-47 Code defining the language of this translationtranslatedWordsAsString- The translated string
-
getTranslations
Get a Map of all present String representations of this Utterance (BCP-47 Code -> String)- Returns:
- String map
-
getTranslatedString
Get String representation of this Utterance for the supplied language tag- Parameters:
tag- BCP-47 code- Returns:
- String representation of this Utterance for this code, if currently stored. Null otherwise.
-
setLanguage
Set BCP-47 code for the default representation of this Utterance- Parameters:
localeCode-
-
getLanguage
Get BCP-47 code for the default representation of this Utterance -
equals
-
hashCode
public int hashCode() -
toString
-