Watson์œผ๋กœ ์‰ฝ๊ฒŒ ๋งŒ๋“œ๋Š” ์นด์นด์˜คํ†ก ChatBot

์ด ํฌ์ŠคํŒ…์„ ์‹œ์ž‘์œผ๋กœ Watson Conversation๊ณผ ์นด์นด์˜คํ†ก api๋ฅผ ํ™œ์šฉํ•˜์—ฌ ChatBot์„ ์ œ์ž‘ํ•ด ๋ณผ ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

์ด ํฌ์ŠคํŒ… ์‹œ๋ฆฌ์ฆˆ๋Š” ์ผ๋ จ์˜ Recipe์œผ๋กœ ์ˆœ์„œ๋Œ€๋กœ ๋”ฐ๋ผํ•˜๋ฉด ChatBot์„ ๊ฐœ๋ฐœํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

๋งŒ๋“ค์–ด์งˆ ChatBot์€ “ํšŒ์˜์‹ค ๊ด€๋ฆฌ์ž”๋กœ ์นด์นด์˜คํ†ก ๋Œ€ํ™”๋ฅผ ํ†ตํ•ด ํšŒ์˜์‹ค์„ ์˜ˆ์•ฝ/์ทจ์†Œ/์˜ˆ์•ฝ ์•Œ๋ฆผ ๋“ฑ์˜ ๊ธฐ๋Šฅ์„ ์ˆ˜ํ–‰ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

## ์ด ํฌ์ŠคํŒ…๊ณผ ๊ด€๋ จ๋œ ๊ธ€

## ์ด ํฌ์ŠคํŒ…๊ณผ ์—ฐ๊ฒฐ๋œ ๊ธ€ ๋ชฉ๋ก

1. Watson Conversation ์„œ๋น„์Šค๋กœ ๋Œ€ํ™” ์„œ๋น„์Šค ๋งŒ๋“ค๊ธฐ

์ฒซ๋ฒˆ ์งธ ๋‹จ๊ณ„๋กœ Watson Conversation ์„œ๋น„์Šค๋ฅผ ํ™œ์šฉํ•˜์—ฌ ๋Œ€ํ™” ์„œ๋น„์Šค๋ฅผ ๊ตฌ์ถ•ํ•ฉ๋‹ˆ๋‹ค. Watson Conversation์œผ๋กœ ๋งŒ๋“œ๋Š” ๋Œ€ํ™” ์„œ๋น„์Šค๋Š” ํ–ฅํ›„ Watson Conversation API๋ฅผ ํ†ตํ•ด Application์—์„œ RESTful API๋ฅผ ํ†ตํ•ด ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•ฉ๋‹ˆ๋‹ค.

1-1 Watson Conversation ์„œ๋น„์Šค ๊ฐœ์š”

IBM Watsonโ„ข Conversation ์„œ๋น„์Šค๋Š” ์ž์—ฐ์–ด๋ฅผ ์ดํ•ดํ•˜๊ณ  ๊ธฐ๊ณ„ ํ•™์Šต(Machine learning)์„ ์‚ฌ์šฉํ•˜์—ฌ ๊ณ ๊ฐ๊ณผ ์†Œํ†ตํ•  ๋•Œ ์‚ฌ๋žŒ์ด ํ•˜๋Š” ๋Œ€ํ™” ๋ฐฉ์‹์œผ๋กœ ์‘๋‹ตํ•˜๋Š” ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ๋งŒ๋“ค ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ค๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ์•„๋ž˜์™€ ๊ฐ™์€ ์•„ํ‚คํ…์ฒ˜์˜ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์„ ์„ค๊ณ„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

