Assignment 3 – Victorian Concordance – Analyzing Literature by Words and Numbers

Maximum Points = 50

A porter in a British hotel comes upon an American tourist impatiently jabbing at the button for the lift.
"Sir, the lift will be here in a moment."
"Lift? Lift?" replies the American. "Oh, you mean the elevator."
"No sir, here we call it a lift."
"Well, as it was invented in the
United States, it’s called an elevator."
"Yes sir, but as the language was invented here, it’s called a lift."

from The Reader’s Digest

“Victorians were enamored of the new science of statistics, so it seems fitting that these pioneering data hounds are now the subject of an unusual experiment in statistical analysis. The titles of every British book published in English in and around the 19th century — 1,681,161, to be exact — are being electronically scoured for key words and phrases that might offer fresh insight into the minds of the Victorians.” [Analyzing Literature by Words and Numbers] The ability to analyze literary text has expanded significantly with the use of faster and more powerful computers.

The purpose of this lab is to continue your study of computer programming and algorithms through the Python programming language. In this lab you will use several new features including – user-defined functions, reading input from files, and lists. You may work with one other student on this assignment, but both partners must submit the assignment and timesheet to CougarView.

 

Write a program that does 1,2,3 and at least one CHALLENGE

1)              Asks the user for the name of a text file and then reads in the file of word pairs, where the first word is spelled in Victorian-era British spelling and the second word is the corresponding word spelled in “American English.”

a.     Print the two lists

For example:

BRITISH       AMERICAN

Bonnet          Hood

Boot             Trunk

Colour           Color

Favour          Favor

Honour          Honor

Invigilator      Proctor

Lift                Elevator

Spanner        Wrench

Whilst           While

2)              Asks the user for the name of a text file that contains a sample of Victorian literature.

3)              Analyze the literature sample (second file) and displays

a.     the number of lines of text in the file

b.     the number of words in the text

c.     display the file

 

CHALLENGE 1

4)                      ask the user for a word to search for and then display the line(s) that the word occurs in [see example at The Victorian Literary Studies Archive “Hyper-Concordance”]

CHALLENGE 2

5)                      find all of the words from the British-American word file and display them.

CHALLENGE 3

6)                      provide the user with a menu to allow the user to select what they want to do.

 

Make sure that your program uses proper indentation and complete documentation. See http://csc.columbusstate.edu/summers/NOTES/1301/style.htm for guidelines.

The program heading should occur at the top of the program and should include:

               #============================
               # PROGRAM SPECIFICATIONS
               # NARRATIVE DESCRIPTION:
                #
                #  @author (your name) 
               #  @version(date)
               #==============================

 

 (Due before 8 am on Wednesday, September 19, 2012) Submit your .py file containing your program and your timesheet documenting your time to the dropbox in WebCT.

 Grades are determined using the following scale:

Grading Rubric  (Word document)