A Parser for Non-valid Dates
The Date Parser script in
the examples section constructs a shallow parser for dates. It knows
about the number of days for each month and about leap years. Study and
run the script until you understand how the Date Parser works. Note
that it will not recognize dates such as "February 29, 1900" but it
will accept "February 29, 2000".
Your task is to create a shallow parser that marks all dates that
are not valid, such as, "February 29, 1900" and "April 31" with the
HTML tags "<NON-DATE>" ... "</NON-DATE>",
Add your definition(s) for NonDateParser to the end of the
date.script above the Testing section and replace the line
Once you are done with this first task, find a way to combine your
NonDateParser with the original DateParser so that valid dates
get marked with <DATE> ... </DATE> tags and invalid dates
get marked as <NON-DATE> ... </NON-DATE>.