Crisis Detection using NLP, Sentiment Analysis & Geospatial Mapping
CrisisWatch-NLP is a social media analysis tool. The goal is to build a pipeline that detects, analyzes, and visualizes crisis-related discussions (e.g., suicidality, mental health distress, substance use) from Reddit using advanced NLP techniques and geospatial tools.
- 🔍 Extract crisis-related posts from Reddit based on keyword filters and location cues
- 💬 Analyze sentiment using VADER
- 🧠 Assess crisis risk levels using BERT-based semantic similarity
- 🗺️ Visualize regional distress patterns on an interactive map
- Collected posts via Reddit’s
prawAPI from mental health subreddits - Filtered posts using a keyword list (e.g., “i want to die”, “relapse”)
- Cleaned text using
nltk(stopwords, punctuation, emojis removed) - Output:
raw_reddit_posts.csv,cleaned_reddit_posts.csv
- Applied VADER sentiment scoring (Positive, Neutral, Negative)
- Embedded post text and high-risk phrases using BERT (
sentence-transformers) - Calculated semantic similarity to label risk levels:
- 🟥 High-Risk
- 🟧 Moderate Concern
- 🟩 Low Concern
- Output:
reddit_bert_risk_labeled.csv, distribution plots
- Extracted city/state names using spaCy NER (GPE labels)
- Geocoded locations with
geopy.Nominatim - Created interactive Folium heatmap of distress discussions
- Displayed Top 5 crisis-prone locations
- Output:
crisis_heatmap.html
| Component | Tool / Library |
|---|---|
| Data Source | Reddit via praw |
| NLP | nltk, spaCy, sentence-transformers |
| Sentiment | vaderSentiment |
| Embeddings | BERT (all-MiniLM-L6-v2) |
| Geocoding | geopy |
| Mapping | folium |
| Visualization | matplotlib, seaborn |
| Environment | Google Colab |
- Open the notebook in Google Colab
- Run code cells step-by-step:
- Extract posts
- Clean text
- Run sentiment & BERT classification
- Extract and map locations
- Download outputs:
- CSV files
crisis_heatmap.html
/crisiswatch-nlp/
├── raw_reddit_posts.csv
├── cleaned_reddit_posts.csv
├── reddit_bert_risk_labeled.csv
├── crisis_heatmap.html
├── README.md
└── [Colab Notebook].ipynb