variable from python to AIML like {set name="some name"} a python {/set}

 
Hello, again. I would like to retrieve data from pytnon to aiml Is there such a possibility? For example, I want to use the <set var = (a python)>. whether it is possible in some way? I've tried with setPredicates, getPredicates <set name = "xx"> a python </ set> but it did not work. Please help.
kwatters's picture

What's the actual goal here?

Hi Bartcam!

  So,  there are many ways to do what you seek to do.

the ProgramAB.setPredicates(username, varname, value) call will do it, but it's asynchronous, so it won't be available until the next question ..

Another approach is to just have python create a string of some text and then call  programab.getResponse(username, text)  ...    Then in the AIML you can trigger some category based on that and have the robot say what you pass in from python.

I guess the real question is, do you have an example / end use case in mind for doing this?  It would help to know what goal you're trying to achieve.  

Best,

   -Kevin

  

bartcam's picture

example

My code is very long so i write example:

Python-->


face recognition ( get the face recognized as "face" variable )


now is

AIML -->


>I saw Hello robot< - now i need to get the "face" variable

<li value = my face> <srai>go to x template </srai></li>

<li value = my dauther face> <srai>go to xx template </srai></li>

<li value = other face> <srai>go to xxx template </srai></li>

etc....

I know i have to use <condition> <var>, not value to jump to other template.

I need to do somethink like these. That of course is only example


 

bartcam's picture

You are right!

The Variable is avaliable at next PATTERN not in these same.
Great! Thank You!

calamity's picture

hi bartcam   when I have play

hi bartcam

 

when I have play with the face recognizer I end up with that script

https://github.com/MyRobotLab/pyrobotlab/blob/master/home/Calamity/faceR...

 

So it use the different session name depending on who he last recognize

That way you can have completely different predicate file base on who he's talking to

bartcam's picture

Thank You for help

Thank for help. Works now.