Unable to parse intent throws error: rasa\lib\site-packages\rasa\core\processor.py:366: UserWarning: Interpreter parsed an intent 'hey' that is not defined in the domain. f"Interpreter parsed an intent '{intent}' "

I am writing a chatbot code and I have defined few intents in the domain.yml file as follows: intents:

  • restaurant_search
  • send_mail
  • affirm
  • greet
  • goodbye
  • stop
  • dont_send_email

These intents are in turn defined in nlu.md as follows:

intent:greet

  • hey
  • howdy
  • hey there
  • hello
  • hi
  • good morning
  • good evening
  • dear sir

Now when I run the rasa shell after giving input as “hey” it throws error: rasa\lib\site-packages\rasa\core\processor.py:366: UserWarning: Interpreter parsed an intent ‘hey’ that is not defined in the domain. f"Interpreter parsed an intent ‘{intent}’ "

I am not able to debug the issue since the intent hey is clearly mentioned in the nlu.md and the domain file. Still the interpreter in unable to parse it. Any clues?

I have the same problem. I have mentioned it if previous posts:

forum post 1

forum post 2

Does your bot behaves the way it should? This is true for my case. Therefore I think it might be a bug.

I am not able to debug the issue since the intent hey is clearly mentioned in the nlu.md and the domain file. Still the interpreter in unable to parse it. Any clues?

You haven’t defined the intent “hey” in your nlu data. It is part of your “greet” intent.

Hey @mtrworld, @Chatbot_Ra,

I’d suggest the following first debug to try. Create a new python file and paste in the following code:

from rasa.nlu.training_data.formats import MarkdownReader

training_data = ()

doc = "<PATH TO NLU.MD>"

reader = MarkdownReader()
reader.read(doc, language='de', fformat='MARKDOWN')
for message in reader.training_examples:
    training_data = training_data + ([message.text, message.get('intent')],)

You could then check, if at least the training data is parsed correctly inside Rasa leading to a correct model. I assume that there has gone something wrong regarding the training.

Please post the outcome here such that we can evaluate the result.

Kind regards
Julian

@mtrworld /@Chatbot_Ra have this particular issue (Although not exactly the same).

@JulianGerhard Let me summarize your last post, because I am not sure if I got it right: You want us to create a new python file (loocation propably in the root folder). The name of this file can be choosen by us. Let’s say MarkdownReader.py. In this file we copy your code and change the path variable to the NLU.md file. I am using windows, so it will propably look sth like this:

C:\Analysen\chatbot_x\rasa_project\data

Afterwards you want us to debug the rasa bot project, correct? I tried to run this file (MarkdownReader.py) separately, but this doesn’t work.

Hi @Chatbot_Ra,

we have to figure out why the bot thinks there exists an intent called “hey” instead of only treating hey as a training sample for the greet-intent. Without having more insights this is a tough one. My assumption was, that the bot got something wrong while training leading to my suggestion to check, if the training data was parsed correctly.

In Windows, your path has to be:

C:\\Analysen\\chatbot_x\\rasa_project\\data\\nlu.md

Can you post the error you got?

Regards
Julian

Oh if this is the case, I can tell you right now, that (at least in my case) the training works fine. Why do I think so?:

  1. The bot works as it should. No problems. This is why the warning is so strange
  2. After training the model with supervised_embeddings I get this message:

I have marked the intent name and the entity name. Looks for me, that this is clearly recognized.

However, running this model / bot I get this:

It seems, the intent is unknown for the model! I marked it red! Above, you can read an other warning, which I think has nothing to do with this, because it used to appear some time before this problem came up, and is not so crucial according to what I found out.

By the way, I do not know, why the intent name is given as name: in the warning. I do not see where the colon : is coming from. This doens’t seem to be the case for @mtrworld

Hi @Chatbot_Ra,

this is indeed interesting. I think we have to dig deeper. The method which is responsible for that line is defined in processor.py as follows:

def _log_unseen_features(self, parse_data: Dict[Text, Any]) -> None:

I’d suggest to print/log this parse_data object first to determine if the error comes from the caller or not. I have the feeling that there is a light bug in some formatting method.

Regards
Julian

@JulianGerhard I added a print line to the method that you have mentioned in your previous post:

Running the bot gives me this:

Here greet, yes_Datenschutz, yes_user are intents of my bot. They seem to work. The different to the intent name is, that I do not use them to fill a slot. More about this, I have explained here. In this post, I had the feeling, that the problem maybe has to do with the way I set the slots in my custom form. Still I am not sure about this!

What I do not understand, why rasa seems to add a colon to the intent name.

I tried to debug Rasa. As you can see in the figure below, at some point the intent name suddently becomes name:. Where does the colon suddenly comes from??? Since I am not an expert in debugging, I was not able to trace back, where this happends (for now!).

