Pedro Pinto
Pedro Pinto

Reputation: 179

My model can't find any entities

I'm testing NLP tools and right now I'm facing a problem with Rasa NLU.

With API.AI, Wit.ai and LUIS.AI I could find the entities I want with no more than 8-10 examples. With Rasa, on the other hand, I already have 18 examples and I could never find an entity. Even if my query matches exactly one of my examples, I still have an empty entities array as the result.

I'm using Rasa with the recommended Docker instance and my current pipeline is ["nlp_spacy", "tokenizer_spacy", "intent_featurizer_spacy", "ner_crf", "ner_synonyms", "intent_classifier_sklearn" and "ner_duckling"].

I specify my project and my model within my query, like this:

localhost:5000/parse?q=my_sentence&project=my_project&model=my_model

Any useful information is appreciated. Thank you!

Update with examples

{
       "text": "How can I make a carrot cake?",
       "intent": "AskRecipe",
       "entities": [
          {
            "start": 17,
            "end": 27,
            "value": "carrot cake",
            "entity": "recipe"
          }  
       ]
  },
  {
       "text": "What do I need to make a Lemon Pie?",
       "intent": "AskRecipe",
       "entities": [
         {
           "start": 25,
           "end": 33, 
           "value": "Lemon Pie",
           "entity": "recipe"
         }  
       ]
  },
  {
      "text": "What do I need to make brownies?",
      "intent": "AskRecipe",
      "entities": [
         {
           "start": 23,
           "end": 30,
           "value": "brownies",
           "entity": "recipe"
         }  
       ]
   }

Then when I try, for instance, to extract information from "What do I need to make brownies?" (which is also listed as a example) this is the result:

{"entities": [], "intent": {"confidence": 0.8870822891508189, "name": "AskRecipe"}, "text": "What do I need to make brownies?", "intent_ranking": [{"confidence": 0.8870822891508189, "name": "AskRecipe"}, {"confidence": 0.11291771084918109, "name": "greet"}]}

I tried many other examples, but none of them worked.

Upvotes: 2

Views: 1720

Answers (2)

Parvathy Sarat
Parvathy Sarat

Reputation: 393

I had the same issue of Rasa not recognizing entities. I see you've solved the issue in a different way, I'll just add what worked for me cos I see the same mistake I made, in the examples posted -

The end value must be ('start' index) + (length of 'value') so it should be every 'end' value shown here +1.

I know it's very simple, but it worked for me.

Upvotes: 1

Pedro Pinto
Pedro Pinto

Reputation: 179

I solved this problem.

In my config.json file, I updated my pipeline value to "scapy_sklearn" as opposed to ["nlp_spacy", "tokenizer_spacy", "intent_featurizer_spacy", "ner_crf", "ner_synonyms", "intent_classifier_sklearn" and "ner_duckling"].

Also, I restarted my docker instance after I trained a new model.

I must say, though, the docker instance with which I succeeded is not the same as the one I was using when I posted this issue, so, honestly, I can't be 100% sure I didn't break any configuration before - although I believe I didn't.

I hope this helps someone :)

Upvotes: 3

Related Questions