conversation_arch_overview

  • ์‚ฌ์šฉ์ž๋Š” ์—ฌ๋Ÿฌ ๋งค์ฒด๋ฅผ ํ†ตํ•ด ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜๊ณผ ์†Œํ†ตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ด ํฌ์ŠคํŒ…์—์„œ๋Š” ์›น ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜๊ณผ ์นด์นด์˜คํ†ก์ด ์‚ฌ์šฉ์ž์™€ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜ ์‚ฌ์ด์˜ ๋งค๊ฐœ์ฒด๊ฐ€ ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ ์ด ํฌ์ŠคํŒ…์„ ํ™œ์šฉํ•˜์—ฌ Slack, ํŽ˜์ด์Šค๋ถ ๋ฉ”์‹ ์ €, Twilio ๋ฌธ์ž ๋ฉ”์„ธ์ง• ์„œ๋น„์Šค ๋“ฑ ๋งŽ์€ ์ธํ„ฐํŽ˜์ด์Šค๋ฅผ ์—ฐ๋™ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Watson STT(Speech To Text)์™€ TTS(Text To Speech) ์ถ”๊ฐ€๋กœ ํ™œ์šฉํ•˜์—ฌ ๋ฌธ์ž ๋Œ€ํ™”๊ฐ€ ์•„๋‹Œ ์Œ์„ฑ ๋Œ€ํ™”๋กœ ๋งŒ๋“ค ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์€ ์‚ฌ์šฉ์ž์˜ ์ž…๋ ฅ๊ณผ Watson Conversation Service ์‚ฌ์ด์˜ ๋งค๊ฐœ์ฒด๊ฐ€ ๋ฉ๋‹ˆ๋‹ค. ์นด์นด์˜คํ†ก์œผ๋กœ๋ถ€ํ„ฐ input์„ ๋ฐ›์•„ Watson Conversation Service์— ์ „๋‹ฌํ•˜๊ณ  Watson Conversation Service๊ฐ€ ์ฃผ๋Š” ๋‹ต๋ณ€์„ ์นด์นด์˜คํ†ก์œผ๋กœ ๋‹ค์‹œ ์ „๋‹ฌํ•˜๋Š” ์—ญํ• ์„ ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
  • ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์€ ๋˜ํ•œ Back-end ์‹œ์Šคํ…œ๊ณผ ์—ฐ๋™๋˜์–ด ํ•„์š”ํ•œ ๊ฒฝ์šฐ ์•ก์…˜์„ ์ทจํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. ์ด ์˜ˆ์ œ์—์„œ๋Š” ํšŒ์˜์‹ค ์˜ˆ์•ฝ ์‹œ์Šคํ…œ๊ณผ ์—ฐ๋™ํ•˜์—ฌ ์‹ค์ œ๋กœ ํšŒ์˜์‹ค์„ ์˜ˆ์•ฝํ•˜๊ณ  ๊ด€๋ฆฌํ•˜๊ฒŒ ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค.
  • ์ง€์›๋˜๋Š” ์–ธ์–ด : ํ˜„์žฌ ์ง€์›๋˜๋Š” ์–ธ์–ด๋Š” Brazilian Portuguese, English, French, Italian, Spanish, German, Traditional Chinese, Simplified Chinese, Dutch ์ž…๋‹ˆ๋‹ค. ํ–ฅํ›„ ํ•œ๊ตญ์–ด๋„ ์ถ”๊ฐ€๋  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

1-2 Watson Conversation ์„œ๋น„์Šค ์‚ฌ์šฉ ์‹œ์ž‘ํ•˜๊ธฐ

Watson Conversation Service๋Š” Bluemix๋ฅผ ํ†ตํ•ด ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Bluemix์— ๋กœ๊ทธ์ธ ํ•œ ํ›„ Catalog์—์„œ Conversation ์„œ๋น„์Šค๋ฅผ ์ž‘์„ฑํ•ฉ๋‹ˆ๋‹ค. ์™ผ์ชฝ ์นดํ…Œ๊ณ ๋ฆฌ์—์„œ Watson์„ ์„ ํƒํ•˜๋ฉด ์„œ๋น„์Šค๋ฅผ ๋” ๋นจ๋ฆฌ ์ฐพ์„ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

bluemix-catalog-watson-conversation

1-3 Watson Conversation ์„œ๋น„์Šค๋กœ ๋Œ€ํ™” ์„œ๋น„์Šค ๋งŒ๋“ค๊ธฐ

Watson Conversation ์„œ๋น„์Šค๋Š” ๋ณ„๋„์˜ ํˆด์„ ์ œ๊ณตํ•ฉ๋‹ˆ๋‹ค. ๋ธ”๋ฃจ๋ฏน์Šค ๋Œ€์‰ฌ๋ณด๋“œ์—์„œ ์œ„ ๋‹จ๊ณ„์—์„œ ์ƒ์„ฑํ•œ ์„œ๋น„์Šค๋ฅผ ํด๋ฆญํ•œ ํ›„ Launch tool ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ ํˆด๋กœ ์ด๋™ํ•ฉ๋‹ˆ๋‹ค.

bluemix-service-dashboard

1) Workspace ๋งŒ๋“ค๊ธฐ

