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>
Command line options available in sub-class.void
answerQuestion
(Symbol speaker, Symbol listener, Term answerSemantics) Search currently 'active' questions from one that matches answerSemantics.void
cancelWaitForResponse
(Term responseForm) Remove the answer corresponding to the provided semantics from the current or suspended question collections and signal the answer conditionprotected void
init()
Perform any component initialization.boolean
isQuestionResponse
(Symbol speaker, Symbol listener, Term semantics) Determines if the semantics of a given utterance are an answer to any currently active questionsboolean
isRepeatedPredicate
(Predicate word, Symbol listener, Predicate state, int recency) void
parseArgs
(org.apache.commons.cli.CommandLine cmdLine) Called directly after construction to pass runtime values that will override default values.void
registerForDialogueHistoryNotifications
(ai.thinkingrobots.trade.TRADEServiceInfo callback) void
resumeWaitForResponse
(Term responseForm) Put the previously cached answer back into the current questions collection for considerationprotected void
Any component that needs particular shutdown logic needs to override this method andvoid
suspendWaitForResponse
(Term responseForm) Transfer the answer corresponding to the provided semantics from the current question collection to the suspended one and signal the answer conditionvoid
unregisterForDialogueHistoryNotifications
(ai.thinkingrobots.trade.TRADEServiceInfo callback) void
waitForResponse
(Predicate responseForm) waitForResponse
(Predicate responseForm, long waitDuration) Methods inherited from class edu.tufts.hrilab.diarc.DiarcComponent
createInstance, createInstance, createInstance, createInstance, executionLoop, getMyGroupConstraints, getMyGroups, getMyService, getMyServices, main, shutdown
-
Constructor Details
-
DialogueComponent
public DialogueComponent()
-
-
Method Details
-
init
protected void init()Description copied from class:DiarcComponent
Perform 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:
init
in classDiarcComponent
-
parseArgs
public void parseArgs(org.apache.commons.cli.CommandLine cmdLine) Description copied from class:DiarcComponent
Called directly after construction to pass runtime values that will override default values. This should parse all the options that additionalUsageInfo provides.zs- Overrides:
parseArgs
in classDiarcComponent
-
additionalUsageInfo
Description copied from class:DiarcComponent
Command line options available in sub-class. This should be paired with a parseArgs implementation.- Overrides:
additionalUsageInfo
in classDiarcComponent
- Returns:
-
shutdownComponent
protected void shutdownComponent()Description copied from class:DiarcComponent
Any component that needs particular shutdown logic needs to override this method and- Overrides:
shutdownComponent
in classDiarcComponent
-
updateDialogueHistory
-
getDialogueHistory
-
registerForDialogueHistoryNotifications
public void registerForDialogueHistoryNotifications(ai.thinkingrobots.trade.TRADEServiceInfo callback) -
unregisterForDialogueHistoryNotifications
public void unregisterForDialogueHistoryNotifications(ai.thinkingrobots.trade.TRADEServiceInfo callback) -
isRepeatedPredicate
-
waitForResponse
-
waitForResponse
- Parameters:
responseForm
- answer semantics which this method will block until receivingwaitDuration
- duration this method will block until giving up. If a negative number, will block indefinitely- Returns:
- Bindings from the answer, or null if no answer was received in time
-
isQuestionResponse
Determines if the semantics of a given utterance are an answer to any currently active questions- Parameters:
speaker
- currently not usedlistener
- currently not usedsemantics
- answer semantics provided by the interlocutor- Returns:
-
answerQuestion
Search currently 'active' questions from one that matches answerSemantics. Get the relevant bindings from the answer, save them and unlock the question thread.- Parameters:
speaker
- currently not usedlistener
- currently not usedanswerSemantics
- answer semantics provided by the interlocutor
-
cancelWaitForResponse
Remove the answer corresponding to the provided semantics from the current or suspended question collections and signal the answer condition- Parameters:
responseForm
- answer semantics required to match against the corresponding question
-
suspendWaitForResponse
Transfer the answer corresponding to the provided semantics from the current question collection to the suspended one and signal the answer condition- Parameters:
responseForm
- answer semantics required to match against the corresponding question
-
resumeWaitForResponse
Put the previously cached answer back into the current questions collection for consideration- Parameters:
responseForm
- answer semantics required to match against the corresponding question
-