I cant extract name using duckling in rasa 2.0

I want to extract name using duckling but keep failing saing that "faild to extract requested slot 'name’s "…can anyone explain me

@faiza_conte duckling doesn’t extract name entities. Can you show me the setup that you’re trying to achieve this with?

Ow thanks I didnt know that duckling can not extract name…but what about duration??

Please take a look at our documentation for this information: Components

I know I already say it…if I want to extract duration using duckling of course it will extract…but I see something else which is normalized value…and I want rasa to catch that so is that possible

the entity extraction has that information, if you want to fill your slot with anything other than the “value” defined there, then you will need to handle that in a custom action or a form (with a custom slot mapping).

I did the slot thing…and it catches the value 2 as u can see from the picture …but if u see the picture there is a normalized one and I want to catch that if possible…did u get me ?

yes, you have to handle that in a custom action or a form, like i said. See this docs page for more detail: Forms

I think u dont get me…the value is too…the formaction is taking the first value if you see in the picture…please see the picture again

I understand the problem, the way to solve it is by defining these custom slot mappings that I linked to, instead of the default ones. the method to get that value from your custom slot mapping would be something like: next(tracker.get_latest_entity_values("duration"), None)["entities"]["additional_info"]["normalized"]

But slot mapping is depricated and is done in domain file so how will that works ?

So you mean getting the entity like this Duration=next(tracker.get_latest_entity_values(“duration”), None)[“entities”][“additional_info”][“normalized”] Like this…will I get the duration that is normalized???

@akelad please am waiting for your answer

custom slot mappings aren’t deprecated, the default slot mappings can be defined in the domain, but you can define custom slot mappings as described in the docs. So it would look something like this if you are using a form:

from typing import Dict, Text, List

from rasa_sdk import Tracker
from rasa_sdk.events import EventType
from rasa_sdk.executor import CollectingDispatcher
from rasa_sdk import Action
from rasa_sdk.events import SlotSet


class ValidateYourtForm(Action):
    def name(self) -> Text:
        return "validate_your_form"

    def run(
        self, dispatcher: CollectingDispatcher, tracker: Tracker, domain: Dict
    ) -> List[EventType]:
        duration_value = next(tracker.get_latest_entity_values(“duration”), None)[“entities”][“additional_info”][“normalized”] 

        return [SlotSet("duration", duration_value)]

If you are not using a form, then you would use similar code in a regular custom action.

Okay any regular action that is going to be performed is also going to work thank you so much…I will try it and get back to you if it didnt work

@akelad…here is the error I get while.trying to execute custom action for what u have told me

@faiza_conte at this point that’s an error with the object, it’s possible you may need to use a .get() for the entities, instead of ["entities"]

So @akelad how should I rewrite the code …

@akelad i did try but it says .get is nontype…i dont know how am suppose to write the .get one u said

@faiza_conte what code have you been using?