<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>post NLU Utterance Prediction Using Script in Developer articles</title>
    <link>https://www.servicenow.com/community/developer-articles/nlu-utterance-prediction-using-script/ta-p/2697876</link>
    <description>&lt;P&gt;Hi Experts,&lt;/P&gt;
&lt;P&gt;In this article, I have added the code to get the NLU Prediction result based on our model and utterance.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Execute the below code in the background script to test :&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;try {
    var modelId='&amp;lt;&amp;lt;Add you model sysID&amp;gt;&amp;gt;';//NLU Model sys_id
    var utterance='coffee with prady';// add the utterance
    if (modelId &amp;amp;&amp;amp; 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);
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Please mark this helpful if this helps you in any manner.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Thanks,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Pradyumna Das&lt;/FONT&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 10 Oct 2023 18:20:58 GMT</pubDate>
    <dc:creator>Pradyumna Das</dc:creator>
    <dc:date>2023-10-10T18:20:58Z</dc:date>
    <item>
      <title>NLU Utterance Prediction Using Script</title>
      <link>https://www.servicenow.com/community/developer-articles/nlu-utterance-prediction-using-script/ta-p/2697876</link>
      <description>&lt;P&gt;Hi Experts,&lt;/P&gt;
&lt;P&gt;In this article, I have added the code to get the NLU Prediction result based on our model and utterance.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Execute the below code in the background script to test :&lt;BR /&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="javascript"&gt;try {
    var modelId='&amp;lt;&amp;lt;Add you model sysID&amp;gt;&amp;gt;';//NLU Model sys_id
    var utterance='coffee with prady';// add the utterance
    if (modelId &amp;amp;&amp;amp; 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);
}&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Please mark this helpful if this helps you in any manner.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Thanks,&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="arial,helvetica,sans-serif"&gt;Pradyumna Das&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 18:20:58 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-articles/nlu-utterance-prediction-using-script/ta-p/2697876</guid>
      <dc:creator>Pradyumna Das</dc:creator>
      <dc:date>2023-10-10T18:20:58Z</dc:date>
    </item>
  </channel>
</rss>

