1

My problem is that I'm trying to use multiple <set> in <pattern> tag but my core (in this case, Pandorabots) is not recognizing what I wrote. I thought the problem was the multiple set tag in the pattern tag. With just one, it works.

So here's the slice of aiml:

<category>
    <pattern>^ <set>components</set> ^ <set>desc_broken</set></pattern>
    <template>Test answer</template>
</category>

And the relative sets:

components.set

[
    ["ENGINE"],
    ["FILTERS"],
    ["CARBURETORS"]
]

desc_broken.set

[
    ["BROKEN"]
]

My goal is to match strings like "My engine is broken" or, more general: "something CAR PART something ADJECTIVE something"

operator
  • 247
  • 1
  • 3
  • 15

4 Answers4

1

The documentation does not specify either way if it supports or does not support the usage of multiple <set>...</set> statements within the <pattern>...</pattern>.

Leponzo
  • 624
  • 1
  • 8
  • 20
A. Kootstra
  • 6,827
  • 3
  • 20
  • 43
1

You can put multiple set tags. Below is sample AIML:

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

<category>
      <pattern>I WANT TO KNOW * AND *</pattern>
      <template>
        <think> <set name="topic"> <star index = "1"/></set></think>
        <think> <set name="topic1"> <star index = "2"/></set></think>
       Ok. Please Wait...
       </template>
</category>
</aiml>

Below is the Python code to get these topics and get the desired results:

bot = Kernel()
category= "Some text"
bot.respond(category) 
bot.getPredicate("topic")
bot.getPredicate("topic1")
Rahul Agarwal
  • 4,034
  • 7
  • 27
  • 51
  • I think the original question is about the use of sets and maps in patterns, not about using the .. element to update properties. – Ubercoder Oct 19 '17 at 15:49
0

I don't think you can put a <set> tag within a <pattern> tag if that is what you are asking.

Mason L.
  • 11
  • 3
  • What you say is correct for AIML v1. In AIML v2 there is the concept of sets and maps, and set members can be used in patterns. The syntax is shown in the original question and it looks valid AIML v2 to me. – Ubercoder Nov 22 '17 at 15:46
0

I tried using below code by creating "colors.txt" and "modify.txt" files under "sets" folder.

colors.txt has

green

red

And modify.txt has

modify

change

<category>
     <pattern># <SET>colors</SET> <SET>modify</SET> #</pattern>
     <template>Working on <star index = "2" /> color <star index = "3" /></template>
</category>

When i give input as green modify

output as Working on green color modify

jettimadhuChowdary
  • 1,058
  • 1
  • 13
  • 23