## Natural Language Toolkit: sem2.fcfg ## ## Longer feature-based grammar with more quantifers, and illustrating ## transitive verbs and prepositional phrases (PPs). The ## interpretation of PPs is a bit weird and could do with further ## work. ## ## Author: Ewan Klein ## URL: ## For license information, see LICENSE.TXT ## ## $Id: sem2.cfg 4674 2007-06-14 08:55:32Z ehk $ % start S ############################ # Grammar Rules ############################# S[sem = ] -> NP[num=?n,sem=?subj] VP[num=?n,sem=?vp] NP[num=?n,sem= ] -> Det[num=?n,sem=?det] Nom[num=?n,sem=?nom] NP[loc=?l,num=?n,sem=?np] -> PropN[loc=?l,num=?n,sem=?np] Nom[num=?n,sem=?nom] -> N[num=?n,sem=?nom] Nom[num=?n,sem=] -> N[num=?n,sem=?nom] PP[sem=?pp] VP[num=?n,sem=] -> TV[num=?n,sem=?v] NP[sem=?obj] VP[num=?n,sem=?v] -> IV[num=?n,sem=?v] VP[num=?n,sem=] -> VP[num=?n,sem=?vp] PP[sem=?pp] PP[sem=] -> P[loc=?l,sem=?p] NP[loc=?l,sem=?np] ############################# # Lexical Rules ############################# PropN[-loc,num=sg,sem=<\P.P(john)>] -> 'John' PropN[-loc,num=sg,sem=<\P.P(mary)>] -> 'Mary' PropN[-loc,num=sg,sem=<\P.P(suzie)>] -> 'Suzie' PropN[-loc,num=sg,sem=<\P.P(fido)>] -> 'Fido' PropN[+loc, num=sg,sem=<\P.P(noosa)>] -> 'Noosa' NP[-loc, num=sg, sem=<\P.\x.P(x)>] -> 'who' Det[num=sg,sem=<\P Q. all x. (P(x) implies Q(x))>] -> 'every' Det[num=pl,sem=<\P Q. all x. (P(x) implies Q(x))>] -> 'all' Det[sem=<\P Q. exists x. (P(x) and Q(x))>] -> 'some' Det[num=sg,sem=<\P Q. exists x. (P(x) and Q(x))>] -> 'a' N[num=sg,sem=] -> 'boy' N[num=pl,sem=] -> 'boys' N[num=sg,sem=] -> 'girl' N[num=pl,sem=] -> 'girls' N[num=sg,sem=] -> 'dog' N[num=pl,sem=] -> 'dogs' TV[num=sg,sem=<\X y. X(\x. chase(y,x))>,tns=pres] -> 'chases' TV[num=pl,sem=<\X y. X(\x. chase(y,x))>,tns=pres] -> 'chase' TV[num=sg,sem=<\X y. X(\x. see(y,x))>,tns=pres] -> 'sees' TV[num=pl,sem=<\X y. X(\x. see(y,x))>,tns=pres] -> 'see' TV[num=sg,sem=<\X y. X(\x. chase(y,x))>,tns=pres] -> 'chases' TV[num=pl,sem=<\X y. X(\x. chase(y,x))>,tns=pres] -> 'chase' IV[num=sg,sem=<\x. bark(x)>,tns=pres] -> 'barks' IV[num=pl,sem=<\x. bark(x)>,tns=pres] -> 'bark' IV[num=sg,sem=<\x. walk(x)>,tns=pres] -> 'walks' IV[num=pl,sem=<\x. walk(x)>,tns=pres] -> 'walk' P[+loc,sem=<\X P x. X(\y. (P(x) and in(x,y)))>] -> 'in' P[-loc,sem=<\X P x. X(\y. (P(x) and with(x,y)))>] -> 'with'