I didn't make this, it's a slightly modified version of this: https://gist.github.com/grantslatton/7694811
I'm planning to rewrite this in Ruby to allow me to surface where each parts of the headline is sourced from.