Question: Python question: The aim in this question is to find the main characters in a novel by doing textual analysis. We will hypothesise that the

Python question:

Python question: The aim in this question is to find the main

characters in a novel by doing textual analysis. We will hypothesise that

the most frequent capitalised words in a novel are likely to be

The aim in this question is to find the main characters in a novel by doing textual analysis. We will hypothesise that the most frequent capitalised words in a novel are likely to be the character names. You should write a program to open a file called novel.txt and read in all the words. For this purpose let's assume that words are groups of letters and punctuation separated by spaces. Your program should then count the number of times each word appears and print out the top 3 words which start with a capital letter. For example, for our first sample file which you can download here: Jellicle Cats are black and white Jellicle Cats are rather small; Jellicle Cats are merry and bright, And pleasant to hear when they caterwaul Jellicle Cats have cheerful faces, Jellicle Cats have bright black eyes; They like to practise their airs and graces And wait for the Jellicle Moon to rise Your program should print out: 6 Jellicle 5 Cats 2 And because the word Jellicle is the most frequently capitalised word (occurring 6 times), followed by Cats and then And. Once you've got it working on that simple example, lets try something really ambitious and run it on a novel - Pride and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!