Skip to content

Instantly share code, notes, and snippets.

View y-some's full-sized avatar

Yasuyuki SOMEYA y-some

  • IBM Global Services Japan Solution and Services Co. (ISOL)
  • Hokkaido, Japan
View GitHub Profile
@y-some
y-some / RaspberryPi-Watson-Main.json
Last active March 10, 2018 13:01
[Raspberry Pi] [Watson] スマートスピーカー「もどき」を作ってみた|メインフロー
[{"id":"bc54ad34.d98e6","type":"http request","z":"9624e338.2d34f","name":"","method":"GET","ret":"txt","url":"","tls":"","x":570,"y":400,"wires":[["98276d4d.dc3ca"]]},{"id":"354efb96.d67044","type":"function","z":"9624e338.2d34f","name":"URIエンコード","func":"var rawText = msg.payload;\nvar encodedText = encodeURI(rawText);\nmsg.payload = encodedText;\nreturn msg;","outputs":1,"noerr":0,"x":400,"y":340,"wires":[["bc54ad34.d98e6"]]},{"id":"98276d4d.dc3ca","type":"watson-text-to-speech","z":"9624e338.2d34f","name":"","lang":"ja-JP","langhidden":"ja-JP","langcustom":"NoCustomisationSetting","langcustomhidden":"","voice":"ja-JP_EmiVoice","voicehidden":"","format":"audio/wav","password":"","payload-response":true,"default-endpoint":true,"service-endpoint":"https://stream.watsonplatform.net/text-to-speech/api","x":720,"y":300,"wires":[["8256ba41.e152d8","59efe6c9.4fd578"]]},{"id":"8256ba41.e152d8","type":"play audio","z":"9624e338.2d34f","name":"","voice":"0","x":910,"y":340,"wires":[]},{"id":"af1dab82.9b1758","type":
@y-some
y-some / RaspberryPi-Watson-Switch.json
Last active March 10, 2018 13:01
[Raspberry Pi] [Watson] スマートスピーカー「もどき」を作ってみた|タクトスイッチ
[{"id":"7f846f46.1afc2","type":"rpi-gpio out","z":"65a30a60.c6e594","name":"","pin":"22","set":true,"level":"0","freq":"","out":"out","x":500,"y":140,"wires":[]},{"id":"a332ecf9.4f29","type":"rpi-gpio in","z":"65a30a60.c6e594","name":"","pin":"18","intype":"tri","debounce":"25","read":false,"x":81,"y":138,"wires":[["f213f6c6.817a28"]]},{"id":"f213f6c6.817a28","type":"switch","z":"65a30a60.c6e594","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"str"},{"t":"neq","v":"1","vt":"str"}],"checkall":"true","outputs":2,"x":210,"y":140,"wires":[["4da7a752.80edb8"],["6272cc7d.9ec4e4"]]},{"id":"4da7a752.80edb8","type":"change","z":"65a30a60.c6e594","name":"set HIGH","rules":[{"t":"set","p":"payload","pt":"msg","to":"1","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":340,"y":80,"wires":[["7f846f46.1afc2","aaa2448f.edcb68"]]},{"id":"6272cc7d.9ec4e4","type":"change","z":"65a30a60.c6e594","name":"set LOW","rules":[{"t":"set","p":"payload","pt":"msg","to":"0","tot
@y-some
y-some / RaspberryPi-Watson-ServerSide.json
Last active March 18, 2018 14:26
[Raspberry Pi] [Watson] スマートスピーカー「もどき」を作ってみた|サーバーサイド
[{"id":"dc56bffc.823a","type":"watson-conversation-v1","z":"4618dbfd.5b31b4","name":"","workspaceid":"","multiuser":false,"context":true,"empty-payload":false,"default-endpoint":true,"service-endpoint":"https://gateway.watsonplatform.net/conversation/api","x":357,"y":201,"wires":[["3d6cd8e1.85fd58"]]},{"id":"3d6cd8e1.85fd58","type":"change","z":"4618dbfd.5b31b4","name":"回答テキスト抽出","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.output.text[0]","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":396,"y":262,"wires":[["accb9530.921ef8"]]},{"id":"7ef474c3.8cb07c","type":"switch","z":"4618dbfd.5b31b4","name":"","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"null","vt":"str"},{"t":"neq","v":"null","vt":"str"}],"checkall":"true","outputs":2,"x":349,"y":134,"wires":[["b83a7007.5b5f3"],["dc56bffc.823a"]]},{"id":"accb9530.921ef8","type":"switch","z":"4618dbfd.5b31b4","name":"後続処理判定","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"weather","vt":"str"}
@y-some
y-some / Watson-Discovery-Node-RED.json
Created November 30, 2017 23:37
[Watson] [Node-RED] 質問応答システムを作ってDiscoveryを試してみた
[{"id":"26540529.0c454a","type":"http in","z":"a195c64e.53d308","name":"","url":"/discovery","method":"get","swaggerDoc":"","x":117,"y":84,"wires":[["57bd9617.787298"]]},{"id":"31e0d518.ddfc1a","type":"debug","z":"a195c64e.53d308","name":"Debug","active":true,"console":"false","complete":"search_results","x":478.687744140625,"y":320.41363525390625,"wires":[]},{"id":"e4ed0398.b8788","type":"function","z":"a195c64e.53d308","name":"回答取り出し","func":"if (msg.search_results.results.length > 0 && msg.search_results.results[0].text) {\n msg.payload = msg.search_results.results[0].text;\n} else {\n msg.payload = \"回答できません\";\n}\nreturn msg;\n","outputs":1,"noerr":0,"x":576,"y":527,"wires":[["c7643c2e.2f56f","368fb630.16185a"]]},{"id":"b31b960b.159038","type":"http response","z":"a195c64e.53d308","name":"","x":400.2205810546875,"y":83.25299072265625,"wires":[]},{"id":"39f97af7.3720b6","type":"change","z":"a195c64e.53d308","name":"質問文の取り出し","rules":[{"t":"set","p":"discoveryparams.query","pt":"msg","to":"payload.q"