{"id":18368030,"url":"https://github.com/pranav016/python-chatbot","last_synced_at":"2025-10-16T18:12:27.903Z","repository":{"id":103533768,"uuid":"309147806","full_name":"Pranav016/Python-Chatbot","owner":"Pranav016","description":"Chatbot made using Chatterbot and Chatterbot Corpus packages.","archived":false,"fork":false,"pushed_at":"2020-11-20T23:28:53.000Z","size":207,"stargazers_count":6,"open_issues_count":0,"forks_count":7,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-22T03:51:17.263Z","etag":null,"topics":["chatterbot","python-chatbot"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Pranav016.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-11-01T17:17:19.000Z","updated_at":"2024-10-07T06:18:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"b97ecb20-3763-4efb-9e25-fdfd006c3f54","html_url":"https://github.com/Pranav016/Python-Chatbot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pranav016%2FPython-Chatbot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pranav016%2FPython-Chatbot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pranav016%2FPython-Chatbot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Pranav016%2FPython-Chatbot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Pranav016","download_url":"https://codeload.github.com/Pranav016/Python-Chatbot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247522316,"owners_count":20952520,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatterbot","python-chatbot"],"created_at":"2024-11-05T23:24:22.434Z","updated_at":"2025-10-16T18:12:27.841Z","avatar_url":"https://github.com/Pranav016.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003chtml\u003e\n\u003ch1\u003ePython Chatbot\u003c/h1\u003e\n\u003c/hr\u003e\n\u003cdiv align=\"center\"\u003e\u003cimg src=\"assets/chatbot.png\"\u003e\u003c/div\u003e\n\u003ch1\u003eWhat is a Chatbot?\u003c/h1\u003e\n\u003ch4\u003eA chatbot is a computer program that's designed to simulate human conversation. Users communicate with these tools using a chat interface or via voice, just like they would converse with another person. Chatbots interpret the words given to them by a person and provide a pre-set answer.\u003c/h4\u003e\n\u003ch4\u003eArtificial intelligence, which brings into play machine learning and Natural language Processing (NLP) for building bot or chatbot, is specifically designed to unravel the smooth interaction between humans and computers.\u003c/h4\u003e\n\u003ch1\u003eHow can Chatbots be useful?\u003c/h1\u003e\n\u003cul\u003e\n    \u003cli\u003e\u003cb\u003eIncreases operational efficiency.\u003c/b\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003eAutomating customer request fulfillment.\u003c/b\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003eHandling basic queries, which in turn free employees to work for complex \u0026 higher value inquiries.\u003c/b\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003eOffers Multi-language support.\u003c/b\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003eSaves time \u0026 effort by automating customer support.\u003c/b\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003eImproves the response rate as well as customer engagement.\u003c/b\u003e\u003c/li\u003e\n    \u003cli\u003e\u003cb\u003ePersonalization of communication\u003c/b\u003e\u003c/li\u003e\n\u003c/ul\u003e\n\u003ch1\u003ePackages used:\u003c/h1\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ch2\u003eChatterbot\u003c/h2\u003e\u003c/li\u003e\n    \u003cb\u003eChatterBot is a Python library that makes it easy to generate automated responses to a user’s input. ChatterBot uses a selection of machine learning algorithms to produce different types of responses.\u003c/b\u003e\n\u003cli\u003e\u003ch2\u003eChatterbot Corpus\u003c/h2\u003e\u003c/li\u003e\n    \u003cb\u003eThis is a corpus of dialog data that is included in the chatterbot module.\u003c/b\u003e\n\u003c/ul\u003e\n\u003ch1\u003eHow does this chatbot work?\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\u003cimg src=\"assets/flowchart.png\"\u003e\u003c/div\u003e\n\u003cul\u003e\n\u003cli\u003e\u003ch4\u003eAfter importing chatterbot and chatterbot corpus we create an instance of our chatbot class. We use logical adapters such as \u003ccode\u003echatterbot.logic.BestMatch\u003c/code\u003e and \u003ccode\u003echatterbot.logic.TimeLogicAdapter\u003c/code\u003e.\u003c/h4\u003e\u003c/li\u003e\n    \u003cpre\u003e\u003ccode\u003ebot = ChatBot(\n        'Pranav',\n        logic_adapters=[\n            'chatterbot.logic.BestMatch',\n            'chatterbot.logic.TimeLogicAdapter'],\n    )\u003c/code\u003e\u003c/pre\u003e\n\u003cli\u003e\u003ch2\u003eLogical Adapters\u003c/h2\u003e\u003c/li\u003e\n\u003ch4\u003eLogic adapters determine the logic for how ChatterBot selects a response to a given input statement. It is possible to enter any number of logic adapters for your bot to use. If multiple adapters are used, then the bot will return the response with the highest calculated confidence value. If multiple adapters return the same confidence, then the adapter that is entered into the list first will take priority.\u003c/h4\u003e\n\u003cul\u003e\n    \u003cli\u003e\u003ch3\u003echatterbot.logic.BestMatch\u003c/h3\u003e\u003c/li\u003e\n    \u003ch4\u003eThe logic adapter returns a response based on known responses to the closest matches to the input statement.\u003c/h4\u003e\n    \u003cli\u003e\u003ch3\u003echatterbot.logic.BestMatch\u003c/h3\u003e\u003c/li\u003e\n    \u003ch4\u003eThe TimeLogicAdapter identifies statements in which a question about the current time is asked. If a matching question is detected, then a response containing the current time is returned.\u003c/h4\u003e\n\u003c/ul\u003e\n\u003cli\u003e\u003ch2\u003eTraining our chatbot\u003c/h2\u003e\u003c/li\u003e\n\u003cli\u003e\u003ch4\u003eChatterBot includes tools that help simplify the process of training a chat bot instance. ChatterBot’s training process involves loading example dialog into the chat bot’s database. This either creates or builds upon the graph data structure that represents the sets of known statements and responses. When a chat bot trainer is provided with a data set, it creates the necessary entries in the chat bot’s knowledge graph so that the statement inputs and responses are correctly represented.\u003c/h4\u003e\n\u003cpre\u003e\u003ccode\u003efrom chatterbot.trainers import ChatterBotCorpusTrainer\u003c/code\u003e\u003c/pre\u003e\n\u003ch4\u003eWe can also train our chatterbot on a list using \u003ccode\u003echatterbot.trainers.ListTrainer\u003c/code\u003e\u003c/h4\u003e\u003c/li\u003e\n\u003cli\u003e\u003ch4\u003eMaking an instance of the ChatterbotCorpusTrainer\u003c/h4\u003e\n\u003cpre\u003e\u003ccode\u003etrainer.train('chatterbot.corpus.english')\u003c/code\u003e\u003c/pre\u003e\u003c/li\u003e\n\u003cli\u003e\u003ch4\u003eHere I have trained the chatbot using the inbuilt data in the chatterbot corpus.\u003c/h4\u003e\n\u003cpre\u003e\u003ccode\u003etrainer.train('chatterbot.corpus.english')\u003c/code\u003e\u003c/pre\u003e\n\u003cdiv align=\"center\"\u003e\u003cimg src=\"assets/training.png\"\u003e\u003c/div\u003e\n\u003ch4\u003eFor more info on the data, refer to the official repo of the \u003ca href=\"https://github.com/gunthercox/chatterbot-corpus\"\u003eChatterbotCorpus\u003c/a\u003e package.\u003c/h4\u003e\u003c/li\u003e\n\u003cli\u003e\u003ch4\u003eThis piece of code is pretty straight forward. It uses a while loop to get responses untill we get a 'Bye' from the user.\u003c/h4\u003e\n\u003cpre\u003e\u003ccode\u003ename=input(\"Enter Your Name: \")\nprint(\"Hi \"+name+\", how can I help you?\")\nwhile True:\n    request=input(name+':')\n    if request=='Bye' or request =='bye':\n        print('Pranav: Bye')\n        break\n    else:\n        response=bot.get_response(request)\n        print('Pranav:',response)\n\u003c/code\u003e\u003c/pre\u003e\n\u003ch4\u003eHere \u003ccode\u003eget_response()\u003c/code\u003e is a method of chatbot instance. It return the bot’s response based on the input.\u003c/h4\u003e\u003c/li\u003e\n\n\u003ch1\u003eEnvironment Setup and Local Installation:\u003c/h1\u003e\n\u003col\u003e\n\u003cli\u003e\u003cb\u003eDrop a \u003cspan style='font-size:20px;'\u003e\u0026#9733;\u003c/span\u003e on the Github Repository.\u003c/br\u003e\n\u003c/br\u003e\n\n\u003cli\u003eDownload Python IDE (recommended Anaconda IDE)\n\u003c/br\u003e\n\t\u003ca href=\"https://docs.anaconda.com/anaconda/install/windows/\"\u003eInstall Anaconda for Windows\u003c/a\u003e\u003c/br\u003e\n\t\u003ca href=\"https://docs.anaconda.com/anaconda/install/mac-os/\"\u003eInstall Anaconda for MacOS\u003c/a\u003e\u003c/br\u003e\n\t\u003ca href=\"https://docs.anaconda.com/anaconda/install/linux/\"\u003eInstall Anaconda for Linux\u003c/a\u003e\n    \u003c/li\u003e\n\u003c/br\u003e\n\n\u003cli\u003eClone the Repo by going to your local Git Client and pushing this command:\n\u003c/br\u003e\n\t\u003cpre\u003e\u003ccode\u003egit clone https://github.com/Pranav016/Python-Chatbot.git\u003c/code\u003e\u003c/pre\u003e\n\u003c/li\u003e\u003c/br\u003e\n\n\u003cli\u003eGo to the AnacondaPrompt and use this command to install the packages. Open Jupyter Notebook to work-on/ use the chatbot:\n\u003cpre\u003e\u003ccode\u003e\n    pip install -r requirements.txt\n\u003c/code\u003e\u003c/pre\u003e\n\u003c/br\u003e\n    or\n\u003c/br\u003e\n\nOpen the project in your Jupyter Notebook.\nRun these commands in it.\n\u003cpre\u003e\u003ccode\u003e\n    !pip install chatterbot\n    !pip install chatterbot_corpus\n\u003c/code\u003e\u003c/pre\u003e\n\u003c/b\u003e\u003c/li\u003e\u003c/ol\u003e\n\u003ch2\u003eLicensed under \u003ca href=\"LICENSE\"\u003eMIT LICENSE\u003c/a\u003e\u003c/h2\u003e\n\u003c/html\u003e","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpranav016%2Fpython-chatbot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpranav016%2Fpython-chatbot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpranav016%2Fpython-chatbot/lists"}