DEV Community

Anja
Anja

Posted on

How to create a Chatbot with Python

Hey! Lets have a look at how you can create a simple chatbot with Pythons NLTK module. The module is made for natural language processing. First you need to install and run Jupyter Notebook, to do that you need to run these commands in your terminal:

pip install notebook
jupyter notebook 
Enter fullscreen mode Exit fullscreen mode

Click on ‘new’ and then on ‘Python 3’ and open that file. To install NLTK, write pip install nltk inside one cell, run the cell and restart the Kernel (check the tabs ‘cell’ and ‘kernel’ of the website for the commands).

Write the code snippet :

Alt Text

and run the cell, then type “My name is yourName” and press Enter to see the chatbots answer. In the list with the pairs you can add more pairs for answers of the chatbot. Which are your favorite Python modules? Have a nice day. :-)

Top comments (0)