{"id":21770,"date":"2023-07-10T09:34:00","date_gmt":"2023-07-10T07:34:00","guid":{"rendered":"https:\/\/www.codemotion.com\/magazine\/?p=21770"},"modified":"2023-07-07T12:34:17","modified_gmt":"2023-07-07T10:34:17","slug":"develop-chatbot-with-python-and-chatterbot","status":"publish","type":"post","link":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/","title":{"rendered":"How to Develop Your Own Chatbot With Python and ChatterBot from Scratch"},"content":{"rendered":"\n<p>Building a ChatBot with Python is easier than you may initially think. Chatbots are extremely popular right now, as they bring many benefits to companies in terms of user experience.<\/p>\n\n\n\n<p>In this guide, we\u2019re going to look at how you <strong>can build your very own chatbot in Python<\/strong>, step-by-step.<\/p>\n\n\n\n<p>Before we get to that, though, let\u2019s learn a little bit about chatbots and how they work.<\/p>\n\n\n\t\t\t\t<div class=\"wp-block-uagb-table-of-contents uagb-toc__align-left uagb-toc__columns-1  uagb-block-db67a181      \"\n\t\t\t\t\tdata-scroll= \"1\"\n\t\t\t\t\tdata-offset= \"30\"\n\t\t\t\t\tstyle=\"\"\n\t\t\t\t>\n\t\t\t\t<div class=\"uagb-toc__wrap\">\n\t\t\t\t\t\t<div class=\"uagb-toc__title\">\n\t\t\t\t\t\t\tTable Of Contents\t\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<div class=\"uagb-toc__list-wrap \">\n\t\t\t\t\t\t<ol class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#what-is-a-chatbot\" class=\"uagb-toc-link__trigger\">What is a Chatbot?<\/a><ul class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#rule-based-chatbots\" class=\"uagb-toc-link__trigger\">Rule-based chatbots<\/a><li class=\"uagb-toc__list\"><li class=\"uagb-toc__list\"><a href=\"#ai-based-chatbots\" class=\"uagb-toc-link__trigger\">AI-based chatbots<\/a><\/li><\/ul><\/li><li class=\"uagb-toc__list\"><a href=\"#what-is-python\" class=\"uagb-toc-link__trigger\">What is Python?<\/a><li class=\"uagb-toc__list\"><a href=\"#chatterbot\" class=\"uagb-toc-link__trigger\">ChatterBot<\/a><li class=\"uagb-toc__list\"><a href=\"#prerequisites\" class=\"uagb-toc-link__trigger\">Prerequisites<\/a><li class=\"uagb-toc__list\"><a href=\"#developing-your-own-chatbot-from-scratch\" class=\"uagb-toc-link__trigger\">Developing Your Own Chatbot From Scratch<\/a><li class=\"uagb-toc__list\"><a href=\"#congratulations-youve-built-a-chatbot-in-python\" class=\"uagb-toc-link__trigger\">Congratulations, You\u2019ve Built a Chatbot in Python<\/a><\/ul><\/ol>\t\t\t\t\t<\/div>\n\t\t\t\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-is-a-chatbot\">What is a Chatbot?<\/h2>\n\n\n\n<p>A chatbot is a piece of <a href=\"https:\/\/talks.codemotion.com\/panel---ai--ml-theres-a-whole-word-beyon?_ga=2.266462094.1061426960.1684363071-1413984898.1684363071\" class=\"ek-link\">AI-driven software<\/a> designed to communicate with humans. Chatbots can be either auditory or textual, meaning they can communicate via speech or text.<\/p>\n\n\n\n<p>Chatbots can be used in a variety of ways. In many cases, they\u2019ll be used to supplement human agents in sales or back, where they can perform tasks such as scheduling appointments, helping customers to perform self-service, or capturing the details of leads.<\/p>\n\n\n\n<p>They have other uses though. For example, <a href=\"https:\/\/www.make.com\/en\/integrations\/openai-gpt-3\/google-sheets\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">ChatGPT for Google Sheets<\/a> can be used to automate processes and streamline workflows to save data input teams time and resources.<\/p>\n\n\n\n<p>Over 30% of people primarily view chatbots as a way to have a question answered, with other popular uses including paying a bill, resolving a complaint, or purchasing an item.<\/p>\n\n\n\n<p>There are two main types of chatbot:<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Rule-based chatbots<\/h3>\n\n\n\n<p>Rule-based chatbots interact with users via a set of predetermined responses, which are triggered upon the detection of specific keywords and phrases. Rule-based chatbots don\u2019t learn from their interactions, and may struggle when posed with complex questions.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">AI-based chatbots<\/h3>\n\n\n\n<p>AI-based chatbots learn from their interactions using artificial intelligence. This means that they improve over time, becoming able to understand a wider variety of queries, and provide more relevant responses. AI-based chatbots are more adaptive than rule-based chatbots, and so can be deployed in more complex situations.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">What is Python?<\/h2>\n\n\n\n<p>There&#8217;s no doubt: today, <a aria-label=\"Python is one of the most widely used computer programming languages (opens in a new tab)\" href=\"https:\/\/www.codemotion.com\/magazine\/languages\/python\/\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">Python is one of the most widely used computer programming languages<\/a>. <\/p>\n\n\n\n<p>Many developers use <a href=\"https:\/\/www.codemotion.com\/magazine\/languages\/top-python-frameworks\/\" target=\"_blank\" aria-label=\"Python and its different frameworks (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">Python and its different frameworks<\/a> and libraries to build websites and software, but it can also be used to conduct data analysis, automate tasks, and create a <a href=\"https:\/\/www.databricks.com\/glossary\/data-pipeline\/\" class=\"ek-link\">Python data pipeline<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><tbody><tr><th>Rank<\/th><th>Change<\/th><th>Language<\/th><th>Share<\/th><th>1-year trend<\/th><\/tr><tr><td>1<\/td><td><\/td><td>Python<\/td><td>27.43 %<\/td><td>-0.2 %<\/td><\/tr><tr><td>2<\/td><td><\/td><td>Java<\/td><td>16.19 %<\/td><td>-1.0 %<\/td><\/tr><tr><td>3<\/td><td><\/td><td>JavaScript<\/td><td>9.4 %<\/td><td>-0.1 %<\/td><\/tr><tr><td>4<\/td><td><\/td><td>C#<\/td><td>6.77 %<\/td><td>-0.3 %<\/td><\/tr><tr><td>5<\/td><td><\/td><td>C\/C++<\/td><td>6.44 %<\/td><td>+0.2 %<\/td><\/tr><\/tbody><\/table><figcaption class=\"wp-element-caption\"><em>Top 5 most popular programming languages in 2023 according to the <a aria-label=\"PYPL Index (opens in a new tab)\" href=\"https:\/\/pypl.github.io\/PYPL.html\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\">PYPL Index<\/a>.<\/em><\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">ChatterBot<\/h2>\n\n\n\n<p>ChatterBot is a Python library designed to respond to user inputs with automated responses. It uses various machine learning (ML) algorithms to generate a variety of responses, allowing developers to build chatbots that can deliver appropriate responses in a variety of scenarios.<\/p>\n\n\n\n<p>Because it\u2019s built using ML algorithms, the chatbot will also be able to improve its performance as it learns over time. Chatterbot also features language independence, meaning that it can be used to train chatbots in multiple programming languages.<\/p>\n\n\n\n<p>A chatbot built using ChatterBot works by saving the inputs and responses it deals with, using this data to generate relevant automated responses when it receives a new input. By comparing the new input to historic data, the chatbot can select a response that is linked to the closest possible known input.<\/p>\n\n\n\n<p>Before starting, it&#8217;s important to consider the storage and scalability of your chatbot&#8217;s data. Using <a href=\"https:\/\/www.jotform.com\/what-is-cloud-storage\" class=\"ek-link\">cloud storage<\/a> solutions can provide flexibility and ensure that your chatbot can handle increasing amounts of data as it learns and interacts with users. It&#8217;s also essential to plan for future growth and anticipate the storage requirements of your chatbot&#8217;s conversations and training data. By leveraging cloud storage, you can easily scale your chatbot&#8217;s data storage and ensure reliable access to the information it needs.<\/p>\n\n\n\n<p>Moreover, the more interactions the chatbot engages in over time, the more historic data it has to work from, and the more accurate its responses will be.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"1024\" src=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-6536653_1280-min-1024x1024.png\" alt=\"chatbot with python and chatterbot: a step by step guide.\" class=\"wp-image-21773\" srcset=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-6536653_1280-min-1024x1024.png 1024w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-6536653_1280-min-300x300.png 300w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-6536653_1280-min-150x150.png 150w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-6536653_1280-min-768x768.png 768w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-6536653_1280-min-600x600.png 600w, https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-6536653_1280-min.png 1280w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\">ChatterBot is a Python library that helps you create your own chatbot in no time.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Prerequisites<\/h2>\n\n\n\n<p>We\u2019ve tried to make this guide as easy to follow as possible, so you should be able to build your own chatbot in Python, regardless of whether you\u2019re a pro developer with a working knowledge of software such as <a href=\"https:\/\/www.databricks.com\/blog\/2023\/04\/05\/visual-data-modeling-using-erwin-data-modeler-databricks-lakehouse-platform.html\" class=\"ek-link\">open source data modelling tools<\/a>, or a complete novice.<\/p>\n\n\n\n<p>However, there are a few key concepts you should be clued up on before you begin, including:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>General Python functions<\/li>\n\n\n\n<li>Substring checks<\/li>\n\n\n\n<li>Substring replacements<\/li>\n\n\n\n<li>File input\/output<\/li>\n\n\n\n<li>Lists and tuples<\/li>\n<\/ul>\n\n\n\n<p>Before starting, you should import the necessary data packages and initialize the variables you wish to use in your chatbot project. It\u2019s also important to perform data preprocessing on any text data you\u2019ll be using to design the ML model.<\/p>\n\n\n\n<p>Creating the testing and training datasets before you begin will also help you save time later on.&nbsp;<\/p>\n\n\n\n<p>We\u2019ll be using the ChatterBot library to create our Python chatbot, so&nbsp; ensure you have access to a version of Python that works with your chosen version of ChatterBot.&nbsp;<\/p>\n\n\n\n<p>If you need a quick refresher on Python and its use before you begin, there are plenty of online resources that will show you <a href=\"https:\/\/www.databricks.com\/learn\/training\/introduction-to-python\" class=\"ek-link\">how to learn Python for data engineering<\/a>, or a multitude of other purposes.<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><em><strong>Recommended read: <a href=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/document-understanding-large-language-models\/\" target=\"_blank\" aria-label=\"Document Understanding With Large Language Models on Google Cloud (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">Document Understanding With Large Language Models on Google Cloud<\/a><\/strong><\/em><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<h2 class=\"wp-block-heading\">Developing Your Own Chatbot From Scratch<\/h2>\n\n\n\n<p>Now that we\u2019re armed with some background knowledge, it\u2019s time to build our own chatbot.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Prepare dependencies<\/li>\n<\/ol>\n\n\n\n<p>The first step is to install the ChatterBot library in your system. It\u2019s recommended that you use a new Python virtual environment in order to do this.<\/p>\n\n\n\n<p>To achieve this, write and execute this command in your Python terminal:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">pip install chatterbot\r\npip install chatterbot_corpus\r\n<\/code><\/span><\/pre>\n\n\n<p>If you wish to upgrade to ChatterBot\u2019s latest development version, execute the command:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">Pip install - -upgrade chatterbot_corpus\r\nPip install - -upgrade chatterbot \r\n<\/code><\/span><\/pre>\n\n\n<p>Once these steps are complete your setup will be ready, and we can start to create the Python chatbot.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Import classes<\/li>\n<\/ol>\n\n\n\n<p>The next step is to import classes.&nbsp;<\/p>\n\n\n\n<p>Classes are code templates used for creating objects, and we\u2019re going to use them to build our chatbot.<\/p>\n\n\n\n<p>There are two classes we\u2019ll need to download to do this: ChatBot from chatterbot, and ListTrainer from chatterbot.trainers.<\/p>\n\n\n\n<p>To download these, execute these commands:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-1\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">from<\/span> chatterbot <span class=\"hljs-keyword\">import<\/span> ChatBot\r\n<span class=\"hljs-keyword\">from<\/span> chatterbot.trainers <span class=\"hljs-keyword\">import<\/span> ListTrainer\r\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-1\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<ol class=\"wp-block-list\">\n<li>Train the chatbot<\/li>\n<\/ol>\n\n\n\n<p>The chatbot you\u2019re building will be an instance belonging to the class \u2018ChatBot\u2019.&nbsp;<\/p>\n\n\n\n<p>Create a new ChatterBot instance, and then you can begin <a href=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/understanding-ai-training\/\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">training the chatbot<\/a>.<\/p>\n\n\n\n<p>Training the chatbot will help to improve its performance, giving it the ability to respond with a wider range of more relevant phrases.<\/p>\n\n\n\n<p>&nbsp;You can begin by executing the following command:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-2\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">my_bot = ChatBot(name=\u2019Chatty\u2019, read_only=<span class=\"hljs-keyword\">True<\/span>,\r\nlogic_adapters=\r\n&#91;\u2018chatterbot.logic.MathematicalEvaluation\u2019,\u2019chatterbot.logic.BestMatch\u2019])\r\n<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-2\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>Let\u2019s break down that command so we understand how we\u2019re training the chatbot.<\/p>\n\n\n\n<p>\u2018name=\u2019 refers to the name of your chatbot. <strong>We\u2019ve called this one Chatty<\/strong>, but feel free to choose something more original!\u00a0<\/p>\n\n\n\n<p>If you\u2019re planning to set up a website to give your chatbot a home, don\u2019t forget to make sure your desired domain is available with a check domain service.<\/p>\n\n\n\n<p>For example, if you&#8217;re developing an AI-driven chatbot for an ecommerce website, you can train it to provide product recommendations, answer customer inquiries about orders and shipping, and assist with the checkout process.<\/p>\n\n\n\n<p>The command \u2018read_only=True\u2019 means that the chatbot\u2019s ability to learn after this training has been disabled. This is optional, depending on the purpose of the chatbot.<\/p>\n\n\n\n<p>The command \u2018logic_adapters\u2019 provides the list of resources that will be used to train the chatbot.<\/p>\n\n\n\n<p>This chatbot is going to <strong>solve mathematical problems<\/strong>, so \u2018chatterbot.logic.MathematicalEvaluation\u2019 is included. This logic adapter checks statements for mathematical equations. If one is present, a response is returned containing the result.<\/p>\n\n\n\n<p>The logic adapter \u2018chatterbot.logic.BestMatch\u2019 is used so that that chatbot is able to select a response based on the best known match to any given statement.<\/p>\n\n\n\n<p>In order for this to work, you\u2019ll need to provide your chatbot with a list of responses.&nbsp;<\/p>\n\n\n\n<p>Here are just a few of the strings you can train your chatbot to learn:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">animals = &#91;\u201caardvark\u201d, \u201cbadger\u201d, \u201ccat\u201d, \u201cdog\u201d, \u201celephant\u201d]\r<\/code><\/span><\/pre>\n\n\n<p>For clarity, you can also place each string on a separate line:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-3\" data-shcb-language-name=\"PHP\" data-shcb-language-slug=\"php\"><span><code class=\"hljs language-php\">small_talk = &#91;\u201chi!\u201d\r\n\u201chow\\\u2019re you?\u201d\r\n\u201cwhat\\\u2019s up?\u201d\r\n\u201cglad to hear that\u201d\r\n\u201ci\\\u2019m chatty the chatbot. <span class=\"hljs-keyword\">Do<\/span> you have a maths question?\u201d]\r<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-3\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">PHP<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">php<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>We\u2019ll need to train it to be able to recognise and solve maths problems if it\u2019s going to be asked them, for example:<\/p>\n\n\n<pre class=\"wp-block-code\"><span><code class=\"hljs\">math_talk_1 = &#91;\u2018pythagorean theorem\u2019,\n\n\u2018a squared plus b squared equals c squared.\u2019]<\/code><\/span><\/pre>\n\n\n<p>Your chatbot is now ready to engage in basic communication, and solve some maths problems.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Communicate with the chatbot<\/li>\n<\/ol>\n\n\n\n<p>Now you can start to play around with your chatbot, communicating with it in order to see how it responds to various queries.<\/p>\n\n\n\n<p>It\u2019s important to remember that, at this stage, your chatbot\u2019s training is still relatively limited, so its responses may be somewhat lacklustre.<\/p>\n\n\n\n<p>You should take note of any particular queries that your chatbot struggles with, so that you know which areas to prioritise when it comes to training your chatbot further.&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\" start=\"2\">\n<li>Train the chatbot further<\/li>\n<\/ol>\n\n\n\n<p>Now that you\u2019ve got an idea about which areas of conversation your chatbot needs improving in, you can train it further using an existing corpus of data.<\/p>\n\n\n\n<p>A corpus is a collection of authentic text or audio that has been organised into datasets. There are numerous sources of data that can be used to create a corpus, including novels, newspapers, television shows, radio broadcasts, and even tweets.<\/p>\n\n\n\n<p>ChatterBot provides some corpora that can be used for this purpose:<\/p>\n\n\n<pre class=\"wp-block-code\" aria-describedby=\"shcb-language-4\" data-shcb-language-name=\"JavaScript\" data-shcb-language-slug=\"javascript\"><span><code class=\"hljs language-javascript\"><span class=\"hljs-keyword\">from<\/span> chatterbot.trainers <span class=\"hljs-keyword\">import<\/span> ChatterBotCorpusTrainer\r\ncorpus_trainer = ChatterBotCorpusTrainer(my_bot)\r\ncorpus_trainer.train(\u2018chatterbot.corpus.english\u2019)\r<\/code><\/span><small class=\"shcb-language\" id=\"shcb-language-4\"><span class=\"shcb-language__label\">Code language:<\/span> <span class=\"shcb-language__name\">JavaScript<\/span> <span class=\"shcb-language__paren\">(<\/span><span class=\"shcb-language__slug\">javascript<\/span><span class=\"shcb-language__paren\">)<\/span><\/small><\/pre>\n\n\n<p>ChatterBot offers corpora in a variety of different languages, meaning that you\u2019ll have easy access to training materials, regardless of the purpose or intended location of your chatbot.<\/p>\n\n\n\n<p>If you wish, <strong>you can even export a chat from a messaging platform such as WhatsApp<\/strong> to train your chatbot. Not only does this mean that you can train your chatbot on curated topics, but you have access to prime examples of natural language for your chatbot to learn from.<\/p>\n\n\n\n<p>Once your chatbot is trained to your satisfaction, it should be ready to start chatting.<\/p>\n\n\n\n<p>Don\u2019t forget to test your chatbot further if you want to be assured of its functionality, (consider using <a href=\"https:\/\/www.globalapptesting.com\/blog\/what-is-automation-testing\" target=\"_blank\" aria-label=\" (opens in a new tab)\" rel=\"noreferrer noopener\" class=\"ek-link\">software test automation<\/a> to speed the process up).<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Congratulations, You\u2019ve Built a Chatbot in Python<\/h2>\n\n\n\n<p>The method we\u2019ve outlined here is just one way that you can create a chatbot in Python. There are various other methods you can use, so why not experiment a little and find an approach that suits you.<\/p>\n\n\n\n<p>The chatbot we\u2019ve built is relatively simple, but there are much more complex things you can try when building your own chatbot in Python. If it sparks your interest, then learn<a aria-label=\" (opens in a new tab)\" href=\"https:\/\/www.databricks.com\/glossary\/deep-learning\" target=\"_blank\" rel=\"noreferrer noopener\" class=\"ek-link\"> how deep learning works<\/a>. You can build a chatbot that can provide answers to your customers\u2019 queries, take payments, recommend products, or even direct incoming calls.<\/p>\n\n\n\n<p>Keep working at it, and see what you can achieve.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Building a ChatBot with Python is easier than you may initially think. Chatbots are extremely popular right now, as they bring many benefits to companies in terms of user experience. In this guide, we\u2019re going to look at how you can build your very own chatbot in Python, step-by-step. Before we get to that, though,&#8230; <a class=\"more-link\" href=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/\">Read more<\/a><\/p>\n","protected":false},"author":147,"featured_media":21772,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_editorskit_title_hidden":false,"_editorskit_reading_time":0,"_editorskit_is_block_options_detached":false,"_editorskit_block_options_position":"{}","_uag_custom_page_level_css":"","_genesis_hide_title":false,"_genesis_hide_breadcrumbs":false,"_genesis_hide_singular_image":false,"_genesis_hide_footer_widgets":false,"_genesis_custom_body_class":"","_genesis_custom_post_class":"","_genesis_layout":"","footnotes":""},"categories":[46],"tags":[],"collections":[],"class_list":{"0":"post-21770","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-ai-ml","8":"entry"},"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.9 (Yoast SEO v26.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Create a ChatBot with Python and ChatterBot: Step By Step<\/title>\n<meta name=\"description\" content=\"Chatbots can help you perform many tasks and increase your productivity. Here&#039;s how to build your own chatbot with Python.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Develop Your Own Chatbot With Python and ChatterBot from Scratch\" \/>\n<meta property=\"og:description\" content=\"Chatbots can help you perform many tasks and increase your productivity. Here&#039;s how to build your own chatbot with Python.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/\" \/>\n<meta property=\"og:site_name\" content=\"Codemotion Magazine\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Codemotion.Italy\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-10T07:34:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1280\" \/>\n\t<meta property=\"og:image:height\" content=\"905\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Pohan Lin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:site\" content=\"@CodemotionIT\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Pohan Lin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/\"},\"author\":{\"name\":\"Pohan Lin\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/c160cbd1f9c52359651eb105e9908eb0\"},\"headline\":\"How to Develop Your Own Chatbot With Python and ChatterBot from Scratch\",\"datePublished\":\"2023-07-10T07:34:00+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/\"},\"wordCount\":1775,\"publisher\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg\",\"articleSection\":[\"AI\/ML\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/\",\"name\":\"Create a ChatBot with Python and ChatterBot: Step By Step\",\"isPartOf\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg\",\"datePublished\":\"2023-07-10T07:34:00+00:00\",\"description\":\"Chatbots can help you perform many tasks and increase your productivity. Here's how to build your own chatbot with Python.\",\"breadcrumb\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#primaryimage\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg\",\"contentUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg\",\"width\":1280,\"height\":905,\"caption\":\"Let's create a chatbot with Python and Chatterbot!\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"AI\/ML\",\"item\":\"https:\/\/www.codemotion.com\/magazine\/ai-ml\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Develop Your Own Chatbot With Python and ChatterBot from Scratch\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#website\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/\",\"name\":\"Codemotion Magazine\",\"description\":\"We code the future. Together\",\"publisher\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#organization\",\"name\":\"Codemotion\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png\",\"contentUrl\":\"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png\",\"width\":225,\"height\":225,\"caption\":\"Codemotion\"},\"image\":{\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/Codemotion.Italy\/\",\"https:\/\/x.com\/CodemotionIT\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/c160cbd1f9c52359651eb105e9908eb0\",\"name\":\"Pohan Lin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/bfd1d2c6b4754a561bc1bce5137a9376380f436b75a10e2ee06a1ae59bce472c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/bfd1d2c6b4754a561bc1bce5137a9376380f436b75a10e2ee06a1ae59bce472c?s=96&d=mm&r=g\",\"caption\":\"Pohan Lin\"},\"description\":\"Pohan Lin is the Senior Web Marketing and Localizations Manager at Databricks. Databricks is a global AI and AutoML open source provider connecting the features of data warehouses and data lakes to create lakehouse architecture. With over 18 years of experience in web marketing, online SaaS business and ecommerce growth, Pohan is passionate about innovation and is dedicated to communicating the significant impact data has in marketing. Pohan Lin also published articles for domains such as SME-News. Here is Pohan\u2019s LinkedIn.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/pohan-lin-7ba9\/\"],\"url\":\"https:\/\/www.codemotion.com\/magazine\/author\/pohan-lin\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Create a ChatBot with Python and ChatterBot: Step By Step","description":"Chatbots can help you perform many tasks and increase your productivity. Here's how to build your own chatbot with Python.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/","og_locale":"en_US","og_type":"article","og_title":"How to Develop Your Own Chatbot With Python and ChatterBot from Scratch","og_description":"Chatbots can help you perform many tasks and increase your productivity. Here's how to build your own chatbot with Python.","og_url":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/","og_site_name":"Codemotion Magazine","article_publisher":"https:\/\/www.facebook.com\/Codemotion.Italy\/","article_published_time":"2023-07-10T07:34:00+00:00","og_image":[{"width":1280,"height":905,"url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg","type":"image\/jpeg"}],"author":"Pohan Lin","twitter_card":"summary_large_image","twitter_creator":"@CodemotionIT","twitter_site":"@CodemotionIT","twitter_misc":{"Written by":"Pohan Lin","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#article","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/"},"author":{"name":"Pohan Lin","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/c160cbd1f9c52359651eb105e9908eb0"},"headline":"How to Develop Your Own Chatbot With Python and ChatterBot from Scratch","datePublished":"2023-07-10T07:34:00+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/"},"wordCount":1775,"publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg","articleSection":["AI\/ML"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/","url":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/","name":"Create a ChatBot with Python and ChatterBot: Step By Step","isPartOf":{"@id":"https:\/\/www.codemotion.com\/magazine\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#primaryimage"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg","datePublished":"2023-07-10T07:34:00+00:00","description":"Chatbots can help you perform many tasks and increase your productivity. Here's how to build your own chatbot with Python.","breadcrumb":{"@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#primaryimage","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg","width":1280,"height":905,"caption":"Let's create a chatbot with Python and Chatterbot!"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/develop-chatbot-with-python-and-chatterbot\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codemotion.com\/magazine\/"},{"@type":"ListItem","position":2,"name":"AI\/ML","item":"https:\/\/www.codemotion.com\/magazine\/ai-ml\/"},{"@type":"ListItem","position":3,"name":"How to Develop Your Own Chatbot With Python and ChatterBot from Scratch"}]},{"@type":"WebSite","@id":"https:\/\/www.codemotion.com\/magazine\/#website","url":"https:\/\/www.codemotion.com\/magazine\/","name":"Codemotion Magazine","description":"We code the future. Together","publisher":{"@id":"https:\/\/www.codemotion.com\/magazine\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codemotion.com\/magazine\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codemotion.com\/magazine\/#organization","name":"Codemotion","url":"https:\/\/www.codemotion.com\/magazine\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/","url":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","contentUrl":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2019\/11\/codemotionlogo.png","width":225,"height":225,"caption":"Codemotion"},"image":{"@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/Codemotion.Italy\/","https:\/\/x.com\/CodemotionIT"]},{"@type":"Person","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/c160cbd1f9c52359651eb105e9908eb0","name":"Pohan Lin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codemotion.com\/magazine\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/bfd1d2c6b4754a561bc1bce5137a9376380f436b75a10e2ee06a1ae59bce472c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/bfd1d2c6b4754a561bc1bce5137a9376380f436b75a10e2ee06a1ae59bce472c?s=96&d=mm&r=g","caption":"Pohan Lin"},"description":"Pohan Lin is the Senior Web Marketing and Localizations Manager at Databricks. Databricks is a global AI and AutoML open source provider connecting the features of data warehouses and data lakes to create lakehouse architecture. With over 18 years of experience in web marketing, online SaaS business and ecommerce growth, Pohan is passionate about innovation and is dedicated to communicating the significant impact data has in marketing. Pohan Lin also published articles for domains such as SME-News. Here is Pohan\u2019s LinkedIn.","sameAs":["https:\/\/www.linkedin.com\/in\/pohan-lin-7ba9\/"],"url":"https:\/\/www.codemotion.com\/magazine\/author\/pohan-lin\/"}]}},"featured_image_src":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min-600x400.jpg","featured_image_src_square":"https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min-600x600.jpg","author_info":{"display_name":"Pohan Lin","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/pohan-lin\/"},"uagb_featured_image_src":{"full":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg",1280,905,false],"thumbnail":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min-150x150.jpg",150,150,true],"medium":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min-300x212.jpg",300,212,true],"medium_large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min-768x543.jpg",768,543,true],"large":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min-1024x724.jpg",1024,724,true],"1536x1536":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg",1280,905,false],"2048x2048":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg",1280,905,false],"small-home-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min.jpg",100,71,false],"sidebar-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min-180x128.jpg",180,128,true],"genesis-singular-images":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min-896x504.jpg",896,504,true],"archive-featured":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min-400x225.jpg",400,225,true],"gb-block-post-grid-landscape":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min-600x400.jpg",600,400,true],"gb-block-post-grid-square":["https:\/\/www.codemotion.com\/magazine\/wp-content\/uploads\/2023\/07\/chat-7767694_1280-min-600x600.jpg",600,600,true]},"uagb_author_info":{"display_name":"Pohan Lin","author_link":"https:\/\/www.codemotion.com\/magazine\/author\/pohan-lin\/"},"uagb_comment_info":0,"uagb_excerpt":"Building a ChatBot with Python is easier than you may initially think. Chatbots are extremely popular right now, as they bring many benefits to companies in terms of user experience. In this guide, we\u2019re going to look at how you can build your very own chatbot in Python, step-by-step. Before we get to that, though,&#8230;&hellip;","lang":"en","_links":{"self":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/21770","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/users\/147"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/comments?post=21770"}],"version-history":[{"count":5,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/21770\/revisions"}],"predecessor-version":[{"id":21833,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/posts\/21770\/revisions\/21833"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media\/21772"}],"wp:attachment":[{"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/media?parent=21770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/categories?post=21770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/tags?post=21770"},{"taxonomy":"collections","embeddable":true,"href":"https:\/\/www.codemotion.com\/magazine\/wp-json\/wp\/v2\/collections?post=21770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}