Ruby-us Hagrid: Writing Harry Potter with Ruby
The average salary for a Ruby programmer (according to Techworld) is £52k, but the average net worth of a “J. K. Rowling” is more than $1bn! Clearly we’re in the wrong business; we shouldn’t be writing Ruby code, we should be writing Harry Potter books.
The bad news is that writing novels beloved by children across the world is hard. The good news is we can get Ruby to do it for us! It turns out that Ruby and the dark arts of NLP (Natural Language Programming) are a match made in heaven.
Using some basic language modeling techniques, a dash of probability, and a few lines of easy-to-follow Ruby code, we can create a virtual author capable of generating a very convincing Potter pastiche. And if the life of an author’s not for you, don’t worry. The techniques we’ll explore are applicable to a host of other problems, from machine translation to spam detection.
Friday, 6th July 2018