code from blog post: http://arunxjacob.blogspot.com/2014/01/making-sense-of-unstructured-text-in.html