Upgrade to Pro — share decks privately, control downloads, hide ads and more …

冴えてるBotの育てかた / cool_bot

Jun Watanabe
December 22, 2016

冴えてるBotの育てかた / cool_bot

presented on #zohyomeetup vol.8 https://zohyo.connpass.com/event/44940/

Jun Watanabe

December 22, 2016
Tweet

More Decks by Jun Watanabe

Other Decks in Programming

Transcript

  1. Jun Watanabe @rela1470 • ORATTA, Inc. Chief Engineer • PHPer

    • ࠷ۙ͸ࣾ಺Πϯϑϥ͹͔Γ • http://rela.red/
  2. BotKitͰͷ࣮૷ྫ var context = ''; var mode = 'dialog'; var

    place = '౦ژ'; var options = { url: 'https://api.apigw.smt.docomo.ne.jp/dialogue/v1/dialogue?APIKEY=xxxxx', json: { utt: message.text, place: place, context: context, mode: mode } } //ϦΫΤετૹ৴ request.post(options, function (error, response, body) { context = body.context; mode = body.mode; bot.reply(message, body.utt); });
  3. BotKitͰͷ࣮૷ྫ var massage_text = encodeURI(message.text); var url = 'https://api.projectoxford.ai/luis/v2.0/apps/xxx? subscription-key=xxx&verbose=true&q='

    + massage_text; request( url, function( error, response, body ){ if( !error && response.statusCode == 200 ){ console.dir(json[‘entities’]); } });
  4. ฦΓ஋ྫ { "query": "ΞεΧͷεςʔδʹlibΛ൓ө͓ئ͍͠·͢ɻ಺༰͸৽ػೳͷ൓өͰ͢ɻ", "topScoringIntent": { "intent": "σϓϩΠ", "score": 0.9743152

    }, "intents": [ { "intent": "σϓϩΠ", "score": 0.9743152 }, { "intent": "None", "score": 0.005910686 } ], "entities": [ { "entity": "lib", "type": "git໊", "startIndex": 9, "endIndex": 11, "score": 0.889078 }, { "entity": "εςʔδ", "type": "؀ڥ໊", "startIndex": 4, "endIndex": 7, "score": 0.789255 }, { "entity": "ΞεΧ", "type": "ΞϓϦ໊", "startIndex": 0, "endIndex": 2, "score": 0.9694294 }, { "entity": "৽ػೳͷ൓ө", "type": "ίϝϯτ", "startIndex": 0, "endIndex": 2, "score": 0.9510122 } ] }