Class SpeechAct

  • All Implemented Interfaces:
    java.io.Serializable

    public class SpeechAct
    extends RemoteAction
    Represents a SpeechAct
    Author:
    Joao Dias
    See Also:
    Serialized Form
    • Constructor Detail

      • SpeechAct

        public SpeechAct()
        Creates a new empty SpeechAct
      • SpeechAct

        public SpeechAct​(ValuedAction speechAction,
                         AgentModel am)
        Creates a new SpeechAct from a ValuedAction
    • Method Detail

      • ParseFromXml

        public static RemoteAction ParseFromXml​(java.lang.String xml)
        Parses a SpeechAct from a XML formatted String
        Parameters:
        xml - - the XML string to be parsed
        Returns:
        the parsed SpeechAct
      • isSpeechAct

        public static boolean isSpeechAct​(java.lang.String action)
        Checks if the received action corresponds to a SpeechAct or not (it may be a Question, a Reply, a Suppport, etc)
        Parameters:
        action - - the action to check
        Returns:
        true if the action actually corresponds to a SpeechAct, false otherwise
      • AddContextVariable

        public void AddContextVariable​(java.lang.String name,
                                       java.lang.String value)
        Adds a context variable (name-value pair) to the SpeechAct
        Parameters:
        name - - the name of the context variable
        value - - the value of the context variable
      • getContextVariables

        public java.util.ArrayList<Parameter> getContextVariables()
      • getReceiver

        public java.lang.String getReceiver()
        Gets the SpeechAct's receiver
        Returns:
        the receiver
      • getSender

        public java.lang.String getSender()
        Gets the SpeechAct's sender
        Returns:
        the sender of the SpeechAct
      • getMeaning

        public java.lang.String getMeaning()
        Gets the SpeechAct's meaning (ex: insult, greeting, etc)
        Returns:
        the meaning of the SpeechAct
      • getUtterance

        public java.lang.String getUtterance()
        Gets the specific utterance of the SpeechAct (ex: "Hi John")
        Returns:
        the SpeechAct's utterance
      • setReceiver

        public void setReceiver​(java.lang.String string)
        Sets the SpeechAct's receiver
        Parameters:
        string - - the receiver to store in the SpeechAct
      • setSender

        public void setSender​(java.lang.String string)
        Sets the SpeechAct's sender
        Parameters:
        string - - the sender to store in the SpeechAct
      • setMeaning

        public void setMeaning​(java.lang.String string)
        Sets the SpeechAct's meaning (ex: insult, greeting)
        Parameters:
        string - - the type to store in the SpeechAct
      • setUtterance

        public void setUtterance​(java.lang.String string)
        Sets the SpeechAct specific utterance (ex: "what a wimp", "hi Paul")
        Parameters:
        string - - the utterance to store in the SpeechAct
      • getAMSummary

        public java.lang.String getAMSummary()
      • setAMSummary

        public void setAMSummary​(java.lang.String summary)
      • toEvent

        public Event toEvent​(short actionEventType)
        Converts the SpeechAct to an Event
        Overrides:
        toEvent in class RemoteAction
        Returns:
        the converted Event
      • toXML

        public java.lang.String toXML()
        Converts the SpeechAct to XML (the inverse of the Parse method)
        Overrides:
        toXML in class RemoteAction
        Returns:
        a XML string that contains the SpeechAct information
      • toLanguageEngine

        public java.lang.String toLanguageEngine()
        Converts the SpeechAct to XML that is ready to be sent to the LanguageEngine for the generation of a specific utterance
        Returns:
        a XML string that contains the SpeechAct information