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
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
images updates readme May 4, 2019
nltk_data
static
templates adds many things Mar 27, 2019
.gitignore initial commit Mar 21, 2019
Procfile adds procfile & updates requirements Mar 21, 2019
README.md Update README.md May 6, 2019
app.py does a hell lot of changes Mar 27, 2019
bot.py adds wordnet corpora for deployment Mar 21, 2019
extra.js does styling Mar 26, 2019
extractor.py initial commit Mar 21, 2019
ipl.txt initial commit Mar 21, 2019
requirements.txt adds fakeuseragent Mar 27, 2019
scraper.py adds fakeuseragent Mar 27, 2019

README.md

IPL BOT

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 https://github.com/adimyth/iplbot.git

Install the requirements

pip install -r requirements.txt

Run the flask app

cd iplbot
python app.py

How it works

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

  2. Given an input sentence, generate_response function in bot.py 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

Results

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.