(Message 85) From: HELEN HPS (on ERCC DEC-10) Date: Wednesday, 30-Jan-85 22:59:54-GMT To: ecmi04@2972,Pain@EDXA Via: uk.ac.edinburgh.edxa ; (to uk.ac.edinburgh.emas) 30 Jan 85 23:01:57 gmt Msg ID: <132017-752-505@EDXA> -------- AI1 PROLOG PROJECTS - NATURAL LANGUAGE PROJECT AI1 PROLOG PROJECTS - NATURAL LANGUAGE PROJECT AI1 PROLOG PROJECTS - NATURAL LANGUAGE PROJECT Helen Pain 30 January 1985 This project is based on a program that generates sentences from an recursive transition network (RTN). The RTN representation of the grammar consists of a number of states and connecting arcs. The arcs are labelled by other RTN's (non-terminals) or by words (terminals). The RTN may be traversed and a sentence generated in the process of traversal. To run the program three files need to be consulted: 'ecmi04.rtn' 'ecmi04.drinks' 'ecmi04.random' The file 'ecmi04.rtn' contains the sentence generating predicates, generate and traverse. The file 'ecmi04.drinks' contains the grammar itself - it comprises RTN's for sentence, nounphrase, verb, noun, determiner, adjective, proper_noun and stop_mark. The file 'ecmi04.random' contains number of predicates that are used to select an element from a list, at random. (NOTE: you do not have to worry about how the predicates in this file work - you only need to know that the predicate random_pick(List,El) matches List to a list of any number of elements and that El matches to a random element selected from that list). To generate a sentence, in response to the prompt type ?- go. Try this several times and explore the sentences generated. List the program. Trace the program and step through it. ?- debug go. When you think that you understand how the program works do the following: 1. Write a description of how the program works: a paragraph for each of the procedures in the program, describing what each procedure does, and how it does it. 2. Draw the RTN's that are represented by the 'drinks' grammar. [see your linguistic notes]. 3. Provide 6 examples of the sentences generated and an example trace of the program for two of these examples. 2 4. Copy the "drinks" file to your area. Edit it to include the following additional vocabulary: verbs - hates,pours nouns - pint, milk, glass adjectives - clear, fresh, full Include a listing of the editted grammar, and sample sentences produced, in your project report. In addition to the above, do at least two of the following extensions to the project. For each, include in your project report: i. a description of the extension to the program (including any new RTN's used); ii. a listing of the program to indicate the changes made; iii. a number of examples to illustrate the extension; iv. any relevant discussion of the problem; how you solved it, how else you might have solved it, where it fails and why, etc. _______ __________ Program_Extensions 1. This program does not distinguish between subject and object. It can produce sentences such as: "the tea drinks the vicar" Rewrite the RTN's to prevent this. Rewrite the program (edit the "drinks" file) to include these new rtn's. 2. How could the program be altered to generate the following: fred like a pint of beer. the vicar pours a glass of sherry! Add to the sentence grammar an RTN for prepositional phrases. Change the program to generate sentences that include these prepositional phrases. Try also adding conjunctions, for example: jane wants a vodka and tonic. the policeman drinks the tea and the beer? Alter the program to generate these. 3. Copy the 'rtn' file and edit it so that a call of "go" prints a parse tree in the form: sentence nounphrase determiner a noun vicar verb drinks nounphrase determiner the noun tea stop_mark 3 [harder extensions] 4. Rewrite the drinks grammar and rtn to produce poems. (They do not have to rhyme!) 5. Rewrite the program so that, instead of generating a sentence, it takes a sentence, for example [the,vicar,loves,tea], and prints a parse of it using the grammar - or fails if it will not parse. [it might produce the same sort of parse tree as that above]. 6. Find out about the Prolog notation for "Definite Clause Grammars". Rewrite the sentence generator using these. Please provide TWO copies of your project report, including all listings and examples. These should be submitted to me, Helen Pain, by Monday 22nd April (that is, Monday of week 2 of next term). --------