Workspace๋Š” ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์‚ฌ์šฉํ•˜๋Š” ๋‹จ์œ„์ž…๋‹ˆ๋‹ค. ํ•˜๋‚˜์˜ Watson Conversation Service ์ธ์Šคํ„ด์Šค ์•ˆ์— ์—ฌ๋Ÿฌ Workspace๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
Workspace๋Š” ๋‹ค์Œ๊ณผ ๊ฐ™์€ ํƒ€์ž…์˜ artifact๋กœ ์ด๋ฃจ์–ด์ง‘๋‹ˆ๋‹ค.

  • Intent : Intent๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ํ•˜๋ ค๋Š” ๋ง์˜ ๋ชฉ์ ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์šฐ๋ฆฌ๋Š” ์„œ๋น„์Šค์—์„œ ์ œ๊ณตํ•˜๊ณ ์ž ํ•˜๋Š” ์š”์ฒญ์˜ ๋ชจ๋“  ํƒ€์ž…์„ Intent๋กœ ์ •์˜ํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ๋“ค์–ด ํšŒ์˜์‹ค ์˜ˆ์•ฝ์€ ํ•˜๋‚˜์˜ Intent๊ฐ€ ๋  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Watson Conversation์—์„œ Intent๋ฅผ ์ง€์นญํ•  ๋•Œ์—๋Š” #์„ prefix๋กœ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. Intent๋ฅผ ์ •์˜ํ•  ๋•Œ์—๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ์ด Intent๋ฅผ ๋ชฉ์ ์œผ๋กœ ๋ง์„ ํ•  ๋•Œ ์‚ฌ์šฉํ•  ๊ฐ€๋Šฅ์„ฑ์ด ์žˆ๋Š” ์ตœ๋Œ€ํ•œ ๋งŽ์€ ์˜ˆ์‹œ๋ฅผ ์ œ๊ณตํ•˜๋Š” ๊ฒƒ์ด ์ข‹์Šต๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ํšŒ์˜์‹ค ์˜ˆ์•ฝ์ด๋ผ๋Š” Intent์—๋Š” “ํšŒ์˜์‹ค ์˜ˆ์•ฝํ•ด์ฃผ์„ธ์š”.”, “์ง€๊ธˆ ๋นˆ ํšŒ์˜์‹ค์ด ์žˆ๋‚˜์š”?” ๋“ฑ์˜ ์˜ˆ์‹œ๋ฅผ ์ œ๊ณตํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • Entity : Entity๋Š” Intent์™€ ๊ด€๋ จ๋œ ์šฉ์–ด ๋˜๋Š” ๋ชฉ์ ์–ด๋ฅผ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค. Entity๋Š” Intent์— ๋Œ€ํ•ด ๊ตฌ์ฒด์ ์ธ ๋ฌธ๋งฅ(Context)์„ ์ œ๊ณตํ•˜๋Š”๋ฐ์— ์“ฐ์ž…๋‹ˆ๋‹ค. ์˜ˆ๋ฅผ ๋“ค์–ด ํšŒ์˜์‹ค ์˜ˆ์•ฝ์ด๋ผ๋Š” Intent๋ฅผ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” ํšŒ์˜์‹ค ์ด๋ผ๋Š” Entity๋ฅผ ์ •์˜ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ํšŒ์˜์‹ค Entity์—๋Š” ์‹ค์ œ๋กœ ๋ณด์œ ์ค‘์ธ ํšŒ์˜์‹ค ์ด๋ฆ„์„ ๋‹ด์œผ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์ด๋ ‡๊ฒŒ Entity๋ฅผ ์ •์˜ํ•˜๋ฉด ์‚ฌ์šฉ์ž๊ฐ€ “์ง„๋‹ฌ๋ž˜ ํšŒ์˜์‹ค ์ง€๊ธˆ ๋น„์–ด ์žˆ์–ด?” ๋ผ๊ณ  ํ–ˆ์„ ๋•Œ ํšŒ์˜์‹ค Entity์˜ ๊ฐ’์ด “์ง„๋‹ฌ๋ž˜”๋กœ ๋ฆฌํ„ด๋˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
  • Dialog : Dialog๋Š” ๋Œ€ํ™”์˜ ํ๋ฆ„์„ ๋ถ„๊ธฐํ•˜๋Š” ๊ฒƒ์œผ๋กœ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์ด ์ •์˜๋œ Intent์™€ Entity๋ฅผ ์ธ์‹ํ–ˆ์„ ๋•Œ ์–ด๋– ํ•œ ์‘๋‹ต์„ ํ•  ๊ฒƒ์ธ์ง€๋ฅผ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์‹œ ๋งํ•˜๋ฉด ์‚ฌ์šฉ์ž๊ฐ€ ๋Œ€ํ™”๋ฅผ ์‹œ๋„ํ–ˆ์„ ๋•Œ ์ด ๋Œ€ํ™”์˜ Intent์™€ Entity๋ฅผ ํŒŒ์•…ํ•œ ํ›„ ์–ด๋– ํ•œ ์‘๋‹ต์„ ํ•  ๊ฒƒ์ธ์ง€๋ฅผ ์ •์˜ํ•ฉ๋‹ˆ๋‹ค.

์•„๋ž˜๋Š” ์ด ํฌ์ŠคํŒ…์˜ 1-3์—์„œ ์˜คํ”ˆํ•œ Watson Conversation ํˆด์˜ ์ฒซ๋ฒˆ์งธ ํ™”๋ฉด์ž…๋‹ˆ๋‹ค.

conversation-tool

Create ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ Workspace๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. ์ด๋ฆ„์„ ์ž…๋ ฅํ•˜๊ณ  ์–ธ์–ด๋ฅผ ์„ ํƒํ•ฉ๋‹ˆ๋‹ค. ์ถ”ํ›„ ํ•œ๊ตญ์–ด๊ฐ€ ์ง€์›๋  ์˜ˆ์ •์ด์ง€๋งŒ ํ˜„์žฌ์—๋Š” ์˜์–ด๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

conversation-create-workspace

Workspace๋ฅผ ์ƒ์„ฑํ•˜๋ฉด ๋ฐ”๋กœ ์ƒ์„ฑํ•œ workspace๋กœ ์ด๋™๋ฉ๋‹ˆ๋‹ค. ๋‹ค์‹œ ๋Œ์•„๊ฐ€๋ ค๋ฉด ์™ผ์ชฝ ์ƒ๋‹จ์˜ ๋ฉ”๋‰ด ์•„์ด์ฝ˜์„ ํด๋ฆญํ•˜์—ฌ ๋‚˜์˜ค๋Š” ๋ฉ”๋‰ด์—์„œ Back to workspaces ๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ๋ฉ๋‹ˆ๋‹ค.

