Skip to Content

Natural Language Processing in PHP

Natural Language Processing (NLP) and Machine Learning (M.L., not to be confused with the programming language) tools available today can be a uniquely useful aid in understanding text automatically and organizing it for faster human processing. (See http://alias-i.com/lingpipe/web/demos.html). PHP is the most widely deployed programming language on websites, and Websites are the most commonly used medium for accessing current information. It begs the question, then, where are the NLP and M.L. tools for use in PHP?

It's not impossible to use M.L. on the web since there are tools available in Java and Python, and using SOAP, anything can be called from anything. But I think we need a more direct approach to being able to call NLP and M.L. functions reliably in PHP. As reliably as, say, the mysql_ set of functions, without having to muck around with a complex installation.
So far, I think this can be achieved by using PiP (Python in PHP - http://www.csh.rit.edu/~jon/projects/pip/) alongside the NLTK (nltk.org) which is written in Python, and then adding a bunch of wrapper code to access NLTK from PHP. I'm pretty sure this is not the most optimal solution, but it illustrates the direction I'm thinking towards.
I'd love to work on this further, and am open to suggestion and participation by other coders.