A Customer Support Chatbot built using Natural Language Processing (NLP) techniques and Logistic Regression. The chatbot understands user queries and responds based on predefined intents and their associated responses.
This project implements a simple customer support chatbot that can classify user input into predefined categories (intents) and generate appropriate responses. The chatbot uses Logistic Regression for intent classification and TF-IDF Vectorization for text feature extraction. The user interface is built with Streamlit, allowing for an interactive web-based experience.
- Intent Recognition: Identifies the intent of the user's input (e.g., greeting, inquiry, complaint).
- Response Generation: Provides pre-defined responses based on the identified intent.
- Conversation History: Logs user inputs, chatbot responses, and timestamps to a CSV file for later reference.
- Web Interface: A Streamlit-based interface to interact with the chatbot.
- Python 3.x
- Streamlit: A framework for building web apps.
- Scikit-learn: For implementing machine learning models (Logistic Regression, TF-IDF).
- NLTK: For natural language processing tasks (tokenization).
- Pandas: For handling CSV-based conversation history.
- JSON: For storing predefined intents and responses.
To run this project, you need to install the required dependencies. You can do this by creating a virtual environment and installing the dependencies via pip
.
- Create a Virtual Environment (optional but recommended):
python -m venv chatbot-env source chatbot-env/bin/activate # On Windows, use `chatbot-env\Scripts\activate`
- Install Dependencies:
Create a requirements.txt file with the following content:
streamlit scikit-learn nltk pandas Then run the following command to install the dependencies: ```bash pip install -r requirements.txt
git clone <repository-url>
cd <repository-directory>
python -m venv venv
source venv/bin/activate # On Windows use `venv\Scripts\activate`
pip install -r requirements.txt
import nltk
nltk.download('punkt')
To run the chatbot application, execute the following command:
streamlit run app.py
Once the application is running, you can interact with the chatbot through the web interface. Type your message in the input box and press Enter to see the chatbot's response.
The chatbot's behavior is defined by the intents.json
file, which contains various tags, patterns, and responses. You can modify this file to add new intents or change existing ones.
The chatbot saves the conversation history in a CSV file (chat_log.csv
). You can view past interactions by selecting the "Conversation History" option in the sidebar.
Contributions to this project are welcome! If you have suggestions for improvements or features, feel free to open an issue or submit a pull request.
This project is licensed under the MIT License. See the LICENSE file for details.
- NLTK for natural language processing.
- Scikit-learn for machine learning algorithms.
- Streamlit for building the web interface.