intro to api.ai / wit.ai / luis.ai

Post on 21-Jan-2018

369 Views

Category:

Technology

3 Downloads

Preview:

Click to see full reader

TRANSCRIPT

行動開發學院 MobileDev.TW

人工智慧語意分析工具API.ai / Wit.ai / Luis.ai

Ryan@iii.org.twIII IT Training Center

1

行動開發學院 MobileDev.TW

問題

• 如何讓機器人聽得懂人話?–特定指令–日常生活會說的句子

明天下午三點到北車集合

4月22日15:00在台北火車站碰面

明天下午三點整在北平西路3號會合

哈摟!我看明天我們就在台北車站碰面好了,下午三點,要記得哦

ㄟ,還記得明天的約會嗎?是下午三點,在火車站,別遲到!

提醒你一下,三點在北車碰頭,不見不散!

2

行動開發學院 MobileDev.TW

天氣機器人開發 1.0

• 目標–輸入:時間、地點–回傳:天氣概況、溫度

• 介面–網頁

• 工具/技術– API.ai– AJAX

3

行動開發學院 MobileDev.TW

API.ai

4

行動開發學院 MobileDev.TW

Create New Agent

5

行動開發學院 MobileDev.TW

Create New Agent

6

行動開發學院 MobileDev.TW

語意分析常見名詞

• Intent 意圖–使用者對談的目的

• Entity 關鍵資訊–達成目的的必要輸入資訊

• Utterance 例句–使用者常用的句型

7

行動開發學院 MobileDev.TW

Create Intent

8

行動開發學院 MobileDev.TW

標示必要資訊,並引導使用者輸入

9

行動開發學院 MobileDev.TW

追問出日期

10

行動開發學院 MobileDev.TW

追問出城市

11

行動開發學院 MobileDev.TW

設定確認取得查詢資訊的回應

AgentTrainedComplete

12

行動開發學院 MobileDev.TW

測試看看

13

行動開發學院 MobileDev.TW

整合至網頁

14

https://gist.github.com/Gugic/cfc008599fa9a82eeba4127648009132

行動開發學院 MobileDev.TW

修改網頁

• Client access token

15

行動開發學院 MobileDev.TW

開始有回應

16

行動開發學院 MobileDev.TW

修改顯示的回應內容• 只顯示想要給使用者看的內容

17

行動開發學院 MobileDev.TW

顯示出對話記錄

18

行動開發學院 MobileDev.TW

顯示出對話記錄

19

行動開發學院 MobileDev.TW

結合Open Weather Map

http://openweathermap.org/

20

行動開發學院 MobileDev.TW

Get API Key

https://openweathermap.org/appid

21

行動開發學院 MobileDev.TW

API - By city name

22

行動開發學院 MobileDev.TW

取得天氣資訊• 確定交談動作完成時,開始取得資料

23

行動開發學院 MobileDev.TW

取得天氣資訊• 依城市名稱進行天氣資訊查詢

24

行動開發學院 MobileDev.TW

jQuery.ajax()

25

http://api.jquery.com/jquery.ajax/

行動開發學院 MobileDev.TW

jQuery.getJSON()

26

http://api.jquery.com/jquery.getjson/

行動開發學院 MobileDev.TW

簡易版天氣機器人完成

27

行動開發學院 MobileDev.TW

延伸實作• 如何查詢特定日期天氣?• 如何在網頁上顯示天氣概況圖?• 能不能回傳中文天氣概況描述?

28

行動開發學院 MobileDev.TW

回顧一下,我們串了什麼?

輸入查詢

HTML5網頁

雲端處理機制

語意分析判斷輸入

使用者介面網際網路資源

開放資料

天氣 API

29

行動開發學院 MobileDev.TW

輸入與輸出

How is the weather today in Taipei?

時間:Today地點:Taipei

取得當天氣溫天氣描述

30

行動開發學院 MobileDev.TW

練習:電影機器人開發 1.0• 目標–輸入:電影名稱–回傳:簡介、海報

• 介面–網頁

• 工具/技術– API.ai– AJAX

• 資料– theMovieDB.org

31

行動開發學院 MobileDev.TW

產品預期畫面

32

行動開發學院 MobileDev.TW

延伸實作:Backend整合

• 用API.ai取代傳統餐廳預約表單輸入–將餐廳預約需要的資訊整理至API.ai–將API.ai產生的變數傳送至餐廳預約系統–檢查是否有成功預約

• 用API.ai取代Google表單輸入–將問卷中的問題移至API.ai–將API.ai產生的變數傳送至Google表單系統–檢查是否有成功輸入

33

行動開發學院 MobileDev.TW

Wit.ai

34

行動開發學院 MobileDev.TW

新增 APP

35

行動開發學院 MobileDev.TW

增加例句並設定entity

36

行動開發學院 MobileDev.TW

測試 (Settings)

37

onlinecurl.com

行動開發學院 MobileDev.TW

Start your curl• Check response body

38

行動開發學院 MobileDev.TW

Luis.ai

39

行動開發學院 MobileDev.TW

New App

40

行動開發學院 MobileDev.TW

餐廳預約

41

行動開發學院 MobileDev.TW

Create an intent

42

行動開發學院 MobileDev.TW

Intent : 進行餐廳預約

43

行動開發學院 MobileDev.TW

使用情形

• 中文斷詞判斷優於API.ai• 但以注音輸入中文時,按下Enter會被網頁判斷

成輸入完成

44

top related