Hi, I have successfully got my code to detect the correct intent but no entities appear even though I provided some entities in my training data.
data.json: { “common_examples”: [ { “text”:“Hello”, “intent”:“greeting”, “entities”:[] }, { “text”:“Hi”, “intent”:“greeting”, “entities”:[] }, { “text”:“I want a recipe for my lunch”, “intent”:“get_recipe”, “entities”:[ { “start”:22, “end”: 28, “value”: “lunch”, “entity”: “mealtime” } ] }, { “text”:“Can you give me a recipe for dinner tonight?”, “intent”:“get_recipe”, “entities”:[ { “start”:29, “end”:35, “value”: “dinner”, “entity”: “mealtime” } ] }, { “text”:“I don’t know what to have for lunch”, “intent”:“get_recipe”, “entities”:[ { “start”:31, “end”: 35, “value”: “lunch”, “entity”: “mealtime” } ] }, },
}
This is just a snippet. I have created 11 example sentences in total for the get_recipe intent. I just need it to pick out the entity of ‘mealtime’ as either lunch or dinner depending on how the sentence is phrased.
My config.yml is as follows:
language: “en”
pipeline:
- name: “nlp_spacy”
- name: “tokenizer_spacy”
- name: “intent_entity_featurizer_regex”
- name: “intent_featurizer_spacy”
- name: “ner_crf”
- name: “ner_synonyms”
- name: “intent_featurizer_count_vectors”
- name: “intent_classifier_tensorflow_embedding”
and this if the code I run to train the bot: from rasa_nlu.training_data import load_data from rasa_nlu.model import Trainer from rasa_nlu import config from rasa_nlu.model import Interpreter
def train_bot(data_json,config_file,model_dir): training_data = load_data(data_json) trainer = Trainer(config.load(config_file)) trainer.train(training_data) model_directory=trainer.persist(model_dir,fixed_model_name=‘vegabot’)
And the code I run to predict the intent: def predict_intent(text): interpreter = Interpreter.load(‘models/nlu/default/vegabot’) print(interpreter.parse(text))
Which produces the result: {‘intent’: {‘name’: ‘get_recipe’, ‘confidence’: 0.9701309204101562}, ‘entities’: [], ‘intent_ranking’: [{‘name’: ‘get_recipe’, ‘confidence’: 0.9701309204101562}, {‘name’: ‘greeting’, ‘confidence’: 0.03588612377643585}], ‘text’: ‘can you find me a recipe for dinner’}
As you can see the intent is correct but entities is blank [] and I can’t figure out why. Any help would be greatly appreciated.
I ran an evaluation and got: - intent examples: 12 (2 distinct intents) - Found intents: ‘greeting’, ‘get_recipe’ - entity examples: 10 (1 distinct entities) - found entities: ‘mealtime’ which all looks fine.
I’m using rasa nlu version 0.14.