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

Call java functions from aiml
 
 

Hello!

I am creating a chatbot using Java and program ab. In few places I can’t answer the questions directly, I have to process something or call a web service and process the result and then reply back. In such cases how to include the result of my java function to the responses in the aiml.

Say,

UserWhat is the price of the product A?
BotThe price of product A is $50 

In the above example, $50 is not going to be same always. I have to take that in run time. So how to solve this problem?

AIML:

<
category>
    <
pattern>WHAT IS THE PRICE OF THE *</pattern>
    <
template>The price of <star/> is $<call some function price(productA)> 
    </
template>
</
category>

JAVA:

public 
int price(String product){
     
// gets the product price
     // do the conversion 
     // apply discount
     
return price;

Please someone help me. Thanks in advance.

 

 

 
  [ # 1 ]

I wonder if this might be of any help to you: https://code.google.com/archive/p/program-ab/wikis/ExtendingAIML.wiki
I’m sorry to tell you that I don’t really understand, because my Java knowledge is limited.
Either way, good luck smile

 

 
  login or register to react