Closed buinguyen closed 6 years ago
You need to convert you
Thank you for your guide. I tried to convert to upper case but it's not working. I still guess that the function get_that_pattern() has any problems.
Thanks!
Ok let me take a look over the weekend and work out what is happening
I’ll had your aiml to a unit test
K
Huge shout out to @nguyenbnt for finding this rather unpleasant bug, fixed with supporting unit tests and pushed to master and pypi
Hello, I saw the change. But may be it's not thorough yet. You can test the bellow case:
<category>
<pattern>Hi</pattern>
<template><srai>GREETINGS</srai></template>
</category>
<category>
<pattern>GREETINGS</pattern>
<template>
<random>
<li>Hello. Do you know explore the website?</li>
<li>Good day. Do you know explore the website?</li>
</random>
</template>
</category>
<category>
<pattern>Yes</pattern>
<that>DO YOU KNOW EXPLORE THE WEBSITE</that>
<template><srai>AGREEMENT</srai></template>
</category>
<category>
<pattern>AGREEMENT</pattern>
<that>DO YOU KNOW EXPLORE THE WEBSITE</that>
<template><srai>GROUPAGREEMENT</srai></template>
</category>
<category>
<pattern>GROUPAGREEMENT</pattern>
<that>DO YOU KNOW EXPLORE THE WEBSITE</that>
<template>The website was created in 2014.</template>
</category>
<category>
<pattern>GROUPAGREEMENT</pattern>
<template>Default AGREEMENT</template>
</category>
<category>
<pattern>No</pattern>
<that>DO YOU KNOW EXPLORE THE WEBSITE</that>
<template><srai>DISAGREEMENT</srai></template>
</category>
<category>
<pattern>DISAGREEMENT</pattern>
<that>DO YOU KNOW EXPLORE THE WEBSITE</that>
<template><srai>GROUPDISAGREEMENT</srai></template>
</category>
<category>
<pattern>GROUPDISAGREEMENT</pattern>
<that>DO YOU KNOW EXPLORE THE WEBSITE</that>
<template>Disagreement with that pattern.</template>
</category>
<category>
<pattern>GROUPDISAGREEMENT</pattern>
<template>Default DISAGREEMENT</template>
</category>
Input: Hi -> Yes Expected: The website was created in 2014.
Best Rg, Nguyen
You have too many that elements. You only need that in the first statement to capture the conditional Yes/No, afterwards its better practice and more efficient to keep the statements free of that
I have kept your original AIML but commented out below the unnecessary <that>
tags
<category>
<pattern>Hi</pattern>
<template>
<srai>GREETINGS</srai>
</template>
</category>
<category>
<pattern>GREETINGS</pattern>
<template>
<random>
<li>Hello. Do you know explore the website?</li>
<li>Good day. Do you know explore the website?</li>
</random>
</template>
</category>
<category>
<pattern>Yes</pattern>
<that>DO YOU KNOW EXPLORE THE WEBSITE</that>
<template>
<srai>AGREEMENT</srai>
</template>
</category>
<category>
<pattern>AGREEMENT</pattern>
<!-- <that>DO YOU KNOW EXPLORE THE WEBSITE</that> -->
<template>
<srai>GROUPAGREEMENT</srai>
</template>
</category>
<category>
<pattern>GROUPAGREEMENT</pattern>
<!-- <that>DO YOU KNOW EXPLORE THE WEBSITE</that> -->
<template>The website was created in 2014.</template>
</category>
<category>
<pattern>GROUPAGREEMENT</pattern>
<template>Default AGREEMENT</template>
</category>
<category>
<pattern>No</pattern>
<that>DO YOU KNOW EXPLORE THE WEBSITE</that>
<template>
<srai>DISAGREEMENT</srai>
</template>
</category>
<category>
<pattern>DISAGREEMENT</pattern>
<!-- <that>DO YOU KNOW EXPLORE THE WEBSITE</that> -->
<template>
<srai>GROUPDISAGREEMENT</srai>
</template>
</category>
<category>
<pattern>GROUPDISAGREEMENT</pattern>
<!-- <that>DO YOU KNOW EXPLORE THE WEBSITE</that> -->
<template>Disagreement with that pattern.</template>
</category>
<category>
<pattern>GROUPDISAGREEMENT</pattern>
<template>Default DISAGREEMENT</template>
</category>
Ok. I know. In this case, it's unnecessary.
Above case is an example for testing.
However, in fact, the case which has some
Thanks for the grammar, I added it to the unittests and updated the code to make it compatible
New version just pushed to master
Hi, after reading the above comments and doing some experiments, I am a bit confused about how
I have tried keiffster's version of AIML from the above comment, in which only the first
Input: Hi Output: Hello. Do you know explore the website? Input: yes Output: Default AGREEMENT
I think the expected response of the last one should be "The website was created in 2014."
When
<category>
<pattern>Hi</pattern>
<template>
<srai>GREETINGS</srai>
</template>
</category>
<category>
<pattern>GREETINGS</pattern>
<template>
<random>
<li>Hello. Do you know explore the website?</li>
<li>Good day. Do you know explore the website?</li>
</random>
</template>
</category>
<category>
<pattern>Yes</pattern>
<!-- <that>DO YOU KNOW EXPLORE THE WEBSITE</that> -->
<template>
<srai>AGREEMENT</srai>
</template>
</category>
<category>
<pattern>AGREEMENT</pattern>
<!-- <that>DO YOU KNOW EXPLORE THE WEBSITE</that> -->
<template>
<srai>GROUPAGREEMENT</srai>
</template>
</category>
<category>
<pattern>GROUPAGREEMENT</pattern>
<that>DO YOU KNOW EXPLORE THE WEBSITE</that>
<template>The website was created in 2014.</template>
</category>
<category>
<pattern>GROUPAGREEMENT</pattern>
<template>Default AGREEMENT</template>
</category>
<category>
<pattern>No</pattern>
<!-- <that>DO YOU KNOW EXPLORE THE WEBSITE</that> -->
<template>
<srai>DISAGREEMENT</srai>
</template>
</category>
<category>
<pattern>DISAGREEMENT</pattern>
<!-- <that>DO YOU KNOW EXPLORE THE WEBSITE</that> -->
<template>
<srai>GROUPDISAGREEMENT</srai>
</template>
</category>
<category>
<pattern>GROUPDISAGREEMENT</pattern>
<that>DO YOU KNOW EXPLORE THE WEBSITE</that>
<template>Disagreement with that pattern.</template>
</category>
<category>
<pattern>GROUPDISAGREEMENT</pattern>
<template>Default DISAGREEMENT</template>
</category>
Input: hi Output: Hello. Do you know explore the website? Input: yes Output: The website was created in 2014.
Which one is the suggested and efficient way to use
Hi guys, please ignore my last comment. Sorry that I didn't notice that there are duplicate "GROUPAGREEMENT" pattern in the AIML. After removing the duplicate, the AIML works as expected on both Pandorabots site and the newest programy.
That’s great news
I tested with some cases on Ubuntu but it seems 'that' tag did not work in the case srai to other pattern.
Expected Behavior
That tag should work normally.
Hi -> Hello. Do you know explore the website? Yes -> The website was created in 2014.
Current Behavior
'That' pattern gets default value [*]
Hi -> Hello. Do you know explore the website? Yes -> Test pattern: AGREEMENT
Possible Solution
The function get_that_pattern() in programy/dialog.py I think the code: that_question = self.previous_nth_question(1) not working properly in this case.
Steps to Reproduce
Run my aiml code:
Context (Environment)
Possible Implementation
The function get_that_pattern() in programy/dialog.py I change the code: that_question = self.previous_nth_question(1) I got previous question until response of that question is not None. This is my opinion.
Hope you check this issue. Many thanks!