Can someone explain the RegexFeaturizer/RegexEntityExtractor for me?

I’m trying to use the RegexFeaturizer/RegexEntityExtractor to improve intent classification. But I can’t get it to work. I have:

pipeline:
  - name: WhitespaceTokenizer
  - name: RegexFeaturizer
  - name: RegexEntityExtractor
  - 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

- lookup: food
  examples: |
    - italian pancake
    - pizza
    - doughy stuff
    - tomato sauce

- lookup: furniture
  examples: |
    - something to sit on
    - butsupporter
    - stool
- intent: order_pizza
  examples: |
    - I would like a [pizza](food)
    - I am hungry for a [pizza](food)
    - can i get a [italian pancake](food)
    - please give me a [italian pancake](food)

- intent: order_furniture
  examples: |
    - I would like a [chair](furniture)
    - I am hungry for a [chair](furniture)
    - can i get a [stool](furniture)
    - please give me a [stool](furniture)

Although entities from the lookup table are recognized, the model doesn’t seem to use the entities/lookuptable to classify the intents when using values not listed in the intent examples.

for example: “can I get a butsupporter” recognizes butsupporter as entity furniture but it’s kinda random to which intent this gets classified. Whats going on?

Can someone explain this for me?

Sounds like you need to add more utterance examples for the intents. Shoot for 15-20 examples for each one.

Thanks for your answer, It still didn’t work as I would expect after adding extra examples. I would like a cheese platter still gets classified as order_furniture

version: "3.1"

nlu:
- intent: greet
  examples: |
    - hey
    - hello
    - hi
    - hello there
    - good morning
    - good evening
    - moin
    - hey there
    - let's go
    - hey dude
    - goodmorning
    - goodevening
    - good afternoon

- intent: goodbye
  examples: |
    - cu
    - good by
    - cee you later
    - good night
    - bye
    - goodbye
    - have a nice day
    - see you around
    - bye bye
    - see you later

- intent: affirm
  examples: |
    - yes
    - y
    - indeed
    - of course
    - that sounds good
    - correct

- intent: deny
  examples: |
    - no
    - n
    - never
    - I don't think so
    - don't like that
    - no way
    - not really

- intent: mood_great
  examples: |
    - perfect
    - great
    - amazing
    - feeling like a king
    - wonderful
    - I am feeling very good
    - I am great
    - I am amazing
    - I am going to save the world
    - super stoked
    - extremely good
    - so so perfect
    - so good
    - so perfect

- intent: mood_unhappy
  examples: |
    - my day was horrible
    - I am sad
    - I don't feel very well
    - I am disappointed
    - super sad
    - I'm so sad
    - sad
    - very sad
    - unhappy
    - not good
    - not very good
    - extremly sad
    - so saad
    - so sad

- intent: bot_challenge
  examples: |
    - are you a bot?
    - are you a human?
    - am I talking to a bot?
    - am I talking to a human?

- intent: order_pizza
  examples: |
    - I would like a [pizza](food)
    - I would like a [pizza](food)
    - I am hungry for a [pizza](food)
    - can i get a [italian pancake](food)
    - please give me a [italian pancake](food)
    - i would like some [italian pancake](food)
    - can you provide me with [doughy stuff](food)
    - please give me a lot of [doughy stuff](food)
    - i really need [doughy stuff](food)
    - I wish to have [pizza](food)
    - please entertain me with [pizza](food)
    - i wont some of your [pizza](food)
    - if you dont give me some [pizza](food)
    - if you wont give me some [pizza](food)
    - isnt it nice to have [pizza](food)
    - provide me with please  [pizza](food)
    - i would like to get some [pizza](food)
    - a [pizza](food) would be nice
    - some [pizza](food) for me would be great
    - i'm really missing some [pizza](food)

- intent: order_furniture
  examples: |
    - I would like a [chair](furniture)
    - I would like a [chair](furniture)
    - I am hungry for a [chair](furniture)
    - can i get a [chair](furniture)
    - please give me a [buttsupporter](furniture)
    - i would like some [buttsupporter](furniture)
    - can you provide me with [kruk](furniture)
    - please give me a lot of [kruk](furniture)
    - i really need [buttsupporter](furniture)
    - I wish to have [chair](furniture)
    - please entertain me with [chair](furniture)
    - i wont some of your [chair](furniture)
    - if you dont give me some [chair](furniture)
    - if you wont give me some [chair](furniture)
    - isnt it nice to have [chair](furniture)
    - provide me with please [chair](furniture)
    - i would like to get some [chair](furniture)
    - a [chair](furniture) would be nice
    - some [chair](furniture) for me would be great
    - i'm really missing some [chair](furniture)

- lookup: food
  examples: |
    - italian pancake
    - pizza
    - doughy stuff
    - tomato sauce
    - ananas
    - grapes
    - cheese platter

- lookup: furniture
  examples: |
    - buttsupporter
    - kruk
    - chair
    - stool
    - something to sit on
    - couch
    - table
version: "3.1"

intents:
  - greet
  - goodbye
  - affirm
  - deny
  - mood_great
  - mood_unhappy
  - bot_challenge
  - order_pizza
  - order_furniture

entities:
  - food
  - furniture

responses:
  utter_order_furniture:
  - text: "you ordered a furniture"

  utter_order_pizza:
  - text: "you ordered a pizza"
  utter_greet:
  - text: "Hey! How are you?"

  utter_cheer_up:
  - text: "Here is something to cheer you up:"
    image: "https://i.imgur.com/nGF1K8f.jpg"

  utter_did_that_help:
  - text: "Did that help you?"

  utter_happy:
  - text: "Great, carry on!"

  utter_goodbye:
  - text: "Bye"

  utter_iamabot:
  - text: "I am a bot, powered by Rasa."

session_config:
  session_expiration_time: 60
  carry_over_slots_to_new_session: true

version: "3.1"

rules:

- rule: Say goodbye anytime the user says goodbye
  steps:
  - intent: goodbye
  - action: utter_goodbye

- rule: Say 'I am a bot' anytime the user challenges
  steps:
  - intent: bot_challenge
  - action: utter_iamabot

- rule: order pizza
  steps:
  - intent: order_pizza
  - action: utter_order_pizza

- rule: order furniture
  steps:
  - intent: order_furniture
  - action: utter_order_furniture
  

Sorry, ignore my prior message. These two intents are the same except for the entity type. You should combine the intents into a single order intent and use a single entity, item.

- rule: order
  steps:
  - intent: order
  - action: utter_order
  utter_order:
  - text: "you ordered a {item}"

Thanks again, I know this would be the way for the use case I’m showing. But, I made this to see the influence of the Regexfeaturizer and the lookup tables. The model doesn’t seem to attribute a lot of weight to these features when training. This is why I would like to get a deeper understanding. In the example I gave everything is the same except for the entities. Therefore I would expect the model to classify the intents correctly by using the lookup tables. However, it only does this for some.

Ok, so you probably noticed this from the docs:

When using lookup tables with RegexFeaturizer , provide enough examples for the intent or entity you want to match so that the model can learn to use the generated regular expression as a feature. When using lookup tables with RegexEntityExtractor , provide at least two annotated examples of the entity so that the NLU model can register it as an entity at training time.

While it’s not explicitly stated here, I don’t think Rasa is generating additional utterance examples for all of your lookup table entries as you might expect. I haven’t looked at the source code for lookup tables, but based on these docs, it’s probably only using a RegEx for model.

Thanks, it looks like this is the case to me as well… Was just hoping for a different outcome. I don’t really see the use for lookup tables if they don’t work the way I thought they would work. Sure, they could improve intent qualification but you still have to use the different values in the intent examples.