Help needed: Entities are not getting extracted and slots not filled

Hi there, I’m new to RASA and after many hours of experimenting, I still can’t get my bot to fill any slots or extract any entities. I basically want my bot to store the whole utterance of the user in an entity and a slot. I tried this using training data before, but as the utterances can be really different each time, I get that the bot cannot detect the entities this way. That’s why I tried using lookup-tables, but it still doesn’t work and I can’t figure out why.

Background information: In this story, I want the bot to check if the user knows how to import the pandas-library in python. The user is supposed to type “import pandas as pd” and his answer is supposed to be stored in a slot. As a next step, I want to write a custom action to verify if the user’s input was correct. But for that, I need to user’s input to be stored in a slot, which is not happening right now.

Here’s my story:

  • story: mood great start studying session steps:
    • intent: greet
    • action: utter_greet_and_ask_mood
    • intent: mood_great
    • action: utter_ask_if_wants_to_learn
    • intent: affirm
    • action: utter_ask_for_import_statement
    • intent: give_import_statement entities:
      • import_statement: “import pandas as pd”
    • action: utter_verify_slot

Here are my entity- and slot-declaratons in my domain.yml: entities:

  • import_statement slots: import_statement: type: any mappings:
    • type: from_entity entity: import_statement intent: give_import_statement

And here’s my nlu-training data in my nlu.yml:

  • intent: give_import_statement examples: |
    • [import pandas as pd] (import_statement)
    • I wrote [import pandas as pd] (import_statement)
    • I have [import pandas as pd] (import_statement)
    • I would type [import pandas as pd] (import_statement)
    • [import pandas] (import_statement)
    • I wrote [import pandas] (import_statement)
    • I have [import pandas] (import_statement)
    • [import pandas as pd] (import_statement)
    • I wrote [import pandas] (import_statement)
  • lookup: import_statement examples: |
    • import pandas as pd
    • import pandas
    • iport pandas
    • import

I also added the RegexEntityExtractor to my Pipeline and enabled the use of lookup tables:

  • name: WhitespaceTokenizer
  • name: RegexFeaturizer
  • name: LexicalSyntacticFeaturizer
  • name: CountVectorsFeaturizer
  • name: CountVectorsFeaturizer analyzer: char_wb min_ngram: 1 max_ngram: 4
  • name: DIETClassifier epochs: 100 constrain_similarities: true
  • name: EntitySynonymMapper
  • name: ResponseSelector epochs: 100 constrain_similarities: true
  • name: FallbackClassifier threshold: 0.3 ambiguity_threshold: 0.1
  • name: RegexEntityExtractor use_lookup_tables: True

It still doesn’t work. I ran “rasa interactive” and tried to teach the bot at least to recognize the entity, but in the story-examples that were then added to my “story”-file, the entity was still not marked as such. The slot also remained empty.

I would be grateful for any kind of suggestion what I might be doing wrong!

Thank you very much in advance :slight_smile: Steffi

In the meantime, I was able to solve the issue - the problem seems to have been the type of the slot. When I set it to “text”, it worked! I also discovered that in a lot of cases it solved my problems to just cut out the whole text in the file (no matter if domain, nlu or the others) and then paste it again. It seems that some of the changes I make are not really being taken into account until I cut-paste the whole document. It might be an issue of my editor (eclipse), but I thought I just post it here in case it might help anybody else, too :slight_smile:

1 Like

Hi Steffi, by “the problem seems to have been the type of the slot”, do you mean by the mappings (from_entity) or the type: any field?