% File DCGSUBC.PL % Michael A. Covington % Natural Language Processing for Prolog Programmers % (Prentice-Hall) % Chapter 3, Section 3.4.4 % Parser that enforces subcategorization s --> np, vp. np --> d, n. %d --> [the];[a]. %n --> [dog];[cat];[gardener];[policeman];[butler]. d --> [the]. d --> [a]. n --> [dog]. n --> [cat]. n --> [gardener]. n --> [policeman]. n --> [butler]. 1/10 :: vp --> v(1). 3/10 :: vp --> v(2), np. 4/10 :: vp --> v(3), np, np. 2/10 :: vp --> v(4), s. v(1) --> [barked]. v(1) --> [slept]. v(2) --> [chased]. v(2) --> [saw]. v(3) --> [gave]. v(3) --> [sold]. v(4) --> [said]. v(4) --> [thought]. % To test: ?- s([the,gardener,thought,the,dog,chased,a,cat],[]). (succeeds) % versus: ?- s([the,gardener,slept,the,dog,chased,a,cat],[]). (fails)