Skip to content

Latest commit

 

History

8 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

🤖 FAQ Chatbot using Python

Python NLP Platform

A professional, rule-based Intelligent FAQ Chatbot built using Python, Natural Language Processing (NLP), and basic Machine Learning techniques. The application utilizes TF-IDF (Term Frequency-Inverse Document Frequency) and Cosine Similarity to mathematically evaluate user queries and fetch highly accurate responses from a predefined computer science knowledge base.

Optimized to run seamlessly across both standard Desktop IDEs and Android-based terminal environments like Pydroid 3.


✨ Key Features

  • Advanced Text Preprocessing: Automates tokenization, case-normalization, punctuation stripping, and English stopword elimination.
  • Vector Space Modeling: Implements Scikit-Learn's TfidfVectorizer to convert unstructured raw string queries into weighted mathematical vectors.
  • Cosine Similarity Matching: Uses spatial geometry formulas to determine the closest conceptual match between user intent and the database.
  • Strict Confidence Filtering: Enforces a 0.25 similarity threshold score. If user input is too ambiguous, the bot gracefully triggers a polite fallback prompt.
  • Cross-Platform CLI: Interactive, memory-efficient command-line loop handling real-time runtime execution.

🏗️ Project Architecture & Pipeline

 ┌──────────────┐       ┌──────────────────────┐       ┌────────────────────────┐
 │  User Input  │ ───>  │  Text Preprocessing  │ ───>  │  TF-IDF Vectorization  │
 └──────────────┘       │  (NLTK Stopwords)    │       └────────────────────────┘
                        └──────────────────────┘                    │
                                                                    ▼
 ┌──────────────┐       ┌──────────────────────┐       ┌────────────────────────┐
 │ Final Answer │ <───  │ Threshold Validation │ <───  │   Cosine Similarity    │
 └──────────────┘       │      (> 0.25)        │       │   (vs Dataset Keys)    │
                        └──────────────────────┘       └────────────────────────┘

🛠️ Tech Stack & Requirements

  • Core Language: Python 3.x
  • Primary Frameworks:
    • nltk (Natural Language Toolkit) - String tokenization and semantic filtering.
    • scikit-learn - Vector mapping matrix operations.
    • string - Standard structural operations.

📋 Installation & Environment Setup

Ensure you have your environment configured with the required dependencies before bootstrapping the script.

Desktop Deployment (Windows, macOS, Linux):

Execute the following native pip command in your terminal console:

pip install nltk scikit-learn

Android Native Deployment (Pydroid 3):

  1. Launch the Pydroid 3 application interface.
  2. Select the Pip management terminal from the left sidebar navigation menu.
  3. Search for nltk and scikit-learn independently, then click Install.

🚀 Execution Guide

  1. Clone the project locally or pull it directly into your active workspace.
  2. Fire up the core script via your terminal command structure:
    python faq_chatbot.py
  3. Note on First Run: The backend pipeline will automatically parse and sync missing remote packages (punkt, punkt_tab, stopwords) onto your local machine storage.
  4. Interact directly within the continuous interface (e.g., "What is python?", "What is machine learning?").
  5. Type exit smoothly to shut down and de-allocate memory safely.

👩‍💻 Developer

  • Harshita Jain

📄 License

This repository is distributed under the open-source MIT License. Feel free to fork, modify, and utilize this project framework for your academic or custom implementations.

About

A simple offline FAQ chatbot built using Python. It provides instant responses to frequently asked questions without requiring an internet connection. The chatbot uses a predefined knowledge base and is designed for beginners to understand basic chatbot development.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages