This project was developed as part of my CodeAlpha Artificial Intelligence Internship. It is an NLP-based chatbot designed to answer frequently asked questions about an online shopping store. Users can ask about orders, delivery, returns, refunds, payments, account access, and customer support.
View the FAQ Chatbot screenshot
- Chat-style interface built with Streamlit
- Frequently asked questions stored in a separate JSON file
- Text cleaning and normalization before matching
- Stop-word removal and word stemming
- TF-IDF feature extraction
- Cosine-similarity-based question matching
- Fallback response when no reliable match is found
- Conversation history during the current session
- Clear-conversation option
- Similarity score for each response
- Error handling for missing or incorrectly formatted FAQ data
The chatbot uses a collection of sample questions and answers stored in faqs.json.
When a user submits a question, the application:
- Converts the text to lowercase.
- Removes unnecessary characters and common stop words.
- Reduces words to their basic stems using the Porter Stemmer.
- Converts the processed question into a TF-IDF vector.
- Compares it with the stored FAQ questions using cosine similarity.
- Returns the answer linked to the closest matching question.
If the highest similarity score is below the selected threshold, the chatbot asks the user to rephrase the question instead of returning an unreliable answer.
- Python
- Streamlit
- scikit-learn
- NLTK
- JSON
- TF-IDF
- Cosine similarity
The current knowledge base includes questions related to:
- Order tracking
- Delivery times
- Returns and exchanges
- Order cancellation
- Payment methods
- Damaged products
- Refund processing
- Shipping addresses
- International delivery
- Password recovery
- Discount codes
- Product availability
- Customer support
.
├── app.py
├── faqs.json
├── requirements.txt
├── chatbot-demo.png
├── README.md
└── .gitignore
Make sure Python is installed on your computer.
Download the repository as a ZIP file from GitHub and extract it.
Open a terminal or command prompt inside the extracted folder.
pip install -r requirements.txtstreamlit run app.pyThe application will open in your web browser.
You can test the chatbot with questions such as:
- How can I track my order?
- How long does delivery take?
- Can I return an item?
- Which payment methods do you accept?
- When will I receive my refund?
- I forgot my password.
- How can I contact customer support?
This chatbot matches questions using words and phrases found in its FAQ knowledge base. It does not generate new answers or understand every possible question like a large language model.
Its accuracy can be improved by adding more question variations and answers to faqs.json.
The application has been developed and deployed. Its response quality depends on the number and variety of questions available in the FAQ knowledge base.
Shayan Akbar
Developed as part of the CodeAlpha Artificial Intelligence Internship.