Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in pattern parser where the star index of the words will change #296

Open
EdvinJakobsson opened this issue Aug 12, 2021 · 0 comments
Open

Comments

@EdvinJakobsson
Copy link

EdvinJakobsson commented Aug 12, 2021

I have tried to pinpoint when this bug occurs, and I have found one simple example. I have seen the bug trigger in other instances as well though, and it has become a major headache to try to sidestep it in our project.

Example pattern:

    <category>
        <pattern>^ <iset words="SHOW, GIVE"/> ^ VIDEO ^ <iset words="INSTALL, REPLACE"/> <iset words="RADIO, ANTENNA"/></pattern>
        <template>
            1:<star index="1"/> <br/>
            2:<star index="2"/> <br/>
            3:<star index="3"/> <br/>
            4:<star index="4"/> <br/>
            5:<star index="5"/> <br/>
            6:<star index="6"/> <br/>
        </template>
    </category>

In this pattern the install/replace word should be retrievable as "star index=5" and the radio/antenna as "star index=6", and when this is the only pattern in the bot it works fine for an example question: "please show me a video on how to install radio
".

However, if I add a second pattern:

<category>
        <pattern>^ SHOW ^ VIDEO ON CATS</pattern>
        <template>
            CAT VIDEO
        </template>
    </category>

then even though this pattern will not match the example question above, it will affect how the words are indexed in the first pattern (in this case it will kind of forget about all words before the "show"). All words are hence indexed one step earlier than they should, leaving the radio/antenna word to be retrievable as "star index=4" and radio/antenna as "star index=5", as seen in the image attached. Also note that using the other word in the iset, "give", the pattern still functions as normal.
p4

I will also attach the log from when asking the three questions in the image, when both patterns are loaded (and no other patterns)

programy-log-edvin.log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant