Replies - Activity - brunohjs - Rasa Community Forum

User: Bruno Justo

Advanced Rasa Certified Developer
Porto Alegre, RS - Brasil


Discussions

Am trying to get normalized value that is extracted using duckling for duration but am facing this error

Nov 25, 2020
between line 425 and 426 set your flag nodedescription to True. And remove lines 428 and 429.

Am trying to get normalized value that is extracted using duckling for duration but am facing this error

Nov 23, 2020
Of course! You can contact me via Telegram chat. My user is @brunohjs.

Am trying to get normalized value that is extracted using duckling for duration but am facing this error

Nov 23, 2020
Good! Maybe someone has an idea.

In the shell I think not. Rasa shell is for the developer can test the chatbot. Perhaps in some channel it is possible, for example in the website channel. I never did anything like that, so I don’t know how to answer you.


Technical Responses

  1. Use .csv file is a good idea. To work with .csv files in python, you need to use the csv lib. This tutorial can help you:

In particular, I would use a .json file because of its structure {"key": "value"}, in this case {"drug name": "drug description"}, but it is subjective.

  1. The dispatcher is called whenever a bubble needs to be printed. Do you want the names to be displayed in the same bubble? If so, you can use that variable department_response:

    department_response = ""
    for k in department_data:
        department_response += f"{k[0]} {k[1]}\t"
    dispatcher.utter_message(department_response)
    

    You do not need to create a variable department_response just to store the response.

    dispatcher.utter_message(f"{k[0]} {k[1]}")
    
  2. Store the duration the same way you did for the other slots.

  3. The method get_latest_entity_values() does not return the normalized value. To get the normalized text, you should use tracker.latest_message["entities"] property and filter by the entity duration.

  4. To show the normalized value:

    data2 = entity_val["normalized"]
    dispatcher.utter_message(f"{data2["value"]} {data2["unit"]}")
    

    For Example, if user input is "2 hours", output will be "7200 seconds".


Image Examples

To put the data you want in that slot, you need to do the logic within the slot’s validate method.