Abstract
This chapter describes the use of the special syntax provided in Prolog for analyzing grammar rules: the operator -->/2, the predicate phrase/2 and braces to enclose ’regular’ Prolog used in conjunction with grammar rules. A simple grammar able to deal with basic sentences is defined. Predicates are given to enable the validity of sentences presented as lists of words to be established and to extract important information such as the type of each noun_phrase from valid sentences. Finally, predicates are defined to convert sentences in standard English into the ’list of words’ form required by the grammar rules.
After reading this chapter you should be able to:
-
Understand and use the special syntax provided in Prolog for analyzing grammar rules.
-
Define a simple grammar able to deal with basic sentences of English.
-
Define predicates to enable the validity of sentences presented as lists of words to be established and to extract important information such as the type of each noun phrase from valid sentences.
-
Define predicates to convert sentences in standard English into the ’list of words’ form required by Prolog grammar rules
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Author information
Authors and Affiliations
Practical Exercise 12
Practical Exercise 12
Extend the grammar rules given at the end of Section 12.2 to allow for the possibility of an adverb at the end of a sentence of type s3 or s4. Define the following words as adverbs: well, badly, quickly, slowly.
Rights and permissions
Copyright information
© 2013 Springer-Verlag London
About this chapter
Cite this chapter
Bramer, M. (2013). Using Grammar Rules to Analyse English Sentences. In: Logic Programming with Prolog. Springer, London. https://doi.org/10.1007/978-1-4471-5487-7_12
Download citation
DOI: https://doi.org/10.1007/978-1-4471-5487-7_12
Published:
Publisher Name: Springer, London
Print ISBN: 978-1-4471-5486-0
Online ISBN: 978-1-4471-5487-7
eBook Packages: Computer ScienceComputer Science (R0)