Project 1, Part 2

Shakespeare Lookup from Web Page
Due: February 26 - 11:55 pm

Moodle Link

Screen_Shot_2017-01-26_at_9.14.36_AM.png shake.gif


To take the code from project one that allows the looking up of words in Shakespeare though an inverted index, and create a web page version. Rather then write this from scratch you will reuse and modify the code provided for the US Census name server program.

Minimum Functionality:

  1. Enter in a word to search for.
  2. Use stemming
  3. Display the number of matching lines.
  4. Display the lines with the matching words
Additional Functionality
  1. Highlight the words matching in the lines.
  2. First show the number of matches per book, then click on a book to show the matches in the book
  3. When you click on a matching line, open up a modal window and show the entire paragraph with the matching line.
  4. If two words are answered, show only lines with matches to both words.

US Census Name data program

You have been given the code to look up names in the US Census data. The architecture of the solution is seen below:


The code for this US Census Name Data lookup system is located at

Clone the program to your folder

Type: "git clone"

Change the names

You will need to change the programs in two files to make it work correctly for you. You can use textwrangler or notepad++

1. Change the Makefile

Copy this project into a new folder in your folder. Then change the "user= skon" in the Makefile to be "user=username" where username is your server username.

2. Change the reference to the CGI program in the HTML file

In namelookup.js change the line:"GET", "/cgi-bin/skon_namelookup.cgi?"

so that skon is now your username. This makes sure your code is copied to the right directories, and with the correct names.

Run the program

To run the system go to the project folder (see above) in a ssh terminal.

  1. Make the project: make
  2. Go to your folder with a browser, and open namelookup.html

Create a new project

You will need to make a copy of the nameserver folder to use as the wtarting point for the new Shakespeare project. From your main directory make a copy:

cd ~
cp -r namelookup shakeproject2

You will then need to change the file names, and then change the Makefile to make the changes in the filenames. You are required to use a makefile for this project.

Shakespeare Program

In project 1 you created code to lookup words in Shakespeare. You will combine that code with the code from this US Name data system to make a web version of your Shakespeare lookup program.

You will need to modify the program to serve up Shakespeare matches

  1. Rename the files as appropriate, change the Makefile to reflect these changes
  2. Modify the the HTML program (renamed from name_stats_ajax.html) to send a request with a single word, and then display the results after calling the CGI program.
  3. Modify the CGI program (renamed from namelookup.cpp) to receive a word from the web page, lookup the lines with the matching words matching lines back, and send them to the web page.


Below is a list of features you can put in your program, along with the points. Notice that people with Data Structures must do more than students with only the introduction course to get 100 points (the perfect score) on the program. If you do more than 100 points, you getr= extra credit.

Requirement Data Structures Intro Prog Comments Score
Program displays the number of matches, shows matching lines for each word entered on the web page, use stemming* 40 60    
Shows number of matches per book first, then allow user to click on book to see matches in book. 10      
Program highlights the words as bold in the output. 5      
Allow clicking on line to show modal with paragraph. 15      
Program allows the searching for two words on the same line. 15      
Well designed User Interface* 10 10    
Program broken up into functionally cohesive functions* 10 10    
Program has meaningful comments, good variable names, and good formatting* 10 10    
Program uses appropriate classes 10 10    
*These are required in order to get extra credit.

Turn in

  1. The program must be runnable.
  2. All source files you authored
  3. A writeup with the table above, and an indicated of which was included. Paste table into Moodle text field, and put X's in to options you attempted. Also include a statement of the highest computer science course you have taken.
  4. Several runs showing all features.

Topic attachments
I Attachment History Action Size Date Who Comment
PNGpng NamesWebArchtectureSimple.png r1 manage 48.7 K 2017-10-10 - 03:24 JimSkon  
PNGpng Screen_Shot_2017-01-26_at_9.14.36_AM.png r1 manage 310.4 K 2017-10-10 - 01:50 JimSkon  
GIFgif shake.gif r1 manage 36.6 K 2017-10-10 - 01:49 JimSkon  
Edit | Attach | Watch | Print version | History: r9 < r8 < r7 < r6 < r5 | Backlinks | Raw View | Raw edit | More topic actions
Topic revision: r9 - 2018-09-12 - JimSkon
This site is powered by the TWiki collaboration platform Powered by PerlCopyright © 2008-2019 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback