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..

Passing original input to outputmacro
 
 

Most of the time, I want the DO_SPELLCHECK token active, but occasionally, I’d like to be able to process the original content. Example (simplified for clarity—hopefully):

outputmacro: ^get_word(^word)
  \n Original word: \n
  ^word
  \n

TOPIC: ~wordexample…

u: (< regurgitate * > _*-1)
  ^get_word(_0)

bot > regurgitate xyz
...
Original User Input: regurgitate xyz
Tokenized into: regurgitate xyz
Spelling changed into: regurgitate XXY
Actual input used: regurgitate XXY
...
Original word:
XXY
...
bot >

What I want to avoid is spelling changes, either by directly accessing the original user input or disabling DO_SPELLCHECK. Unfortunately, I haven’t been successful with the token/retry samples in the advanced user manual.

Thank you.

 

 
  [ # 1 ]

There are a couple of ways to demonstrate this.  Assuming the original bot has $token using #DO_SPELLCHECK, then you can build a simple topic like this:

topic: ~introductions keep repeat ()
t: () keep() ^” \“Hello.\” “
s: (test) $stdtoken = $token
s: (name is _*) 
if ($token == $stdtoken)
{
$token = #DO_INTERJECTION_SPLITTING | #DO_SUBSTITUTE_SYSTEM | #DO_NUMBER_MERGE | #DO_PARSE
retry(SENTENCE)
}
‘_0 is the name.
$token = $stdtoken

Then, if you merely input:
My name is Rogr
you would see the spellcorrected form as output. If you wanted the non-spell corrected form, you would say
test
My name is Rogr
and the call to test preenables the system to disable spell check and return to it later.  Normally $stdtoken I would set in the bot definition, so it would already be ready for me.

This is the basic idea. In my world, I don’t trust that I will make it back to the same rule on the retry, so I reset the $token value not from that rule, but from postprocessing.

 

 
  [ # 2 ]

Thank you. The “if” makes sense and is the missing element from the documentation.

 

 
  [ # 3 ]

I have amended the documentation.

 

 
  [ # 4 ]

Thanks, Bruce. Most helpful.

 

 
  login or register to react