Course Planner Prerequisite Parsing Fixes

Nov 24 2013 Published by under CourseTree,Programming

One of the bugs still in the Waterloo Course Planner is the handling of prerequisite sentences that end with “* students only.”. The fix I made was rather simple. Though converting existing test cases to unit tests did not help because none of the older grammar rules were changed and therefore the tests were not broken, it did help in the development of new grammar rules. Python unit tests does a nice job of pinpointing the exact place where the expected results differ from running the code.

Failure
Traceback (most recent call last):
  File "N:\Projects\ply\prereqyacc.py", line 182, in testQuirks
    self.assertEqual(results, map(parser.parse, prereqs))
AssertionError: Lists differ: ['MATH 127/MATH 128/MATH 137/M... != ['MATH 127/MATH 128/MATH 137/M...

First differing element 1:
MATH 115/MATH 119
MATH 115, MATH 119

- ['MATH 127/MATH 128/MATH 137/MATH 147', 'MATH 115/MATH 119']
?                                                  ^

+ ['MATH 127/MATH 128/MATH 137/MATH 147', 'MATH 115, MATH 119']
?                                                  ^^

“* students only.” appearing in a string results in the tokenizer printing out a list of invalid tokens. There are two ways of ignoring strings in PLY:

  1.  t_ignore_ in the tokenizer
  2. change t_ignore_ to a token and add a new rule that returns an empty string in the parser

I used the second method this time, since the semicolon preceding “* students only.” would also need to be ignored. Semicolons are treated as a signal for an “and” clause otherwise. The new rule looks like the following:

def p_restriction(p):
    'semi_restriction : SEMI STUDENTS_ONLY'
    p[0] = ''

No responses yet

Course Explorer Refresh, with Inspiration

Dec 23 2010 Published by under CourseTree

Coursetree 1.5

screenshot.21

New Features:

  • Successor relationships
  • Textbooks by ISBN from the bookstore
  • Department requirements
  • 2 clicks at most to look up information on a course
  • Intelligent back button behavior
  • Links to Wikipedia
  • HTML5 semantic markup

Bugfixes:

  • All issues listed in the previous release notes
  • Phrase “one of” being missed by the scraper
  • Parser can handle phrases such as “taken prior to”
  • M(y)isunderstanding regarding commas corrected
    • CS 136 or 145, MATH 135
    • now becomes (CS 136 or 145) and MATH 135
    • should see more prerequisites listed as a result
  • Courses being overwritten by labs

Bugs:

  • A couple of quirks showing up as errors in the parser
    • EARTH 121, 121L or 122, 122L should be interpreted as EARTH 121/EARTH 122
    • CHEM 264 or 28/262 should be interpreted as CHEM 264/CHEM 282/CHEM262
  • Courses overlapping in the prerequisite graph

Waterloo Course Planner has been tested and works on IE8, Firefox 3.6, Chrome 9, Safari 5, and Opera 11.

No responses yet