Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 26 additions & 19 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,44 @@
# 📰 QuickFactChecker – Fake News Detection

## 📌 Project Overview
QuickFactChecker is a machine learning–based web app that helps detect whether a news article is **real** or **fake**.
It uses different models (e.g., Naive Bayes, LSTM) trained on the **LIAR dataset** to evaluate credibility and assist users in identifying potentially misleading information.
QuickFactChecker is a **machine learning–based web app** that helps detect whether a news article is **real** or **fake**.
It uses different models (e.g., Naive Bayes, LSTM) trained on the **LIAR dataset** to evaluate credibility and assist users in identifying potentially misleading information.

---

## ✨ Features
- ✅ Fake news classification using ML models (Naive Bayes, LSTM).
- ✅ Interactive web app built with **Flask** and **HTML templates**.
- ✅ Preprocessed dataset included (`train.tsv`, `test.tsv`, `valid.tsv`).
- ✅ Notebooks for **data analysis & experimentation** (`liar-data-analysis.ipynb`, `dataset.ipynb`).
- ✅ Easy setup with `requirements.txt`.
- ✅ Fake news classification using ML models (**Naive Bayes**, **Logistic Regression**, **Random Forest**, and **LSTM**).
- ✅ Interactive web app built with **Flask** and **HTML templates**.
- ✅ **Automated NLTK Setup** to prevent missing resource errors.
- ✅ Preprocessed dataset included (`train.tsv`, `test.tsv`, `valid.tsv`).
- ✅ Notebooks for **data analysis & experimentation** (`liar-data-analysis.ipynb`, `dataset.ipynb`).
- ✅ Easy setup with `requirements.txt`.

---

## 📂 Project Structure
```bash
dataset/liar
├── README.md ##Dataset description
├── train.tsv ##Training data
├── test.tsv ##Testing data
├── valid.tsv ##Validation data
   ├── README.md   ##Dataset description
   ├── train.tsv   ##Training data
   ├── test.tsv    ##Testing data
   ├── valid.tsv   ##Validation data

module/
├── dataset.ipynb
├── fake-news-detection-using-lstm.ipynb
├── fake-news-detection-using-nb.ipynb
├── liar-data-analysis.ipynb
   ├── dataset.ipynb
   ├── fake-news-detection-using-lstm.ipynb
   ├── fake-news-detection-using-nb.ipynb
   ├── liar-data-analysis.ipynb

templates/
├── index.html
   ├── index.html

scripts/
└── fake_news_logreg_rf.py ## Train & evaluate Naive Bayes, Logistic Regression, Random Forest
   ├── setup_nltk.py
   └── fake_news_logreg_rf.py     ## Train & evaluate Naive Bayes, Logistic Regression, Random Forest
results/
├── model_comparison.md ## Generated baseline comparison table (markdown)
└── comparison.png ## Generated accuracy bar chart
   ├── model_comparison.md        ## Generated baseline comparison table (markdown)
   └── comparison.png             ## Generated accuracy bar chart

.gitattributes
app.py
Expand Down Expand Up @@ -67,6 +69,11 @@ requirements.txt
pip install -r requirements.txt
```

5. Download NLTK Corpora:
```bash
python scripts/setup_nltk.py
```

## 📊 Baseline Model Comparison

We evaluated three models on the LIAR dataset using TF-IDF features. Example results (accuracy & precision):
Expand Down
49 changes: 49 additions & 0 deletions scripts/setup_nltk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import nltk
import ssl

def setup_nltk_resources():
"""
Downloads required NLTK resources, handling potential SSL and download errors.
"""

try:
_create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
pass
else:
ssl._create_default_https_context = _create_unverified_https_context

resource_paths = {
"punkt": "tokenizers/punkt",
"stopwords": "corpora/stopwords",
"wordnet": "corpora/wordnet",
"omw-1.4": "corpora/omw-1.4",
}

print("🚀 Starting NLTK resource setup...\n")

for package, path in resource_paths.items():
print(f"Processing: {package}")

try:
nltk.data.find(path)
print(f" ✅ {package} is already installed.")
except LookupError:
try:
print(f" ⬇️ Downloading {package}...")
nltk.download(package, quiet=False)
print(f" ✅ Successfully downloaded: {package}")
except Exception as e:
print(f"--- 🛑 ERROR downloading {package} ---")
print(" -> Check your network connection or run with administrator permissions.")
print(f" -> Details: {type(e).__name__}: {e}")
except Exception as e:
print(f"⚠️ Unexpected error while checking {package}: {e}")

print()

print("🎉 NLTK resource setup complete.")
print("If you still encounter 'LookupError', ensure NLTK is installed correctly and your Python environment is active.")

if __name__ == "__main__":
setup_nltk_resources()