A Python package for analyzing WhatsApp group chats.
Project description
WhatsApp Chat Analyzer
Introduction
The WhatsApp Chat Analyzer is a Python project designed to parse and analyze WhatsApp chat exports. It generates detailed HTML reports for each user, providing statistics, various visualizations (like activity heatmaps, sentiment trends, word clouds), and behavioral insights based on the chat data. This tool helps users understand communication patterns, sentiment dynamics, language complexity, and more from their WhatsApp conversations.
Features
- Group Summary Report: Generates a central
index.htmlwith group-wide statistics and links to all participant reports. - General Statistics:
- Total messages, words, emojis, media files shared, and URLs.
- Counts of edited and deleted messages.
- Activity Analysis:
- Activity heatmaps showing message frequency by day of the week and hour.
- Most active hours and overall activity trends.
- Average response time distribution.
- Sentiment Analysis:
- Distribution of message sentiment (positive, negative, neutral).
- Sentiment trends over time.
- Sentiment bubble charts (polarity vs. subjectivity).
- Emotion Analysis:
- Emotion trends (joy, surprise, sadness, anger, neutral) over time based on message content.
- Language Analysis:
- Word clouds to visualize the most frequent words.
- Commonly used N-grams (unigrams, bigrams, trigrams).
- Language complexity metrics (average word length, average sentence length).
- Vocabulary diversity.
- Part-of-Speech (POS) tagging distribution.
- Behavioral Insights:
- Keyword-based analysis for skills (e.g., communication, technical, leadership).
- Detection of Hindi abusive words.
- Generated textual insights based on analyzed traits.
- User Relationship Graphs:
- Network graphs visualizing interactions between users.
- Individual HTML Reports:
- Generates a separate, comprehensive HTML report for each user in the chat.
Installation
- Install the package:
pip install whatsapp-groupchat-analyzer
- Python Version:
- Recommended: Python 3.8 or higher.
- Emoji Fonts:
- For the best display of emojis in generated reports and visualizations, it is highly recommended to have emoji-supporting fonts installed on your system. Examples include "Segoe UI Emoji" (Windows), "Apple Color Emoji" (macOS), or "Noto Color Emoji" (Linux).
How to Use
Using the Command Line Interface (CLI)
The easiest way to use the analyzer is via the built-in CLI command:
# Analyze a chat file and save reports to the 'my_reports' directory
whatsapp-analyzer path/to/chat.txt -o my_reports
# Generate reports for specific users only
whatsapp-analyzer path/to/chat.txt -o my_reports -u "John Doe" "Jane Smith"
If you haven't installed the package yet, you can also run it using:
python -m whatsapp_analyzer.run path/to/chat.txt -o my_reports
As a Python library
from whatsapp_analyzer.analyzer import WhatsAppAnalyzer
# Initialize with the path to your WhatsApp chat file and desired output directory
chat_file_path = "path/to/your/whatsapp_chat.txt"
output_directory_path = "path/to/output_directory"
analyzer = WhatsAppAnalyzer(chat_file=chat_file_path,
out_dir=output_directory_path)
# Generate reports for all users and a group summary (index.html)
analyzer.generate_report()
Anonymizing Chat Data
If you need to anonymize chat data before analysis, you can use the anonymize utility function:
from whatsapp_analyzer.utils import anonymize
anonymize("original_chat.txt", "anonymized_chat.txt")
Understanding the Output
The analyzer generates a folder containing:
index.html: A central dashboard showing group-level statistics, activity heatmaps, and links to each individual's report.User_Name_report.html: Detailed reports for each participant, including:- Key Statistics: Tables with message counts, averages, and linguistic metrics.
- Common Words: Most frequent n-grams and detected Hindi abuse words.
- Visualizations: A rich set of charts (Heatmaps, Sentiment Trends, Emotion Trends, Word Clouds, etc.).
- Behavioral Insights: Inferred traits like communication style and technical skills.
Troubleshooting/Notes
- Emoji Display: If icons look like boxes, ensure you have an emoji-supporting font installed. The tool will attempt to use "Segoe UI Emoji", "Apple Color Emoji", or "Noto Color Emoji" if available.
- Large Chats: Analysis of very large chat files can be memory-intensive.
- Font Setup: On some Linux/WSL systems,
matplotlibmight struggle with font caches. The tool is designed to catch these errors and fallback gracefully.
Contributing
Contributions are welcome! Please follow standard fork/pull-request workflows.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file whatsapp_groupchat_analyzer-2.0.0.tar.gz.
File metadata
- Download URL: whatsapp_groupchat_analyzer-2.0.0.tar.gz
- Upload date:
- Size: 62.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
707f2e93189f02b344852e338dc81b187747d219e51aa34ef487e895d4e97a25
|
|
| MD5 |
9137dedd8b1bf550af42cb612b4e98ec
|
|
| BLAKE2b-256 |
b531041ec7c4a94489d15762a93dfbffb99f09a4c87a7b334c74bc41ed6d9650
|
Provenance
The following attestation bundles were made for whatsapp_groupchat_analyzer-2.0.0.tar.gz:
Publisher:
python-publish.yml on gauravmeena0708/whatsapp-analyzer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
whatsapp_groupchat_analyzer-2.0.0.tar.gz -
Subject digest:
707f2e93189f02b344852e338dc81b187747d219e51aa34ef487e895d4e97a25 - Sigstore transparency entry: 1188158052
- Sigstore integration time:
-
Permalink:
gauravmeena0708/whatsapp-analyzer@d17de9f3a5565b2f106d407ec63fb35c52c0aeb6 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/gauravmeena0708
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@d17de9f3a5565b2f106d407ec63fb35c52c0aeb6 -
Trigger Event:
release
-
Statement type:
File details
Details for the file whatsapp_groupchat_analyzer-2.0.0-py3-none-any.whl.
File metadata
- Download URL: whatsapp_groupchat_analyzer-2.0.0-py3-none-any.whl
- Upload date:
- Size: 52.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5446337db106f1b1b8bc6296660afe35a4c6de870e49d2673aed4ec7baac9a5
|
|
| MD5 |
a2c966ba00c0dffaf9b6a8205368e1e9
|
|
| BLAKE2b-256 |
f146606e0cd9b2edec270a4b88a592aa2a665dedd2acd78fefeac9b0fef1b99d
|
Provenance
The following attestation bundles were made for whatsapp_groupchat_analyzer-2.0.0-py3-none-any.whl:
Publisher:
python-publish.yml on gauravmeena0708/whatsapp-analyzer
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
whatsapp_groupchat_analyzer-2.0.0-py3-none-any.whl -
Subject digest:
f5446337db106f1b1b8bc6296660afe35a4c6de870e49d2673aed4ec7baac9a5 - Sigstore transparency entry: 1188158075
- Sigstore integration time:
-
Permalink:
gauravmeena0708/whatsapp-analyzer@d17de9f3a5565b2f106d407ec63fb35c52c0aeb6 -
Branch / Tag:
refs/tags/v2.0.0 - Owner: https://github.com/gauravmeena0708
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@d17de9f3a5565b2f106d407ec63fb35c52c0aeb6 -
Trigger Event:
release
-
Statement type: