3.3 Semantics Construction

With a little effort, we can do a lot more with DCGs than just parsing sentences: by making use of extra arguments we can associate semantic representations with lexical items quite straightforwardly. The normal Prolog unification mechanism then gives us the basic tool needed to combine semantic representations and to pass them up towards sentence level.

We now have a way of handling Task 1: We have used a DCG to specify the syntax of a given fragment of English language. We can even directly use our DCG to parse sentences from this fragment.

Thus having prepared the ground, we can now turn to the remaining Tasks 2 and 3. Luckily, we will benefit even here from our choice to use DCGs for Task 1. For with a little effort, we can do a lot more with DCGs than just parsing sentences: by making use of extra arguments we can associate semantic representations with lexical items quite straightforwardly. The normal Prolog unification mechanism then gives us the basic tool needed to combine semantic representations and to pass them up towards sentence level. In short, working with DCGs both dispenses us from having to implement parsers, and at the same time offers us a powerful mechanism for combining representations. So we can devote our attention to semantic construction - and this is what we turn to now. In this section, we approach the matter in a very implementation-centered way. We will supplement our DCG by additional code step by step, wherever we see it is needed in order to produce the results we want to have. Doing so, we will of course not arrive at a principled solution - but we get a nice case study. Looking closely at the problems we have encountered, we will then develop a much cleaner and more general approach in the next lecture.



Aljoscha Burchardt, Stephan Walter, Alexander Koller, Michael Kohlhase, Patrick Blackburn and Johan Bos
Version 1.2.5 (20030212)