Extracting multiple slots from a single utterance

hey team,

I am currently exploring the slot filling capabilities to create a shopping bot assistance. Currently I have a very simple bot where I can get all the required slots filled by asking questions upon questions. However, my bot still cannot extract multiples entities from a single user utterance.

For example: is there a nice [dress](item) below [$50](price) for [female](gender)?

ideally, three entities are extracted from the msg above - dress, $50 and female. Yet, I haven’t figure it out how. I’ve seen the examples provided in Github, but it is still unclear to me.

The following is my stories.md

    ## happy path
    * greet
        - utter_greet
    * request_item
        - shopping_form
        - form{"name": "shopping_form"}
        - form{"name": null}
        - utter_slots_values
    * thankyou
        - utter_noworries


class ShoppingForm(FormAction):

    def name(self) -> Text:
        return "shopping_form"

    def required_slots(tracker: Tracker) -> List[Text]:
        return ["item", "size", "price", "brand", "color", "gender"]
    def slot_mappings(self) -> Dict[Text, Union[Dict, List[Dict]]]:
        """A dictionary to map required slots to
            - an extracted entity
            - intent: value pairs
            - a whole message
            or a list of them, where a first match will be picked"""
            "item": self.from_entity(entity='item', not_intent="chitchat"),
            "price": [
                self.from_entity(entity="price", intent=["inform"]), 
                self.from_intent(intent="deny", value=False),
            "size": [
                self.from_entity(entity="size", intent=["inform", "request_item"]),
            "gender": [
                self.from_entity(entity="gender", intent=["inform", "request_item"]),

            "brand": [
                self.from_entity(entity="brand", intent=["inform", "request_item"]),
                self.from_intent(intent="deny", value=False),

            "color": [
                self.from_entity(entity="color", intent=["inform", "request_item"]),
                self.from_intent(intent="deny", value=False),

not sure if this question has been asked before, there are something similar but somehow I still couldn’t figure how to fix this. Could anyone give me some pointers?


Extracting multiple entities from a user message is definitely possible. I guess, you are using the CRFEntityExtractor in your pipeline. This component will extract any number of entities. If you run your bot in debug mode, for example, rasa shell --debug, you should see all entities that were extracted by this component. If you see multiple entities over there, you should take a closer look at your slot mapping inside your form action.

Do you see multiple entities picked up in your logs when enabling debug mode?

Hi @Tanja

Thank you for your reply. I found the bug where I had some typos in my domain.md.

Thank you again