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

Check if match is in a concept
 
 

Hi,

Normally, if i’d want to check whether a word is defined within the concept, I’d do something like
s: TESTCASE ( * _0?~someconcept ) # A simplified test case

I’m wondering if there’s a way to do it inside a “if” block. The reason why I’d like to do this is that I’m setting _1 from a ^query. Seems like a straightforward way isn’t working:

if ( _1?~someconcept) {
Do something here.
}

I may have a problem in my code, I’m just wondering is this supposed to work or if there is some other way of doing the same thing.

Oh, and did handling of ~money change in version 2.8? I think “$3” used to match ~money, but it doesn’t seem to do that any more? Or maybe I’ve made a mistake there, too.

Thanks for the adding the ^retry in 2.71 - that has been very useful to me.

 

 
  [ # 1 ]

if ( _1 ? ~concept)  is supposed to work, if each token is separated by a space.

~money was renamed to ~moneynumber to make it less likely to collide with normal concepts and topic names. You would discover this if you did :prepare on your input.

^retry has been in the system forever but was broadened to take an argument, so you could retry a topic or a sentence instead of just a rule. I previously used it to multiply scan an input to extract particular kinds of facts.  The retry sentence I use in conjunction with looking ahead in the input stream ( ^nextInput).  E.g., if I ask
t: do you have any pets
a: (yes %more)  —- I can test here to see if they name a pet they have in the next sentence
      —if they do, I retain local control and pick it up
      —if they dont, I ^retry(Sentence) to process their next sentence normally, since I dont know what it is.
a: (yes) what is it?

 

 
  [ # 2 ]

Oh right, I should have known to separate the tokens in “if” with a space. A good tip about :prepare, that indeed shows the ~moneynumber change. 

Thanks for the reply, all my problems are solved.

 

 
  login or register to react
‹‹ Bare Bot      ChatScript 2.9 ››