0

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?

erip
  • 16,374
  • 11
  • 66
  • 121
user16655
  • 1,901
  • 6
  • 36
  • 60
  • This is about the workings of the NLTK's semantics module, so I don't think it's off-topic. – alexis May 08 '15 at 14:13

1 Answers1

1

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.

alexis
  • 48,685
  • 16
  • 101
  • 161
  • @alexis...what is the meaning of (?p),(?q)...actually what is indicating by this sign(?).. ??? thanks . – Sudip Das Nov 27 '16 at 09:19
  • They're placeholders matching the corresponding part in the expansion of the rule. Or "variables over feature values", as the nltk book puts it. See [here](http://www.nltk.org/book/ch09.html#using-attributes-and-constraints). – alexis Nov 27 '16 at 16:27