Newsgroups: comp.lang.prolog
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!howland.reston.ans.net!cs.utexas.edu!convex!seas.smu.edu!pedersen
From: pedersen@seas.smu.edu (Ted Pedersen)
Subject: Re: DCG parsing
Message-ID: <1994Nov12.000510.17371@seas.smu.edu>
Sender: news@seas.smu.edu (USENET News System)
Nntp-Posting-Host: blaze_f.seas.smu.edu
Organization: SMU - School of Engineering and Applied Science
References: <1994Nov8.185049.29988@seas.smu.edu> <PEREIRA.94Nov10220856@alta.research.att.com>
Date: Sat, 12 Nov 1994 00:05:10 GMT
Lines: 53

> I dodn't understand your reasoning. As stated, the problem is
> symmetric, there is no reason why unknown words would be harder to
> treat left-to-right than right-to-left. It may happen for a particular
> grammar there are more constraints on unknown words from the left than
> from the right. However, whether this will matter depends on your
> particular way of handling unknown words. When I did something of that
> kind for a fairly large English grammar, I didn't encounter the
> problem you are worrying about.

My thinking goes like this...Suppose you are parsing a 10 word
sentence left to right and the second word is unknown. Suppose further
that this word could be one of four different classes (noun, verb,
adjective, adverb for instance). Then it would seem like one possible
way of deciding the class of this unknown word would be to parse the
sentenceassuming that each of the four classes is correct and see what
happens. This means you would be parsing the rest of the sentence (8
words) 4 different times.  

So if you parse this same sentence right to left the unknown word will
be second to the last. You assume all of the four potential classes
are correct and parse to see what happens. Except in this case the
rest of the sentence is only 1 word. It seems like it should be
faster...If not, what's the flaw in my reasoning (I'm quick to concede
that there could be...)

> If you really want to do right-to-left DCG parsing, the simplest way
> is to take a standard DCG->Prolog translator and modify it in the
> appropriate way. It's a pretty straightforward exercise.
> --
> Fernando Pereira

I guess that's what my original query was asking. I'm not such a great
Prolog programmer so it didn't seem quite so obvious. All I could
think of was reverse the sentence and reverse the grammar rules...and
that just doesn't seem too slick...

Regards
Ted
---
* Ted Pedersen                                  pedersen@seas.smu.edu * 
* Department of Computer Science and Engineering,                     *
* Southern Methodist University, Dallas, TX 75275      (214) 768-2126 *











