Skip to main content

Using Grammar Rules to Analyse English Sentences

  • Chapter
  • First Online:
Logic Programming with Prolog
  • 3325 Accesses

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

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

eBook
USD 16.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 16.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Author information

Authors and Affiliations

Authors

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

Reprints 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)

Publish with us

Policies and ethics