/ChatBotScratch

A very introductory and beginner level attempt to make a CHATBOT that responds to certain ruled questions.

Primary LanguagePython

ChatBotScratch

This is a beginner level interpretaion model of a chatbot that answers to a certain ruled questions. This repository contains two files that do the following -

  • chatbot.py - The chat bot will reply according to certains rules and regularization.
  • chatbot.txt - The corpus.

Working

I have used the Wikipedia page for chatbots as our corpus. The data is then read and preprocessed. A function is defined for key-word matching, that is, if a user’s input is a greeting, the bot shall return a greeting response. The response is then generated by using the concept of Document Similarity. This will be used to find the similarity between words entered by the user and the words in the corpus. If it doesn’t find the input matching any of the keywords, it returns a response:” I am sorry! I don’t understand you”. Finally, the lines are fed as such the bot says in the beginning and end of the conversation depending on the user's input.

Building the Bot

Packages

  1. io
  2. nltk
  3. random
  4. string
  5. warning
  6. numpy
  7. scikit-learn

Downloading and installing NLTK

$ pip3 install nltk
$ python3 import nltk

Import NLTK and run nltk.download(). You can choose the corpora and models to download. You can also download all packages at once.

Built with

  • Python

Author

  • Nikita Kodkany - Student