2) Intent ๋งŒ๋“ค๊ธฐ

Workspace์˜ ๋ชจ์Šต์ž…๋‹ˆ๋‹ค. ์ƒ๋‹จ ๋ฉ”๋‰ด๋ฅผ ๋ณด๋ฉด Intents, Entities, Dialog 3๊ฐœ์˜ ๋ฉ”๋‰ด๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ์œ„์—์„œ ์„ค๋ช…ํ•œ ๊ฒƒ๋“ค์„ ์ด 3๊ฐœ์˜ ๋ฉ”๋‰ด๋ฅผ ํ†ตํ•ด์„œ ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

conversation-create-intent

๋จผ์ € Intent๋ฅผ ์ƒ์„ฑํ•ด ๋ด…๋‹ˆ๋‹ค. Create new ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
์ฒซ๋ฒˆ์งธ ๋‹จ๊ณ„๋กœ ์ƒ์„ฑํ•  Intent๋Š” 2๊ฐœ์ž…๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž์˜ ์ธ์‚ฌ๋ฅผ ๋ฐ›์•„๋“ค์ด๋Š” #Greeting๊ณผ ์˜ˆ์•ฝ ์š”์ฒญ์˜ ์‹œ์ž‘์„ ๋ฐ›์•„๋“ค์ด๋Š” #Reservation์„ ์ƒ์„ฑํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.
๋จผ์ € #Greeting์„ ์•„๋ž˜ ํ™”๋ฉด์ฒ˜๋Ÿผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

conversation-intent-greeting

#Reservation์„ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค.

conversation-intent-reservation

๋‘ Intent๋ฅผ ๋ชจ๋‘ ์ƒ์„ฑํ•˜๋ฉด ์•„๋ž˜ ํ™”๋ฉด๊ณผ ๋น„์Šทํ•œ ๊ฒฐ๊ณผ๋ฅผ ๋ณผ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

conversation-intent-result

๋งˆ์ง€๋ง‰์œผ๋กœ ๊ธ์ •์ ์ธ ๋Œ€๋‹ต์— ๋Œ€ํ•œ Intent๋ฅผ ์ถ”๊ฐ€ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค. Intent์˜ ์ด๋ฆ„์€ PositiveAnswer๋กœ ํ•˜๊ณ  ๊ฐ’์€ ์•„๋ž˜์˜ ํ‘œ๋ฅผ ์ฐธ์กฐํ•˜์—ฌ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค. ์ด Intent๋Š” ์‚ฌ์šฉ์ž์˜ ๋Œ€๋‹ต์—์„œ ๊ธ์ •์˜ ์˜๋ฏธ๊ฐ€ ์žˆ๋Š” ๊ฒฝ์šฐ ์ถ”์ถœํ•˜๊ธฐ ์œ„ํ•จ์ž…๋‹ˆ๋‹ค.

์˜ˆ์ œ
Absolutely
Of course
OK
Sure
Why not
Y
Yep
Yes

3) Entity ๋งŒ๋“ค๊ธฐ

์ƒ๋‹จ ๋ฉ”๋‰ด์—์„œ Entities๋ฅผ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.

conversation-entity-create

Entity๋Š” ๋‚ด๊ฐ€ ๋งŒ๋“œ๋Š” My entities์™€ ์‹œ์Šคํ…œ์— ์˜ํ•ด ๋งŒ๋“ค์–ด์ ธ ์žˆ๋Š” System entities๊ฐ€ ์žˆ์Šต๋‹ˆ๋‹ค. ์šฐ๋ฆฌ๋Š” ์ด ๋‘๊ฐ€์ง€ ํƒ€์ž…์˜ Entity๋ฅผ ๋ชจ๋‘ ์‚ฌ์šฉํ•  ์˜ˆ์ •์ž…๋‹ˆ๋‹ค.

๋จผ์ € ํšŒ์˜์‹ค ์—”ํ‹ฐํ‹ฐ๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. Create new ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ ์•„๋ž˜์ฒ˜๋Ÿผ ํšŒ์˜์‹ค ์ด๋ฆ„์„ ๋‹ด์€ Entity๋ฅผ ์ƒ์„ฑํ•ฉ๋‹ˆ๋‹ค. Value์—๋Š” ๊ฐ ์‹œ์Šคํ…œ์—์„œ ์‚ฌ์šฉํ•  ํšŒ์˜์‹ค ์ด๋ฆ„, ๋™์˜์–ด์—๋Š” ์‚ฌ์šฉ์ž๊ฐ€ ํŠน์ • ํšŒ์˜์‹ค์„ ๋ถ€๋ฅผ ๋•Œ ์‚ฌ์šฉํ•  ์ˆ˜ ์žˆ๋Š” ๋ชจ๋“  ๋‹จ์–ด๋ฅผ ์ถ”๊ฐ€ํ•ด ์ค๋‹ˆ๋‹ค.

