next up previous
Next: The Current System Up: assign3.html Previous: assign3.html  

Description of the Problem

This assignment, once again, is to implement an interactive version of the KWIC index system (described in Parnas's On the Criteria To Be Used in Decomposing Systems into Modules) in the implicit invocation paradigm. You will be provided with a partial C++ implementation of the system and asked to identify and make the necessary modifications.

The provided system, as in Assignment 2, is simply a line alphabetizer. It interactively inputs a line at a time and upon demand outputs an alphabetized list of the current collection of lines. Unlike the first assignment this version also allows a delete command. Here is a transcript of a sample session:

  Add, Delete, Print, Quit:
  a
  > Star Wars
  Add, Delete, Print, Quit:
  a
  > The Empire Strikes Back
  Add, Delete, Print, Quit:
  a
  > Return of the Jedi
  Add, Delete, Print, Quit:
  p
  Return of the Jedi
  Star Wars
  The Empire Strikes Back
  Add, Delete, Print, Quit:
  d
  > Star Wars
  Add, Delete, Print, Quit:
  p
  Return of the Jedi
  The Empire Strikes Back

Your assignment is to modify the existing code to support the following changes:

  1. Rather than simply outputting an alphabetic list of all the lines, the Print command should output an alphabetic list of the circular shifts of all the lines. However, shifts (including the nullary shift) which result in a line beginning with a trivial word--a, an, and, the and the capitalized versions of these words--should be omitted.
  2. On a Print command the system should also print a counter of the number of original lines added by the system.
  3. On a Histogram command the system should print a list of all the words stored in the index and the number of occurrences of each word.

Here is a sample session of the new system:

  Add, Delete, Histogram, Print, Quit:
  a
  > Star Wars
  Add, Delete, Histogram, Print, Quit:
  a
  > The Empire Strikes Back
  Add, Delete, Histogram, Print, Quit:
  a
  > Return Of The Jedi
  Add, Delete, Histogram, Print, Quit:
  p
  -- Number of Original Lines:   3--
  Back The Empire Strikes
  Empire Strikes Back The
  Jedi Return Of The
  Of The Jedi Return
  Return Of The Jedi
  Star Wars
  Strikes Back The Empire
  Wars Star
  Add, Delete, Histogram, Print, Quit:
  d
  > Star Wars
  Add, Delete, Histogram, Print, Quit:
  p
  -- Number of Original Lines:   2--
  Back The Empire Strikes
  Empire Strikes Back The
  Jedi Return Of The
  Of The Jedi Return
  Return Of The Jedi
  Strikes Back The Empire



TOM Conversion
Thu Mar 20 16:27:04 EST 1997