AI Zone Admin Forum Add your forum

NEWS: Chatbots.org survey on 3000 US and UK consumers shows it is time for chatbot integration in customer service!read more..

PC-PATR: A syntactic parser
 
 

While I’ve become somewhat bemused during the course of my research with the plethora of different linguistic theories that have come and gone over the last three decades, not to mention all the “busy work” being carried out by the statistical natural language processing crowd, there remains a hard core of research dedicated to rigorous deterministic methods.

I just discovered a real gem of this type, an all-platform open source natural language parser that implements PATR, a simple but powerful language for defining the grammar of natural languages.

You can download the executables and documentation for your platform of choice, or grab the source code and compile it yourself. It’s the cleanest and easiest to use parsing tool that I’ve ever come across, rivalling the Link Grammar Parser in it’s simplicity, but significantly more powerful and versatile.

http://www-01.sil.org/pcpatr

The availability of a tool like this could finally make it possible for a collaborative community effort to develop sets of language definitions that everyone could share and use. Who would be interested in taking part in such a project?

You can jump straight to the documentation for examples and usage details here:

http://www-01.sil.org/pcpatr/manual/pcpatr.html

————————————————————

Here’s a portion of a grammar definition in PATR to give you an idea of what it’s like to write.

;sentence formation
RULE
S = NP VP (AdvP)
  <NP head agr> = <VP head agr>
  <NP head case> = NOM
  <S subj> = <NP>
  <S head> = <VP head>

;passive verb with agent
RULE
VP = AUX V PrepP
  <pre> = by
  <AUX head auxform> = be
  <V head vform> = EN
<VP head> = <AUX head>
  <VP head passive> = +
  <VerbalP head partform> = <V vform>

;transitive verb
RULE
VP = VerbalP NP
  <NP head case> = ACC
  <NP head verbal> = -
<VP head> = <VerbalP head>

————————————————————

Even the simple example grammar included in the test suite is capable of handling the following sorts of input:

;Try sentences such as these:
;uther sleeps
;the knights sleep
;uther storms cornwall
;the brave knights have stormed cornwall
;i sleep
;he sleeps
;he was sleeping
;he slept
;he has slept
;i see him
;he sees me
;i was seen
;i was seen by him
;i was seen by him clearly
;i saw the man with a telescope
;the tall man on the hill saw me with a telescope
;i saw uther before he stormed cornwall

;These malformed sentences are rejected:
; uther sleep
; the knights sleeps
; uther storm cornwall
; the knights storms cornwall
; i sleeps
; he sleep
; he sleeping
; i see he
; him sees me
; he seen me
; he seeing me
;
;But these malformed sentences (and many more!) are accepted:
; he is sleep
; he is slept
; he has sleep
; he has sleeping
; he stormed
; he slept me
; i have seen by him

 

 
  [ # 1 ]

Thanks for the link.

So far I have just used the Stanford NLP Parser.  It’s not perfect but it does the job.  Do you think PATR is significantly better or has the potential to be?

One concern is that it doesn’t look to be open source (there is a freeware licence but it reserves most rights other than usage).  Is there a risk that we put a lot of work in but then can’t use the results?

 

 
  [ # 2 ]

The software uses a grammar formalism called PATR-II which is a language that was developed for defining and describing natural languages. As it is intended to be theory agnostic it has pretty much become the standard for defining grammars for natural language, so any effort that you put into using it is unlikely to be wasted. That said, I haven’t been able to find anything other than toy examples of it in use so far.

How it all fits together becomes much clearer if you read the original paper which describes PATR-II. In fact this answered a great many questions for me, and though it is comparatively long, it is an easy and interesting read. It is readily available as a PDF from a number of sources. I’ve included one such link.

Shieber, Stuart M., An Introduction to Unification Based Approaches to Grammar

http://user.phil-fak.uni-duesseldorf.de/~rumpf/SS2011/Vererbung/Shi86.pdf

 

 
  login or register to react