<< Prev | - Up - |
Let's now turn to our case study again: semantic construction with
-calculus and functional application. We saw in the last chapter that using functional application and
-conversion more or less reduces the process of combining semantic representations to an elegant triviality, while it shifts most of the semantic load to the lexical component. Now the only semantic information that our
lexicon/4
-facts supply are the relevant constant and relation symbols. So our semantic macros are where the real work will be done. Basically, they will specify the templates for the abstraction patterns associated with different lexical categories. Let's now implement the semantic macros needed for-calculus. Here are some examples:
Let's now turn to our case study again: semantic construction with -calculus and functional application. We saw in the last chapter that using functional application and
-conversion more or less reduces the process of combining semantic representations to an elegant triviality, while it shifts most of the semantic load to the lexical component. Now the only semantic information that our
lexicon/4
-facts supply are the relevant constant and relation symbols. So our semantic macros are where the real work will be done. Basically, they will specify the templates for the abstraction patterns associated with different lexical categories. Let's now implement the semantic macros needed for -calculus. Here are some examples:
Nouns and proper names
nounSem(Sym,lambda(X,Formula)):-
compose(Formula,Sym,[X]).
The first macro, nounSem/2
, builds a semantic representation for any noun given the predicate symbol Sym
, turning this symbol into a formula -abstracted with respect to a single variable. For example, given the predicate symbol
man
, it will return the -abstraction
lambda(X,man(X))
. The scope of the abstraction is built using compose/3
to incorporate the given predicate symbol into a well-formed open formula. The semantic macro for proper names (pnSem/2
) is still simpler: It constructs the kind of -expression discussed above and doesn't even need to call
compose/3
for this purpose.
Verbs
Let's have a look at the macros for verbs next. The one for intransitive verbs is very straightforward:
ivSem(Sym,lambda(X,Formula)):-
compose(Formula,Sym,[X]).
In fact, the macro does exactly the same as nounSem/2
. This is not surprising at all - after all the -expressions we saw for intransitive verbs are also exactly like the ones for nouns.
Finding the right abstraction pattern for transitive verbs turned out to be a little more involved. Nevertheless now we've got it, this pattern too translates into a semantic macro without a glimpse:
tvSem(Sym,lambda(K,lambda(Y,K @ lambda(X,Formula)))):-
compose(Formula,Sym,[Y,X]).
This macro is again similar to that for nouns, except that it handles two variables rather than just one. Additionally, it resembles the macro for proper names in the way it incorporates our well known role-reversing trick.
Special words
As we've already mentioned, our grammar also deals with some ``special'' words, words that do not have a value for a predicate or constant symbol specified in the lexicon. Determiners are such words - and here are the macros for the indefinite and the universal one. They're basically just the old-style ``lexical entries'' we used in Section 3.5.3:
detSem(uni,lambda(P,lambda(Q,forall(X,(P@X)>(Q@X))))).
detSem(indef,lambda(P,lambda(Q,exists(X,(P@X)&(Q@X))))).
These macros are self-contained in that they provide a complete semantic representation starting from no input. While the first argument does have a value, this is only a tag that helps Prolog select the right clause. It does not occur in the output representation.
All semantic macros can be found in lambda.pl
: View Download
For a complete listing of the macros we have been discussing, see the file lambda.pl
. We shall see more types of semantic macros as we work our way through the course. But let's emphasize: From now on, we will always use the lexicon and the rules listed above. The primary locus of change will be the semantic macros and the implementation of combine/2
.
<< Prev | - Up - |