conversation-entity-room

๋‹ค์Œ์œผ๋กœ System entities๋ฅผ ์‚ฌ์šฉํ•˜๋„๋ก ์„ค์ •ํ•ฉ๋‹ˆ๋‹ค. System entities๋Š” ๋‚ ์งœ, ์ˆซ์ž, ํ†ตํ™” ๋“ฑ์„ ํ•ธ๋“ค๋ง ํ• ๋•Œ ๋งค์šฐ ์œ ์šฉํ•ฉ๋‹ˆ๋‹ค. ํšŒ์˜์‹ค ์˜ˆ์•ฝ์‹œ์—๋Š” ๋‚ ์งœ์™€ ์‹œ๊ฐ„์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์ด ๋‘ Entity๋ฅผ Enableํ•ฉ๋‹ˆ๋‹ค.

conversation-entity-system

4) Dialog ๋งŒ๋“ค๊ธฐ

์ƒ์œ„ ๋ฉ”๋‰ด์—์„œ Dialog๋ฅผ ํด๋ฆญํ•˜๊ณ  Create ๋ฒ„ํŠผ์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค. ์ด ๋‹จ๊ณ„์—์„œ๋Š” ์‚ฌ์šฉ์ž์™€์˜ ๋Œ€ํ™”์—์„œ Watson์ด ์–ด๋–ป๊ฒŒ ๋Œ€๋‹ตํ•  ๊ฒƒ์ธ์ง€๋ฅผ ๊ฒฐ์ •ํ•˜๊ณ  ๋ถ„๊ธฐํ•˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค. Dialog๋Š” Intent์™€ Entity๋ฅผ ์‚ฌ์šฉํ•˜์—ฌ ์‚ฌ์šฉ์ž ์ธํ’‹์„ ๋ถ„์„ํ•˜๋ฉฐ ์ •๋ณด๋ฅผ ์ˆ˜์ง‘ํ•˜๊ณ  ์œ ์šฉํ•œ ๋Œ€๋‹ต์„ ํ•˜๊ฒŒ ๋งŒ๋“ญ๋‹ˆ๋‹ค. Dialog๋Š” ํŠธ๋ฆฌ ํ˜•ํƒœ๋ฅผ ๊ฐ€์ง€๋Š”๋ฐ ๊ฐ ์ธํ…ํŠธ๋ฅผ ์ตœ์ƒ์œ„ ๋…ธ๋“œ๋กœ ๋†“๊ณ  ๊ฐ€์ง€๋ฅผ ์น˜๋ฉฐ ์ ์ ˆํ•œ ๋Œ€๋‹ต์„ ํ•  ์ˆ˜ ์žˆ๋„๋ก ์œ ๋„ํ•˜๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์ด Recipe์—์„œ๋Š” ์•„๋ž˜ ๊ทธ๋ฆผ์ฒ˜๋Ÿผ 4๊ฐœ์˜ ์ตœ์ƒ์œ„ ๋…ธ๋“œ๋ฅผ ๋งŒ๋“ค ๊ฒƒ์ด๋ฉฐ Reservation ๋…ธ๋“œ๊ฐ€ ๊ฐ€์žฅ ์ค‘์š”ํ•œ ๋น„์ฆˆ๋‹ˆ์Šค ์—ญํ• ์„ ํ•  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

conversation-dialog-intents

