;; This defines the grammars and lexicons in ;; Chapter 4. It does not contain a morphological analyzer, however ;; so you must break apart suffixes yourself. For instance, if you call ;; (BU-parse '(Jack cries)) ;; the parser will complain about an unknown word "cries" ;; The right form should be ;; (BU-parse '(Jack cry +s)) ;; Try (BU-parse '(a fish saw the man)) ;; (BU-parse '(the man want +s the fish to cry)) (setq *grammar4-5* '((headfeatures (v root subcat) (n root)) ((v (vform pres) (agr 3s)) -LEX1> (head (v (vform bare) (irreg-pres -))) (+s)) ((v (vform pres) (agr (? a 1s 2s 1p 2p 3p))) -LEX2> (head (v (vform bare) (irreg-pres -)))) ((v (vform past) (agr (? a 1s 2s 3s 1p 2p 3p))) -LEX3> (head (v (vform bare) (irreg-past -))) (+ed)) ((v (vform pastprt)) -LEX4> (head (v (vform bare) (en-pastprt -))) (+ed)) ((v (vform pastprt)) -LEX5> (head (v (vform bare) (en-pastprt +))) (+en)) ((v (vform ing)) -LEX6> (head (v (vform bare))) (+ing)) ((n (agr 3p)) -LEX7> (head (n (agr 3s) (irreg-pl -))) (+s)))) (setq *lexicon4-6* '((a (art (agr 3s) (root A1))) (be (v (root BE1) (vform bare) (subcat (? s _adjp _np)) (irreg-pres +) (irreg-past +))) (cry (v (root CRY1) (vform bare) (subcat _none))) (dog (n (root DOG1) (agr 3s))) (fish (n (root FISH1) (agr (? a 3s 3p)) (IRREG-PL +))) (happy (adj (subcat _vp-inf) (root HAPPY1))) (he (pro (root HE1) (AGR 3s))) (is (v (root BE1) (VFORM pres) (SUBCAT (? s _adjp _np)) (AGR 3s))) (Jack (name (agr 3s) (root JACK1))) (man (n (root MAN1) (agr 3s))) (men (n (root MAN1) (agr 3p))) (saw (n (root SAW1) (agr 3s))) (saw (v (root SAW2) (vform bare) (subcat _np))) (saw (v (root SEE1) (VFORM past) (subcat _np) (agr ?a))) (see (v (root SEE1) (VFORM bare) (subcat _np) (irreg-past +) (en-pastprt +))) (seed (n (root SEED1) (AGR 3s))) (the (art (root THE1) (agr (? a 3s 3p)))) (to (to (vform inf))) (want (v (root WANT1) (VFORM bare) (subcat (? s _np _vp-inf _np_vp-inf)))) (was (v (root BE1) (VFORM past) (AGR (? a 1s 3s)) (SUBCAT (? s _adjp _np)))) (were (v (root BE1) (VFORM past) (AGR (? a 2s 1p 2p 3p)) (SUBCAT (? s _adjp _np)))) (+s (+S)) (+ed (+ED)) (+en (+EN)) (+ing (+ING)) ;; additional entry for saw2 to allow a PP after it (saw (v (root SAW2) (vform bare) (subcat _np_pp))) ;; additional an entry for see1 to allow a NP_VP after it (see (v (root SEE1) (vform bare) (subcat _np_vp-bare) (irreg-past +) (en-pastprt +))) (saw (v (root SEE1) (vform past) (subcat _np_vp-bare) (agr ?a))) ;; an entry for the proposition with (with (p (root with1))) ;; an entry for "wood" (wood (n (root WOOD1) (agr 3s))) ;; an entry for "sad" (sad (adj (subcat _vp-inf) (root SAD1))) )) (setq *grammar4-7* '((headfeatures (s agr) (vp vform agr) (np agr)) ((s (inv -)) -1> (np (agr ?a)) (head (vp (vform (? v past pres)) (agr ?a)))) ((np) -2> (art (agr ?a)) (head (n (agr ?a)))) ((np) -3> (head (pro))) ((vp) -4> (head (v (subcat _none)))) ((vp) -5> (head (v (subcat _np))) (np)) ((vp) -6> (head (v (subcat _vp-inf))) (vp (vform inf))) ((vp) -7> (head (v (subcat _np_vp-inf))) (np) (vp (vform inf))) ((vp) -8> (head (v (subcat _adjp))) (adjp)) ((vp (vform inf)) -9> (head (to)) (vp (vform bare))) ((adjp) -10> (head (adj))) ((adjp) -11> (head (adj (subcat _vp-inf))) (vp (vform inf))) ;; The first extension - VP->N[_np_vp-base] NP VP[base] ;; Needed to handle ;; I saw him run I mage him laugh It is sad [vp to see [np him] [vp run]] ((vp) -my1> (head (v (subcat _np_vp-bare))) (np) (vp (vform bare))) ;; The second extension - PP -> P NP ((pp) -my2> (head (p)) (np)) ;; The third extension VP -> V[_np_pp] NP PP ;; Needed to handle ;; He saws the wiid with a saw ;; I saw him [vp saw [np the wood] [pp with a saw]] ((vp) -my3> (head (v (subcat _np_pp))) (np) (pp)) ))