{"id":795,"date":"2013-04-29T12:09:39","date_gmt":"2013-04-29T12:09:39","guid":{"rendered":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/?p=795"},"modified":"2013-08-14T15:19:42","modified_gmt":"2013-08-14T15:19:42","slug":"learn-to-build-your-own-conversational-robot-using-chatscript","status":"publish","type":"post","link":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/learn-to-build-your-own-conversational-robot-using-chatscript\/","title":{"rendered":"Learn to Build Your Own Conversational Bot using ChatScript"},"content":{"rendered":"\n<!-- Facebook Like Button v1.9.6 BEGIN [http:\/\/blog.bottomlessinc.com] -->\n<iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=http%3A%2F%2Finspiredtoeducate.net%2Finspiredtoeducate%2Flearn-to-build-your-own-conversational-robot-using-chatscript%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"border:none; overflow:hidden; width:450px; height: 30px; align: left; margin: 2px 0px 2px 0px\"><\/iframe>\n<!-- Facebook Like Button END -->\n<p><a href=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/c3p0_2.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-809\" title=\"c3p0_2\" src=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/c3p0_2.jpg\" alt=\"\" width=\"334\" height=\"500\" srcset=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/c3p0_2.jpg 334w, http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/c3p0_2-200x300.jpg 200w\" sizes=\"(max-width: 334px) 100vw, 334px\" \/><\/a><\/p>\n<p>Science fiction (i.e. Star Trek and Star Wars) paint a vision of the future where people can simply use conversational language to interact with their robots and computers.\u00a0\u00a0 In the future, conversation will become a first class user interface like the keyboard, the mouse, and touch screens.\u00a0\u00a0 \u00a0Bruce Wilcox has made a powerful contribution to natural language processing and chatbots by creating ChatScript.\u00a0 His work has won in the Loebner Prize Contest in 2010, 2011, and 2012.\u00a0\u00a0 I wanted to provide a high level introduction into this smart and insightful chatbot engine.\u00a0\u00a0\u00a0 This is a true gem of the open source world.<\/p>\n<p><strong>Download ChatScript for SourceForge.NET<\/strong><\/p>\n<ul>\n<li>Open your web browser to <a href=\"http:\/\/sourceforge.net\/projects\/chatscript\/\">http:\/\/sourceforge.net\/projects\/chatscript\/<\/a> .<\/li>\n<li>Click to the \u2018download\u2019 button.<\/li>\n<li>After the ChatScript ZIP has completed downloading, unzip the file to a location on your hard drive.\u00a0\u00a0 (i.e. c:\\chatscript or \/home\/user\/chatscript).\u00a0\u00a0 We will refer to this location as your ChatScript home directory.<\/li>\n<\/ul>\n<p><strong>Test drive ChatScript<\/strong><\/p>\n<ul>\n<li>Open your ChatScript home directory.<\/li>\n<li>Run \u2018ChatScript.EXE\u2019 (or LinuxChatScript32)<\/li>\n<li>After ChatScript loads and you have provided your name, you will have the opportunity to chat with the small chatbot installed by default in ChatScript.<\/li>\n<li>In the ChatScript home folder, open the \u2018documentation\u2019 folder to learn how ChatScript functions.\u00a0\u00a0 Bruce Wilcox and his team have provided a nice set of user guides to help you understand the language and process of creating a chatbot.\u00a0\u00a0 I highly recommend checking out the \u201cChatScript Tutorial.pdf\u201d and \u201cPaper- ARBOR-MakingItReal.pdf.\u201d<\/li>\n<\/ul>\n<p><strong>Let\u2019s add some personality<\/strong><\/p>\n<ul>\n<li>Open your ChatScript home directory.<\/li>\n<li>Copy \u201cFiles1.txt\u201d to \u201cFiles2.txt.\u201d\u00a0 \u201cFiles2.txt\u201d will contain the topic files (i.e. \u201c.top\u201d files) that your personality will load.<\/li>\n<li>Using your favorite text editor, we need to add a line to enable a new topic file.\u00a0\u00a0 We will also need to disable the \u201csimpletopic\u201d file.\u00a0\u00a0 Edit \u201cfiles2.txt\u201d so it looks exactly like the following.\u00a0\u00a0 \u00a0\u00a0Save your changes and close your text editor.<\/li>\n<\/ul>\n<p><a href=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_file2.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-796\" title=\"ChatScript File2\" src=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_file2.jpg\" alt=\"ChatScript File2\" width=\"621\" height=\"321\" srcset=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_file2.jpg 621w, http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_file2-300x155.jpg 300w\" sizes=\"(max-width: 621px) 100vw, 621px\" \/><\/a><\/p>\n<ul>\n<li>Open your ChatScript home folder.<\/li>\n<li>Open the \u201cRAWDATA\u201d folder.<\/li>\n<li>In this folder, create a file called \u201ctutorial.top.\u201d<\/li>\n<\/ul>\n<p><a href=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_helloworld.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-797\" title=\"cs_helloworld\" src=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_helloworld.jpg\" alt=\"cs helloworld\" width=\"394\" height=\"184\" srcset=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_helloworld.jpg 394w, http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_helloworld-300x140.jpg 300w\" sizes=\"(max-width: 394px) 100vw, 394px\" \/><\/a><\/p>\n<ul>\n<li>Open your ChatScript home folder.<\/li>\n<li>Run ChatScript.EXE. \u00a0After the user provides their name, the user is greated with &#8220;Hello world.&#8221;<\/li>\n<\/ul>\n<p><a href=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_hellworld_results.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-798\" title=\"cs_hellworld_results\" src=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_hellworld_results.jpg\" alt=\"cs helloworld results\" width=\"628\" height=\"319\" srcset=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_hellworld_results.jpg 628w, http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_hellworld_results-300x152.jpg 300w\" sizes=\"(max-width: 628px) 100vw, 628px\" \/><\/a><\/p>\n<p>ChatScript enables you to organize your chatbot brain into conversation topics. \u00a0 \u00a0 As you probably guessed, the first line of the script is associated with introductions.\u00a0\u00a0 Refer to the \u201cChatScript Tutorial.pdf\u201d documentation for additional details.<\/p>\n<p><strong>Creating a virtual waiter<\/strong><\/p>\n<p>Let\u2019s say we needed to program ChatScript to manage the process of ordering breakfast for a user.\u00a0\u00a0 Yum! What would this look like in ChatScript?\u00a0\u00a0 If you skim through the code below, you can probably understand the logical progression of the conversation.\u00a0 I believe this is a major strength of ChatScript over alternatives.<\/p>\n<p>Modify the \u201ctutorial.top\u201d file with the following code snippet.\u00a0 \u00a0To reload the ChatScript brain, type \u201c:build 2\u201d at the ChatScript prompt to reload the system.<\/p>\n<pre>topic: ~introductions keep repeat[]\r\n\r\nt: keep() repeat() Hello! How are you? Welcome to Big Joe's Breakfast.  Can I start you off with something to drink?\r\n\ta: (~yes) What can I get you to drink?\r\n\t\tb: (*) Ok.  I'll get you your drink order. And I'll come back to take your breakfast order. ^reuse(READY_TO_ORDER)\r\n\r\n\ta: (~no) Ok. ^reuse(READY_TO_ORDER)\r\n\r\nt: READY_TO_ORDER() keep() repeat() Are you ready to order?\r\n\ta: (~yes) Ok.   Do you like meat?\r\n\t\tb: (~yes) You might enjoy trying the green eggs and ham.\r\n\t\tb: (~no) You might enjoy trying our veggie omlette.  It's very good.\r\n\r\n\ta: (~no) I will be back shortly to take your order.<\/pre>\n<p>The following shows a sample Chat session using this script.<\/p>\n<p><a href=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_waiter.jpg\"><img loading=\"lazy\" class=\"alignnone size-full wp-image-803\" title=\"cs_waiter\" src=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_waiter.jpg\" alt=\"cs_waiter\" width=\"628\" height=\"319\" srcset=\"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_waiter.jpg 628w, http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-content\/uploads\/2013\/04\/cs_waiter-300x152.jpg 300w\" sizes=\"(max-width: 628px) 100vw, 628px\" \/><\/a><\/p>\n<ul>\n<li><span style=\"color: #3366ff;\">t: keep() repeat() Hello! How are you? Welcome to Big Joe&#8217;s Breakfast.\u00a0 Can I start you off with something to drink?<\/span>\n<ul>\n<li>This line is a topic rule or gambit. (denoted by the \u201ct:\u201d)\u00a0\u00a0 Topic lines are executed from top to bottom so that chatbot creators can craft stories.\u00a0 Topics are initiated by the bot when the system starts or the bot needs to shift the direction of conversation.<\/li>\n<li>a: (~yes) What can I get you to drink?\u201d &#8211; When the user wants something to drink. This rule will be triggered.\u00a0\u00a0 The \u201c(~yes)\u201d code will get triggered when the system encounters any form of an affirmative response.\u00a0\u00a0 In more technical terms, ChatScript will trigger this rule when the concept of \u201cyes\u201d is encountered.\u00a0 While other chatbot frameworks pattern match on strings or text, ChatScript pattern matches on concepts.<\/li>\n<li>a: (~no) Ok. ^reuse(READY_TO_ORDER) \u2013 This rule will reply \u201cOk\u201d to the user and direct the system to trigger the \u201cREADY_TO_ORDER\u201d rule.<\/li>\n<\/ul>\n<\/li>\n<li><span style=\"color: #3366ff;\">t: READY_TO_ORDER() keep() repeat() Are you ready to order?<\/span>\n<ul>\n<li>This topic rule is named \u201cREADY_TO_ORDER.\u201d\u00a0 The bot simply asks the question \u201cAre you ready to order?\u201d<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>Reflections on ChatScript<\/strong><\/p>\n<ul>\n<li>I really love the \u201cconcepts\u201d feature of the language.\u00a0\u00a0 It\u2019s really cool that the system knows that \u201cI do!\u201d and \u201cI think so\u201d means \u201cyes.\u201d<\/li>\n<li>To prepare this small ChatScript code sample, I had to craft a focused story before designing my code.\u00a0 I believe it would be interesting to introduce this technology to high school or college students interested in creative writing or drama.\u00a0 Why?\u00a0 The craft of designing the chatbot is like writing a scene from a play.<\/li>\n<\/ul>\n<blockquote><p>\u00a0<em>\u201cWhile ChatScript is a marvelous tool, it is not a chatbot. For that you need the script itself. And to write that script you need to define a personality, much as a novelist crafts a character. Who is the chatbot? What do they do? Who are their friends? What is their life story? We want to create a consistent being with a logical set of interests and intentions living in a rational world. The more a user can model the character&#8217;s personality, the more engrossed the user can become in the reality of a fictitious world.\u201d<br \/>\nBruce and Sue Wilcox \u2013 \u201cMaking it Real: Loebner-winning Chatbot Design\u201d<\/em><\/p><\/blockquote>\n<ul>\n<li>\u00a0I would encourage the reader to explore the documentation for ChatScript.\u00a0 This blog post only scratches the surface of the rich capabilities of the language.\u00a0 In future work, we hope to create media to make ChatScript accessible to younger audiences and inspire the next generation of AI professionals.<\/li>\n<li>Special thanks to Bruce and Sue Wilcox for creating such an amazing contribution to natural language processing.<\/li>\n<p>&nbsp;<\/p>\n<p>Photo from\u00a0<a href=\"http:\/\/www.flickr.com\/photos\/edlitmus\/4784371536\/sizes\/m\/in\/photostream\/\">http:\/\/www.flickr.com\/photos\/edlitmus\/4784371536\/sizes\/m\/in\/photostream\/<\/a><\/p>\n<p>&nbsp;<\/p>\n\n<!-- Facebook Like Button v1.9.6 BEGIN [http:\/\/blog.bottomlessinc.com] -->\n<iframe src=\"http:\/\/www.facebook.com\/plugins\/like.php?href=http%3A%2F%2Finspiredtoeducate.net%2Finspiredtoeducate%2Flearn-to-build-your-own-conversational-robot-using-chatscript%2F&amp;layout=standard&amp;show_faces=false&amp;width=450&amp;action=like&amp;colorscheme=light\" scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" style=\"border:none; overflow:hidden; width:450px; height: 30px; align: left; margin: 2px 0px 2px 0px\"><\/iframe>\n<!-- Facebook Like Button END -->\n","protected":false},"excerpt":{"rendered":"<p>Science fiction (i.e. Star Trek and Star Wars) paint a vision of the future where people can simply use conversational language to interact with their robots and computers.\u00a0\u00a0 In the future, conversation will become a first class user interface like the keyboard, the mouse, and touch screens.\u00a0\u00a0 \u00a0Bruce Wilcox has [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4,18,16,3,8,1],"tags":[],"_links":{"self":[{"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/posts\/795"}],"collection":[{"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/comments?post=795"}],"version-history":[{"count":14,"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/posts\/795\/revisions"}],"predecessor-version":[{"id":1070,"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/posts\/795\/revisions\/1070"}],"wp:attachment":[{"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/media?parent=795"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/categories?post=795"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/inspiredtoeducate.net\/inspiredtoeducate\/wp-json\/wp\/v2\/tags?post=795"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}