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

beginner question
 
 
  [ # 16 ]

Hi Alaric,

i am not sure if i understand that 100 %
your first example with travel
i understand what you mean. But the realy drawback is that you need for each verb a file
is not really comfortable i think

the second example
here is it not clear

it is not possible i put the three conjugation in a substitution file in my case:

the infinitiv form is “to go”

went - go
gone - go

when a person give the input

the man is gone than is this sentence the same input like
the man go

is that possible?

grettings from kiel

roland

 

 
  [ # 17 ]

You can enter
went - go
gone - go
going - go
goes - go
into the normal file and it will work.  You can have more than on entry map to the same word.  Just use the word go in all of your patterns afterwards.

 

 
  [ # 18 ]

For a more advanced option that does exactly what you need we can perform our own substitutions.  The SRAI tag stands for Symbolic Reduction Artificial Intelligence.  We can use it to “reduce” the input down to simpler patterns.  In this case we want to reduce the verb tenses. 

We will need to perform the following steps:
1) Create a “canonical” file that contains the substitutions.
2) Create a “system” file that contains the processing procedure
3) Update the “pand_initial” to redirect failed responses to the system file.
4) Create a sample test pattern.

 

 
  [ # 19 ]

Code for Steps 1-4

Step 1: Create aiml file “canonical”

<?xml version="1.0" encoding="UTF-8"?>
<aiml versi>

<
topic name="canonical">

<
category><pattern>XCANONICAL # goes #</pattern><template><star/> go <star index="2"/></template></category>
<category><pattern>XCANONICAL # went #</pattern><template><star/> go <star index="2"/></template></category>
<category><pattern>XCANONICAL # going #</pattern><template><star/> go <star index="2"/></template></category>

<category><pattern>XCANONICAL # travels #</pattern><template><star/> travel <star index="2"/></template></category>
<category><pattern>XCANONICAL # traveled #</pattern><template><star/> travel <star index="2"/></template></category>
<category><pattern>XCANONICAL # traveling #</pattern><template><star/> travel <star index="2"/></template></category>

<category><pattern>XCANONICAL *</pattern><template><star/></template></category>

</
topic>

</
aiml

Step 2:  Create aiml file “system”

<?xml version="1.0" encoding="UTF-8"?>
<aiml versi>

<
topic name="system">

<
category>
    <
pattern>*</pattern>
    <
template>
        <
think><set name="original_sentence"><star/></set>
        <
set name="topic">canonical</set>
        <
set name="parsed_sentence"><srai>XCANONICAL <get name="original_sentence"/></srai></set>
        <
set name="parsed_sentence"><srai>XCANONICAL <get name="parsed_sentence"/></srai></set>
        <
set name="parsed_sentence"><srai>XCANONICAL <get name="parsed_sentence"/></srai></set>
               <
set name="topic">introductions</set>
        </
think><srai>XSTATEMENT <get name="parsed_sentence"/></srai>
    </
template>
</
category>

</
topic>

</
aiml

Step 3: Edit aiml file “pand_initial”
Delete the first category in this file.
Replace the existing * category that catches all input with the following 2 categories.

<category><pattern>XSTATEMENT *</pattern>
<
template>I have no answer for that
original sentence: <get name="original_sentence"/>
parsed sentence: <get name="parsed_sentence"/>    
</
template>
</
category>

<
category><pattern>*</pattern>
<
template><think>
    <
set name="topic">system</set>
    </
think><srai><star/></srai>
</
template>
</
category

Step 4:  Create a test pattern

<category><pattern>XSTATEMENT # i go # and i travel #</pattern>
<template>
    
You get around
    <
get name="original_sentence"/>
    <
get name="parsed_sentence"/>
</
template>
</
category

 

 

 
  [ # 20 ]

Sample input: I went to the store and I traveled to the game.
Output: You get around.
i went to the store and i traveled to the game
i go to the store and i travel to the game

Explanation: This works because your test pattern starts with XSTATEMENT so any input will fail.  The pand_initial file is called last and catches the failed input it sets the topic to “system” and passes input to that topic.  The original_sentence input is stored.  Three attempts are made at substituting verbs by prefixing the users input with the word XCANONICAL and setting the topic to “canonical”.  Results are stored in parsed_sentence.  The topic is set back to introductions and the parsed_sentence input is passed prefixed with the word XSTATEMENT.  The pattern matches.  The original_sentence is displayed along with the parsed_sentence.  Any patterns that fail are caught by the new category pattern XSTATEMENT * in the pand_initial file.  Failed input is shown with orginal_sentence and parsed_sentence.

Cons: All patterns must be prefixed with XSTATEMENT. 
Pros:  You can expand the canonical file to include whatever entries you want for many verbs.
      You can add more rows to the system processing to call substitutions more than three times.  I used 10 times.
      Later you can add logic to test for questions and then prefix your patterns with either XSTATEMENT or XQUESTION so you can have different responses for each.

 

 

 

 
  [ # 21 ]

Hello Alaric,

thank you very much for the explanation. This works for me. Can i give you another Question

i will give the guest of my hotel answear of the question ” when is it possible to get breakfast”

for that i make a plan : (see you on the Attachments) I made a code for that thats work see you here

<?xml version="1.0" encoding="UTF-8"?>
<aiml versi>
 <
category>
    <
pattern> <set>fruehstueckfrage</set> * </pattern>
     <
template><random>
  <
li>Von Montag bis Freitag von 6:30 bis 10 Uhr und an den Wochenenden von 7 bis 10:30 Uhr frühstücken Sie bei uns im ACQUA Restaurant fürstlich.</li><br />
  <
li>Im Acqua servieren wir ihnen das Frühstück von 6:30 bis 10 Uhr und an den Wochenenden von 7 bis 10:30</li><br />
  <
li>Frühstück gibt es von 6:30 bis 10 Uhr und an den Wochenenden von 7 bis 10:30 Uhr</li><br />
  </
random>

<
srai>target tipps fruehstueck</srai></template>
</
category

</
aiml

sorry is in german.-)
I am not 100 % sure if this code ok for other question that will come. On the Picture of the Attachments you see what i plan for that
my problem is also that when the guest give on the last advice question the aswear “yes”
then i will give him all topics of the breakfast clickable ( I have no idea how i can manage that

i hope you understand everything

thank you

roland

Image Attachments
breakfast.jpg
 

 
  [ # 22 ]

The simple answer is to use the tag <that>.  You can review aiml articles online about it.

The way it works is that after a pattern matches the response such as “yes” or “no” if a <that> tag is encountered then the contents of the tag must match the previous response/question in order to continue processing rows in the template tag.  If it does not match then processing will continue to look for other categories.

Implemented in AIML in your case it would look something like this:

<category><pattern>XQUESTION until what time i can make breakfast</pattern>
<
template>
    
Breakfast is possible from 6:00am-10:00am.
    Do 
you have more questions for breakfast?
</
template>
</
category>

<
category><pattern>XSTATEMENT # yes #</pattern>
<template>
    <
that>XQUESTION until what time i can make breakfast</that>
    
1When is possible to get breakfast?
    
2Where can i get breakfast?
    
3What kind of breakfast is available?
</
template>
</
category>

<
category><pattern>XSTATEMENT # no #</pattern>
<template>
    <
that>XQUESTION until what time i can make breakfast</that>
    (
Good Advice for EventsHotelFood Etc.)
</
template>
</
category
 

 
  [ # 23 ]

sorry

 

 
  [ # 24 ]

ohh sorry i am soooo stupid it is late in germany.-) i got it but is when the guest write yes and i get the list is it possible to make this list clickable?

 

 
  [ # 25 ]

You would need to develop a front end application that would do that.  It is best to think of the chatbot logic part as a service or server side code while what you do with the results is up to you in your application.  There are very few off the shelf solutions that provide a front end client that does not require any programming.

The way that you might proceed with that using AIML is to use the <OOB> tag which allows your chatbot to issue commands to your application such as “DRAW BUTTON”.

Here is a link explaining the OOB tags.

_http://blog.pandorabots.com/using-oob-tags-in-aiml-part-1/

I think you are looking for a platform more like the Microsoft Bot Sdk where there are actions, cards, etc that are rendered in the chat window of various platforms and where they have worked out how to develop one set of code/services that works across the various popular messaging services. 

Here is a link showing code and results on that platform but I do not have any experience with it.  A little ways down the article you can see a sample order for a sandwich that looks similar to what you are trying to accomplish.
https://blogs.msdn.microsoft.com/tsmatsuz/2016/08/31/microsoft-bot-framework-messages-howto-image-html-card-button-etc/

 

 
  [ # 26 ]

Hello Alaric,

thank you for your help. Can i ask another question please.
You have much more knowledge.

when i have a Sentence for example the sentence from my last Problem

“until what time is it possible to make breakfast”

You know that we have a lots of possibilities to ask for the same question

i was thinking to manage this problem with keyword but i read this is not a good solution
when you have this question “until what time is it possible to make breakfast”
you write a lots of sentence with other words?
what is the best was to do it

thank you

roland

 

 
  [ # 27 ]

That’s simple, really. You create one category to handle the “original” response, then create other categories that <srai> to the original one, like this:

<category>
  <
pattern>BREAKFAST DEADLINE</pattern>
  <
template>Breakfast is served between 5:00AM and 10:00AM.</template>
</
category>


<
category>
  <
pattern>UNTIL WHAT TIME IS IT POSSIBLE TO MAKE BREAKFAST</pattern>
  <
template><srai>BREAKFAST DEADLINE</srai></template>
</
category>

<
category>
  <
pattern>HOW LATE CAN I ORDER BREAKFAST</pattern>
  <
template><srai>BREAKFAST DEADLINE</srai></template>
</
category>

<
category>
  <
pattern>WHEN IS BREAKFAST SERVED</pattern>
  <
template><srai>BREAKFAST DEADLINE</srai></template>
</
category>

<
category>
  <
pattern>WHEN BREAKFAST</pattern>
  <
template><srai>BREAKFAST DEADLINE</srai></template>
</
category>

<
category>
  <
pattern>WHEN BREAKFAST *</pattern>
  <
template><srai>BREAKFAST DEADLINE</srai></template>
</
category

This way you can have the same response for a large number of variations on the same question.

 

 < 1 2
2 of 2
 
  login or register to react