I am following the guide here: Python API to test out a custom intent. I notice that unless my training data json has more than one intent, the python API consistently returns no found intents.
Training data:
{
"rasa_nlu_data": {
"regex_features": [],
"common_examples": [
{
"text": "what is the temperature today?",
"intent": "intent_3"
},
{
"text": "what is the weather today?",
"intent": "intent_3"
},
{
"text": "will it rain today?",
"intent": "intent_3"
}
],
"lookup_tables": [],
"entity_synonyms": []
}
}
Config:
language: en
pipeline: pretrained_embeddings_spacy
Code:
from rasa_nlu.training_data import load_data
from rasa_nlu.model import Trainer
from rasa_nlu import config
training_data = load_data('training_data.json)
trainer = Trainer(config.load("config.yml"))
trainer.train(training_data)
model_directory = trainer.persist('model_dir')
from rasa_nlu.model import Interpreter
interpreter = Interpreter.load(model_directory)
interpreter.parse("what is the weather today?")
Response with one intent:
{'intent_ranking': [], 'entities': [], 'text': 'what is the weather today?', 'intent': None}
I found that if I add another intent to the common examples of my training data, then I get a good response:
New training Data:
{
"rasa_nlu_data": {
"regex_features": [],
"common_examples": [
{
"text": "what is the temperature today?",
"intent": "intent_3"
},
{
"text": "what is the weather today?",
"intent": "intent_3"
},
{
"text": "will it rain today?",
"intent": "intent_3"
},
{
"text": "how much does that cost?",
"intent": "intent_4"
},
{
"text": "what is the price?",
"intent": "intent_4"
}
],
"lookup_tables": [],
"entity_synonyms": []
}
}
Response with new training data:
{'intent_ranking': [{'confidence': 0.8170498642280895, 'name': 'intent_3'}, {'confidence': 0.18295013577191052, 'name': 'intent_4'}], 'entities': [], 'text': 'what is the weather today?', 'intent': {'confidence': 0.8170498642280895, 'name': 'intent_3'}}
Why I am I seeing this behavior? Is it possible to train exactly one intent?