๋…ธ๋“œ๋ฅผ ์ƒ์„ฑํ•˜๊ธฐ ์•ž์„œ Dialog์—์„œ ์‚ฌ์šฉํ•˜๋Š” ์šฉ์–ด๋ฅผ ์„ค๋ช…๋“œ๋ฆฌ๊ฒ ์Šต๋‹ˆ๋‹ค.

  • ๋…ธ๋“œ(Node) : ๋…ธ๋“œ๋Š” Dialog๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์š”์†Œ์ž…๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž์™€์˜ ๋Œ€ํ™”์—์„œ 1๋ฒˆ์˜ ์ƒํ˜ธ์ž‘์šฉ์„ ์˜๋ฏธํ•ฉ๋‹ˆ๋‹ค.
  • ์ปจ๋””์…˜(Condition) : ๋…ธ๋“œ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์š”์†Œ๋กœ ์‚ฌ์šฉ์ž์˜ ์ธํ’‹ ๋“ฑ์„ ๋ฐ”ํƒ•์œผ๋กœ ์กฐ๊ฑด์— ๋งž๋Š” ๊ฒฝ์šฐ ํ•ด๋‹น ๋‚ด์šฉ์„ ์‘๋‹ตํ•ฉ๋‹ˆ๋‹ค.
  • ์‘๋‹ต(Response) : ๋…ธ๋“œ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š” ์š”์†Œ๋กœ ์‚ฌ์šฉ์ž์˜ ์ธํ’‹์ด ์ปจ๋””์…˜์— ๋งค์น˜๋˜๋ฉด ํ™œ์„ฑํ™”๋ฉ๋‹ˆ๋‹ค. ๊ฐ„๋‹จํ•œ ๋ฌธ์ž์—ด์„ ๋ฆฌํ„ดํ•  ์ˆ˜๋„ ์žˆ๊ณ  ์ข€ ๋” ๋ณต์žกํ•œ ํ”„๋กœ์„ธ์Šค๋ฅผ ์‹คํ–‰์‹œํ‚ฌ ์ˆ˜๋„ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๋ธŒ๋žœ์น˜(Branch) : ์‚ฌ์šฉ์ž์™€์˜ ๋Œ€ํ™”๋ฅผ ์˜๋ฏธํ•œ ์ผ๋ จ์˜ Dialog Node๋ฅผ ๋ธŒ๋žœ์น˜๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ์‚ฌ์šฉ์ž์˜ ์ธํ’‹์ด ๊ธฐ๋ณธ ๋…ธ๋“œ์˜ ์ปจ๋””์…˜์— ๋งž์„ ๋•Œ ๋ธŒ๋žœ์น˜๊ฐ€ ์‚ฌ์šฉ๋˜๊ฒŒ ๋ฉ๋‹ˆ๋‹ค.
  • ํ„ด(Turn) : ์‚ฌ์šฉ์ž๊ฐ€ ์ธํ’‹์„ ํ•˜๊ณ  ์ด์— ์‘๋‹ตํ•˜๋Š” ํ•˜๋‚˜์˜ ์‚ฌ์ดํด์„ ํ„ด์ด๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ๋ธŒ๋žœ์น˜๋Š” ํ•˜๋‚˜ ์ด์ƒ์˜ ํ„ด์„ ๊ฐ€์งˆ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  • ๊ธฐ๋ณธ ๋…ธ๋“œ(Base node) : ๋ธŒ๋žœ์น˜์˜ ์ตœ ์ƒ์œ„ ๋…ธ๋“œ(์ฒซ ๋ฒˆ์งธ ๋…ธ๋“œ)๋ฅผ ๊ธฐ๋ณธ ๋…ธ๋“œ๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค.
  • ์ž์‹ ๋…ธ๋“œ(Child node) : ๊ธฐ๋ณธ ๋…ธ๋“œ๊ฐ€ ์•„๋‹Œ ๋…ธ๋“œ๋ฅผ ์ž์‹ ๋…ธ๋“œ๋ผ๊ณ  ํ•ฉ๋‹ˆ๋‹ค. ์ž์‹ ๋…ธ๋“œ๋Š” ์ด์ „ ๋…ธ๋“œ๊ฐ€ ์ตœ์ข… ์‘๋‹ต์„ ์ฃผ๊ธฐ ์œ„ํ•ด ๋” ๋งŽ์€ ์‚ฌ์šฉ์ž ์ธํ’‹ ๋˜๋Š” ํ”„๋กœ์„ธ์Šค๋ฅผ ํ•„์š”๋กœ ํ•  ๋•Œ ์‚ฌ์šฉ๋ฉ๋‹ˆ๋‹ค.
  • ๋™๊ธฐ ๋…ธ๋“œ ๋˜๋Š” ์ž๋งค ๋…ธ๋“œ(Peer node or Sibling node) : ๋‹ค๋ฅธ ๋…ธ๋“œ์˜ ๋Œ€์•ˆ์ฑ…์ด ๋˜๋Š” ๋…ธ๋“œ์ž…๋‹ˆ๋‹ค. ๋ชจ๋“  ๊ธฐ๋ณธ ๋…ธ๋“œ๋Š” ๋‹ค๋ฅธ ๊ธฐ๋ณธ ๋…ธ๋“œ์˜ ๋™๊ธฐ ๋…ธ๋“œ์ž…๋‹ˆ๋‹ค.
  • ๋…ธ๋“œ ๋ฉ”๋‰ด(Node menu) : ๋…ธ๋“œ๋ฅผ ๊ตฌ์„ฑํ•˜๋Š ์š”์†Œ๋กœ ๋…ธ๋“œ๋ฅผ ์ง€์šฐ๊ฑฐ๋‚˜ ๊ธฐ๋Šฅ์„ ์ถ”๊ฐ€ํ•  ์ˆ˜ ์žˆ๋„๋ก ํ•ด์ค๋‹ˆ๋‹ค.

๋…ธ๋“œ๋ฅผ ์ž‘์„ฑํ•  ๋•Œ์—๋Š” SpEL(Spring Expression Language)์„ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. ์ž์„ธํ•œ ์‚ฌ์šฉ๋ฒ•์€ Watson Conversation์—์„œ ์‚ฌ์šฉํ•˜๋Š” Expression Language๋ฅผ ์ฐธ์กฐํ•˜์„ธ์š”.

๋…ธ๋“œ๋ฅผ ์ž‘์„ฑํ•˜๋Š” ๋ฒ•์„ ๊ฐ„๋‹จํ•˜๊ฒŒ ์„ค๋ช…ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

