230 likes | 380 Views
B ài 2 Natural Language Understanding ( NLU) - Artificial Intelligence Markup Language ( AIML). Hà Nội 2013. Yêu cầu :. Eclipse đã cài đặt ADT, Android SDK Cài đặt Robot SDK Ref erence : http ://ftri.fpt.edu.vn/robot/docs/NAO/SDK.html. Mục đích :.
E N D
Bài 2 Natural Language Understanding (NLU) - Artificial Intelligence Markup Language (AIML) HàNội 2013
Yêucầu: • Eclipse đãcàiđặt ADT, Android SDK • Càiđặt Robot SDK Reference: http://ftri.fpt.edu.vn/robot/docs/NAO/SDK.html
Mụcđích: • Giớithiệucác API của NLU và AIML
Task 1: NLU • NLU liênquanchủyếuđếnbàitoánphânlớp: • C = {c1, c2, …, ck} tập k lớp • X = {xi} (i=1,2,…) làtậpcácđốitượngcầnphânlớp • Xâydựngánhxạf: • flàmôhìnhphânlớp(classification model, classifier). • fcóthểđượcxâydựngbằnghọcgiámsátdựatheotậpdữliệuhuấnluyệnD = {(x1, c1), (x2, c2), …, (xn, cn)}: • Huấnluyệnmôhìnhfdựatrêntậphuấnluyện Dsaocho f phânlớpchínhxácnhất. X f C
Mộtsốmôhìnhphânloại: • Môhình Naïve Bayes • Môhình TF IDF • Môhình Bernoulli • Thamkhảotàiliệulink.
NLU API NLU API Train Learn Classify Training Data
Dữliệu training đượcchứatrong 1 file text có format nhưsau: Mỗidòngchứa 1 label (action) và text. Lưuý: File nàyphảilưuởsdcardkhisửdụng.
API đượcđịnhnghĩatrongTextClassifierclass. • Hầuhếtcáchàmlàasynchronizemethods: set callback thông qua method: • Train API:
Tạo 1 robot project mớicó 2 layout: • activity_main.xml • activity_other.xml
Tạo 1 object TextClassifier: • Cóthểlấy 1 list các action (label) đượcsắpxếptheothứtựgiảmdầncủaxácsuất: • Hoặclấy action vớixácsuấtlớnnhất:
Đểhọcdữliệumới: • Cóthể download source code theolink
Task 2: AIML • AIML API đượcđịnhnghĩatrongChatBotclass. • Nóbaogồm: Train API:
Sphinx + AIML project: • Tạocác layout:
Copy aiml, sphinx data vào assets folder: Lưuý: • Aiml data phảiđượcchứatrongthưmục bots của assets. Thưmụctiếptheolàcótêngiốngnhưtêncủa chat bot. • Cáccâuhỏiđượcchứatrong file question_data.txt.
Copy aiml, sphinx data vào assets folder: Lưuý: • Aiml data phảiđượcchứatrongthưmục bots của assets. Thưmụctiếptheolàcótêngiốngnhưtêncủa chat bot. • Cáccâuhỏiđượcchứatrong file question_data.txt. • Cácdữliệutrong assets sẽđược copy vàosdcardtronglầnđầuchạy app.
Để train aimlphải copy dữliệuvàosdcardtrước. Sauđó set chat bot name choChatbot class.
Lấy response từ input text: • Download source code từlink.