I think one possible problem is the method get_parsing_states in which the intent_name is set. You can look it up in the source code here!

It is interesting that the actual value of the intent name is set correctly to Peter. Therefore, I am starting to think, there is a bug in rasa code which parses the intent wrong.

What do you think?

Hi @Chatbot_Ra,

I think I found the error. Look at the “latest_message” dictionary. As far as I know, e.g. the format:

 utter_ask_color:
- text: "what color would you like?"
  buttons:
  - title: "blue"
    payload: '/choose{"color": "blue"}'
  - title: "red"
    payload: '/choose{"color": "red"}'

used for setting slots with Buttons leads to the interpretation:

You can use buttons as a shortcut. Rasa Core will send messages starting with a / to the RegexInterpreter , which expects NLU input in the same format as in story files, e.g. /intent{entities} . For example, if you let users choose a color by clicking a button, the button payloads might be /choose{"color": "blue"} and /choose{"color": "red"} .

as explained here.

Now according to what you posted, there is:

{ ‘text’: '/name:{“name”: “Peter”}, ‘intent’: {‘name’: ‘name:’, ‘confidence’: 1.0}
{ 'text': '/name:{"name": "Peter"}, 'intent': {'name': 'name:', 'confidence': 1.0}

which absolutely makes sense for /intent{entities}.

So you simply need to verify how your inputs to the bot are done and remove the ':' from /name: - then you should be done.

Did that help?`

Kind regards
Julian

1 Like

Hey, thank you very much for your response!

If I understand you correctly, you are talking about “how to set a slot by clicking a button”. However, when I ask for the user name (last name, birthday, customer-id,…) I am not setting a button. The custom form asks the user (“What is you first name?”) and the user types it into the field to set the slot directly.

Please do not understand me wrong. I also have the strong feeling, that setting the slot correclty is the key to the problem. The second option for me is that Rasa has a bug.

Let’s look at the problem more cloosly to make sure that everybody can understand it:

In my domain file I have:

intents:
 - name
 - name_last


entities:
 - name
 - name_last

slots:
  name:
    type: unfeaturized
  name_last:
    type: unfeaturized

actions:
 - utter_ask_name
 - utter_ask_name_last

forms:
  - authenticate_form

templates:

  utter_ask_name:
    - text: What is your first name?
      buttons:
        - title: "FirstName"
          payload: "name"

  utter_ask_name_last:
    - text: What is your last name?
      buttons:
        - title: "LastName"
          payload: "name_last"

This is how I set the slot. As you can see, it looks like creating a button, but the way I set the payload will not create a button. I have to admit, it was not a smart idea to call every item (intent, entity and slot) by the same name. As far as I checked. this is not the root of the problem. According to your last post, what is wrong about this? I don’t see what I did wrong!

I am not sure if this is important, but let me explain what else I do:

In the stories.md file I do this:


## story_form_happy_path
- authenticate_form
- form{"name": "authenticate_form"}   <!--- start form  --> 
- slot{"name": "Sam"}    
- slot{"name_last": "Johns"}  
- form{"name": null}    <!--- finish  form.  This is set when the form has filled all of its required slots  --> 

Not sure, if this is the correct way, but it seems to work.

Lastly, let me explain my custom form which asks all relevent questions. If you need to collect multiple pieces of information (name, name_last, birthday,…) in a row, Rasa recommends to create a FormAction . This is a single action which contains the logic to loop over the required slots and ask the user for this information. As far as I understand, this is where I set the slots.

class AuthenticateForm(FormAction):

    def name(self):
        # type: () -> Text
        return "authenticate_form"

    @staticmethod
    def required_slots(tracker):
        # type: () -> List[Text]
      
        return ["name", "name_last", "birthday"]

    def submit(self, dispatcher, tracker, domain):
        # type: (CollectingDispatcher, Tracker, Dict[Text, Any]) -> List[Dict]

        return []

    def slot_mappings(self):
        # type: () -> Dict[Text: Union[Dict, List[Dict]]]
        return {
            "name": [self.from_entity(entity="name", not_intent=["chitchat"])],
            "name_last": [self.from_entity(entity="name_last", not_intent=["chitchat"])],
            "birthday": [self.from_entity(entity="birthday", not_intent=["chitchat"])]
        }

    def validate(self,
                 dispatcher: CollectingDispatcher,
                 tracker: Tracker,
                 domain: Dict[Text, Any]) -> List[Dict]:

        ....

        # validation succeed, set the slots values to the extracted values
        return [SlotSet(slot, value) for slot, value in slot_values.items()]

So, these are all potential error sources that I can think of.

Note: Setting the slots the way I explained above is working! The bot is excatly doing what it is supposed to do. However, each time I set the slot, I get this warning, that I mentioned earlier.