<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Zsuzsanna Horváth</title>
    <description>The latest articles on DEV Community by Zsuzsanna Horváth (@zsuzsanna_horvath).</description>
    <link>https://dev.to/zsuzsanna_horvath</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F164088%2Fed0dd1ba-f257-4bc7-9f69-eb13f10c3cac.png</url>
      <title>DEV Community: Zsuzsanna Horváth</title>
      <link>https://dev.to/zsuzsanna_horvath</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zsuzsanna_horvath"/>
    <language>en</language>
    <item>
      <title>RASA: a Newbie's Journey</title>
      <dc:creator>Zsuzsanna Horváth</dc:creator>
      <pubDate>Fri, 27 Nov 2020 13:19:25 +0000</pubDate>
      <link>https://dev.to/zsuzsanna_horvath/rasa-a-newbie-s-journey-np6</link>
      <guid>https://dev.to/zsuzsanna_horvath/rasa-a-newbie-s-journey-np6</guid>
      <description>&lt;h2&gt;
  
  
  Part2: Is Anybody Out There?
&lt;/h2&gt;

&lt;p&gt;EDIT: Guys, sorry, I have abandoned this project, and RASA changed a lot since I've last seen it. Be back with a brand new project, and new insights hopefully not in almost two years. ^^'&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/xgHaWOkVJAS2s/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xgHaWOkVJAS2s/giphy.gif" alt="That famous David Tennant Doctor Who sad rain meme"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;BUT IF YOU ARE INTERESTED IN THE LESS TECHNICAL PART OF CHATBOT MAKING:&lt;/p&gt;

&lt;p&gt;In the &lt;a href="https://dev.to/zsuzsanna_horvath/rasa-a-newbie-s-journey-1m44"&gt;last part&lt;/a&gt; you started your journey as the mini coder hero you are.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/UqxVRm1IaaIGk/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/UqxVRm1IaaIGk/giphy.gif" alt="Anonymous hacker mid hack, with an adorable mum barging in with cookies"&gt;&lt;/a&gt;&lt;br&gt;
You installed the RASA stack and enough dependencies to last...&lt;br&gt;
a few weeks... since this is computer science.&lt;/p&gt;

&lt;h2&gt;
  
  
  Congrats!
&lt;/h2&gt;

&lt;p&gt;Now wipe away the sweat from your brows, we are going in for the next round.&lt;/p&gt;

&lt;h4&gt;
  
  
  TL;DR
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Before you do anything, decide what problem you want to solve with your chatbot.&lt;/li&gt;
&lt;li&gt;You need to know early on who will interact with the bot.&lt;/li&gt;
&lt;li&gt;You can make structured data out of the wild things your users say by

&lt;ul&gt;
&lt;li&gt;identifying what they want to do (intent classification)&lt;/li&gt;
&lt;li&gt;grabbing the information you need from them (entity extraction)&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Choose a project
&lt;/h4&gt;

&lt;p&gt;If you have't already taken the time to think about what purpose your chatbot will have, here are a few approaches:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--EIINH51P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/74tsmh00pspkwevdx16j.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--EIINH51P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/74tsmh00pspkwevdx16j.png" alt="Basic" width="150" height="100"&gt;&lt;/a&gt;&lt;br&gt;
Check out tutorials, and follow them to the letter (you know my opinion on those).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--gjpnR6KL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vs6uzdrqcfn3e69m2dwc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--gjpnR6KL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/vs6uzdrqcfn3e69m2dwc.png" alt="Intermediate" width="150" height="100"&gt;&lt;/a&gt;&lt;br&gt;
Look up existing bots for inspiration. There are sites like the aptly named &lt;a href="https://www.chatbots.org/"&gt;chatbots.org&lt;/a&gt;, and the more hip &lt;a href="https://chatbottle.co/#annotations:JcdqPF0LEemHmQs6qJhjsA"&gt;chatbottle.co&lt;/a&gt;. A lot of the bots are either old, or not around anymore, but they show just how many purposes chatbots can fulfill.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--TqoWQ0J0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/euynl8jz97qmjv00xico.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--TqoWQ0J0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://thepracticaldev.s3.amazonaws.com/i/euynl8jz97qmjv00xico.png" alt="Advanced" width="150" height="100"&gt;&lt;/a&gt;&lt;br&gt;
Consider the communication problems around you. See where people need to run the same searches over and over and go through the same motions while they are trying to accomplish a goal or get information. Where would people actually benefit from being able to just tell what they want to accomplish?&lt;/p&gt;

