IIT Bombay
CS 101 Lab 9 Exercises on Text/Strings
Problem: A Text Analyzer
1. Your program accepts a name of a file as its command line
parameter.
The program answers the following questions:
(1) Word count?
(2) no. of occurrences of articles used in the text/word count?
Give overall figures, and also individual figures for occurrences
of 'a', 'an', 'the'.
(3) no. of words ending with 'ing'/word count?
Test your program on some parts of the texts available on osl account
at: ~rkj/test/ (try ls ~rkj/test to get the listing)
From the output, try to identify patterns associated with individual
authors.
2. Based on the study carried out in 1, handcraft some rules to guess
the author of
the file given in the input. (For this part, if you wish, you can
use/add other features of
your choice)
At the end of the above program, include your rules and
announce your guess about the author. Apply this program to
randomly picked up
long enough texts from the collection provided to you.
How accurate is your guess?
Submission: The cpp and a readme mentioning your discoveries.
Deadline: 11 pm.
Reference: Sample
programs on string