AIMA Artificial Intelligence a modern approch

AIMA-exercises is an open-source community of students, instructors and developers. Anyone can add an exercise, suggest answers to existing questions, or simply help us improve the platform. We accept contributions on this github repository.

Exercise 12.29 [shopping-grammar-exercise]

A complete solution to the problem of inexact matches to the buyer’s description in shopping is very difficult and requires a full array of natural language processing and information retrieval techniques. (See Chapters nlp1-chapter and nlp-english-chapter.) One small step is to allow the user to specify minimum and maximum values for various attributes. The buyer must use the following grammar for product descriptions:

Here, ${Category}$ names a product category, ${Attribute}$ is some feature such as “CPU” or “price,” and ${Value}$ is the target value for the attribute. So the query “computer with at least a 2.5 GHz CPU for under 500” must be re-expressed as “computer with CPU $>$ 2.5 GHz and price $<$ 500.” Implement a shopping agent that accepts descriptions in this language.

View Answer