Message Boards Message Boards

GROUPS:

Analyze your WhatsApp Chat

Posted 1 year ago
8616 Views
|
8 Replies
|
10 Total Likes
|

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
  • And more.. !

Download your WhatsApp conversation is really easy, just follow the 3 simple steps shown in this link: https://faq.whatsapp.com/android/chats/how-to-save-your-chat-history/?lang=en. Just make sure your phone is in 24h-format exporting your chat!

An example (with changed names) is: enter image description here

Let me know any doubts or suggestions to improve this notebook!

8 Replies
Posted 1 year ago

Thanks Ivan.

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.

enter image description here -- you have earned Featured Contributor Badge enter image description here

Your exceptional post has been selected for our editorial column Staff Picks http://wolfr.am/StaffPicks and Your Profile is now distinguished by a Featured Contributor Badge and is displayed on the Featured Contributor Board. Thank you!

Posted 11 months ago

Thanks Ivan, even though I find it is not that simple to do but you had given a good and 'simple' explanation on the how.

Posted 6 months ago

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

Posted 6 months ago

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:

datesAndTime = 
 StringSplit /@ 
  StringCases[rawData, 
   "[" ~~ x : (DigitCharacter .. ~~ "/" ~~ DigitCharacter .. ~~ "/" ~~
         DigitCharacter .. ~~ Whitespace ~~ DigitCharacter .. ~~ ":" ~~
         DigitCharacter .. ~~ ":" ~~ DigitCharacter .. ~~ Whitespace ~~
         LetterCharacter ..) ~~ "]" -> x]

and the assignment of messages with:

messages = 
  StringSplit[rawData, 
   "[" ~~ DigitCharacter .. ~~ "/" ~~ DigitCharacter .. ~~ "/" ~~ 
    DigitCharacter .. ~~ Whitespace ~~ DigitCharacter .. ~~ ":" ~~ 
    DigitCharacter .. ~~ ":" ~~ DigitCharacter .. ~~ Whitespace ~~ 
    LetterCharacter .. ~~ "]" ~~ Whitespace ..];

I don't get any other errors after fixing that. Let me know if this works for you!

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

[17.03.20, 08:59:46] <name>: <message>

? Thanks :)

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.

Posted 6 months ago

I posted an example of the file and it uses 24 hour time

[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

So that can't be the problem. Other thoughts? Does this data look like the data you used?

And thanks for replying so quickly!

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract