Monday, July 07, 2014

My experience converting my NLP library and demo web app from Clojure to Haskell

Originally published June 20, 2014

Several years ago I took ten years of part time natural language processing (NLP) hacks in Common Lisp, Scheme, and Java and converted a useful subset to Clojure. The resulting code base was much easier to work with both because Clojure is such a clean and practical language, and also because any large scale code cleanup removes technical debt and makes for easier development.

In the last month in my spare time I took my Clojure code and converted it to Haskell. Here is the demo web app. I have about 80% of the functionality of the NLP library converted (automatic summarization, entity detection, and categorization). The Haskell web app is very simple compared to the Clojure demo web app, and I might improve the demo web app sometime but for now I am more interested in improving the functionality and accuracy of the NLP library.

Even though I am still learning Haskell I am already finding it easier to work on the NLP library using Haskell. I find both the strong type system and the quick edit + compile + run repl cycles with Emacs + Haskell to be a lot of fun and productive. On the other hand, Clojure + lib noir + compojure are hands-down my favorite tools for writing web applications. Haskell + Yesod are certainly nice to use, but I like the Clojure web stack better.

I have also been experimenting using Haskell for SPARQL client code using the HSparql library. Long term, I want to augment my Haskell NLP library to generate useful RDF from text in news articles.

No comments: