AI Zone Admin Forum Add your forum

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

Getting raw input

Is there a way to get the raw input (before substitution happens)? For example, I want to get the sentence “How are you” before it gets substituted and becomes ~emohowzit. I know I can edit the “substitutes.txt”, but I’d like to avoid modifying that file if possible.



  [ # 1 ]

You can change $token to turn off substitutions.txt or any or all of the substitutions files.  and you could even do it one way, then change the tokenflag and then do it again the other way.  I turn off Spell checking whenever I think I am about to get or see a pattern that suggests the user is going to give me his name, because foreign names often get demolish by spell checking.


  [ # 2 ]

WHat you named doesn’t come from substitutes.txt but from interjections.txt


  [ # 3 ]

I should also point out that %tokenflags returns a bunch of flags describing the input, which includes what substitution files affected the input, so you can KNOW if interjections had an impact on the input or not.


  [ # 4 ]


I’m not sure what your application is, but here is a way I captured exact user input to a $$temp string for logging. You might be able to use something similar for your application. In this setting, $$usertyped holds whatever the user typed for that one particular input:


Near line 21, I changed:
# main per-sentence processing
u: ()
to u: (_*)  $$usertyped = ‘_0

and added

^log(FILE TMP/noanswer.txt $$usertyped \n)

around line 104, just before it finishes the final loop and says “I don’t know”.

This will give you a log file called noanswer.txt in your TMP directory. It will list, one per line, every user input that exhausts the script and forces the bot to respond with “I don’t know”. You can then use this information to create or update your topics, gambits, KB, etc.


  [ # 5 ]

Thank you Bruce and John! John, your solution is interesting, and I’ll keep it in mind. For now, I think the simplest route for me to take is to just change the interjections.txt file.


  [ # 6 ]

John, it’s a fine and useful idea. But it doesn’t give you the “raw” user input. Only the input that ChatScript is actually responding to after it massages it.


  [ # 7 ]

Ahh. Ok. Thanks Bruce, as usual. I think I missed something somewhere. Starting my day at 4am isn’t always productive. lol.


  login or register to react