Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python program to parse the string, by separate the lines according to who said them: Romeo, Juliet, etc. Use the transcript format. Once you see

Python program to parse the string, by separate the lines according to who said them: Romeo, Juliet, etc. Use the transcript format. Once you see one of the speakers tags 'ROMEO' all lines/words belong to that speaker until you see another speakers tag. Once the words are separated, remove all stop words using the provided BanWords string and remove punctuation from words. Count the word frequency of the words in the transcript. Use a dictionary, where the key is the word and the value is the count. Once you have a dictionary for each persons, you must extract the 30 most frequently used non-stopwords and their counts in rows and columns. Since a dictionary is unordered you need to create (count,word) tuples, put them in a list, and then sort the list. Put count first in the tuple because sorting will sort on the first item.

transcript.txt WOMAN: Two households both alike in dignity in fair Verona, Where we lay our scene, From ancient grudge break to new mutiny, Where civil blood makes civil hands unclean, From forth the fatal loins of these two foes, A pair of star crossed lovers take their life, Whose misadventured piteous overthrows doth with their death, Bury their parents strife. The fearful passage of their death marked love, And the continuance of their parents rage, Which but their children's end not could remove, Is now the two hours traffic of our stage.

ROMEO: Did my heart love till now? forswear it, sight! For I ne'er saw true beauty till this night.

ROMEO: If I profane with my unworthiest hand This holy shrine, the gentle sin is this: My lips, two blushing pilgrims, ready stand To smooth that rough touch with a tender kiss.

JULIET: Good pilgrim, you do wrong your hand too much, Which mannerly devotion shows in this; For saints have hands that pilgrims' hands do touch, And palm to palm is holy palmers' kiss.

ROMEO: Have not saints lips, and holy palmers too?

JULIET: Ay, pilgrim, lips that they must use in prayer.

ROMEO: Well, then, dear saint, let lips do what hands do; They pray, grant thou, lest faith turn to despair. JULIET: Saints do not move, though grant for prayers' sake.

ROMEO: Then move not, while my prayer's effect I take. Thus from my lips, by yours, my sin is purged.

Then have my lips the sin that they have took.

ROMEO: Sin from my lips? O trespass sweetly urged! Give me my sin again.

You kiss by the book.

ROMEO: Is she a Capulet?

Ay, so I fear; the more is my unrest.

JULIET My only love sprung from my only hate! Too early seen unknown, and known too late! Prodigious birth of love it is to me, That I must love a loathed enemy. ROMEO: He jests at scars that never felt a wound. But, soft! what light through yonder window breaks? It is the east, and Juliet is the sun. Arise, fair sun, and kill the envious moon, Who is already sick and pale with grief, That thou her maid art far more fair than she: Be not her maid, since she is envious; Her vestal livery is but sick and green And none but fools do wear it; oh cast it off. It is my lady, O, it is my love! O, that she knew she were!

JULIET: Ay me!

ROMEO: She speaks: O, speak again, bright angel! JULIET: Romeo, O Romeo! wherefore art thou Romeo? Deny thy father and refuse thy name; Or, if thou wilt not, be but sworn my love, And I'll no longer be a Capulet.

ROMEO: [Aside] Shall I hear more, or shall I speak at this?

JULIET: 'Tis but thy name that is my enemy; Thou art thyself, though not a Montague. What's Montague? it is nor hand, nor foot, Nor arm, nor face, nor any other part Belonging to a man. O, be some other name! What's in a name? that which we call a rose By any other word would smell as sweet; So Romeo would, were he not Romeo call'd, Retain that dear perfection which he owes Without that title. O Romeo, doff thy name, And for that name which is no part of thee Take all myself.

WOMAN: A glooming peace this morning with it brings, the sun, for sorrow will not show his head. Go hence, to have more talk of these sad things. Some shall be pardoned and some punished. For never was a story of more woe, than this of Juliet and her Romeo.

BanWords.txt a about above after again against all am an and any are aren't as at be because been before being below between both but by came can will can't cannot come could couldn't did didn't do does doesn't doing don't down during each few for from further get go got had hadn't has hasn't have haven't having he he'd he'll he's her here here's hers herself him himself his how how's i i'd i'll i'm i've if in into is isn't it it's its itself let's like me more most must mustn't my myself no nor not of off on one once only or other ought our ours ourselves out over own quite said same saw say says see shan't she she'd she'll she's should shouldn't so some such than that that's the their theirs them themselves then there there's these they they'd they'll they're they've this those through to too under until up very was wasn't way we went we'd we'll we're we've were weren't what what's when when's where where's which while who who's whom why why's with won't would wouldn't you you'd you'll you're you've your yours yourself yourselves

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Autonomous Database In Enterprise Architecture

Authors: Bal Mukund Sharma, Krishnakumar KM, Rashmi Panda

1st Edition

1801072248, 978-1801072243

More Books

Students also viewed these Databases questions

Question

What were the reasons for their resistance?

Answered: 1 week ago

Question

What are Measures in OLAP Cubes?

Answered: 1 week ago

Question

How do OLAP Databases provide for Drilling Down into data?

Answered: 1 week ago

Question

How are OLAP Cubes different from Production Relational Databases?

Answered: 1 week ago