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

Multiple triggers

How to manage multiple triggers that are meaning the same? Example:
+ what is my ip
+ please, tell me my ip


  [ # 1 ]

This can be done with Replies.

one approach is to have a generic reply trigger.

+ what is my ip
@ __get_ip__

+ please, tell me my ip
@ __get_ip__

+ __get_ip__


  [ # 2 ]

Alternatively, things like:

// if parts of the trigger are the same ("my ip" here)
+ (what is|please tell memy ip

// can do this to combine two entirely different triggers too
+ (what is my name|who am i)
You're <get name>. 

RiveScript triggers are simplified regular expressions (the syntax like “(apple|orange|banana)” is directly regexp-like) which makes it a lot easier to compress multiple triggers down into one, as opposed to AIML where you’d need to make a whole bunch of triggers all redirect to one (like in Rob’s example).

As a side note, symbols shouldn’t be used in triggers, such as the comma in your “please, tell me my ip” trigger, or the underscores in Rob’s example. The user’s input message gets stripped of punctuation in the default setup (but I haven’t extensively tested with UTF-8 mode turned on). In UTF-8 mode I relaxed a lot of the syntax restrictions because a lot of common regexp metacharacters break down when trying to match against Unicode strings, for example \w to match a word character is only reliable for ASCII letters, not letters of foreign languages, etc.


  login or register to react