๋‹ค์ด์–ผ๋กœ๊ทธ ์ž‘์„ฑ ํ™”๋ฉด์—์„œ ๋…ธ๋“œ๋ฅผ ํด๋ฆญํ•˜๋ฉด ํ•ด๋‹น ๋…ธ๋“œ์˜ ์šฐ์ธก๊ณผ ์•„๋ž˜์ธก์— +๋ฒ„ํŠผ์ด ์ƒ๊น๋‹ˆ๋‹ค. ์ด ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜์—ฌ ๋™๊ธฐ ๋…ธ๋“œ ๋˜๋Š” ์ž์‹ ๋…ธ๋“œ๋ฅผ ์ƒ์„ฑํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
conversation-node-click

๋…ธ๋“œ๋ฅผ ๋”๋ธ” ํด๋ฆญํ•˜๋ฉด ํ•ด๋‹น ๋…ธ๋“œ๋ฅผ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Triggered by ํ•„๋“œ๋Š” ์ด ๋…ธ๋“œ๋ฅผ ์‚ฌ์šฉํ• ์ง€ ๊ฒฐ์ •ํ•˜๋Š” Condition์˜ ์—ญํ• ์„ ํ•ฉ๋‹ˆ๋‹ค. Fullfill with a response ํ•„๋“œ๋Š” Response๋ฅผ ์ž‘์„ฑํ•˜๊ธฐ ์œ„ํ•œ ํ•„๋“œ์ž…๋‹ˆ๋‹ค. ์šฐ์ธก์— ์œ„์น˜ํ•œ Jump to…๋ฒ„ํŠผ์€ ์‚ฌ์šฉ์ž์˜ ์ธํ’‹ ์—†์ด๋„ ๋‹ค๋ฅธ ๋…ธ๋“œ๋กœ ์ด๋™ํ•˜๊ธฐ ์œ„ํ•ด ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค. Response์— response condition์„ ์ถ”๊ฐ€ํ•˜์—ฌ ๋…ธ๋“œ ์•ˆ์—์„œ๋„ ์ ์ ˆํ•˜๊ฒŒ ์‘๋‹ต์„ ๋ถ„๊ธฐํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. Response์˜ ์šฐ์ธก์— ์œ„์น˜ํ•œ {…} ๋ฒ„ํŠผ์„ ํด๋ฆญํ•˜๋ฉด Text ๋Œ€์‹  ์‘๋‹ตํ•  Json์„ ์ง์ ‘ ์ˆ˜์ •ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.

conversation-node-doubleclick

๋…ธ๋“œ ์ž‘์„ฑ๋ฒ•์„ ํ™•์ธํ•œ ํ›„ 4๊ฐœ์˜ ์ตœ์ƒ์œ„ ๋…ธ๋“œ๋ฅผ ์•„๋ž˜ ์ •๋ณด๋ฅผ ์ฐธ์กฐํ•˜์—ฌ ์ž‘์„ฑํ•˜์‹ญ์‹œ์˜ค.

Index Triggered by Response Condition Response Jump to
1 conversation_start Welcome!
2 #Greeting Hi, what can I do for you?
Remove response variation
Hey, what can I do for you?
3 #Reservation
{
  "context": {
    "dates": null,
    "rooms": null,
    "times": null
  },
  "output": {}
}
    
3-1 Condition
4 anything_else I’m sorry, I don’t understand. Please try again.

#Reservation ๋…ธ๋“œ์— ์•„๋ž˜ ์ •๋ณด๋ฅผ ๋ฐ”ํƒ•์œผ๋กœ ํ•˜์œ„๋…ธ๋“œ๋ฅผ ์ถ”๊ฐ€ํ•˜์‹ญ์‹œ์˜ค.

Index Triggered by Response Condition Response Jump to
3-1 NOT $user
{
  "context": {
    "user": {
      "id": "hjjo\\@kr.ibm.com",
      "name": "HyeonJeong Jo",
      "email": "hjjo\\@kr.ibm.com",
      "phone": "01031229436"
    }
  },
  "output": {}
}
    
3-2 Condition
3-2 $user
{
  "context": {
    "dates": "< ? @sys-date?:$dates ?>",
    "rooms": "< ? @Room?:$rooms ?>",
    "times": "< ? @sys-time?:$times ?>"
  },
  "output": {}
}
    
3-2-1 Condition
3-2-1 NOT $dates
{
  "context": {
    "repeat": 1
  },
  "output": {
    "text": {
      "values": [
        "When do you want to have a meeting?"
      ],
      "selection_policy": "sequential"
    }
  }
}
    
3-2-1-1 @sys-date 3-2 Condition
3-2-1-2 true I’m sorry. Please tell me the dates that you want to book a room. For example, you can say in format “mm/dd/yyyy”
3-2-1-2-1 @sys-date 3-2 Condition
3-2-1-2-2 $repeat < 3
{
  "context": {
    "repeat": "< ? $repeat + 1 ?>"
  },
  "output": {}
}
    
3-2-1-2 Condition
3-2-1-2-3 true I’m sorry. I can’t understand you. Please start again.
3-2-2 NOT $times
{
  "context": {
    "repeat": 1
  },
  "output": {
    "text": {
      "values": [
        "What time do you prefer?"
      ],
      "selection_policy": "sequential"
    }
  }
}
    
