3

I need shallow parsing and deep parsing using Stanford CoreNLP. I have googled a lot but not get succeed. At the end, I found that there are 2 parser, Constituency parser and Dependency parser.

My questions are :

Is Constituency Parser shallow parsing and dependency parser is deep parsing ?

Can anybody put the code of both the above parsers and any helpful links ?

iNikkz
  • 3,729
  • 5
  • 29
  • 59

2 Answers2

14

The distinction constituency vs dependency parsing has nothing to do with the distinction deep vs shallow parsing. They are completely orthogonal

Constituency parsing is classical parsing where words are leafs in the tree, and non-leaf nodes are constituents (e.g. noun-phrase, verb-phrase, prep-phrase, etc) but never words.

Dependency parsing does not build constituent nodes in the tree. All nodes in the tree are one sentence word. The tree establishes the hierarchy (depencendes actually) between words.

A constituency tree can be deterministacailly converted to a dependency tree if the head node is known for every rule. The backwards conversion is not possible, since dependency trees have no information about which constituents should be created.

On the other hand, 'deep parsing' refers to building complete trees for a sentence (so, what you would normally expect from a parser), while 'shallow parsing' is an easier task consisting of building a set of partial trees for one sentence (e.g. grouping only noun phrases)

Typically, dependency parses produce complete trees (i.e. deep parsing), and there are constituency parsers both for deep and shallow analysis. However, it should be possible to build a dependency parser that produced partial (or shallow) analysis.

Lluís Padró
  • 215
  • 1
  • 5
2

I'm assuming that by "shallow parser" you mean a phrasal chunker, as described here: https://en.wikipedia.org/wiki/Shallow_parsing

Stanford CoreNLP does not offer a shallow parser, and a dependency parser is not a that.

I have used OpenNLP's chunker and the one provided by Freeling.
Both worked fine for my purposes. I found it easier to get off the ground with OpenNLP, especially working from Clojure as I do, but ended up using Freeling because it has more tools and of course access to many more languages.

John Stewart
  • 343
  • 2
  • 11
  • As per my knowledge, Stanford provides Shallow parsing and deep parsing both. And it has best parser among all but Stanford CoreNLP named such parsers something else. What actual names they provided, don't know. – iNikkz May 05 '16 at 02:12
  • You are going to have to tell us what you mean by shallow parsing then. Do you mean semantic role labeling? That's a different task altogether... – John Stewart May 05 '16 at 03:32