This post is to share a simple code that allows you to visualize some statistics and trends of your individual or group chats in WhatsApp! The main results are:
Time Series of the messages in the group or conversation
Pie Chart showing the number of messages sent by each person
Bar Chart showing the time in which every person send more messages
Though, our definitions of “simple” might be a bit different; examples like this not only help me to better understand what Wolfram can do, they help me to imagine what I might be able to do with Wolfram.
Could you post an example of the chatFile.txt that you used?
I tried to run your notebook on a file I exported from WhatsApp and it didn’t work.
The first error was that Length@messages == Length@datesAndTime was false.
After that lots and lots of errors.
I’m wondering if the file format is different because the file I got was called _chat.txt not chatFile.txt.
Also I chose the no media version of the file which is what I assume you used since the file you used is .txt.
I use WhatsApp on an iPhone and here’s the format, names changed and the blank line between lines isn’t in the file but if I don’t put it in the lines show up as concatenated in this message:
[2/6/16, 23:57:17] name1 created group “random fake chat name”
[2/6/16, 23:57:17] name1 added you
[2/6/16, 23:57:46] name1: How’s almost super bowl??
[2/7/16, 08:39:18] name2: So there were a total of
For your first error regarding that Length@messages == Length@datesAndTime returns false, I think the problem is that the script doesn’t take it into account the fact that some users use the 12-hour clock which has AM and PM at the end of the string. A simple fix would be to replace the assignment of datesAndTime with:
That is not the problem for me. My file contains 24h format. Messages has one element, datesAndTime is empty. I think it is because my dates have European format. I am really new to Mathematica and got this link send after registering for the free trial and it looked cool. Can you explain how I should change the Code for dates in the form of
I replaced “/” with “.”, but it did not change anything. messages looks like the same as rawData but with curly braces around it {}. messages == {rawData} evaluates to true.
Update: Fixed this problem now. (Still some other things to change for European date format) Had to also add `“,” between date and time in my format.