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

Trigger options
 
 

If I use multiple trigger options like this code:

(like|lovethe color
Good choiceI love the <starcolor too

Then my chatlog is wrong like this

You: I like the red color
Bot: Good choice! I love the like color too!
You: I love the blue color
Bot: Good choice! I love the love color too!

I mean that rivescriprt instead to remember the wildcard is using the option in the star.
How I can patch it?

 

 
  [ # 1 ]

While I don’t know the proper syntax for using the second wildcard in a response (rivescript isn’t my “thing”, I’m afraid), it’s obvious to me that this is what you need to do, as the first wildcard in the input pattern is (like|love).

 

 
  [ # 2 ]

Aha! I was in mistake! I was thinking (like|love) was not a wildcard, but an option, ok, I will try to change it to [like|love] and maybe it will work like an option, thanks!

 

 
  [ # 3 ]

Ya, I don’t believe you capture back optionals. Only stars and wildcards.

And obviously you will want to use star1, star2 for like, color.

Rob

 

 
  [ # 4 ]

In RiveScript, wildcards (*, #, _), alternatives (that’s the “(this|that)” syntax with parenthesis), and arrays when wrapped in paranthesis like “(@colors)” all get captured as “stars” and you use the <star> tags to get them back. (on that array thing, you can use an array without parenthesis around it, like “+ i have a @colors *” and it won’t go into a <star> tag; <star1> in that case would be the *, not the color)

So in your original example, the “(like|love)” goes into <star1> and the * would be <star2> in this case.

Optionals (the square bracket version) are sort of like alternatives, except 1) they never get captured as a <star> tag, and 2) the user could *completely omit* them from their message.

If you used optionals in your example, like ” + i [like|love] the * color” then the following things would match:

* I love the red color
* I like the red color
* I the red color

In the last one, the “like|love” part is omitted entirely, but it would still match because the word is optional (hence the name). wink

Optionals were designed for the use case of like,

what is your [home|office|cell] phone number
It is 555-1234. 

So the user could say “what is your home phone number” or just “what is your phone number”. Without optionals existing, that trigger would’ve had to be written out like this instead:

what is your (home phone|office phone|cell phone|phonenumber 
 

 
  login or register to react