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

Questions phrased as requests
 
 

Hi,
nearly everytime I write a pattern for a question I have to write another pattern which matches the rephrased question as a sentence.

E.g. for

What is your name?

I could write the simple pattern:

?: (~what be your name

But I also want the rule to match for

Tell me what your name is.

So I have to write a pattern:

u:( (~what be your name) (~communicate_verbs *~1 me ~what your name be

This makes nearly every question pattern more complicated and less readable, and I think there might be a better, more general solution.

Is there a more clever way? Maybe an effective pattern macro? Or is it possible to make Chatscript rephrase the request to a question so that the second output matches the first pattern?

 

 
  [ # 1 ]

You can wrap << and >> around a set of words that may appear in any order in the input.
e.g

u: ( << ~what be name >> ) 

 

 

 
  [ # 2 ]
Andy Heydon - Aug 30, 2017:

You can wrap << and >> around a set of words that may appear in any order in the input.
e.g

u: ( << ~what be name >> ) 

 

I know, but I don’t like this solution, because it has many false positives.

E.g.

My name is Tobi, what is your age?

What is the name of the machine that makes ice cream

 

 
  [ # 3 ]

What I do is create a topic of “implied questions”, which are commands that act like questions.

u: (< tell me )
u: ( < describe)

And these MERELY set the question bit in the tokenvalue, so when they get to your actual scripts, they react to ?:

 

 
  [ # 4 ]
Bruce Wilcox - Aug 31, 2017:

What I do is create a topic of “implied questions”, which are commands that act like questions.

u: (< tell me )
u: ( < describe)

And these MERELY set the question bit in the tokenvalue, so when they get to your actual scripts, they react to ?:

That is a nice solution.
However, is there something that can be done over the different structure of the sentence?

Beside having two choices like:

?: (~what [be your name ) (your name be)]

Or using << >>

 

 
  [ # 5 ]

Well there is always a balance between being too specific in patterns and allowing lenient expressions.

With << ... >>, you could also apply additional restrictions like %length<6 to limit the number of additional words that could be present.

Alternatively what I like to do is to use the initial pattern, ( << ... >> ) to trap potential areas of interest and then have a ^refine() or ^sequence() to test further qualifications, and if nothing really matches then ^fail(RULE).

You can memorize each of the words and compare their positions to see if they are close enough, for example.

In the past, I used ^sequence() to run through a series of patterns that calculate a “score” and then use a final rule in that sequence to determine if the score is high enough to meet my needs or not.

 

 
  [ # 6 ]

And there is the bidirectional match:
u: ( I like *~2 cat )
matches I like my cats or I like a yellow cat.
*~2b is similar to *~2 except it tries to match bidirectionally. First it tries to
match behind it, and if that fails, it tries forward (like *~2).

 

 
  [ # 7 ]

and instead of u:( [ (~what be your name) (~communicate_verbs *~1 me ~what your name be) ]  which is hard to read
u:( [
  (~what be your name)
  (~communicate_verbs *~1 me ~what your name be)
  ] )
is the coding style I use to be easier to read

 

 
  [ # 8 ]
Bruce Wilcox - Aug 31, 2017:

And there is the bidirectional match:
u: ( I like *~2 cat )
matches I like my cats or I like a yellow cat.
*~2b is similar to *~2 except it tries to match bidirectionally. First it tries to
match behind it, and if that fails, it tries forward (like *~2).

I don’t understand the bidirectional map or how I could use it regarding my problem.

Could you give an example?

 

 
  login or register to react