Designed originally to generate a wordcloud of myself and my partners text messages we exchanged via whatsapp while travelling.
The program generates a seperate wordcloud for each user's messages to provide a look at which each person said most frequently.
The project can be cloned from github using the following command
git clone https://github.com/JKelly423/whatsapp-wordcloud.git
Navigate to the project directory using cd
as follows
cd whatsapp-wordcloud
Run the following command to install all dependancies required
pip install -r requirements.txt
The WhatsApp chat must be extracted before the project is executed.
Instructions for exporting your WhatsApp chat can be found here for Android and IOS. The exported file _chat.txt
will be used to generate the WordClouds.
In order to differentiate your messages from your partner's messages, you will need to configure the Contact Names for both you and your partner.
The configuration of the Contact Names as well as the WhatsApp chat log filepath will need to be configured within the config.json
file before the project is executed.
The config.json
file will be configured as shown below:
{
"my_name": "my_contact_name_as_appears_in_Whatsapp",
"partner_name": "partner_contact_name_as_appears_in_Whatsapp",
"chat_filepath": "./data/_chat.txt"
}
The default value for chat_filepath
is ./data/_chat.txt
. To use this default value, copy your exported _chat.txt
file from your WhatsApp export into the /data
directory of the project directory.
For example, if your name (as shown in the WhatsApp chat) is John
and your partners name (as shown in the WhatsApp chat) is Jane Doe
,
your config will look like this:
{
"my_name": "John",
"partner_name": "Jane Doe",
"chat_filepath": "./data/_chat.txt"
}
After configuration is complete and all dependacies, the project can be executed using the following command.
python3 whatsapp-wordcloud.py
After allowing the program to run, the completed WordCloud images will be saved in the /output
directory, named my_name_wordcloud.png
and partner_name_wordcloud.png
based on your name configuration. Enjoy!