Markov Messages
I was talking to a friend from college about automatically generating flavortext and death messages for a game, to keep it unique. We were talking through markov chains (here's a great resource to read up on them), and he mentioned the possibility of using your iMessage chat database from your phone.
I had some free time, so I looked into it. My phone is jailbroken, so it's easy to extract the sms.db chat file from the phone. However, that wouldn't work for larger audiences, and the difficulty in extracting the chat databases from iTunes backups were too much of a hassle. Luckily though, most people who have iPhones have linked their chats to a laptop, and the chat.db file is present and readable.
Originally I wrote a Python script to do this, and if you have a Python environment set up, this is the way I'd recommend going, due to the speed increase. Install the package markovify
, and then just run the script on a Mac. However, that again limits the audience, and I'd been wanting to mess around with Electron as well.
Luckily, someone wrote a Node library that is a near-copy of the Python package I was using (though admittedly slower), which could be easily integrated into the Electron build. You can see the finished product below.
This was the first time I'd used Electron, and it was a really satisfying experience. Most of my experience is in web technologies, so being able to build apps with it was great. That being said, this was an incredibly simple app, and the final build was around a 120mB .app file, with a 60mB .dmg. For smaller projects like this, it just doesn't make sense. You can download the .dmg file from here, or check out the source on Git.