Assignment 1 : Regular Expressions

Due Wednesday, September 19

In this  assignment you will write one or several regular expressions, run your expressions on data, and write a short report about the results. There are several suggested tasks below. You only need do one task. But don't be limited by the list below. I encourage you to come up with your own task(s). The exact assignment is up to your own interests and creativity!

Data

Several texts are available at http://www.cs.vassar.edu/~cs395/data. There are two sets, one consisting of plain text, and one consisting of texts from the American National Corpus in UTF-16. You are also free to find data on the web, use your own email, or any other large corpus you find.

Python scripts

The Python scripts demonstrated in class are available at http://www.cs.vassar.edu/~cs395/code. regexs.py and regexcount.py should be used for plain text files; regexs-utf16.py and regexcount-utf16.py should be used for data encoded in UTF-16. You can also develop your own Python scripts, if you prefer and are able.

Here are some examples of what to type at the Unix prompt in order to run the provided modules:

python regexs.py 'that that' [name of file]   prints all lines containing 'that that' in the file 
python regexs-utf16.py '\bdis(\w+)\b' *.txtprints all lines containing text matching the regular expression in all files
with extension ".txt"  in the current directory
python regexcount.py '\bdis(\w+)\b' *.txtprints prints all lines containing text matching the regular expression in all files
with extension ".txt"  in the current directory, with a count of the number of times it appeared at the bottom
             
             
Example Tasks
Or, consider some more involved (and fun!) variants:
What to hand in, and how

To submit your assignment, send it by email to ide@cs.vassar.edu with the subject line CS395 ASSIGNMENT 1.

In addition to writing your regular expression or program, write a short report about your motivations for the task you chose, your experiences in implementing it, your experiences in running it, and your findings. Feel free to suggest  additional things you might like to do that would build on what you've done so far. The report should be clear and well-written, but it needn't be long--about one page is fine. Also, no need for fancy formatting--in fact, you can just type this report as the body of your email. Your regular expression or program can also be included in the bodyof the email or included as an attachment.