Build A Smart Chat Bot Using Python & Machine Learning

Build A Smart Chat Bot Using Python & Machine Learning

⭐Please Subscribe !⭐

⭐Support the channel and/or get the code by becoming a supporter on Patreon:

⭐Website:

⭐Helpful Programming Books
► Python (Hands-Machine-Learning-Scikit-Learn-TensorFlow):

► Learning Python:

►Head First Python:

► C-Programming :

► Head First Java:

Promising new research on kidneys:

Mayo Clinic Website on Chronic Kidney Disease:

33 Comments

  1. You are amazing mate! Good work. When are you releasing a part 2 to this?. I need to see how your’e going to make the Bot more specific to the user’s question input.

    1. Me too, i am currently working on a chatbot, which will prolly go on my college website, so that students will get their answer more quickly…i would like to see the part 2.

  2. Great tutorial! I have liked, subbed and shared with my friends, however was wondering if you could give further advice/ links on pulling from multiple sites and selecting a response most relevant from both, and this issue I have with .split():


    for word in text.split():
    if word in user_greetings:
    return random.choice(bot_greetings)

    ‘builtin_function_or_method’ object has no attribute ‘split’

    I am using the same site and replicated your code, not sure why .split() is not working

  3. Congratulation, you presented this tutorial in an easy way to follow and understand.
    I might be missing somehing becuase the bot does search the website one set at the article = Article() cell, however when I or someone ask a question or give a key word about that Article , the bot doesn’t bring back any answer ; it just says None. ..
    Maybe you can give me some clue as why it’s doing that?
    Thanks , 🙂

  4. Azaming work of yours it is! But I can’t understand. Can you kindly tell me does this code follow client server paradigm? If yes, how?

  5. Thank you so much for this tutorial! It was very educational, and the best part is that it works. Even on vscode, just tried it there!

  6. Thank you so much. You saved my day. This video helped me to finish my internship recruitment task. Thank you very much again.

    1. Yeah, and this was my first time on NLP, and i had only 1 day of time, so with the help of this video I did that project in a single day from strach.

  7. Can you continue this series? Like how you make data pre-processing and cleaning for more accurate response?

    Btw thanks for the video!

  8. Instead of building the “index_sort” function from scratch you could also use python built-in sort() function.

    1. Actually he can’t, he’s sorting one list based off the values of another list. Where the sort function just sorts the list it is applied to. He did use an adaptation of the bubble sort algorithm which is pretty inefficient, a quick sort or merge sort adaptation would be better.

    2. @Cameron Zuziak For a small list like the article he used as an example, the list would not be long enough to be worth implementing any other sort than the bubble sort. The bubble sort may be inefficient but it has its purpose with ease of coding and small arrays.

  9. That’s freaking genius. appending the users sentence to the sentence list to keep info is a smart way to do it. nice one.

  10. by the way in the index_sort() function why are we sorting them manually instead of using in build sort()?
    can anyone explain?

  11. Hello! I fixed the split/splot typo but I’m still getting the following AttributeError:

    AttributeError: ‘builtin_function_or_method’ object has no attribute ‘split’

    Does anyone have any advice on how to fix this? Thanks x

  12. Some clarifications: This chatbot is not able to answer any questions about a given text corpus. It uses a comparably simple approach (cosine similarity) to compute the relative distance between a query (the request) and sentences contained in a corpus. Responses like greetings are chosen randomly from a predefined list. The bot has no memory (state tracking) nor does it use ML or AI techniques. It can also not identify user “intents”.
    It is therefore neither smart nor does it use ML/AI techniques.

  13. Hello, thanks for your contribution on this one!
    So I have a couple of questions.
    So I am using a different approach to talk the the chatbot, by have a JSON data file with patterns(user inputs) and responses and calculated inside which are close so it will print and appropriate response…
    Though the thing I wanna ask you is, how to implement a whole wiki_en_articles.txt corpus to all this scenario, so I will get back info on what the user put.
    The file is a huge txt.
    Let’s say i input how many planets exists in the solar system?
    So I am expecting the chatbot to reply to me with the correct answer.
    Is there a way to implement such a thing with my current way of doing it?
    I don’t want an API, I have the whole data to text, each line an article

  14. Very useful tutorial but i just have one question: whenever i print the corpus it just prints the transcript of the first video instead of the entire article. Is there anyway to print the article only? Any help would be appreciated.

Leave a Reply

Your email address will not be published. Required fields are marked *

Amazon Affiliate Disclaimer

Amazon Affiliate Disclaimer

“As an Amazon Associate I earn from qualifying purchases.”

Learn more about the Amazon Affiliate Program