WARNING: Copy your files. Don't work directly with your Messages db.
Thanks to Apple's continuity, Messages.app on OS X allows you to receive and send regular texts (SMS) along with the usual iMessages. Now this Messages database makes analyzing texting data much easier.
On your Mac, the Messages database should be here:
/Users/your user name/Library/Messages/chat.db
On Mathematica, first establish a SQLConnection:
Then read the tables:
I have sent/received 9047 messages in this database. Reviewing the number of entries:
Being a RDBMS and containing many different types of relations/cardinalities, the needed pieces of information (who,when, what, etc.) are fragmented. Dispatch tables are created to quickly find the join:
And this function uses the dispatch tables to resolve (basically using as hash tables) the message (message id -> chat -> handle):
Let's look at what's in the message table:
The date/time mark is stored as the number of seconds elapsed since 2001-01-01. Use the below function to convert date and time:
Finally this allows you to extract and process pieces of information:
For the above, I chose to include text contents, sender/receiver, entropy of the message, length, etc.
Now this processed data can be used to analyze your messaging habits/patterns, create plots, etc.
One example, plots of messages sent/received time: