Pradyumna Das
Tera Expert
Options
- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 10-10-2023 11:20 AM
Hi Experts,
In this article, I have added the code to get the NLU Prediction result based on our model and utterance.
Execute the below code in the background script to test :
try {
var modelId='<<Add you model sysID>>';//NLU Model sys_id
var utterance='coffee with prady';// add the utterance
if (modelId && utterance) {
var result = global.NLUStudioPredictor.testUtterance(modelId, utterance);
//gs.info(JSON.stringify(result));//print the result
if(result.status=='success'){
gs.info(result.message.intents[0].intentName);//Print the predicted Intent Name
gs.info(parseInt(result.message.intents[0].score)*100);//print the accuracy score in % wrt utterance
}
} else {
gs.info("Invalid input data provided");
}
} catch (e) {
gs.info('Error+++++++++ '+e);
}
Please mark this helpful if this helps you in any manner.
Thanks,
Pradyumna Das
Labels:
- 481 Views