From 638b8a99845429a970d354f7a2ca58cea98c78fc Mon Sep 17 00:00:00 2001 From: Tony Hung Date: Thu, 26 Oct 2017 08:43:52 -0400 Subject: [PATCH] added logging fixed issue with sentiment analysis --- WS-node/.vscode/launch.json | 11 ++--------- WS-node/lib/asrClient.js | 14 +++++++------- 2 files changed, 9 insertions(+), 16 deletions(-) diff --git a/WS-node/.vscode/launch.json b/WS-node/.vscode/launch.json index 22ce6df..92366e9 100644 --- a/WS-node/.vscode/launch.json +++ b/WS-node/.vscode/launch.json @@ -1,5 +1,5 @@ { - // Use IntelliSense to learn about possible Node.js debug attributes. + // Use IntelliSense to learn about possible attributes. // Hover to view descriptions of existing attributes. // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", @@ -8,14 +8,7 @@ "type": "node", "request": "launch", "name": "Launch Program", - "program": "${workspaceRoot}/app.js", - "cwd": "${workspaceRoot}" - }, - { - "type": "node", - "request": "attach", - "name": "Attach to Process", - "port": 5858 + "program": "${workspaceFolder}/app.js" } ] } \ No newline at end of file diff --git a/WS-node/lib/asrClient.js b/WS-node/lib/asrClient.js index ef0f96f..cd78b95 100644 --- a/WS-node/lib/asrClient.js +++ b/WS-node/lib/asrClient.js @@ -82,20 +82,20 @@ function AsrClient () { }) socket.on('sentiment estimate', (msg) => { - //console.log('sentiment: ', msg) - let x = JSON.parse(msg) + let x = JSON.parse(msg)[0] + console.log('sentiment: ', x) self.emit('sentiment', x) }) socket.on('basic keywords event', (msg) => { - //console.log('kw: ', msg) let x = JSON.parse(msg) + console.log('basic keywords event: ', x) self.emit('keywords', x) }) socket.on('nlp event', (msg) => { - //console.log('nlp: ', msg) let x = JSON.parse(msg) + console.log('nlp: ', x) self.emit('nlp', x) }) '' @@ -131,12 +131,12 @@ function AsrClient () { var object = new Object() object.item = item.p object.time = (tsinceEngineStarted -item.s)/1000.0 - console.log("item", item); + // console.log("item", item); - + console.log("latency", object); self.emit('latency',object) self.transcript.push(item) @@ -148,7 +148,7 @@ function AsrClient () { var text = '' self.transcript.forEach((item, index, array) => { text = text + ' ' + item.w - console.log("item.w " + item.w); + // console.log("item.w " + item.w); if (item.w == "action" || item.w == "actions" ) { newIndex = index }