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

1
io_client.on('output', function (output) {
2
if(output_obj['sentiment']){
3
let sentiment_op = output_obj['sentiment']
4
console.log('Sentiment: '+sentiment_op)
5
}
6
if(output_obj['tone']){
7
let tone_op = output_obj['tone']
8
console.log('Tone: '+tone_op)
9
}
10
if(output_obj['intent']){
11
let intent_op = output_obj['intent']
12
console.log('Intent: '+intent_op)
13
}
14
if(output_obj['emotion']){
15
let emotion_op = output_obj['emotion']
16
console.log('emotion: '+emotion_op)
17
}
18
if(output_obj['dialogTag']){
19
let dialogTag_op = output_obj['dialogTag']
20
console.log('dialogTag: '+dialogTag_op)
21
}
22
if(output_obj['sqc']){
23
let sqc_op = output_obj['sqc']
24
console.log('sqc: '+sqc_op)
25
}
26
27
});
Copied!
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.
1
{
2
'sentence': 'sample transcript here',
3
'channelId': 'channel-denj16kuxzv8lu-1634642379856',
4
'clientId': 'rnoPRoG6YruFs7CbAAAD',
5
'txnId': 'txn-denj16kuxzv8lt-1634642379855'
6
'startTime': '1',
7
'endTime': '2',
8
'dialogTag': 'statement-non-opinion',
9
'customStatementTag': { "similarityMatch": [{
10
"statementTagId": "statement-bxllq1zsuzkvuj44go-1636609624728",
11
"statementTagName": "compliance-quality-check"
12
"matchedTextList": [ {
13
"score": 0.5230883955955505,
14
"text": "This call is going to be recorded for quality purposes.",
15
"value": "This call will be recorded" } ], } ]
16
},
17
'emotion': { 'labels': [ { 'confidence': 0.975735604763031,
18
'value': 'NEUTRAL'}],
19
'text': 'sample transcript here'},
20
21
'intent': { 'similarityMatch': [ { 'matchedTextList': [],
22
'intentId': 'intent-bxllq2f7hpkrvtyzi3-1627981197627',
23
'intentName': 'Credit Card'},
24
{ 'matchedTextList': [],
25
'intentId': 'intent-bxllq2f7hpkrvtzlkf-1627981226223',
26
'intentName': 'Card Limit'}],
27
},
28
'sentenceId': '09ac1196-6f14-40d3-a379-7e0d832d6384-sentence',
29
'sentiment': { 'avgPolarity': 0,
30
'avgSentiment': 'Neutral',
31
'avgSubjectivity': 0,
32
'content': [ { 'phrase': 'sample transcript here',
33
'polarity': 0,
34
'sentiment': 'Neutral',
35
'subjectivity': 0}],
36
'sentence': 'sample transcript here'},
37
38
'tone': {'label': 'happy', 'score': '0.9999918'},
39
'sqc': {'confidence': 0.7820923328399658, 'value': 'statement'}
40
}
Copied!
Last modified 7d ago