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

^match($$variable) help
 
 

Hello, i am trying to create a multi-language chat bot in chatscript, by multi-language i mean i wan’t to handle various patterns based on language selection (I’m not considering dictionaries and interjections, I’m working in #DO_ESSENTIALS mode). Right now I consider only input, the output is english only for now. I would like to handle my patterns this way :

u: (^match(^getPattern(^join(“pattern1_” $LANGUAGE))))
  Nice to meet you, ‘_0

where $LANGUAGE is a global variable that could assume values as ENG and IT, so ^join would produce something like “pattern1_ENG”, ^getPattern would query my DB for pattern with this id, and would return something like “my name is *”, so i would expect ^match to match that pattern. But i just cant seem to make it work, when I strip it up I find out that even rejoinders like :

$$tmp = ^“Hello”
a: (^match($$tmp))
  Hi there

wouldn’t work. While this one does :

a: (^match(“Hello”))
  Hi there

So I am wondering if what I’m trying to achieve is even possible in this ecosystem, my bet is that chatscript wont permit me to use ^match on dynamic content, and wants all the patterns to be ready at compile time. Am i wrong? Could you please suggest what am I missing and how could I go about it?

 

 
  [ # 1 ]

You cannot match “Hello” because the input (:prepare Hello)  will convert that into a dialog act of ~emohello.  So your test examples are useless.

You can use ^eval to do things that normally are done in outputmacros. So you could do this:
u: ( ^eval( $_tmp = ^getPattern(“pattern1_” )) ^match($_tmp)) 
getpattern might as well do the join so you dont repeat that code everywhere. And even use $language as a global.

 

 
  login or register to react