Live data from Hacker News

Natural Language Processing for the Working Programmer

nlpwp.org

11–20 of 48 posts

Re: Natural Language Processing for the Working Programmer

#12
post #3
post #2

I was working with NLP, and its various toolkits (python-nltk I'm looking at you). The thing about NLP is, there just isn't enough libraries (for humans) to simply plug NLP into use. Even nltk, the premier python library for NLP, seems to be an NLP core-library for building NLP solutions, rather than for building NLP-powered apps. It also seems to extremely unpythonic. Is there a missing link there? I don't know. So…

yeah, for the vast majority of uses, most people really want to do just a fairly small set of things fairly well. NER comes to mind, lots and lots and lots of toolkits for building up to NER, but very few that let submit English text and get back a list of people, places and things without having to virtually build my own NER system from scratch anyways. Give me NER, Entity relationships (ER) and a couple kinds of se…

I've used the Stanford NLP library extensively for NER. I made heavy use of it in my senior thesis project.

It's pretty straightforward to use their library to read a document and output an XML file containing NER data (and lots of other fun stuff).

For instance, from the sentence:

> World War II, or the Second World War (often abbreviated as WWII or WW2), was a global military conflict lasting from 1939 to 1945, which involved most of the world's nations, including all of the great powers, eventually forming two opposing military alliances, the Allies and Axis.

Stanford NLP NER will output the following entities:

"World War II" - MISC "Second World War" - MISC "1939 to 1945" - DATE - NORMALIZED 1939/1945 "Axis" - MISC

You can view the output of Stanford's CoreNLP library (NER + dependency grammar + coreference resolution + some other stuff) for the Wikipedia article on World War II in my github repo:

https://raw.github.com/ryantanner/thesis/master/data/ww2samp...

edit: I should add that the real fun (for me) came from combining NER with dependency grammars and coreference resolution. It makes it very easy to turn Stanford NLP's output into a knowledge graph combining a large number of documents.

Re: Natural Language Processing for the Working Programmer

#14
post #11

I'm not that familiar with Haskell and the past week's HN frontpage articles on Monads was just confusing...but what is it about Haskell that makes it more useful for NLP than, say, Python?

Not much. It's a more expressive and cleaner language, but on the other hand python has NLTK + scipy community.

Scala (or Java) is another great NLP language. It's got decent libraries (openNLP, mallet, mahout), hadoop, and Scala is almost as nice as Haskell.

Re: Natural Language Processing for the Working Programmer

#15
post #12
post #3

Earlier quoted context omitted.

yeah, for the vast majority of uses, most people really want to do just a fairly small set of things fairly well. NER comes to mind, lots and lots and lots of toolkits for building up to NER, but very few that let submit English text and get back a list of people, places and things without having to virtually build my own NER system from scratch anyways. Give me NER, Entity relationships (ER) and a couple kinds of se…

I've used the Stanford NLP library extensively for NER. I made heavy use of it in my senior thesis project. It's pretty straightforward to use their library to read a document and output an XML file containing NER data (and lots of other fun stuff). For instance, from the sentence: > World War II, or the Second World War (often abbreviated as WWII or WW2), was a global military conflict lasting from 1939 to 1945, whi…

For those who want to play around with dynamic output: http://nlp.stanford.edu:8080/parser/

This is a bit more human friendly.

Re: Natural Language Processing for the Working Programmer

#16
post #11

I'm not that familiar with Haskell and the past week's HN frontpage articles on Monads was just confusing...but what is it about Haskell that makes it more useful for NLP than, say, Python?

I've only played around with Haskell and NLP (using this guide, actually), but functional languages are a very nice fit for natural language processing, which often involves pipelining text (in the form of arrays or lists of characters) from function to function (tokenization->tagging->chunking->extraction). This fits the functional paradigm very well. I really like using NLTK (Python) but if I were more comfortable in Haskell and if Haskell had better NLP libraries, I'd probably switch to Haskell because it's a natural fit for NLP. But I have to agree with your assessment of monads...I've been learning Haskell on and off for over a year and I'm still shaky on monads. I'm still hoping I will eventually experience that same moment of epiphany with monads that I did with recursions when I first started programming.

Re: Natural Language Processing for the Working Programmer

#17
post #11

I'm not that familiar with Haskell and the past week's HN frontpage articles on Monads was just confusing...but what is it about Haskell that makes it more useful for NLP than, say, Python?

I've only played around with Haskell and NLP (using this guide, actually), but functional languages are a very nice fit for natural language processing, which often involves pipelining text (in the form of arrays or lists of characters) from function to function (tokenization->tagging->chunking->extraction). This fits the functional paradigm very well. I really like using NLTK (Python) but if I were more comfortable…

What worked for me was going through worked examples with IO, List, Maybe and State. You don't want to just do List, Maybe and Either or you'll associate it with holding onto particular data. You want to use highly disparate things so you can get to the fully abstract understanding.

You might try to understand monoids first, because you already have familiarity with many applications of monoids. The realization "oh, this is just two functions" at the heart of monoids is also what's at the heart of monads, but the applications are different.

Desugaring helps a lot too. I learned by avoiding do-notation, but you can learn do-notation at the same time if you try desugaring as you go, so you can make explicit what's going on under the covers.

It's like math, you have to keep playing with it until you grok it. I find it's good to try out different expressions in ghci, use :t a lot to see what types are coming back, to build intuition.

If you put a few hours into it for a few days in a row, you can probably get to this epiphany in one weekend. The trick is building up enough examples that your brain can generalize it. Nobody's going to learn it by staring at the abstract form and thinking hard--if we did work that way, there would be a lot more use of comonads. That's why it's important to re-type examples. You're not going to be able to write the examples yourself until you understand them, but working through them gives you something to build on, and builds healthy expectations (I'm going to need return here, because the naked value isn't in the monad, etc.)

The epiphany is worth it--but don't count on a monad tutorial to help you much, they're mainly a side-effect of other people having the epiphany.

Re: Natural Language Processing for the Working Programmer

#19
I'm always fascinated with NLP. My undergrad works around it. And currently doing a research for my MS degree. It's about a variant of automatic summarization, wherein I extract the most important sentences in an article. I'll open an API for it soon. :) If you're interested, just contact me in my email (check my profile for it).

In the meantime, here's a preview of what it can do. http://goo.gl/Lz7Vr

Re: Natural Language Processing for the Working Programmer

#20
post #12
post #3

Earlier quoted context omitted.

yeah, for the vast majority of uses, most people really want to do just a fairly small set of things fairly well. NER comes to mind, lots and lots and lots of toolkits for building up to NER, but very few that let submit English text and get back a list of people, places and things without having to virtually build my own NER system from scratch anyways. Give me NER, Entity relationships (ER) and a couple kinds of se…

I've used the Stanford NLP library extensively for NER. I made heavy use of it in my senior thesis project. It's pretty straightforward to use their library to read a document and output an XML file containing NER data (and lots of other fun stuff). For instance, from the sentence: > World War II, or the Second World War (often abbreviated as WWII or WW2), was a global military conflict lasting from 1939 to 1945, whi…

I had experimented with NLTK, CoreNLP, OpenNLP etc and when it came it NEP extraction, I felt NLTK does the better job (none of them were anywhere close to perfect/dependable), but NLTK had a lot more dictionaries to choose from and overall better. We use a highly customized/overhauled NLTK for our apps Iris(siri for Android) and Friday for Android.
Post reply on HN