Skip to main content

chat-miner provides lean parsers for every major platform transforming chats into pandas dataframes. Artistic visualizations allow you to explore your data and create artwork from your chats.

Project description

chat-miner: turn your chats into artwork

chat-miner: turn your chats into artwork

PyPI Version License: MIT Downloads codecov Code style: black Imports: isort

chat-miner provides lean parsers for every major platform transforming chats into pandas 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 -r requirements.txt

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()

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

chat-miner-0.4.0.tar.gz (13.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

chat_miner-0.4.0-py3-none-any.whl (14.6 kB view details)

Uploaded Python 3

File details

Details for the file chat-miner-0.4.0.tar.gz.

File metadata

  • Download URL: chat-miner-0.4.0.tar.gz
  • Upload date:
  • Size: 13.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for chat-miner-0.4.0.tar.gz
Algorithm Hash digest
SHA256 37684f36d69637152465ca974beac53085817f211b0bbd22f449f9ec01395aca
MD5 e3a5ce3dac8c14fe39f3f243bbe1bb17
BLAKE2b-256 7da9fc703d24ec4a8080b2d748d8287cd461948697333eddb3fbe8f60696c656

See more details on using hashes here.

File details

Details for the file chat_miner-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: chat_miner-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 14.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for chat_miner-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 04240ed8fe57af2c6a10168654bd5d361e7891ceea91740d190c7f605b7a425e
MD5 a88d96152e0ec1e4393eaf4390b823e6
BLAKE2b-256 94ef48d1591b50a6e07350a0c16cd476a0c1d3e355b15248b9b9e0bd7145c52a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page