keiffster / program-y

Python 3.x based AIML 2.0 Chatbot interpreter, framework, related programs and knowledge files
https://keiffster.github.io/program-y/
Other
350 stars 135 forks source link

Echo <star/> with dots is Responding with a different value #133

Closed abcortes closed 6 years ago

abcortes commented 6 years ago

I have all preprocessors and postprocessors disabled.

My only grammar in aiml folder is echo.aiml,

<?xml version="1.0" encoding="utf-8"?>
<aiml version="2.0">
    <category>
        <pattern>REPEAT *</pattern>
        <template>
            <star/>
        </template>
    </category>
</aiml>

I am getting a different response. I was expecting the whole value passed by <star/>.

Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot, App: v1.5.0 Grammar v1.5.0, initiated March 14, 2017
Hi, how can I help you today?
>>> repeat www.google.com
www. Sorry, I don't have an answer for that!. Sorry, I don't have an answer for that!
>>> 
keiffster commented 6 years ago

OK, I used

<?xml version="1.0" encoding="UTF-8"?>
<aiml>
    <category>
        <pattern>REPEAT *</pattern>
        <template>
            <star />
        </template>
    </category>

 </aiml>

When I run it through Y-Bot, I get the following output

Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot, App: v1.5.0 Grammar v1.5.0, initiated March 14, 2017
Hi, how can I help you today?
>>> repeat This is the words I said
This is the words I said
>>> 

You seem to be showing an error, what is reported in the logs ?

abcortes commented 6 years ago

Hi, Please try something with a dot (.) eg.: www.google.com v.fly user.name.py

It looks like every time I included a dot (period) on the input, the response is being trailed by the default response on every dot.

Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot, App: v1.5.0 Grammar v1.5.0, initiated March 14, 2017
Hi, how repeat I am fine. Yes, I know.>can I help you today?
>>> repeat www.google.com
www. Sorry, I don't have an answer for that!. Sorry, I don't have an answer for that!
>>> repeat This is what I am saying.
This is what I am saying. Sorry, I don't have an answer for that!
>>> repeat This is what I am saying.
This is what I am saying. Sorry, I don't have an answer for that!
>>> repeat This is what I am saying
This is what I am saying
>>> repeat I am fine. Yes, I know.             
I am fine. Sorry, I don't have an answer for that!. Sorry, I don't have an answer for that!
>>>

y-bot.log

keiffster commented 6 years ago

A most interesting issue which is due to the sentence break occuring at the fullstop, which converts repeat www.google.com into 3 sentences 1) repeat www 2) google 3) com It parses 1), but then has no grammars for 2 and 3 which is why you get the error If you put the normalizer pre processor back in it converts it to repeat www dot google dot com Which in then parsers and if you use the denormalizer postprocessor, it converts www dot google dot com in www.google.com

keiffster commented 6 years ago

I enabled only the following

preprocessors.conf programy.processors.pre.normalize.NormalizePreProcessor

postprocessors.conf programy.processors.post.denormalize.DenormalizePostProcessor

and now it works

Loading, please wait...
No bot root argument set, defaulting to [.]
Y-Bot, App: v1.5.0 Grammar v1.5.0, initiated March 14, 2017
Hi, how can I help you today?
>>> repeat www.google.com
www. google.com
>>> repeat ivy.com
ivy.com
>>> 

I need to look at the space in www.google.com, but now you won't get wierd errors

abcortes commented 6 years ago

Let me also find a temporary fix on that spaces. It's breaking up urls. I might add another preprocessor as temporary fix.

seghcder commented 6 years ago

Our "temporary" solution is to change "." to ". " (ie dot space) in dialog.py. This preserves URLs, email addresses, IP addresses as labels etc but could cause you other issues.

def create_from_text(tokenizer, text, sentence_split_chars: str = ". ", split=True):

abcortes commented 6 years ago

Thanks, ideasean. Yes, it looks good. It is better than our temporary fixes since it is working without the normalize and denormalize in processors.

abcortes commented 6 years ago

I'll close this issue for now with Sean's suggested temporary fix.

keiffster commented 6 years ago

I currently working on the foundations to v2.0, and I have a working fix for this split issue along with better documentation on how to split sentences and handle individual sub questions it creates

The core of 2.0 is a refactor of the client -> bot -> brain relationship that will allow a client to have 1 or more bits, each which can have o e or more brains, this paved the way for more than just an aiml brain so you can plug in such brains like rasa hq or your own intent parser and the control the order in which brains are used to find an answer

K