Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extract list in api.ai from user input

I have a query of the following nature in API.ai "btc, ltc, xrp to usd, inr" How can I extract the query as source = [btc, ltc, xrp] destination = [usd, inr]

The number of elements in the source can be variable and the number of elements in the destination can also be variable. I am aware of the list entity and I tried it with the query. It picks up only btc in one list and puts the rest in another rest. Any suggestions

like image 416
PirateApp Avatar asked Jul 30 '17 06:07

PirateApp


1 Answers

You can create 2 intents ,

  1. SingleInput: a. Create a "btc, ltc, xrp" as utterance b. Add a Parameter $First as "SingleArray" with @sys.any

  2. MultipeInput: a. Create a "btc, ltc, xrp" to "usr ind" as utterance b. Add a Parameter $First as "SingleArray" with @sys.any b. Add a Parameter $Second as "MultipleArray" with @sys.any

Now when you issue the utterance with btn,ltc, you will get an output.

Your Single Input: "btc, ltc, xrp" output has parameter $First = [btc ltc xrp]

Your Multiple Input "btc, ltc, xrp to usr ind" output has parameter $First = [btc ltc xrp] and $Second = [usr ind]

like image 76
tx fun Avatar answered Nov 04 '22 21:11

tx fun