Skip to content
No description, website, or topics provided.
TeX JavaScript HTML CSS Python Shell
Branch: master
Clone or download
Latest commit 0e4abb2 May 6, 2019
Type Name Latest commit message Commit time
Failed to load latest commit information.
images updates readme May 4, 2019
templates adds many things Mar 27, 2019
.gitignore initial commit Mar 21, 2019
Procfile adds procfile & updates requirements Mar 21, 2019 Update May 6, 2019 does a hell lot of changes Mar 27, 2019 adds wordnet corpora for deployment Mar 21, 2019
extra.js does styling Mar 26, 2019 initial commit Mar 21, 2019
ipl.txt initial commit Mar 21, 2019
requirements.txt adds fakeuseragent Mar 27, 2019 adds fakeuseragent Mar 27, 2019


A retreival based chat bot trained on IPL wikipedia pages. You can test out the app here. Please, check the app on a desktop.

Libraries Used

  • Flask - For creating the web app
  • Scikit Learn - For training a Tfidf vectorizer
  • BeautifulSoup, Request - For extracting and parsing data

How to run the app

Clone the repository

git clone

Install the requirements

pip install -r requirements.txt

Run the flask app

cd iplbot

How it works

  1. Run to extract text from the following list of wikipedia pages

  2. Given an input sentence, generate_response function in does the following

    • Lowercase the entire string
    • Removing punctuation marks
    • Word tokenization
    • Lemmatization
    • Train a tfidf vectorizer on the sentences generated in step 1 as well as on the input sentence
    • Uses cosine similarity to find the two closest vectors
    • Sorts the vector similarity in decreasing order & chooses the first vector
    • Gets the corresponding sentence & capitalizes it


Query alt text

Response alt text

Another example alt text

Sometimes the result might be different than expected. Better the quality of data fed in, more accurate the results would be alt text

In case, a non-relevant question is sent in, the bot returns a sorry response alt text

Please star the repo and share it

You can’t perform that action at this time.