I need some help writing an advanced control script. I’ll post it here once I’m done.
So I want to process each sentence in the user response but output only the response that’s in the most relevant topic.
For instance:
Example #1
bot: > I want to buy something.
user: > OK.
bot: > So can you help me? ## this is taken from ~quibble
Example #2
bot: > I want to buy something.
user: > OK, what are you looking for?
bot: > I need a (some product). ## this is taken from ~introduction
Example #3, problematic
bot: > I want to buy something.
user: > OK. What are you looking for?
bot: > So can you help me? I need a (some product). ## this is taken from ~quibble + ~introduction
Example #4, problematic
user: > I suggest you buy this one. Is it OK?
bot: > Looks perfect, thanks. I don’t remember. ## this is taken from ~suggestion + ~quibble
I would like to augment the per-sentence processing so that instead of output it generates a fact table of the format (<response> ‘is_in_topic’ <topic>). Then I could have an outputmacro that loops over the fact objects three times for three if-statements: 1)is there a topic that’s the same as the current topic; 2) is there a topic that’s not ~keywordless and not ~quibble; 3) else. Then output the first response that matches any of the if statements.
Is it even possible to write the output from ^rejoinder(), ^gambit() and ^respond() into a variable as a string instead of sending it to the user immediately?