Package edu.tufts.hrilab.slug.dialogue
Class DialogueComponent
java.lang.Object
edu.tufts.hrilab.diarc.DiarcComponent
edu.tufts.hrilab.slug.dialogue.DialogueComponent
-
Field Summary
Fields inherited from class edu.tufts.hrilab.diarc.DiarcComponent
executionLoopCycleTime, log, shouldRunExecutionLoop -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionList<org.apache.commons.cli.Option>Override this method to define command line options available in sub-class.voidvoidanswerQuestion(Question question, Term answerSemantics) voidcancelWaitForResponse(String questionString, List<Term> responseForms, Symbol listener) voidcancelWaitForResponse(String questionString, List<Term> responseForms, Symbol listener, Symbol speaker) Remove the question corresponding to the provided string and response semantics from the current question collection and signal the answer condition without setting response bindingsgetAllQuestions(Symbol agent) getLastQuestion(Symbol agent) getMatchingQuestions(Symbol speaker, Symbol listener, Term answerSemantics) protected voidinit()Perform any component initialization.booleanisAgentWaitingForResponse(Symbol agent) booleanisRepeatedPredicate(Predicate word, Symbol addressee, Predicate state, int recency) voidparseArgs(org.apache.commons.cli.CommandLine cmdLine) Override this method to parse command line args in the sub-class.voidpopulateDiarcAgents(ai.thinkingrobots.trade.TRADEServiceInfo service) voidregisterForDialogueHistoryNotifications(ai.thinkingrobots.trade.TRADEServiceInfo callback) voidregisterForQuestionAskingNotifications(ai.thinkingrobots.trade.TRADEServiceInfo callback) voidvoidresetQuestionTimeout(List<Term> responseForms, Symbol speaker, Symbol addressee) booleanresumeWaitForResponse(long qid, Symbol listener) resumeWaitForResponse(Term responseForm, Symbol listener) resumeWaitForResponse(Term responseForm, Symbol listener, Symbol speaker) Resume the previously suspended question(s) to allow them to match future question responsesresumeWaitForResponse(List<Term> responseForms, Symbol listener) resumeWaitForResponse(List<Term> responseForms, Symbol listener, Symbol speaker) protected voidAny component that needs particular shutdown logic needs to override this method andsuspendWaitForResponse(Term responseForm, Symbol listener, boolean unlock) suspendWaitForResponse(Term responseForm, Symbol listener, boolean unlock, Symbol speaker) Suspend the question(s) corresponding to the provided response semantics.suspendWaitForResponse(List<Term> responseForms, Symbol listener, boolean unlock) suspendWaitForResponse(List<Term> responseForms, Symbol listener, boolean unlock, Symbol speaker) voidunregisterForDialogueHistoryNotifications(ai.thinkingrobots.trade.TRADEServiceInfo callback) voidunregisterForQuestionAskingNotifications(ai.thinkingrobots.trade.TRADEServiceInfo callback) voidvoidupdateDialogueHistoryFromString(Symbol actor, Symbol addressee, String words) waitForResponse(String questionString, List<Term> responseForms, Symbol speaker) waitForResponse(String questionString, List<Term> responseForms, Symbol speaker, Symbol addressee, long waitDuration) Methods inherited from class edu.tufts.hrilab.diarc.DiarcComponent
attachShutdownHook, createInstance, createInstance, createInstance, executionLoop, getMyGroupConstraints, getMyGroups, getMyService, getMyServices, main, postRegistrationInit, shutdown
-
Constructor Details
-
DialogueComponent
public DialogueComponent()
-
-
Method Details
-
init
protected void init()Description copied from class:DiarcComponentPerform any component initialization. This should not be used for setting local fields to default values as was the case in DIARC. This method is called after the constructor, and after parseArgs. Setting default values should be done in field declaration or in the constructor.- Overrides:
initin classDiarcComponent
-
populateDiarcAgents
public void populateDiarcAgents(ai.thinkingrobots.trade.TRADEServiceInfo service) -
parseArgs
public void parseArgs(org.apache.commons.cli.CommandLine cmdLine) Description copied from class:DiarcComponentOverride this method to parse command line args in the sub-class. Called directly after construction to pass runtime values that will override default values. This should parse all the options that additionalUsageInfo provides.- Overrides:
parseArgsin classDiarcComponent
-
additionalUsageInfo
Description copied from class:DiarcComponentOverride this method to define command line options available in sub-class. This should be paired with a parseArgs implementation.- Overrides:
additionalUsageInfoin classDiarcComponent- Returns:
-
shutdownComponent
protected void shutdownComponent()Description copied from class:DiarcComponentAny component that needs particular shutdown logic needs to override this method and- Overrides:
shutdownComponentin classDiarcComponent
-
updateDialogueHistoryFromString
-
updateDialogueHistory
-
getDialogueHistory
-
registerForDialogueHistoryNotifications
public void registerForDialogueHistoryNotifications(ai.thinkingrobots.trade.TRADEServiceInfo callback) -
unregisterForDialogueHistoryNotifications
public void unregisterForDialogueHistoryNotifications(ai.thinkingrobots.trade.TRADEServiceInfo callback) -
registerForQuestionAskingNotifications
public void registerForQuestionAskingNotifications(ai.thinkingrobots.trade.TRADEServiceInfo callback) -
unregisterForQuestionAskingNotifications
public void unregisterForQuestionAskingNotifications(ai.thinkingrobots.trade.TRADEServiceInfo callback) -
isRepeatedPredicate
-
waitForResponse
-
waitForResponse
-
waitForResponse
public Map<Variable,Symbol> waitForResponse(String questionString, List<Term> responseForms, Symbol speaker, Symbol addressee, long waitDuration) - Parameters:
questionString- String corresponding to question which was askedresponseForms- List of possible semantic forms which are considered answers to the questionspeaker- The agent which had asked the questionaddressee- The user able to answer the question. A value of 'any' allows any user to answer the questionwaitDuration- duration this method will block until giving up. If a negative number, will block indefinitely- Returns:
- Bindings from the answer, or an empty map if no answer was received in time or the question was overwritten/canceled
-
getMatchingQuestions
-
answerQuestion
-
cancelWaitForResponse
-
cancelWaitForResponse
public void cancelWaitForResponse(String questionString, List<Term> responseForms, Symbol listener, Symbol speaker) Remove the question corresponding to the provided string and response semantics from the current question collection and signal the answer condition without setting response bindings- Parameters:
questionString- String corresponding to question which was askedresponseForms- List of possible semantic forms required to match against the corresponding questionlistener- The agent which had asked the question
-
suspendWaitForResponse
-
suspendWaitForResponse
public List<Long> suspendWaitForResponse(Term responseForm, Symbol listener, boolean unlock, Symbol speaker) Suspend the question(s) corresponding to the provided response semantics. Optionally unlock the answer to unblock waitForResponse call(s).- Parameters:
responseForm- semantic form to match against the current questionslistener- The agent which had asked the questionunlock- specify whether to unlock the suspended question's answer (practically causes the corresponding waitForResponse call to unblock if true, and not otherwise)
-
suspendWaitForResponse
-
suspendWaitForResponse
-
resumeWaitForResponse
-
resumeWaitForResponse
Resume the previously suspended question(s) to allow them to match future question responses- Parameters:
responseForm- answer semantics required to match against the corresponding questionlistener- The agent which had asked the question
-
resumeWaitForResponse
-
resumeWaitForResponse
-
resumeWaitForResponse
-
isAgentWaitingForResponse
-
allowInstructionsDuringQAForAgent
-
removeAllowInstructionsDuringQAForAgent
-
getLastQuestion
-
getAllQuestions
-
getLastQuestionResponseForm
-
getAllQuestionResponseForms
-
resetQuestionTimeout
-