-3

I am currently tasked with a project to make a Chat bot in Pandorabots using AIML. For this project we need to create the bot with less than 15 categories (to get full marks). There is a text file we were given which had a list of 49 questions that need to be answered by this bot.

Most of the questions that are asked are like "Where is Cardiff" "Whereabouts is Cardiff" "Tell me where Cardiff is" "Where is Cardiff bot"

These sort of questions but changing the city for Bristol, London etc. I have a Github repo of the project with all the questions in there.

https://github.com/SoberBluee/courseworkbot

In no way am I asking someone to do it for me, I just need some direction on where to start because I'm very new to XML.

/files/questions.aiml is the file that all the questions are stored in.

Many Thanks.

Ethan
  • 5
  • 4

1 Answers1

0

Without seeing the questions, it's difficult to guide you but from the examples you gave, you need to look at the <srai> tag in AIML. This can be used to amend the user input and saves you writing lots of categories. Not sure how much guidance you need but here is an example of handling sentences that start with "Whereabouts". If the user's input is "Whereabouts is Cardiff", the bot will process, "Where is Cardiff"

<category>
    <pattern>WHEREABOUTS *</pattern>
    <template><srai>Where <star/></srai></template>
</category>

If you need further guidance, just let me know.

Steve Worswick
  • 880
  • 2
  • 5
  • 11
  • The github repo should be public now so you should be able to see all the questions that are in the file. There are 49 of them. I did have a try with the "Where is Cardiff" question using the condition tag but it did not work for some reason ? – Ethan Nov 15 '19 at 13:08
  • That's right, as you have other categories like "Whereabouts is Cardiff" which will override "* is Cardiff". A star wildcard is only matched if nothing else fits. – Steve Worswick Nov 15 '19 at 13:45
  • So is that code at the top meant to work then because I just got rid of all the questions that had "Whereabouts " and it will not work. Here - https://gyazo.com/f25e00e153d7e258649af037df9af607 – Ethan Nov 15 '19 at 13:57
  • Spell "category" correctly and it will work ;) You might want to put think tags around setting your predicate too or it will be displayed in the template. – Steve Worswick Nov 15 '19 at 17:13
  • Wow that's embarrassing. Thank you and for the think tags would that be used so I can store variables and then find them somewhere else ? – Ethan Nov 15 '19 at 17:26
  • Sorry to bother you again but how would I go about the bot ignoring things like please and bot after the key work. Like having * Cardiff * . I have tried doing this and it did not work – Ethan Nov 15 '19 at 17:56
  • The think tags are used when you want the bot to do something but not display the results back to the user. Try missing them out and see what happens. If you make a new question about ignoring user input, I'll answer there, as it's not really related to this question. – Steve Worswick Nov 15 '19 at 20:06
  • Okay I see. I have just done that and It all works. Thank you for your time. You have been a huge help. – Ethan Nov 15 '19 at 20:08
  • Its me again. I have made another post for the questions on how to get more than one wildcard in a pattern. https://stackoverflow.com/questions/58890611/aiml-how-can-i-have-more-than-one-wildcard-in-a-pattern – Ethan Nov 16 '19 at 12:16