Programming
Workshop

Spring 2018
course
site

Exercises in Programming Style

This is from :

The data files (in this folder) are

the coding task - term frequency

Given a text file, display its 25 most frequent words and the number of times each occurs. Convert all words to lowercase, ignore punctuation, and don't do common "stop words", which are specified in stop_words.txt.

For example, if the file is named input.txt and contains

White tigers live mostly in India 
Wild lions live mostly in Africa

and the python program is frequency.py , then running

$ python frequency.py input.txt

should produce

live - 2 
mostly - 2 
africa - 1 
india - 1 
lions - 1 
tigers - 1 
white - 1 
wild - 1

Your first task: write such a program in python, and run it on pride-and-prejudice.txt .

Pay attention to the style of your code - functional or object oriented or whatever - that's what we want to use this exercise to discuss.