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

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

6f36ff3943be908c5d2259f4aef09ea6?s=47 Jun Watanabe
December 22, 2016

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

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

6f36ff3943be908c5d2259f4aef09ea6?s=128

Jun Watanabe

December 22, 2016
Tweet

Transcript

  1. ࡓ͑ͯΔ൴ঁͷҭ͔ͯͨ 2016/12/22 ࡶฌMeetUp #8 Jun Watanabe B o t

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

    • ࠷ۙ͸ࣾ಺Πϯϑϥ͹͔Γ • http://rela.red/
  3. http://asuka-zero.jp/

  4. ChatOps ஌ͬͯ·͔͢?

  5. ChatOps = DevOpsͷҰ෦ 1೔10σϓϩΠग़དྷΕ͹৭ʑḿΔ! ࣮ݱͷͨΊ։ൃͱӡ༻ΛҰମԽ͠Α͏! ͍Ζ͍Ζۀ຿վળ͠Α͏!

  6. ChatOps ࡞ۀͷଐਓԽΛ๷͍͗ͨ! πʔϧͷઆ໌ॻ࡞੒ͱ͔େม! શ෦νϟοτͰग़དྷΔΑ͏ʹ͠Α͏!

  7. ϝϦοτ • ͱΓ͋͑ͣ࿩͔͚͠Ε͹ͳΜͱ͔ͳΔͷ Ͱɺॳظֶशίετ͕গͳ͍ • νϟοτϩά=࡞ۀϩά άϧʔϓνϟο τͰ΍ͬͯݟ͑ΔԽ! • ࡞ۀ͕֤छπʔϧʹލ͍ͬͯͯ΋ҙࣝ͢

    Δ͜ͱແ͘࡞ۀͰ͖Δ • εϚϗ౳Ͱ΋νϟοτ͕࢖͑Ε͹OK
  8. Slack App Directory

  9. ORATTA ΦϦδφϧBot

  10. None
  11. σϓϩΠʹඞཁͳ৘ใ • ΞϓϦ໊ • ؀ڥ໊(ຊ൪ or εςʔδ؀ڥ) • Git໊ •

    ίϝϯτ
  12. None
  13. None
  14. ͍͍ͪͪฉ͔ΕΔͷ ໘౗͍͘͞!!

  15. None
  16. None
  17. ΋ͬͱ༥௨Λޮ͔ͤͯཉ͍͠!

  18. Ͳ͏͢Ε͹Α͍͔? BotͷධՁج४͸? νϡʔϦϯάςετ?

  19. Beer Test

  20. ͦͷBotͱҰॹʹ ҿΈʹߦ͖͍͔ͨ?

  21. Ѫ͞ΕΔଘࡏʹͳΔͨΊʹ ΍ͬͨ͜ͱ

  22. 1.ࡶஊର࿩

  23. Before

  24. After

  25. After

  26. ͪΐͬͱͨ͠ฦ౴Ͱ΋خ͍͠!

  27. ർΕͨͱ͖ʹ ༊΍ͯ͘͠ΕΔ

  28. Docomo ࡶஊର࿩API https://dev.smt.docomo.ne.jp/? p=docs.api.page&api_name=dialogue&p_name=api_1

  29. 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); });
  30. ͠ΓͱΓ

  31. ਓ֨͸3छྨ

  32. ؔ੢หϞʔυ

  33. ੺ͪΌΜϞʔυ

  34. 2.ࣗવݴޠೖྗղੳ

  35. Before

  36. After

  37. After

  38. ࣗવʹ࿩͔͚͠Δ͚ͩͰ ಺༰Λཧղͯ͘͠ΕΔ

  39. Microsoft LUIS Language Understanding Intelligent Service https://www.luis.ai/

  40. Botʹ࿩͔͚͠ΒΕΔ಺༰͸ ܗ͕༷ࣜʑ

  41. ྫ) ϨΠϰͷϚελʔ൓ө͓ئ͍͠·͢ɻεςʔδ Ͱ͢ɻ ը૾ΛΞεΧZEROຊ൪൓ө͓ئ͍͠·͢ʘ (^o^)ʗ ϦιʔεϑΝΠϧΛΫϩఉͷຊ൪ʹσϓϩΠ͠ ͍ͯͩ͘͞! BLEACHͷϓϩάϥϜϓϩμΫτ൓өOKͰ͢!

  42. શͯʹରԠग़དྷΔΑ͏ͳ ਖ਼نදݱͱ͔...

  43. શͯʹରԠग़དྷΔΑ͏ͳ ਖ਼نදݱͱ͔...

  44. None
  45. 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’]); } });
  46. ฦΓ஋ྫ { "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 } ] }
  47. None
  48. ͲͷՕॴ͕ Կͷཁૉͳͷ͔ ෼͔Ε͹ ͋ͱ͸ਖ਼نදݱ

  49. After

  50. ࠷ॳ͸ ࠜؾΑ͘ ௐڭ͢Δ

  51. LUISͰ἞ΈऔΕ ͳ͔ͬͨ৘ใ͚ͩ ฉ͍ͯ͋͛Δ

  52. LUIS͕ࡶஊͩͱ ൑அͨ͠Β ࡶஊର࿩APIʹ ౤͛Δ

  53. Let’s Beer!