AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

Responding to multi-sentence input
 
 

If i enter “Hi. tell me about yourself” and have rules for both “hi” and “about yourself” only the hi rule seems to get triggered. How would I either respond to both matches or at least the last one?

 

 
  [ # 1 ]

Normally, that comes in as two sentences.  Current HARRY control script stops with the first response. The script can be modified to keep going for more sentences.  Instead of
if (%response == 0)
one does
if (%response == $$response)
having set $$response from %response at the start of the main control

 

 
  [ # 2 ]

I tested this out successfully and will share my example.

I copied the folder ..\Chatscript 4.7\RAWDATA\HARRY to ..\Chatscript 4.7\RAWDATA\HARRYCLONE

I copied the file ..\Chatscript 4.7\filesHarry.txt to ..\Chatscript 4.7\filesHarryClone.txt

I changed the contents of filesHarryClone.txt to the following:
    # underlying conversation system
    RAWDATA/HARRYCLONE/

    # quibble ability
    RAWDATA/QUIBBLE/

There is a file “simplecontrol.top” in ..\Chatscript 4.7\RAWDATA\HarryClone\

Edit the file.  Replace the word “Harry” with “HarryClone”

The top of the file has the following lines showing the replaced bot name.
    # this function is executed once for every new user chatting with harry
    outputmacro: harryclone()  # you get harryclone by default
    $token = #DO_INTERJECTION_SPLITTING | #DO_SUBSTITUTE_SYSTEM   | #DO_NUMBER_MERGE | DO_DATE_MERGE | #DO_PROPERNAME_MERGE | #DO_SPELLCHECK | #DO_PARSE

    ^addtopic(~introductions)
    $control_main = ~control
    $control_post = ~XPOSTPROCESS
    $userprompt = ^”%user: >”
    $botprompt = ^“HARRYCLONE: “

    table: defaultbot (^name)
    ^createfact(^name defaultbot defaultbot)
    DATA:
    harryclone


In the same file “simplecontrol.top” add the following statement to the first line after the main () topic:
    $$response = %response

The following shows the statement in relation to the other preexisting rows in the file:
    u: () # main per-sentence processing

    $$response = %response

    $$currenttopic = %topic # get the current topic at start of volley

Replace every instance of “%response == 0”  with “%response == $$response” in the file.

(I also replaced every instance of “%response != 0”  with “%response != $$response” in the file, although I am not sure about that.)

What this does is change the logic from saying
“if the response is zero then do this”
to
“if the response is still the same as what we started with then do this”

When you start Chatscript then you need to build HarryClone by typing:
:build HarryClone

This way you can have one bot that is standard and another bot that processes multiple sentences.

I have tested the changes and these changes work.

 

 
  [ # 3 ]

I tested with the following test topic file:

topic: ~MultipleSentences (when what like go movies see)

t: I can handle multiple sentences.

#! What movie would you like to see
?: ( what movie would you like to see ) ^keep() ^repeat() I would like to see Guardians of the Galaxy.

#! Would you like to go to the movies
?: ( would you like to go to the movies ) ^keep() ^repeat() Yes. 


Sample HarryClone output:

Glad you came back.
  >Would you like to go to the movies? What movie would you like to see?
Yes. I would like to see Guardians of the Galaxy.

 

 
  [ # 4 ]

Thanks. That explains a bit more. However, I think I will work with the default control until I feel familiar enough with the basics of Harry. That control script looks quite daunting….

 

 
  login or register to react