&lt;p&gt;Even if you choose a project that is way too hard to make, you can break it down, start with the easiest features and build from there. That will help you to get better at organizing your workflow. Or at least you will be better at gauging the difficulty of projects.&lt;/p&gt;

&lt;h4&gt;
  
  
  Understand the user
&lt;/h4&gt;

&lt;p&gt;Creating a chatbot is like designing any user experience. First you need to consider the ones who will interact with it. A good way to do that is to imagine a prototypical user in need of the bot you are creating. Lets say you are making a calendar bot (which I actually am, if you took the time to check my project), a personal assistant, if you will.&lt;/p&gt;

&lt;p&gt;Look at what is the role of your user. What duties they perform, what situations they face, what framework they are acting in. There is a great difference between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A mum, who wants an easy and fast way to organize the housework for each family member.&lt;/li&gt;
&lt;li&gt;A forgetful programmer who wants to track her water consumption for the day.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Then think about what would help these people.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The mum might want to see the tasks of the day laid out at once and send individual tasks directly to the inboxes of her husband and children, maybe assign XP-s for each task.&lt;/li&gt;
&lt;li&gt;The coder friend will want to set periodical reminders during her work hours, and may need a gentle ease out from the flow she is (hopefully) in.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, probably the most important part, the motivation of your users. Why do they want what they do?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Our mum tends to forget what exactly needs to be done, unless she jots down the tasks as soon as they emerge, she also wants teach her family that keeping things orderly around them will free up mum's time to have family adventures.&lt;/li&gt;
&lt;li&gt;Our programmer is so immersed in her work that she get so dehydrated, she has regular headaches, but she already uses so many tools to organize her work (the company's version control system, kanban, Slack etc.), she doesn't want a new one.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Write that down in a story format. Keep it short and sweet, only write down what is necessary to evoke thoughts on how your app should look like.&lt;br&gt;
In the end you will get something along the lines of:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;As a lawyer on a flexible contract I want to track my work schedule and log my activities, so my manager is able to track my billable hours.&lt;/li&gt;
&lt;li&gt;Mr. Apples, as an English teacher would love to organize classwork by sharing agendas with the children, and revise them as the semester progresses.&lt;/li&gt;
&lt;li&gt;I, Snuffles, as the puppy of a depressed writer want to time my snuggling sessions to the dry spells of my human.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you start doing this you will probably realize that many different people are out there to use what you are creating. Group the ones with similar roles and treat them as one person (show the world that stereotypes are sometimes handy) then create stories for each of them.&lt;/p&gt;

&lt;p&gt;After all this, list all the features that come into mind. Choose the ones that will give the most value to most of your users. Then choose the ones that you can make first.&lt;/p&gt;

&lt;p&gt;&lt;small&gt;Or just choose the story that resonates with you the most, and start with whatever feature would be the most important for that character. This is enough for a beginner project, &lt;em&gt;but don't tell anyone I told you that...&lt;/em&gt;&lt;/small&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Now sit up and stretch a bit, because you will do some work!
&lt;/h4&gt;


&lt;center&gt;.&lt;br&gt;
.&lt;br&gt;
.&lt;br&gt;
&lt;/center&gt;
&lt;br&gt;
&lt;img src="https://i.giphy.com/media/rzpHZX5Zm4amA/giphy.gif" alt="Admiral Ackbar smells a trap"&gt;
&lt;h4&gt;
  
  
  On your brain... because now you can learn how machines understand the world!
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/64amnFjSzrwDRGGqw3/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/64amnFjSzrwDRGGqw3/giphy.gif" alt="BMO tries the toilet"&gt;&lt;/a&gt;&lt;br&gt;
(Oh, I love old memes...)&lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;em&gt;Really&lt;/em&gt; understand the user
&lt;/h4&gt;

&lt;p&gt;When your chatbot grows big and strong, first he (she, it... mine's a he) is going to see jumbles of characters people send him.&lt;/p&gt;

&lt;p&gt;People that want to accomplish something and expect a useful answer in return. And their patience is thin, and they are prone to be afraid of machines...&lt;/p&gt;

&lt;p&gt;To help your bot in navigating an environment like this, the easiest way to manage interactions is to give him a definite purpose, and focus only on the tasks to fulfill that purpose, which luckily you already did when you decided on our project.&lt;/p&gt;

&lt;p&gt;&lt;small&gt;It will be best that you state upfront what the intended use of our bot is (but that is a topic for a later time).&lt;/small&gt;&lt;/p&gt;

&lt;p&gt;Other than that, the type of things people say when they accomplish goals with the help of others are dictated by processes and customs. and your Your bot will usually need to deal with requests, and pleasantries, like please and thank you, are regular elements of conversations.&lt;/p&gt;

&lt;p&gt;Finally, grammar structures a text, so some word combinations are more probable than others, for example "You are" is often followed by and adjective, or "I want to" will most likely be followed by a verb.&lt;/p&gt;

&lt;h5&gt;
  
  
  User intent
&lt;/h5&gt;

&lt;p&gt;Once you know what features (or we can call them abilities) the bot should have, you need to think about how the user will prompt those features with messages written in their own words. In short, you will need a way to analyze the text to get the intent of the user. That is why this process is called intent classification.&lt;/p&gt;

&lt;p&gt;For that, you need to give a set of examples, where you identify the intents, so one of the intent classifiers that RASA support (later on that) can find similarities between the examples, so it will be able to predict later for sentences without labels what is most likely said. This is what Machine Learning folk call supervised learning.&lt;/p&gt;

&lt;p&gt;Lets see how that works. First the sentences are split into their smallest meaningful units (often character sets divided by whitespaces, some tools will recognize punctuation marks, the possessive 's or the n't in don't as an independent unit). This is called tokenization, and the resulting elements are called tokens.&lt;/p&gt;

&lt;p&gt;Then it tries to find the closest thing the intent classifier can to the meaning of the identified tokens. It does that by taking a huge set of words that have been categorized, based on how close they are to all other words in the set - via a process that right now I can only identify as Machine Learning Magic, or MLM for short. Then it will find a place for the words you are feeding to it in that huge set.&lt;/p&gt;

&lt;p&gt;Finally it takes the label you gave for the whole sentence, and slaps that on the series of what it now can identify as words, and lumps the now labeled series of words with the other series of that kind, creating as much of a coherent group as it can. And if a new, unlabeled series of words is sufficiently similar to the examples you have given and sufficiently different for everything else, then it will be labeled the same way.&lt;/p&gt;

&lt;h5&gt;
  
  
  Entities, the juice of it all
&lt;/h5&gt;

&lt;p&gt;But identifying intents and creating responses for each will solve very few and highly specific problems, like looking for the opening hours of a place. That is why you will create other applications, or communicate with existing ones. And you will need to feed data to those applications. Data that you want to get from your user.&lt;/p&gt;

&lt;p&gt;Luckily users are usually happy to give that information embedded in their messages. So we will pretty much do the same thing as with the intents, categorize what type of information can be found in user messages, but with one big exception. We will need to indicate &lt;em&gt;where&lt;/em&gt; that information can be located in the sentences we get.&lt;/p&gt;

&lt;p&gt;And those sentences will go through the same process as with intent classification, with the bonus of being able to predict, based on how many and what kind of words were identified in the message before of after a given word, if they are part of some useful information, and what type of information will it be. These bits, that will be used by the connected apps of the chatbot are called entities (because they usually have names like person, address, currency etc.) and the process is called entity recognition.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WHEW&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Congrats again, if you have read this far. I feel like I need to reward you for that. Lets say you have unlocked an achievement:&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;center&gt;⭐Smartypants⭐&lt;/center&gt;
&lt;/h2&gt;

&lt;h4&gt;
  
  
  Take a cookie:
&lt;/h4&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/xT9KVrKucCn7SlSUx2/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/xT9KVrKucCn7SlSUx2/giphy.gif" alt="One chocolate chip cookie flying towards screen from a plate of cookies"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See you in part 3, where you actually, &lt;strong&gt;actually&lt;/strong&gt; will do some work.&lt;/p&gt;

</description>
      <category>nlp</category>
      <category>rasa</category>
      <category>chatbot</category>
      <category>python</category>
    </item>
    <item>
      <title>RASA: a Newbie's Journey</title>
      <dc:creator>Zsuzsanna Horváth</dc:creator>
      <pubDate>Tue, 14 May 2019 08:02:40 +0000</pubDate>
      <link>https://dev.to/zsuzsanna_horvath/rasa-a-newbie-s-journey-1m44</link>
      <guid>https://dev.to/zsuzsanna_horvath/rasa-a-newbie-s-journey-1m44</guid>
      <description>&lt;h2&gt;
  
  
  Part1: Chatbot Begins
&lt;/h2&gt;

&lt;h3&gt;
  
  
  I did something stupid. And it was awesome.
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://i.giphy.com/media/l0IynI18xtOju4Y2Q/giphy.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://i.giphy.com/media/l0IynI18xtOju4Y2Q/giphy.gif" alt="High diving with a horse"&gt;&lt;/a&gt;&lt;br&gt;
After my exceptionally ambitious feats of coding, like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Calculator&lt;/li&gt;
&lt;li&gt;Shopping list creator&lt;/li&gt;
&lt;li&gt;Guess the Number: The Game&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I decided to make a &lt;a href="https://github.com/zs-horvath/chatbot"&gt;chatbot&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I am documenting my journey and what I learned in the process.&lt;/p&gt;

&lt;p&gt;Basically I am expressing what I would say to myself 2 months ago.&lt;br&gt;
After a smack on the head.&lt;/p&gt;
&lt;h4&gt;
  
  
  TL;DR:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Create a chatbot, it is the most rewarding way to learn Python and NLP (among other things).&lt;/li&gt;
&lt;li&gt;Use RASA, the framework that gathers all the NLP and machine learning goodness for you, and can be tamed with Python. You just need to feed it data to grow healthy and strong.&lt;/li&gt;
&lt;li&gt;Installing might be a heroic achievement, but the whole internet will come together to help you.&lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
  
  
  Why is it in fact a good idea to make a chatbot as your first real project?
&lt;/h4&gt;

&lt;p&gt;Not because secretly it is easy, sorry. It is not, even with the proper framework (and there is &lt;a href="https://geekflare.com/chatbot-development-frameworks/"&gt;a lot of those&lt;/a&gt;). But because it will drag you through a lot of things in small doses (NLP, Machine Learning, using API-s, Bash scripting, UX, even marketing, if you are into that), and will teach you to think about how these things link to each other.&lt;br&gt;
Chatbots are also versatile, you can bend them to fit your territory, it is a good opportunity to learn to use tools from various fields.&lt;br&gt;
And in the end you will create a personality that will actually answer you (they will be your, preprogrammed answers, but you may be in for a surprise).&lt;/p&gt;
&lt;h4&gt;
  
  
  Why RASA?
&lt;/h4&gt;

&lt;p&gt;RASA is well documented:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://rasa.com/docs/"&gt;Beginner's guide&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;Documentation: &lt;a href="https://rasa.com/docs/nlu/"&gt;Language Understanding&lt;/a&gt;, &lt;a href="https://rasa.com/docs/core/"&gt;Dialog Generation&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="https://blog.rasa.com/"&gt;Blog&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://forum.rasa.com/"&gt;Forum&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is written in Python, you can check the source &lt;a href="https://github.com/RasaHQ"&gt;here.&lt;/a&gt;&lt;br&gt;
It runs fully on your computer, no need to register anywhere.&lt;br&gt;
You own your data, yet you can integrate your stuff to the cloud.&lt;br&gt;
You can hack the pipeline any step of the way, but the default options will get you results.&lt;/p&gt;
&lt;h4&gt;
  
  
  So how do we start?
&lt;/h4&gt;

&lt;p&gt;I have found two tutorials made by RASA a &lt;a href="https://rasa.com/docs/core/0.9.8/tutorial_basics/"&gt;simple one&lt;/a&gt; and a &lt;a href="https://www.youtube.com/watch?v=xu6D_vLP5vY"&gt;more complex&lt;/a&gt;, they are a bit outdated, but informative.&lt;br&gt;
Tutorials are not the best solution, they never show the obstacles their creators had to overcome, so the sooner you can switch to reading documentations the better. But they are good to get you started. First of all, they show that it &lt;em&gt;can&lt;/em&gt; be done, give you a process to follow, and help you keep on track even after you spent days on manually installing and configuring tensorflow (which &lt;em&gt;may or may not&lt;/em&gt; have happened to me and my old laptop, don't ask).&lt;/p&gt;
&lt;h4&gt;
  
  
  Can we finally install the thing?
&lt;/h4&gt;

&lt;p&gt;Your best friend here is requirements.txt, a file that, as the name suggests, lists all the software requirements. &lt;a href="https://github.com/zs-horvath/chatbot/blob/master/requirements.txt"&gt;This is mine&lt;/a&gt; that I have merged from the ones I found on the remote repositories of the RASA project.&lt;/p&gt;

&lt;p&gt;Use pip to install:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;pip install -r path/to/requirements.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If you want to use a specific version of Python and pip doesn't seem to respect that wish, run pip as a Python script:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;python3 -m pip install -r path/to/requirements.txt
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Just substitute the number with the Python version you want to use.&lt;/p&gt;

&lt;p&gt;It is a long list, so be prepared, you may need to dig deep into the packages of your system, dependencies have dependencies, you have your own things, a lot of opportunities are there for trouble. I cannot help you much with this, as I am not the one to live on your system.&lt;br&gt;
Most problems I faced were solvable by beginner methods:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Search the error message (&lt;a href="https://interactivepython.org/runestone/static/CS152f17/Debugging/KnowyourerrorMessages.html"&gt;common error messages in Python&lt;/a&gt;)&lt;/li&gt;
&lt;li&gt;Search for the problem on Stack Exchange or Stack Overflow (or blog posts, or Linux forums, or Github threads or...), again, using your favorite search engine as a hub.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;With pip you get standard python &lt;a href="http://cs.franklin.edu/~ansaria/traceback.html"&gt;backtraces&lt;/a&gt;, so at least you might feel at home.&lt;/p&gt;

&lt;p&gt;Sometimes, if pip is not cooperative, you can try to install some packages with the native package manager of your system.&lt;/p&gt;

&lt;p&gt;You may want to consider using virtual environments, which I did not, because this is my first actual project, and there is such a thing as too many abstractions at once.&lt;/p&gt;

&lt;p&gt;Good luck, and see you at Part 2!&lt;/p&gt;

</description>
      <category>nlp</category>
      <category>rasa</category>
      <category>chatbot</category>
      <category>python</category>
    </item>
  </channel>
</rss>
