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

Exclude from Sentance Splitting #184

Closed poovarasanvasudevan closed 5 years ago

poovarasanvasudevan commented 5 years ago

Issue tracker is ONLY used for reporting bugs. NO NEW FEATURE ACCEPTED! Use stackoverflow for supporting issues.

I have a scenario of Making user to Enter their user name what has dot( . )

Expected Behavior

Should Work in Single Value ( user.name)

Current Behavior

Splitting Sentances (user , name)

Steps to Reproduce

  1. With this simple AIML
<?xml version="1.0" encoding="UTF-8" ?>
<aiml version="2.0">

    <category>
        <pattern>* RESET PASSWORD</pattern>
        <template>
            <srai>* RESET MY PASSWORD</srai>
        </template>
    </category>

    <category>
        <pattern>* RESET * PASSWORD</pattern>
        <template>
            <srai>PASSWORDTYPE</srai>
        </template>
    </category>

    <category>
        <pattern>PASSWORDREM</pattern>
        <template>
            <think>
                <set name="tcontext">PASSWORDREM</set>
            </think>
            Please Enter your network Login
        </template>
    </category>

    <category>
        <pattern>SECRETID</pattern>
        <template>
            <think>
                <set name="tcontext">SECRETID</set>
            </think>
            Enter your secret ID
        </template>
    </category>

    <category>
        <pattern>PASSWORDTYPE</pattern>
        <template>
            <think>
                <set name="tcontext">PASSWORDTYPE</set>
            </think>
            Sure what kind of password ^AD ^Remedy ^Peoplesoft
        </template>
    </category>

    <category>
        <pattern>*</pattern>
        <template>
            <condition name="tcontext">
                <li value="PASSWORDREM">
                    <think>
                        <set name="networklogin">
                            <denormalize><star/></denormalize>
                        </set>
                    </think>
                    <srai>SECRETID</srai>
                </li>

                <li value="PASSWORDTYPE">
                    <think>
                        <set name="passwordtype">
                            <star/>
                        </set>
                    </think>
                    <srai>PASSWORDREM</srai>
                </li>

                <li value="SECRETID">
                    <think>
                        <set name="secretid">
                            <denormalize><star/></denormalize>
                        </set>
                    </think>
                    <srai>RESETPASSWORD <get name="networklogin"/></srai>
                </li>
                <li>
                    How can i Help You
                </li>
            </condition>

        </template>
    </category>

    <category>
        <pattern>RESETPASSWORD *</pattern>
        <template>
            <think>
                <set name="tcontext" />
            </think>
            Your password <star/> reset Success
        </template>
    </category>

</aiml>
  1. Test Made

User >>> Can you reset my Password BOT >>> Sure what kind of password User >>> AD BOT >> Please enter your network login User >> user.name BOT >> Enter your secret ID Your password user reset Success

3 . Test (without ( . ) in username )

User >>> Can you reset my Password BOT >>> Sure what kind of password User >>> AD BOT >>> Please enter your network login User >>> username BOT >>> Enter your secret ID User >>> username BOT >>> Your password username reset Success

Context (Environment)

Detailed Description

When i entering username with . it splits, without . it works normally

keiffster commented 5 years ago

Sorry, could you provide a little more detail ?

keiffster commented 5 years ago

You have a couple of options, if you are sure that your users will never use more than one sentence then you could remove the fullstop from the sentence splitter. This would be the easiest solution.

Alternatively you could make it part of the entry for them to use the word 'dot'

BOT >> Please enter your network login User >> user dot name

Not a good solution, but would also work as the bot we normalise dot back to . and conjunct the 2 words automatically for you

Option 3 is a big of a longer piece of work but something that I have thought about. For things such as sentence splitting, spelling etc, I could implement a system property that you could control to switch on and off

So AIML would look something like

    <category>
        <pattern>PASSWORDREM</pattern>
        <template>
            <think>
                <set name="tcontext">PASSWORDREM</set>
                <set name="splitter">Off</set
            </think>
            Please Enter your network Login
        </template>
    </category>

Then switch it back on after the * pattern captures the input

By the way there is a more elegant solution for what you are using topics rather than setting contexts

K

poovarasanvasudevan commented 5 years ago

May be, I may suggest some way,

