gread - #!/usr/bin/env python # gread.py by Sara Kazemi # #...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
#!/usr/bin/env python ####################### gread.py by Sara Kazemi ######################## ## This program can be used to assess a text's grade-level readibility ## ## by finding the ratio of non-simple to simple sentences and by ## ## calculating the average sentence length (words per sentence). ## ## Thanks to Professor Malouf for all the help and a great semester! ## ######################################################################### import re print '%26s %5s %15s'% ('Nonsimple:Simple','|','Average Words') print '%25s %6s %15s'% ('Sentence Ratio','|','per Sentence:') print '-'*50 ## Keeps count of words, supplies the number of sentences from how the text ## is split with respect to specified sentence boundaries, and matches ## sentences that contain certain conjuctions in order to count the number ## of non-simple sentences. def Counter(filename): ## Declares our variables and sets them to zero. lines = sentences = words = ns = 0
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 2

gread - #!/usr/bin/env python # gread.py by Sara Kazemi # #...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online