CPSC 320 - 500 LISP Lab 3 -- Natural Language Processing

Due 11:59 pm on April 30 -- turn in your code electronically using the
turnin pro- gram as on previous labs:

Write a LISP program that takes as input the text of a written weather
forecast and correctly fills in the slots in a frame representing the
predicted weather conditions. Your program will be tested on actual
written forecasts from places like newspapers, weather and news sites
on the Web, and TV.  Completeness and correctness of the information
entered into the frame representing the predicted weather conditions
will determine your grade on this assignment.

The input to your program (a function called parse-forecast) will be a
list of lists -- each inner list containing the words in one
"sentence" of the forecast. The following are examples of forecasts
(notice while they are in natural language, they are not necessarily
grammatical):

((clear and cool) (low near 50) (northwest wind diminishing to 5 to 10 mph))

((sunny) (high near 80) (north wind near 10 mph becoming northeast 5 to
10 mph late))

((high near 80 with increasing clouds and a 70 percent chance of rain in
the afternoon) (tonight we will see fair skies and a low near 50))

The output from your function should be the frame containing the
predicted weather information.  Your function must be defined as
follows:

	(defun parse-forecast (weather-text)
		(setf forecast (make-weather))
		... 
		forecast)

The weather structure definition will be as follows. This will be
defined in our testing code, so all you need to turn in is the
parse-forecast function and any helper functions you have defined.

	(defstruct weather
		(high-temp nil)
		(low-temp nil)
		(rain-prob nil)
		(wind-speed nil)
		(wind-direction nil)
		(cloud-cover nil)
		(other-descriptors nil))

Say you have parsed the phrase "winds to 10 mph". To set the
wind-speed slot within the forecast frame constructed with
(make-weather) you will need to:
	(setf (weather-wind-speed) 10)

Values for slots may be numeric or textual -- wind-speed might be
described as gusty rather than having a specific numeric value. Slot
values not mentioned should be nil (this is how they start off.)