Coders Packet

SAM - retrieval based chatbot using Python

By Mohammed Farhan Baluch

A chatbot that can answer your queries based on a corpus(paragraphs of data). It will pre-process the data by itself & give the most relevant answer.

• Created a retrieval-based chatbot that can answer common college-related queries

• Made using scikit library & NLTK (go-to API for NLP) packages in Python

• Optimized response generation using TF-IDF approach & cosine similarity


>> Steps to make it work properly:

1) Open the .py file & install the missing import libraries using pip in your system eg.

pip install nltk

2) There is a text file attached in zip, open that and replace it with any content you want your chatbot to answer from, eg. Copy the content of 'Mars' from Wikipedia & paste it in the text file.

3) In the file, change the strings to make the chatbot answer common queries, the way you want to (or) leave the default one I've set.

4) Done, Just run the file & enjoy.

Download Complete Code


No comments yet