Handling Response

The response can be received the using the io_client object created while initiating the stream.

Code for Handling the output in Node.js

io_client.on('output', function (output) {
      let sentiment_op = output_obj['sentiment']
      console.log('Sentiment:  '+sentiment_op)
      let tone_op = output_obj['tone']
      console.log('Tone:  '+tone_op)
      let intent_op = output_obj['intent']
      console.log('Intent:  '+intent_op)
      let emotion_op = output_obj['emotion']
      console.log('emotion:  '+emotion_op)
      let dialogTag_op = output_obj['dialogTag']
      console.log('dialogTag:  '+dialogTag_op)
      let sqc_op = output_obj['sqc']
      console.log('sqc:  '+sqc_op)


The entire analysis from the real time stream would be streamed by Marsview Realtime API to the websocket endpoint output .This response will include intent analysis, tone analysis and sentiment analysis. The output will vary base on what the user has requested for. If the user has only requested for sentiment analysis, only that will be processed.

Example Response

Given below is the response object that is sent on the stream back to the Client.

 'sentence': 'sample transcript here',
 'channelId': 'channel-denj16kuxzv8lu-1634642379856',
 'clientId': 'rnoPRoG6YruFs7CbAAAD',
 'txnId': 'txn-denj16kuxzv8lt-1634642379855'
 'startTime': '1',
 'endTime': '2', 
 'dialogTag': 'statement-non-opinion',
 'customStatementTag': { "similarityMatch": [{
                        "statementTagId": "statement-bxllq1zsuzkvuj44go-1636609624728",
                        "statementTagName": "compliance-quality-check"
                        "matchedTextList": [ {
                            "score": 0.5230883955955505,
                            "text": "This call is going to be recorded for quality purposes.",
                            "value": "This call will be recorded" } ], } ] 
 'emotion': { 'labels': [ { 'confidence': 0.975735604763031,
                             'value': 'NEUTRAL'}],
               'text': 'sample transcript here'},
 'intent': { 'similarityMatch': [ { 'matchedTextList': [],
                           'intentId': 'intent-bxllq2f7hpkrvtyzi3-1627981197627',
                           'intentName': 'Credit Card'},
                         { 'matchedTextList': [],
                           'intentId': 'intent-bxllq2f7hpkrvtzlkf-1627981226223',
                           'intentName': 'Card Limit'}],
 'sentenceId': '09ac1196-6f14-40d3-a379-7e0d832d6384-sentence',
 'sentiment': { 'avgPolarity': 0,
                 'avgSentiment': 'Neutral',
                 'avgSubjectivity': 0,
                 'content': [ { 'phrase': 'sample transcript here',
                                'polarity': 0,
                                'sentiment': 'Neutral',
                                'subjectivity': 0}],
                 'sentence': 'sample transcript here'},

 'tone': {'label': 'happy', 'score': '0.9999918'},
 'sqc': {'confidence': 0.7820923328399658, 'value': 'statement'}

Last updated