Class Utterance

java.lang.Object
edu.tufts.hrilab.slug.common.Utterance
All Implemented Interfaces:
Serializable

public final class Utterance extends Object implements 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:
  • Constructor Details

  • Method Details

    • createOutputUtterance

      public static Utterance createOutputUtterance(Symbol speaker, Symbol addressee)
      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

      public Symbol getSpeaker()
      Get speaker of the utterance.
      Returns:
    • getAddressee

      public Symbol getAddressee()
      Get actor being addressed.
      Returns:
    • setAddressee

      public void setAddressee(Symbol addressee)
      Set addressee of the utterance. Also adds addressee as a listener.
      Parameters:
      addressee -
    • getListeners

      public List<Symbol> getListeners()
      Get all actors known to be listeners of the utterance.
      Returns:
    • setListeners

      public void setListeners(Collection<Symbol> listeners)
      Sets listeners of the utterance. This removes any existing listeners.
      Parameters:
      listeners -
    • setListener

      public void setListener(Symbol listener)
      Set a listener of the utterance. This removes any existing listeners.
      Parameters:
      listener -
    • addListener

      public void addListener(Symbol listener)
      Add a listener to the utterance.
      Parameters:
      listener -
    • getSemantics

      public Symbol getSemantics()
      Get semantic meaning of utterance.
      Returns:
    • getSupplementalSemantics

      public List<Term> getSupplementalSemantics()
      Get supplemental semantic of utterance.
      Returns:
    • getType

      public UtteranceType getType()
      Get type of utterance. Defined by UtteranceType enum.
      Returns:
    • hasWords

      public boolean hasWords()
      Check if Utterance has words.
      Returns:
    • getWords

      public List<String> getWords()
      Get copy of words list.
      Returns:
    • getWordsAsString

      public String getWordsAsString()
      Get words joined as a single String.
      Returns:
    • getTierAssignments

      public Map<Variable,Symbol> getTierAssignments()
    • setType

      public void setType(UtteranceType type)
    • setWords

      public void setWords(String words)
      Set words of this Utterance. The input String will be split on spaces.
      Parameters:
      words -
    • setWords

      public void setWords(List<String> words)
      Set the words of this Utterance.
      Parameters:
      words -
    • setSemantics

      public void setSemantics(Symbol semantics)
      Set the semantic meaning of the utterance.
      Parameters:
      semantics -
    • setSupplementalSemantics

      public void setSupplementalSemantics(List<? extends Term> supplementalSemantics)
      Set the supplemental semantics of the utterance.
      Parameters:
      supplementalSemantics -
    • getIndirectSemantics

      public List<Term> getIndirectSemantics()
    • setIndirectSemantics

      public void setIndirectSemantics(List<Term> indirectSemantics)
    • addBinding

      public void addBinding(Map<Variable,Symbol> binding)
    • setBindings

      public void setBindings(List<Map<Variable,Symbol>> bindings)
    • getBindings

      public List<Map<Variable,Symbol>> getBindings()
    • getBoundSemantics

      public List<Term> getBoundSemantics()
      Get bound semantics.
      Returns:
    • getBoundIndirectSemantics

      public List<List<Term>> getBoundIndirectSemantics()
      Get bound indirect semantics.
      Returns:
    • getBoundSupplementalSemantics

      public List<List<Term>> getBoundSupplementalSemantics()
      Get bound supplemental semantics.
      Returns:
    • getBoundSemanticsPredicate

      public Predicate getBoundSemanticsPredicate()
      Get bound semantics in Predicate form. e.g., semantics(boundOption1, ...)
      Returns:
    • getBoundIndirectSemanticsPredicate

      public Predicate getBoundIndirectSemanticsPredicate()
      Get bound indirect semantics in Predicate form. e.g., indirectSemantics(semantics(boundOption1, ...),semantics(boundOption, ..),...)
      Returns:
    • getBoundSupplementalSemanticsPredicate

      public Predicate getBoundSupplementalSemanticsPredicate()
      Get bound supplemental semantics in Predicate form. e.g., suppSemantics(semantics(boundOption1, ...),semantics(boundOption, ..),...)
      Returns:
    • hasSingleBinding

      public boolean hasSingleBinding()
    • addTranslation

      public void addTranslation(String language, String translatedWordsAsString)
      Add a translation of this utterance's words
      Parameters:
      language - BCP-47 Code defining the language of this translation
      translatedWordsAsString - The translated string
    • getTranslations

      public Map<String,String> getTranslations()
      Get a Map of all present String representations of this Utterance (BCP-47 Code -> String)
      Returns:
      String map
    • getTranslatedString

      public String getTranslatedString(String tag)
      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

      public void setLanguage(String localeCode)
      Set BCP-47 code for the default representation of this Utterance
      Parameters:
      localeCode -
    • getLanguage

      public String getLanguage()
      Get BCP-47 code for the default representation of this Utterance
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object