Phase 5
Phase 5
Journey
Welcome to the exciting world of chatbots! In this presentation, we'll explore the ins and outs of
designing, training, and improving chatbots using Python.
Introduction to Chatbots
Discover the power of chatbots and why they have become instrumental in various industries. Learn
how chatbots can enhance customer support and automate tasks.
Introduction to Chatbots
Chatbots are virtual assistants that can interact with users through natural language conversations. They
are used in various industries, from customer support to sales and marketing. Let's dive into the
fascinating world of chatbots and discover their potential.
2. Personalized Experience
By analyzing user data, a chatbot can provide tailored recommendations and personalized
interactions.
3. Cost-Effective
Automating customer support with a chatbot can significantly reduce operational costs for
businesses.
```python
import pandas as pd
dataset = pd.read_csv("dialogs.txt")
```
Data Cleaning:
Detail the data cleaning procedures, such as handling missing values, noise
reduction, and formatting.
Include code examples for each cleaning step.
```python
dataset.dropna(inplace=True)
dataset.drop_duplicates(inplace=True)
dataset['message'] = dataset['message'].str.lower()
```python
dataset['message_length'] = dataset['message'].apply(len)
plt.xlabel("Message Length")
plt.ylabel("Frequency")
plt.show()
```
import random
import json
import pickle
import numpy as np
import tensorflow as tf
import nltk
from nltk.stem import WordNetLemmatizer
lemmatizer = WordNetLemmatizer()
words = []
classes = []
documents = []
ignoreLetters = ['?', '!', '.', ',']
classes = sorted(set(classes))
training = []
outputEmpty = [0] * len(classes)
outputRow = list(outputEmpty)
outputRow[classes.index(document[1])] = 1
training.append(bag + outputRow)
random.shuffle(training)
training = np.array(training)
model = tf.keras.Sequential()
model.add(tf.keras.layers.Dense(128, input_shape=(len(trainX[0]),), activation =
'relu'))
model.add(tf.keras.layers.Dropout(0.5))
model.add(tf.keras.layers.Dense(64, activation = 'relu'))
model.add(tf.keras.layers.Dropout(0.5))
model.add(tf.keras.layers.Dense(len(trainY[0]), activation='softmax'))