Final Project Work.
Final Project Work.
OBJECTIVE:
To create a chatbot with minimum 10 questions using NLP
INTRODUCTION:
In the realm of technological advancements, the ability to simulate human conversation through
artificial intelligence has been a significant leap forward. This Python project taps into that
potential by utilizing the ChatterBot library, a powerful tool in the field of Natural Language
Processing (NLP). The project’s cornerstone is ‘MyChatBot’, an interactive chatbot
programmed to respond to a minimum of 15 different questions. The chatbot’s versatility in
handling various topics makes it an exciting venture into the world of AI-driven
communication.
DESCRIPTION:
This Python project utilizes the ChatterBot library to create an interactive chatbot capable of
engaging in conversation by answering a minimum of 15 different questions. The chatbot is
built on Natural Language Processing (NLP) techniques, allowing it to understand and respond
to human language.The program begins by initializing a new ChatBot instance named
‘MyChatBot’. It then employs the ListTrainer class to train the chatbot using a predefined list
of question-and-answer pairs. These pairs are designed to cover various topics, ensuring that
the chatbot can handle a wide range of conversational topics.
Once trained, the chatbot can provide responses to user inputs through the get_response
function. This function takes user input as an argument and returns the chatbot’s response,
simulating a real-time conversation.
The project showcases the application of NLP in creating conversational agents and can be
expanded with additional training data or integrated into different platforms for various use
cases.
NOTE: Initially,necessary library chatterbot is installed using pip before executing the program.
PROGRAM:
# Import ChatBot and ListTrainer
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
# Create a new instance of a ChatBot
chatbot = ChatBot('MyChatBot')
# Create a new trainer for the chatbot
trainer = ListTrainer(chatbot)
# Train the chatbot with a list of conversations
trainer.train([
"Hi there!",
"Hello!",
"How are you?",
"I'm good, thanks!",
"What's your name?",
"I am MyChatBot",
"What can you do?",
"I can have a conversation with you and answer your questions!",
"Who created you?",
"I was created using the ChatterBot library in Python."
"Can you learn?",
"Yes, I can learn from conversations and improve over time."
"What languages do you speak?",
"I can be trained to understand and speak multiple languages."