AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

[Pandorabots-AIaaS]Can the value tag in the condition statement be used to match a value from a set?
 
 

This is what I typed out.
<category>
Check</pattern>
<template>
<condition name=“element”>
  <li><value><set>collection</set></value>Yes, <get name = “element”> is a part of the set</li>
    <li>Sorry <get name=“element”> is not a part of the set.</li>
  </condition>
</template>
</category>

Basically I want to determine if ‘element’ is a part of the predefined set. How do I achieve this? Currently the condition executes the second part.

Additionally, are maps designed to be 1:1 key value pairs? Is it possible to map it 1:n?

 

 
  [ # 1 ]

Good evening!

I took a look at your question.  I do not think it is possible the way that you are trying to use the condition tag. 

Here is one way you might go about it that accomplishes your goal in a different way.

Sample code:

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

<
category>
    <
pattern>is in the collection</pattern>
    <
template><think>
        <
set name="INCOLLECTION"><srai>XIS <star/> in the collection</srai></set>
    </
think>
        <
condition name="INCOLLECTION">
            <
li value="YES">Yes, <star/> is part of the set.</li>
            <
li value="NO">Sorry, <star/> is not part of the set.</li>
            <
li>do not know what to think.  Please contribute to my crowdfunding to pay for a better developer.</li>
        </
condition>
    </
template>
</
category>

<
category><pattern>XIS <set>collection</setin the collection</pattern>
<
template>YES</template></category>

<
category><pattern>XIS in the collection</pattern>
<
template>NO</template></category>


</
aiml

 

 

 
  [ # 2 ]

Thankyou for your response! Yes infact that the alternative method I’m using to achieve the said functionality. My question cropped up because of the below excerpt from
AIML 2.0 Draft

In AIML 2.0 the name and/or value attribute values may be specified in subtags instead of XML attribute values.  The subtags have the same names as the original attribute names.

<condition name="predicate" value="v">X</condition>,

<
condition name="predicate"><value>v</value>X</condition>,

<
condition value="v"><name>predicate</name>X</condition>, and

<
condition><name>predicate</name><value>v</value>X</condition
are all equivalent.

I had my suspicion if this would work for the condition tag, and hence the question. Since its clear that the condition tag wont work in this way, I’ll use the work around to get the same functionality. 

Also, any idea about this question I asked in my earlier post?

Additionally, are maps designed to be 1:1 key value pairs? Is it possible to map it 1:n or n:1 or n:n even?

 

 
  [ # 3 ]

I’m fairly sure they are one to one.  In Pandorabots playground the UI prevents me from adding the same “key” twice.  But the map files are just a convenience.  You can create your own maps with categories.  The categories you make can be made anyway you would like them to be.

Sample Code:

<category><pattern>What is state id *</pattern>
    <
template>
        <
think><set name="STATENAMES"><srai>XMAP STATES <star/></srai></set></think>
        <
get name="STATENAMES"/>
    </
template>
</
category>

<!-- 
one to one -->
<
category><pattern>XMAP STATES 1</pattern><template>CALIFORNIA</template></category>
<
category><pattern>XMAP STATES 2</pattern><template>UTAH</template></category>
<
category><pattern>XMAP STATES 3</pattern><template>NEVADA</template></category>
<!-- 
one to many-->
<
category><pattern>XMAP STATES 4</pattern><template>CALIFORNIA UTAH NEVADA</template></category>
<!-- 
many to many -->
<
category><pattern>XMAP STATES 1 2 3 </pattern><template>CALIFORNIA UTAH NEVADA</template></category

Sample Output:

Human: what is state id 1
sienna4: CALIFORNIA

Human: what is state id 4
sienna4: CALIFORNIA UTAH NEVADA

Human: what is state id 1 2 3  
sienna4: CALIFORNIA UTAH NEVADA

 

 

 
  login or register to react