Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Chatbot help. Have to respond to user with one of the poems below. How do I strip a list of lists of poems of punctuation

Chatbot help. Have to respond to user with one of the poems below. How do I strip a list of lists of poems of punctuation and skip words (the,in,a,am...) and then check f highest frequency (if a tie, the longest) word in the user's response is most frequent in the poems? If found, respond with one of the responses below and respective author and poem. Thanks

POEMS = [["Maya Angelou", "You may write me down in history with your bitter, twisted lies; You may trod me in the very dirt but still, like dust, I'll rise"], \ ["Nikki Giovanni", \ "I was born in the Congo. I walked to the Fertile Crescent and built"\ " the Sphinx. I designed a Pyramid so tough that a star that glows"\ " every one hundred years falls into the center giving divine perfect light."\ " I am bad."], ["Langston Hughes", \ "Hold fast to dreams. For if dreams die. life is a broken-winged bird."\ " That cannot fly."]]

RESPONSES = ["That's interesting. As {poet} has written: '{poem}'", "I was thinking something similar! In fact, I just read {poet}'s"\ " poem about that topic. They wrote: '{poem}'", "I'm speechless. {poet} wrote about that when they said: '{poem}'", "Do you read poetry? Did you know {poet} said the same thing: '{poem}'"]

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_2

Step: 3

blur-text-image_step3

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

More Books

Students also viewed these Databases questions

Question

5. How do instructional objectives help learning to occur?

Answered: 1 week ago

Question

4. Help trainees set challenging mastery or learning goals.

Answered: 1 week ago