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..

getting unknown in global variable
 
 

Hi,
I am new in aiml language. I m using Program AB. I want to store store id in a global variable named storied. For that I wrote below aiml, but in output I am getting unknown<Storeid given by user>.

Code:

<category>
    <
pattern>execute query store id * </pattern>      
    <
template>
        <
srai>query with ID</srai><set name="storeid"><star index="2"/></set>
    </
template>      
</
category>
<
category>
    <
pattern>query with ID</pattern>      
    <
template>
        
please confirm username of store <get name="storeid"/>
    </
template>      
</
category

output: Human: execute query for store id 1234
BOT:  please confirm username of store unknown1234

I am unable to understand instead of 1234 why I am getting unknown1234

Thanks in advance..

 

 
  [ # 1 ]

Greetings, Kritica, and welcome to chatbots.org! smile

The main problem that you’re experiencing is that you’re running the <SRAI>before setting the predicate “storeid”. Try this variation on your code, instead:

<category>
    <
pattern>execute query store id * </pattern>      
    <
template>
        <
think><set name="storeid"><star index="2"/></set></think>
        <
srai>query with ID</srai>
    </
template>      
</
category>
<
category>
    <
pattern>query with ID</pattern>      
    <
template>
        
please confirm username of store <get name="storeid"/>
    </
template>      
</
category

What I’ve done here is to move the <SET> tag to the beginning of the template, and wrapped it in a <THINK> tag to suppress output. By doing that, the value of “storeid” is set before moving on to the <SRAI> tag, and the value is only output once (the first time in your version was getting an undefined variable, which returns “unknown” in Program AB). You should have no trouble at all with this arrangement of the code. smile

Hope this helps.

 

 
  [ # 2 ]

Thanks a lot Dave..
I also have one more question we are creating two files in aiml first is *.aiml and another is *.aiml.csv.
I am not able to understand the logic behind it why we need two files. However, as I checked in program AB, if I modify the code only in *.aiml.csv file. then Bot will give response according to that code in *.aiml.csv file.

Moreover, as per my knowledge we always avoid code duplication and here we are doing same. So, I am confused and want to understand the concept behind it. I really thankful if you explain it.

 

 
  [ # 3 ]

You really don’t need them both. Just work with the .aiml files. the .csv files are created by ProgramAB to make loading of the AIML categories faster on subsequent runs. The only time you should deal with the .csv files at all is when you make changes to the AIML, in which case it might be prudent to delete the .csv files to make sure your changes are applied. Other than that, just ignore them. smile

 

 
  login or register to react