3-2-2-1 @sys-time 3-2 Condition
3-2-2-2 true I’m sorry. Please tell me the times. You can tell me like this. “From 13:00 To 14:00”
3-2-2-2-1 @sys-time 3-2 Condition
3-2-2-2-2 $repeat < 3
{
  "context": {
    "repeat": "< ? $repeat + 1 ?>"
  },
  "output": {}
}
    
3-2-2-2 Condition
3-2-2-2-3 true I’m sorry. I can’t understand you. Please start again.
3-2-3 true
{
  "context": {
    "action": {
      "command": "check-availability",
      "dates": "$dates",
      "times": "$times"
    }
  },
  "output": {
    "text": {
      "values": [
        "$user.name, OK I will check the availabilty of room. $dates, $times, $rooms"
      ],
      "selection_policy": "sequential"
    }
  }
}
    
3-2-3-1 #PositiveAnswer
{
  "context": {
    "action": {
      "dates": "$dates",
      "times": "$times",
      "command": "confirm-reservation"
    }
  },
  "output": {
    "text": {
      "values": [
        "OK. < ? context.room ?> at < ? context.times.get(0).value ?>, < ? context.dates ?> is reserved for you."
      ],
      "selection_policy": "sequential"
    }
  }
}
    
3-2-3-2 true
{
  "context": {
    "action": null
  },
  "output": {
    "text": {
      "values": [
        "Canceled. please start again."
      ],
      "selection_policy": "sequential"
    }
  }
}
    
3-3 true I’m sorry. You’re not a registered user in our system.

Watson Conversation์—์„œ #, $, @์€ ๊ฐ๊ฐ Intent, Context, Entity๋ฅผ ์ง€์นญํ•˜๋Š” Short Expression ์ž…๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ, ํ•ด๋‹น ๋ฌธ์ž์˜ String๊ฐ’์„ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด Escape๋ฅผ ์œ„ํ•ด \\๋ฅผ ์‚ฌ์šฉํ•ฉ๋‹ˆ๋‹ค.

5) Workspace Import ํ•˜๊ธฐ

์œ„์˜ ์Šคํ…์„ ํ†ตํ•ด ์™„์„ฑ๋œ Workspace ๋˜๋Š” ์ง์ ‘ ์ œ์ž‘ํ•œ Workspace๋ฅผ ๊ทธ๋Œ€๋กœ ์‚ฌ์šฉํ•˜๊ณ  ์‹ถ๋‹ค๋ฉด ์ด ๋‹จ๊ณ„๋Š” ์Šคํ‚ตํ•ด๋„ ๋ฉ๋‹ˆ๋‹ค.

๋งํฌ์—์„œ trainingํด๋” ์•„๋ž˜ ์žˆ๋Š” workspace-tutorial1.json ํŒŒ์ผ์„ ๋‹ค์šด๋กœ๋“œ ํ•ฉ๋‹ˆ๋‹ค.

Worspace ํ™”๋ฉด์—์„œ Create ๋ฒ„ํŠผ ์šฐ์ธก์— ์žˆ๋Š” Import ์•„์ด์ฝ˜์„ ํด๋ฆญํ•ฉ๋‹ˆ๋‹ค.
conversation-import

์œ„์—์„œ ๋‹ค์šด๋กœ๋“œํ•œ ํŒŒ์ผ์„ ์„ ํƒํ•˜๋ฉด ์ž๋™์œผ๋กœ Workspace๊ฐ€ ์ƒ์„ฑ๋ฉ๋‹ˆ๋‹ค.

1-4 ๋‚ด๊ฐ€ ๋งŒ๋“  ์„œ๋น„์Šค ํ…Œ์ŠคํŠธ ํ•ด๋ณด๊ธฐ

์ƒ๋‹จ ์šฐ์ธก์— ์žˆ๋Š” ๋ฉ”์„ธ์ง€ ์•„์ด์ฝ˜์„ ํด๋ฆญํ•˜๋ฉด ์ง€๊ธˆ๊นŒ์ง€ ๋งŒ๋“  ๋‹ค์ด์–ผ๋กœ๊ทธ๋ฅผ ํ…Œ์ŠคํŠธํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
conversation-try-icon

์•„๋ž˜์ฒ˜๋Ÿผ ํšŒ์˜์‹ค์„ ์˜ˆ์•ฝํ•˜๋Š” ๋Œ€ํ™”๋ฅผ ํ…Œ์ŠคํŠธํ•˜์‹ญ์‹œ์˜ค.
conversation-try-test

์ด์–ด์ง€๋Š” ๋‹จ๊ณ„๋Š”

[Watson์œผ๋กœ ์‰ฝ๊ฒŒ ๋งŒ๋“œ๋Š” ์นด์นด์˜คํ†ก ChatBot] 2. ๋‚ด๊ฐ€ ๋งŒ๋“  ์ฑ„ํŒ… ์„œ๋น„์Šค๋ฅผ ์–ดํ”Œ๋ฆฌ์ผ€์ด์…˜์—์„œ ์‚ฌ์šฉํ•˜๊ธฐ

์ž…๋‹ˆ๋‹ค.