Bug: <set> tag in <pattern> is deleting the multi-word input #52

Open
opened 2025-10-14 17:30:51 -06:00 by navan · 0 comments
Owner

Originally created by @afaji on 9/7/2020

Expected Behavior

Given the following AIML:

<?xml version="1.0" encoding="UTF-8"?>
<aiml version="2.0">

    <category>
        <pattern> <set>place</set> SUCKS </pattern>
        <template> That is unfortunate </template>
    </category>

    <category>
        <pattern> * </pattern>
        <template> <star/> </template>
    </category>

</aiml>

and place.txt as below, where entries with multiple words exist:

Rio de Janeiro
New York
Tokyo

By entering the query below:

Rio de Janeiro rocks

It should output

Rio de Janeiro rocks

Current Behavior

By entering the query below:

Rio de Janeiro rocks

The program outputs:

Janeiro rocks.

note that the 'Rio de' is deleted for some reason. (Also reproducible with 'New York')

When the input does not match the first pattern, the system works perfectly, for example:

I like Rio de Janeiro

Steps to Reproduce

  1. Use the above .aiml and .txt
  2. Run with the following python code:
from programy.clients.embed.basic import EmbeddedDataFileBot
import sys


files = {'aiml': ['./'],
		 'sets': ['./'],
		 }

my_bot = EmbeddedDataFileBot(files)

for line in sys.stdin:
	print(my_bot.ask_question(line))

Context (Environment)

  • Version of Program-y: 4.1
  • Version of Python: 3.6.1
  • Operating System ( inc Version ): Mac 10.11.6
*Originally created by @afaji on 9/7/2020* ## Expected Behavior Given the following AIML: ``` <?xml version="1.0" encoding="UTF-8"?> <aiml version="2.0"> <category> <pattern> <set>place</set> SUCKS </pattern> <template> That is unfortunate </template> </category> <category> <pattern> * </pattern> <template> <star/> </template> </category> </aiml> ``` and `place.txt` as below, where entries with multiple words exist: ``` Rio de Janeiro New York Tokyo ``` By entering the query below: ``` Rio de Janeiro rocks ``` It should output ``` Rio de Janeiro rocks ``` ## Current Behavior By entering the query below: ``` Rio de Janeiro rocks ``` The program outputs: ``` Janeiro rocks. ``` note that the 'Rio de' is deleted for some reason. (Also reproducible with 'New York') When the input does not match the first pattern, the system works perfectly, for example: ``` I like Rio de Janeiro ``` ## Steps to Reproduce 1. Use the above .aiml and .txt 2. Run with the following python code: ``` from programy.clients.embed.basic import EmbeddedDataFileBot import sys files = {'aiml': ['./'], 'sets': ['./'], } my_bot = EmbeddedDataFileBot(files) for line in sys.stdin: print(my_bot.ask_question(line)) ``` ## Context (Environment) * Version of Program-y: 4.1 * Version of Python: 3.6.1 * Operating System ( inc Version ): Mac 10.11.6
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github/program-y#52
No description provided.