fmorbini / jmNL

modular NL platform for dialogue agents
Other
16 stars 2 forks source link

Parameterize the system's response #4

Open kuaduer opened 6 years ago

kuaduer commented 6 years ago

Hi, I am wondering if there is a way to parameterize the system's response. For example, we use system: greeting to let the NLG say something like "hi there" (the mapping from speech act greeting to utterance "hi there" is stored in system-utterance.xlsx). However, what if we want to do something like system: greeting(name) where name is a state variable that stores the user's name, so the system's response will be "hi John" or "hi Lucy". Does FloReS support this? Thanks.

fmorbini commented 6 years ago

it all depends on your NLG class. the default nlg classes don't support that, but you can easily do that. We did that in other NLGs that are not part of this release. the DMSpeakEvent contains the context in it. check out the DirectableChar NLG for a related example (not exactly the same, but similar).

there are flaws in the system found in this version as the KB can change by the time the NLG works. It's better to change the DMSpeakEvent to parse the nlg message extracting the parameters and getting their values from the KB at that time and storing them in a local table/KB or something like that. So that the NLG will work on those saved values instead of getting them at a later time (as all modules are async and event driven, there is no guarantee that they will see the same context).

does it help?

kuaduer commented 6 years ago

Thanks. This is very helpful. I am actually trying to do something exactly as what the DirectableChar does. In the Directable, for example, _Network pick {

topic: pick

entrance condition: current NLU speech act = PICK

action: OBJ=ARG0

system: PICK }_ we can define an IS (information state) variable OBJ to store the argument of system's PICK action. Is my understanding correct? A follow-up question is how the ARG0 (which I assume is another IS variable) gets its value? For example, if the user said "pick up the cup", then the current value of ARG0 should be "cup". How can we set the value of ARG0 before this network is executed? Is it similar to what you mentioned above, e.g., to handle the NLUEvent and update the KB before the DM executes its policies?

fmorbini commented 6 years ago

yes, if the nlu implementation you have extracts named entities and those are for example the object of the pickup intent/speech act, then those NEs variables will be saved in the information state. however they are temporary variables that get reset by each new NLU event.

so make sure you move them to global IS variables when the NLU event is processed by an operator. There is also an IS variable that holds the history of NLU events grouped by user turn. You can always use that to retrieve old variables.