I'm trying to expand NLTK's simple-sem.fcfg so that it supports coordination of phrases. I want it to successfully parse a sentence like: Irene walks and Angus barks. Since this is represented as walk(Irene) & bark(Angus), I think the best way to achieve this is by adding a rule S -> S and S. What I can't grasp is how to do this with the semantic features... I've done this so far:
Added this rule:
S[SEM = <?subj(?vp)>] -> S[SEM = <?subj(?vp)>] <&> S[SEM = <?subj(?vp)>]
This doesn't work, so is there anyone who has some advice/links etc?
There is no subject or VP in the relevant structure. Try writing a rule for and
when used to conjoin sentences. What is it? Sentence1 and Sentence2 gets the interpretation
<Sentence1> & <Sentence2>
I.e., take the meanings of the two sentences and conjoin them with &
. In the notation of this library, it would be something like this:
S[SEM=<?p & ?q>] -> S[SEM=?p] 'and' S[SEM=?q]
I don't use this module and I can't test the example, so you might have to tweak the syntax. But I hope you get the idea.
PS. This kind of semantics usually assumes binary trees, so the interpretation would go in two steps like this:
S1 (and S2)
This means that you would interpret and
as something that takes a sentence (i.e., S2) and gives you a conjunction function, which will combine with another sentence. But since the examples you link to include a three-place expansion (for VP), it doesn't seem to be necessary.
As for further reading (since you ask for "links"), I would recommend a simple introduction to formal semantics for natural language; e.g., the book by Heim and Kratzer.