Search code examples
inputoutputresponsewatson-conversation

Printing watson entity found in text (input)


I have a situation, where user asks for "I want to buy us dolars". I have already defined the intent for the question "I want to buy". What I need, is to identify which currency user is talking about (buying). For that, I created an Entity "money", with a value "currency", and its synonyms (us dollar, euros, ienes, ....). The issue is, that the node recognizes @items:buying and @money:currency. How can I get which currency was found, and use it onto the context/output?

I tried using and also but it always returns an empty value.

entities[0] returns me only the buying stuff, the first recognized thing. I need the second, specifically by name, in order to customize my conversation flow.

Thanks a lot.


Solution

  • To resolve this, first switch on @sys-currency system entity.

    After that, this example should work once training is complete.

    Condition: @sys-currency

    Response: Currency: <? @sys-currency.unit ?>. Total: <? @sys-currency ?>

    enter image description here

    However it assumes that you are writing the currency correctly. For example:

    • 20 USD
    • $20
    • 20 dollars

    More details here:

    https://www.ibm.com/watson/developercloud/doc/conversation/system-entities.html#sys-currency-entity


    To address the other point of finding the value of the recognised text of the entity, you would use:

    <? entities[0].literal ?>