Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

Multiple yes or no questions #409

Closed
aklifsainie opened this issue Apr 29, 2018 · 13 comments
Closed

Multiple yes or no questions #409

aklifsainie opened this issue Apr 29, 2018 · 13 comments
Labels
aiml help info Not truly an issue, but information that is relevant to the project in some manner

Comments

@aklifsainie
Copy link

aklifsainie commented Apr 29, 2018

I need help ! @Dave-Morton

* Do you like pizza Yes Do you like pizza Do you like pickels yes Do you like pickels How about chicken?

i have a problem with multiple "yes or no" questions.

for example, if the bot asked me a "yes or no" question from the previous pattern, such as "Do you like pizza"... i will answer "yes".

then, the bot will ask me again, "do you like pickels". i answer "yes".

the bot will ask me again "do you like pickels".

@AlekzNet
Copy link
Collaborator

@aklifsainie Can you paste your AIML code here, please? You might want to add a check for already asked question, using "sets" and "conditions".

@ALL A general question: what would be the best and/or easiest way to implement "a button solution" for yes/no questions? In other words, if a yes/no answer is required, two buttons ("yes", "no") would appear on the screen.

@Dave-Morton
Copy link
Collaborator

@AlekzNet Program O doesn't support AIML 2.0 sets, on either the pattern or template side, so that's out, I'm afraid.

@aklifsainie I had a response that I had thought I had posted, but it doesn't seem to be here, so I'll try to recreate it in a moment. Sorry for the delay.

@AlekzNet (again) what you're asking about would require a bit of HTML/JavaScript "trickery", I think, and wouldn't be very easy to pull off. It's certainly doable, but the challenge would be beyond all but the most experienced developers. If you want to contact me via email to discuss how to best implement this, please message me privately. 😄

@Dave-Morton
Copy link
Collaborator

Ok, as promised, I'll try to recreate the post that seems to have gone walkabout.

@aklifsainie this is a situation where you need to have some context with your conversation in the form of relating the desired response to both the current input and the bot's previous response. This is where the pattern-side <that> tag comes in. Let's use your listed scenarios. At some point your bot will ask the user, "do you like pizza?" You probably only expect the user to answer with "yes" or "no", but you should also plan for times when the user responds with pretty much anything else, as well. I'll cover this as well.

<category>
    <pattern>YES</pattern>
    <that>DO YOU LIKE PIZZA</that>
    <template>
        <!-- Deal with an accepted "YES" answer here -->
    </template>
</category>
<category>
    <pattern>NO</pattern>
    <that>DO YOU LIKE PIZZA</that>
    <template>
        <!-- Deal with an accepted "NO" answer here -->
    </template>
</category>
<category>
    <pattern>*</pattern>
    <that>DO YOU LIKE PIZZA</that>
    <template>
        <!-- Deal with any input other than "YES" or "NO" here -->
    </template>
</category>

When a chatbot asks yes/no questions, you'll see categories like this a lot, so this is something that you'll want to get familiar with.

@AlekzNet
Copy link
Collaborator

AlekzNet commented May 1, 2018

I meant something simpler. In every YES/NO category you set a variable according to the "that", for example:

<category>
    <pattern>YES</pattern>
    <that>DO YOU LIKE PIZZA</that>
    <template>
        <think><set name="pizza">yes</set></think> 
        <!-- Deal with an accepted "YES" answer here -->
    </template>
</category>
<category>
    <pattern>NO</pattern>
    <that>DO YOU LIKE PIZZA</that>
    <template>
        <think><set name="pizza">no</set></think>
        <!-- Deal with an accepted "NO" answer here -->
    </template>
</category>

And in every question you check if the corresponding variable is set or undefined. If set - go to the next question, if undefined - ask this one.

@Dave-Morton
Copy link
Collaborator

Ah, I see what you mean now. Oops? 😉

@AlekzNet
Copy link
Collaborator

AlekzNet commented May 2, 2018

Yeah, it's ugly, requires a lot of checking and typing, but it works ;)

An alternative to <that> would be using topics (one per question).

All questions can be listed within a <random> statement or daisy-chained by <srai>s

@Dave-Morton Dave-Morton added aiml help info Not truly an issue, but information that is relevant to the project in some manner review labels May 8, 2018
@aklifsainie
Copy link
Author

Hey,

how to make the chatbot can make a prediction like the Akinator.com?

@Dave-Morton
Copy link
Collaborator

@aklifsainie take a look at Steve Worswick's AIML Downloads Page for some excellent ideas on some specialized AIML files. Among the files there is one that shows how to use AIML to create a "20 questions" game, which is pretty much what you seem to be looking for.

@aklifsainie
Copy link
Author

aklifsainie commented Jul 19, 2018

why does my <topic> tag not working?

<category>
      <pattern>LET DISCUSS MOVIES</pattern>
      <template>Yes <set name = "topic">movies</set></template>  
   </category>
   
   <topic name = "movies">
      <category>
         <pattern> * </pattern>
         <template>Watching good movie refreshes our minds.</template>
      </category>
      
      <category>
         <pattern> I LIKE WATCHING COMEDY! </pattern>
         <template>I like comedy movies too.</template>
      </category>
   </topic>

if I type "let discuss movies", it should enter the topic = "movies". then I type anything, it replies "I have no answer for that"

@patrickschur
Copy link
Collaborator

@aklifsainie Please remove all unnessecary whitespaces and punctuation in your AIML and try again.

<category>
    <pattern>LET DISCUSS MOVIES</pattern>
    <template>Yes <set name="topic">movies</set></template>  
 </category>
   
<topic name="movies">
    <category>
      <pattern>*</pattern>
      <template>Watching good movie refreshes our minds.</template>
    </category>
      
   <category>
      <pattern>I LIKE WATCHING COMEDY</pattern>
      <template>I like comedy movies too.</template>
   </category>
</topic>

@aklifsainie
Copy link
Author

My Chatbot is about the Islamic Law of Inheritance. In Islam, if a person dies, the property of the deceased should be divided according to the calculation set by Islam. I give you an example.

**If the deceased has a wife, and no sons or daughters, then the wife will earn ¼ of the property of the deceased. but if the deceased has a wife and children, then the wife will earn 1/8 of the property.

if the deceased's children only a daughter, then the daughter will earn 1/2 of the property, if there are 2 or more daughter, then the daughter will earn 2/3 of the property.**

How do I translate the above situation into AIML code???
the chatbot will ask many questions such as, "do you have children? how many children? how many daughter and how many sons? etc."

Helpp ! :(

this is for my final year project bachelor in computer science (artificial intelligence).

@AlekzNet
Copy link
Collaborator

the chatbot will ask many questions such as,

I would say yes. Just like a human lawyer. And a chatbot is an emulation of a human. It can be done simpler using HTML forms, checkboxes, javascript, but still, the user will have to go "one by one". So I see no problem here. One possible problem I see is the absence of if-then support in this AIML implementation.

@Program-O
Copy link
Owner

@aklifsainie Heya :) I think you might get the answer to your question alot quicker over at the AIML stackoverflow
https://stackoverflow.com/questions/tagged/aiml or over at chatbots.org https://www.chatbots.org/ai_zone/viewforum/2/.
There are alot more AIML experts over there :D
This board is for submitting issues with Program O and helping to write AIML is not within the scope of Program O or this board.
Many thanks for using Program O and good luck with your project.

@ghost ghost removed the review label Oct 10, 2018
Repository owner locked and limited conversation to collaborators Oct 10, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
aiml help info Not truly an issue, but information that is relevant to the project in some manner
Projects
None yet
Development

No branches or pull requests

5 participants