0% found this document useful (0 votes)
10 views

AI Chatbot Practical File

This document outlines a project to create an AI-powered chatbot using Python and the nltk library for basic Q&A interactions. The chatbot operates by matching user input with predefined patterns and providing responses accordingly. Future enhancements may involve integrating machine learning for improved response accuracy.

Uploaded by

babliisaharsa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views

AI Chatbot Practical File

This document outlines a project to create an AI-powered chatbot using Python and the nltk library for basic Q&A interactions. The chatbot operates by matching user input with predefined patterns and providing responses accordingly. Future enhancements may involve integrating machine learning for improved response accuracy.

Uploaded by

babliisaharsa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

AI Project: AI-Powered Chatbot for Basic Q&A

Introduction:

This project aims to create an AI chatbot that can answer basic questions. The chatbot is

programmed using Python and the nltk library to simulate human-like conversations.

Objective:

- To understand the basics of Artificial Intelligence and Natural Language Processing.

- To develop an interactive chatbot that can respond to simple queries.

Required Software:

- Python 3.x

- nltk library

Working Principle:

1. The chatbot takes user input.

2. It checks for predefined patterns.

3. If a match is found, it provides a response; otherwise, it gives a default reply.

4. The conversation continues until the user exits.

Python Code:

import random

import nltk

from nltk.chat.util import Chat, reflections

pairs = [

["hi|hello|hey", ["Hello!", "Hi there!", "Hey! How can I help you?"]],

["how are you", ["I'm just a bot, but I'm doing well!", "I'm good! What about you?"]],
["what is your name", ["I'm a chatbot created for this project!", "You can call me AI Bot."]],

["bye|goodbye", ["Goodbye!", "See you soon!", "Take care!"]],

def chatbot():

print("Chatbot: Hello! Type 'bye' to exit.")

chat = Chat(pairs, reflections)

chat.converse()

if __name__ == "__main__":

chatbot()

Output Example:

User: hi

Chatbot: Hello!

User: what is your name?

Chatbot: I'm a chatbot created for this project!

User: bye

Chatbot: Goodbye!

Conclusion:

This project showcases how a simple chatbot can be implemented using Python. It introduces the

concepts of Natural Language Processing and AI-based conversations. Future improvements can

include machine learning integration for better responses.

You might also like