Analyzing Tweets with Watson Natural Language Understanding and Visual Recognition

Analyzing Tweets with Watson Natural Language Understanding and Visual Recognition

Alayzing Tweets with IBM Watson made easy with Node Red

[{"id":"903b3b4b.95fed8","type":"twitter in","z":"93c670de.ca0fc","twitter":"","tags":"#robots,#robotics,#Artificialintelligence,#MachineLearning,#DeepLearning","user":"false","name":"","topic":"tweets","inputs":0,"x":93.05558013916016,"y":240.13894367218018,"wires":[["4fdc1250.de066c"]]},{"id":"f9c6a54d.3d1468","type":"debug","z":"93c670de.ca0fc","name":"","active":false,"console":"false","complete":"payload","x":552.1667022705078,"y":201.33330154418945,"wires":[]},{"id":"15047da9.9d8f72","type":"inject","z":"93c670de.ca0fc","name":"","topic":"","payload":"Kerith Burke: Gimme more tech for sports, like a fantasy football performance predictor... https://t.co/0TCk02fhdK","payloadType":"str","repeat":"","crontab":"","once":false,"x":250.00001907348633,"y":553.3333358764648,"wires":[["4227248b.3e01ec"]]},{"id":"8d41cacc.ee8e68","type":"debug","z":"93c670de.ca0fc","name":"","active":true,"console":"false","complete":"true","x":1056.6666870117188,"y":181.6666440963745,"wires":[]},{"id":"4227248b.3e01ec","type":"function","z":"93c670de.ca0fc","name":"","func":"msg = \n{payload:msg.payload,nlu_options:\n{entity_model:\"10:48b15d17-5302-43fd-b552-637dcd8ad0d0\",\n relations_model:\"10:48b15d17-5302-43fd-b552-637dcd8ad0d0\"    \n}};\nreturn msg;","outputs":1,"noerr":0,"x":652.9999847412109,"y":418.66663455963135,"wires":[["161a0907.b15947"]]},{"id":"f5329077.ec77a","type":"change","z":"93c670de.ca0fc","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"","fromt":"str","to":"","tot":"str"},{"t":"set","p":"nome","pt":"global","to":"tweet.user.name","tot":"msg"},{"t":"set","p":"foto","pt":"global","to":"tweet.user.profile_image_url","tot":"msg"},{"t":"set","p":"local","pt":"global","to":"tweet.user.location","tot":"msg"},{"t":"set","p":"texto","pt":"global","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":325.99999237060547,"y":346.33330154418945,"wires":[["4227248b.3e01ec","e17953c8.93f9a","bd4efccd.fa1a7","3bb6d32.8a13f2c","d2a4e40.bfc0e2","b71308db.530358"]]},{"id":"e17953c8.93f9a","type":"function","z":"93c670de.ca0fc","name":"","func":"msg.payload = msg.tweet.user.name + \": \" + msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":426.0000305175781,"y":290.9999485015869,"wires":[["f9c6a54d.3d1468","7c889da5.c047c4"]]},{"id":"7c889da5.c047c4","type":"debug","z":"93c670de.ca0fc","name":"","active":false,"console":"false","complete":"true","x":537.3333587646484,"y":236.6666660308838,"wires":[]},{"id":"632909da.ee4678","type":"ui_gauge","z":"93c670de.ca0fc","name":"","group":"6f0c1805.d27a28","order":5,"width":0,"height":0,"gtype":"wave","title":"Count","label":"Tweets","format":"{{value}}","min":0,"max":"6666666","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":498.33335876464844,"y":805.6667292118073,"wires":[]},{"id":"bd4efccd.fa1a7","type":"function","z":"93c670de.ca0fc","name":"","func":"context.global.cont = context.global.cont || 0;\ncontext.global.cont++;\nmsg.payload = context.global.cont;\nreturn msg;","outputs":1,"noerr":0,"x":307.66672134399414,"y":816.6666078567505,"wires":[["632909da.ee4678"]]},{"id":"267bf073.7af5c","type":"ui_text","z":"93c670de.ca0fc","group":"6f0c1805.d27a28","order":1,"width":"6","height":"1","name":"","label":"Tweet Author","format":"{{msg.payload}}","layout":"row-spread","x":586.000057220459,"y":771.9999485015869,"wires":[]},{"id":"3bb6d32.8a13f2c","type":"function","z":"93c670de.ca0fc","name":"","func":"msg.payload = context.global.nome;\nreturn msg;","outputs":1,"noerr":0,"x":321.33337020874023,"y":850.9999694824219,"wires":[["267bf073.7af5c"]]},{"id":"efb469cb.82dcc8","type":"ui_text","z":"93c670de.ca0fc","group":"6f0c1805.d27a28","order":3,"width":"6","height":"1","name":"","label":"Location","format":"{{msg.payload}}","layout":"row-spread","x":687.8332824707031,"y":738.6667394638062,"wires":[]},{"id":"d2a4e40.bfc0e2","type":"function","z":"93c670de.ca0fc","name":"","func":"msg.payload = context.global.local;\nreturn msg;","outputs":1,"noerr":0,"x":341.5,"y":884.3332824707031,"wires":[["efb469cb.82dcc8"]]},{"id":"f3413aa9.8677b8","type":"ui_template","z":"93c670de.ca0fc","group":"6f0c1805.d27a28","name":"Tweet Image","order":4,"width":0,"height":0,"format":"<img src=\"{{msg.payload}}\" alt=\"image\" style=\"width:304px;height:228px;\">","storeOutMessages":true,"fwdInMessages":true,"templateScope":"local","x":793.6666259765625,"y":704.9999580383301,"wires":[[]]},{"id":"b71308db.530358","type":"function","z":"93c670de.ca0fc","name":"","func":"msg.payload = context.global.foto;\nreturn msg;","outputs":1,"noerr":0,"x":369.83335876464844,"y":917.0001640319824,"wires":[["f3413aa9.8677b8","f4dd534e.fe592","1c14a716.c18989"]]},{"id":"bb962438.c743b8","type":"ui_text","z":"93c670de.ca0fc","group":"6f0c1805.d27a28","order":2,"width":"6","height":"5","name":"","label":"Tweet Text","format":"{{msg.payload}}","layout":"col-center","x":1140.6666870117188,"y":246.6666440963745,"wires":[]},{"id":"e3e81042.eab92","type":"function","z":"93c670de.ca0fc","name":"","func":"msg.payload = context.global.texto;\nreturn msg;","outputs":1,"noerr":0,"x":956.6666870117188,"y":228.6666440963745,"wires":[["bb962438.c743b8"]]},{"id":"a71cb906.aceb88","type":"ui_text","z":"93c670de.ca0fc","group":"90cc1d8.c2654e","order":1,"width":"6","height":"8","name":"","label":"Natural Language Understanding","format":"{{msg.payload}}","layout":"col-center","x":1205.6666870117188,"y":295.6666440963745,"wires":[]},{"id":"394807e.b3bf6f8","type":"function","z":"93c670de.ca0fc","name":"","func":"msg.payload = msg.features;\nreturn msg;","outputs":1,"noerr":0,"x":956.6666870117188,"y":285.6666440963745,"wires":[["a71cb906.aceb88"]]},{"id":"d705c1c9.42c1b","type":"change","z":"93c670de.ca0fc","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"req.query.texto","tot":"msg"},{"t":"set","p":"resAux","pt":"global","to":"res","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":390.07582092285156,"y":655.3636255264282,"wires":[["4227248b.3e01ec"]]},{"id":"4fdc1250.de066c","type":"debug","z":"93c670de.ca0fc","name":"","active":false,"console":"false","complete":"true","x":307.3333549499512,"y":191.33334922790527,"wires":[]},{"id":"161a0907.b15947","type":"natural-language-understanding","z":"93c670de.ca0fc","name":"NLU","categories":true,"concepts":true,"maxconcepts":"8","doc-emotion":true,"doc-emotion-target":"","doc-sentiment":true,"doc-sentiment-target":"","entity":true,"entity-emotion":true,"entity-sentiment":true,"maxentities":"50","keyword":true,"keyword-emotion":true,"keyword-sentiment":true,"maxkeywords":"50","metadata":false,"relation":true,"semantic":true,"semantic-entities":true,"semantic-keywords":true,"maxsemantics":"50","x":770.8750457763672,"y":358.8890357017517,"wires":[["8d41cacc.ee8e68","e3e81042.eab92","394807e.b3bf6f8"]]},{"id":"faafb1e2.4b5c4","type":"delay","z":"93c670de.ca0fc","name":"NLU","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"5","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":248.23614501953125,"y":282.88893127441406,"wires":[["f5329077.ec77a"]]},{"id":"f4dd534e.fe592","type":"visual-recognition-v3","z":"93c670de.ca0fc","name":"","apikey":"5c542d6b5bf9ffe9306826d4a349e822a3d199fb","image-feature":"classifyImage","lang":"en","x":797.2720108032227,"y":977.123291015625,"wires":[["1a33e4ce.c2886b","27af0059.b14a1"]]},{"id":"1a33e4ce.c2886b","type":"function","z":"93c670de.ca0fc","name":"","func":"msg.payload = msg.result.images[0].classifiers;\nreturn msg;","outputs":1,"noerr":0,"x":1021.9840965270996,"y":977.6985931396484,"wires":[["bae40d73.757be"]]},{"id":"27af0059.b14a1","type":"debug","z":"93c670de.ca0fc","name":"","active":true,"console":"false","complete":"true","x":1061.904930114746,"y":863.254035949707,"wires":[]},{"id":"1c14a716.c18989","type":"visual-recognition-v3","z":"93c670de.ca0fc","name":"","apikey":"5c542d6b5bf9ffe9306826d4a349e822a3d199fb","image-feature":"detectFaces","lang":"en","x":800.0001907348633,"y":1013.7776308059692,"wires":[["cde6085e.2e7ff8","27af0059.b14a1"]]},{"id":"bae40d73.757be","type":"ui_text","z":"93c670de.ca0fc","group":"96fc9b9a.2661d8","order":1,"width":"6","height":"8","name":"","label":"Classify Image","format":"{{msg.payload}}","layout":"col-center","x":1115.746238708496,"y":1111.5873985290527,"wires":[]},{"id":"c4a2f254.732b9","type":"ui_text","z":"93c670de.ca0fc","group":"96fc9b9a.2661d8","order":2,"width":"6","height":"8","name":"","label":"Detect Faces","format":"{{msg.payload}}","layout":"col-center","x":1111.1111602783203,"y":1145.3333044052124,"wires":[]},{"id":"cde6085e.2e7ff8","type":"function","z":"93c670de.ca0fc","name":"","func":"msg.payload = msg.result.images[0].faces;\nreturn msg;","outputs":1,"noerr":0,"x":1012.2223663330078,"y":1010.8888463973999,"wires":[["c4a2f254.732b9"]]},{"id":"6f0c1805.d27a28","type":"ui_group","z":"","name":"Tweet Info","tab":"fb8ed33c.aa54","order":1,"disp":true,"width":"6"},{"id":"90cc1d8.c2654e","type":"ui_group","z":"","name":"Watson Language","tab":"fb8ed33c.aa54","order":2,"disp":true,"width":"6"},{"id":"96fc9b9a.2661d8","type":"ui_group","z":"","name":"Watson Visual","tab":"fb8ed33c.aa54","order":3,"disp":true,"width":"6"},{"id":"fb8ed33c.aa54","type":"ui_tab","z":"","name":"Tweets Live View","icon":"dashboard"}]

Flow Info

Created 7 years, 3 months ago
Updated 6 years, 10 months ago
Rating: not yet rated

Owner

Actions

Rate:

Node Types

Core
  • change (x2)
  • debug (x5)
  • delay (x1)
  • function (x10)
  • inject (x1)
Other

Tags

  • Watson
  • Visual
  • Image
  • Recognition
  • Language
  • Dashboard
  • Cognitive
  • Emotion
  • Sentiment
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option