I want to train a bot based on the certain keywords, i.e. if the keywords are available in the text, the NLU should classify intents accordingly. As of now I have trained the bot with around 30 keywords or phrases (2-3 words in a phrase), but the results are not accurate at all.
How can I train the bot to get most accurate results?
And is there any API to enter the intents as well as utterances rather than UI?
Hi @ruchi , by highlighting some keywords/placeholders in the possible utterances within a intent, you can make it more accurate. This will use the concept of slots and considers a placeholder as a value to be filled in.
Thanks for the revert.
But is it not possible to train the model by using keywords only? Or does it have to be sentences only?
Its possible to train the bot using only keywords for an intent, however the accuracy will be better if we use commonly used sentences containing keywords.
Eventually NLU will be detected based on the confidence level (a score between with value between 0 to 1) so its better to provide as much information and phrased form as possible for the training.
Our current NLU engine has very little to know knowledge of basic grammar and syntax. Keywords should be enough for the engine to classify intents.
Also, while entities do slightly impact classification, slots don’t impact classification at all.
Just make sure, your training utterances looks like what you expect to receive at predict time (when users chat with your bot). Words of all grammatical function are taken into account when we compute the “meaning” of a utterance.
Also, keep in mind the form of your utterances is not the only things that impact the overall accuracy of your bot.
Few information might help me diagnosticate your problem / help your bot perform better:
- How many intents do you have ?
- How many utterances is there per intent ?
- Is there a lot of “topic-overlapping” between intents ? Are they well “topic-separated” ?
- What does your test set look like ? What makes you say the NLU performances are weak ? What score/accuracy do you get ?
Keep in mind that Botpress is highly customizable and that you can always fully replace the NLU for an another implementation if you want (Something more keyword-proof for instance). As long as
event.nlu keeps the same interface.
I hope this information helps,
Botpress-NLU code owner
The endpoint to train a bot is the following
## Get your Token Bearer $ curl --request POST \ --url http://localhost:3001/api/v1/auth/login/basic/default \ --header 'content-type: application/x-www-form-urlencoded' \ --data firstname.lastname@example.org \ --data password=botpress ## Train a bot $ curl 'http://localhost:3001/api/v1/bots/<BOT_NAME>/mod/nlu/train/en' \ -H 'Accept: application/json, text/plain, */*' \ -H 'Authorization: Bearer <YOUR_TOKEN>' \ --data-raw ''
Where to find a
- In the config.json bot
- In the URL