Re: Parsing ambiguities
- From: "Ira Baxter" <idbaxter@xxxxxxxxxxxxxx>
- Date: Thu, 1 Jun 2006 16:12:59 -0500
"Arthur J. O'Dwyer" <ajonospam@xxxxxxxxxxxxxx> wrote in message
news:Pine.LNX.4.60-041.0606010031070.5237@xxxxxxxxxxxxxxxxxxxxxxxx
Recently I've been playing around with a "blocks world" AI of my
own construction --- think SHRDLU but far, far dumber --- and so it
occurs to me to ask the following idle question, which is probably
better suited to comp.ai, but since parsers are on-topic here...
Does anyone have any experience or advice for dealing with
sentences whose syntax is ambiguous but whose semantics resolve
the ambiguity? For example,
PLEASE PUT A RED BLOCK ON THE BLOCK IN THE BOX
could mean "Look on the [previously mentioned] block, find a red block
there, and put it in the box"; or it could mean "Look for a red block
and put it on the only block in the box."
The syntax is ambiguous, but by looking at the positions of the blocks,
we can deduce that one of the possible parses is nonsense, and therefore
use the other one.
I found a paper on "limited repair" of parse trees, where the idea
was to cut-and-paste prepositional phrases on a single parse tree until
things felt right, but that seems really icky. It seems to me that the
obvious way to deal with ambiguity is to generate all the (combinatorial
explosion) parse trees for the sentence in the first place.
Is there any (free and/or published) parser generator that can deal
with ambiguous grammars like this one by generating multiple parse trees?
Or am I not seeing some other way of dealing with the problem? SHRDLU
dealt with it expertly, but I haven't found out how, yet. (I don't even
know whether SHRDLU used "parse trees" as I understand them or not,
actually.)
Any advice appreciated.
A standard technique for this is to parse using a context-free parser,
producing all the parsing combinations, and then filter them post-parsing,
by checking each ambiguity and deleting trees that don't make semantic
sense.
An efficient method for doing this is GLR parsing, in which sub-trees
under ambiguity nodes are shared. Check out comp.compilers
for recent dicussion on GLR parsers. We use them to parse
real computer langauges, because ambiguities are a lot more common
than you'd expect (and C++ is ambiguity hell, but our GLR
parser handles this with aplomb).
--
Ira Baxter, CTO
www.semanticdesigns.com
.
- Follow-Ups:
- Re: Parsing ambiguities
- From: Arthur J. O'Dwyer
- Re: Parsing ambiguities
- References:
- Parsing ambiguities
- From: Arthur J. O'Dwyer
- Parsing ambiguities
- Prev by Date: Re: Parsing ambiguities
- Next by Date: Re: Parsing ambiguities
- Previous by thread: Re: Parsing ambiguities
- Next by thread: Re: Parsing ambiguities
- Index(es):
Relevant Pages
|