Creating a custom Tag like this

  <ignore-preprocessing><star /></ignore-preprocessing>

This will bypass preprocessing and make it available directly to bot

keiffster commented 5 years ago

Unfortunately that would not work as by the time you are processing the 'star' the pre parser has already split the sentence.

I have a working model which I will release in a couple of days which works through setting variables, as described above it would work similar to

    <category>
        <pattern>PASSWORDREM</pattern>
        <template>
            <think>
                <set name="tcontext">PASSWORDREM</set>
                <set name="sentence-splitter">off</set
            </think>
            Please Enter your network Login
        </template>
    </category>

    <category>
        <pattern>*</pattern>
        <template>
            <set name="sentence-splitter">on</set
            <condition name="tcontext">
     :
     :

BTW you can replace your context variable with the use of topic as follows

    <category>
        <pattern>PASSWORDREM</pattern>
        <template>
            <think>
                <set name="topc">PASSWORDREM</set>
                <set name="sentence-splitter">off</set
            </think>
            Please Enter your network Login
        </template>
    </category>

    <topic name="PASSWORDREM">
    <category>
        <pattern>*</pattern>
        <template>
               Logic for handling password
        </template>
    </category>
    </topic>

    <topic name="PASSWORDTYPE">
    <category>
        <pattern>*</pattern>
        <template>
               Logic for handling password type
        </template>
    </category>
    </topic>

In this instance it removes the need for a nested condition for handling the context and compartmentalises the logic for handle each condition into its own category

keiffster commented 5 years ago

New version just hitting master this morning which now includes system variable to switch sentence splitting on and off

https://github.com/keiffster/program-y/wiki/Sentence-Splitting

gianfrasoft commented 5 years ago

Is there a way to move configuration param: <set name="sentence-splitter">off</set> inside the configuration file?

keiffster commented 5 years ago

Hi there,

Not sure what you are trying to do, the parameter is designed to allow you to switch off sentence splitting in flight.

By moving it into configuration file do you want to switch off sentence splitting altogether, or have a default value at start up ?

K

On 3 Jul 2019, at 17:00, Gianfranco notifications@github.com wrote:

Is there a way to move configuration param:

off

inside the configuration file?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/keiffster/program-y/issues/184?email_source=notifications&email_token=ABCUFM76XLPSYQNOE5HODBTP5TEJHA5CNFSM4GRQB7HKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZE5FNA#issuecomment-508154548, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCUFMZDZYSNTDQ2JUDZWQLP5TEJHANCNFSM4GRQB7HA.

gianfrasoft commented 5 years ago

My problem is about email addresses: i need Program-Y to processes info@website.com as one word. Always.

keiffster commented 5 years ago

Ok, that’s not the sentence splitter, that’s the normaliser which turns info@website.com mailto:info@website.com into info at website dot com so that it can be processed as AIML

K

On 4 Jul 2019, at 14:43, Gianfranco notifications@github.com wrote:

My problem is about email addresses: i need Program-Y to processes info@website.com mailto:info@website.com as one word. Always.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/keiffster/program-y/issues/184?email_source=notifications&email_token=ABCUFM5WMSPQKXUDS2E6XBTP5X5ABA5CNFSM4GRQB7HKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZHOOFI#issuecomment-508487445, or mute the thread https://github.com/notifications/unsubscribe-auth/ABCUFM5UYG2U4DYATQWN563P5X5ABANCNFSM4GRQB7HA.

gianfrasoft commented 5 years ago

Is there a page in the wiki where I can find more info about?

keiffster commented 5 years ago

Thanks for highlighting that I don’t have page for normalise and dernomalise

Basically if you look at denormalise.txt file you will see the substitutions that take place on pre processing. This process replaces symbols with text which make it easier for aiml to process

K

keiffster commented 5 years ago

Added a new page on the wiki to cover pre and post normalisation

https://github.com/keiffster/program-y/wiki/Normalization

Regards

Keith keith@keithsterling.com 07771 597630

On 6 Jul 2019, at 12:13, Keith Sterling notifications@github.com wrote:

Thanks for highlighting that I don’t have page for normalise and dernomalise

Basically if you look at denormalise.txt file you will see the substitutions that take place on pre processing. This process replaces symbols with text which make it easier for aiml to process

K

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.