chat-miner: turn your chats into artwork
chat-miner provides lean parsers for every major platform transforming chats into dataframes. Artistic visualizations allow you to explore your data and create artwork from your chats.
1. Installation
Latest release including dependencies can be installed via PyPI:
pip install chat-miner
If you're interested in contributing, running the latest source code, or just like to build everything yourself:
git clone https://github.com/joweich/chat-miner.git
cd chat-miner
pip install .
2. Exporting chat logs
Have a look at the official tutorials for WhatsApp, Signal, Telegram, Facebook Messenger, or Instagram Chats to learn how to export chat logs for your platform.
3. Parsing
Following code showcases the WhatsAppParser module.
The usage of SignalParser, TelegramJsonParser, FacebookMessengerParser, and InstagramJsonParser follows the same pattern.
from chatminer.chatparsers import WhatsAppParser
parser = WhatsAppParser(FILEPATH)
parser.parse_file()
df = parser.parsed_messages.get_df(as_pandas=True) # as_pandas=False returns polars dataframe
Note: Depending on your source system, Python requires to convert the filepath to a raw string.
import os
FILEPATH = r"C:\Users\Username\chat.txt" # Windows
FILEPATH = "/home/username/chat.txt" # Unix
assert os.path.isfile(FILEPATH)
4. Visualizing
import chatminer.visualizations as vis
import matplotlib.pyplot as plt
4.1 Heatmap: Message count per day
fig, ax = plt.subplots(2, 1, figsize=(9, 3))
ax[0] = vis.calendar_heatmap(df, year=2020, cmap='Oranges', ax=ax[0])
ax[1] = vis.calendar_heatmap(df, year=2021, linewidth=0, monthly_border=True, ax=ax[1])
4.2 Sunburst: Message count per daytime
fig, ax = plt.subplots(1, 2, figsize=(7, 3), subplot_kw={'projection': 'polar'})
ax[0] = vis.sunburst(df, highlight_max=True, isolines=[2500, 5000], isolines_relative=False, ax=ax[0])
ax[1] = vis.sunburst(df, highlight_max=False, isolines=[0.5, 1], color='C1', ax=ax[1])
4.3 Wordcloud: Word frequencies
fig, ax = plt.subplots(figsize=(8, 3))
stopwords = ['these', 'are', 'stopwords']
kwargs={"background_color": "white", "width": 800, "height": 300, "max_words": 500}
ax = vis.wordcloud(df, ax=ax, stopwords=stopwords, **kwargs)
4.4 Radarchart: Message count per weekday
if not vis.is_radar_registered():
vis.radar_factory(7, frame="polygon")
fig, ax = plt.subplots(1, 2, figsize=(7, 3), subplot_kw={'projection': 'radar'})
ax[0] = vis.radar(df, ax=ax[0])
ax[1] = vis.radar(df, ax=ax[1], color='C1', alpha=0)
5. Command Line Interface
The CLI supports parsing chat logs into csv files. As of now, you can't create visualizations from the CLI directly.
Example usage:
$ chatminer -p whatsapp -i exportfile.txt -o output.csv
Usage guide:
usage: chatminer [-h] [-p {whatsapp,instagram,facebook,signal,telegram}] [-i INPUT] [-o OUTPUT]
options:
-h, --help
Show this help message and exit
-p {whatsapp,instagram,facebook,signal,telegram}, --parser {whatsapp,instagram,facebook,signal,telegram}
The platform from which the chats are imported
-i INPUT, --input INPUT
Input file to be processed
-o OUTPUT, --output OUTPUT
Output file for the results
Metadata
Release files for chat-miner 0.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| chat_miner-0.6.0.tar.gz | 12.4 kB | Without provenance | Details for chat_miner-0.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| chat_miner-0.6.0-py3-none-any.whl | Python 3 | none | any | Details for chat_miner-0.6.0-py3-none-any.whl |
Total release size: 25.1 kB
Release files / chat_miner-0.6.0.tar.gz
| Download URL | chat_miner-0.6.0.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
58452462f4eb45f8c6c53b4bcefadb0ccf1b949692d85db8eb186169477c38e7
|
|
BLAKE2b-256 checksum How to use checksums |
a6fe8649303da1c09f9df938a688e862ba92c98303f7f92fce67b23f93fd2fb0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Release files / chat_miner-0.6.0-py3-none-any.whl
| Download URL | chat_miner-0.6.0-py3-none-any.whl |
|---|---|
| Size | 12.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
274387306522695c43556b7f69967c67b829ff8999eb0dee1f513120aa6c4a16
|
|
BLAKE2b-256 checksum How to use checksums |
ea2d144977add0100a94f8b98905f03b2311254c35d7d753773e150969315d60
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.0.1 CPython/3.12.8
|
Security for chat-miner 0.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.