Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Your assignment is to use the Datamuse API to generate a predictive text-driven Haiku topic of the user's choice. Your program should first request that

image text in transcribed
Your assignment is to use the Datamuse API to generate a predictive text-driven Haiku topic of the user's choice. Your program should first request that the user provide a top begin the Haiku generation. Then, your program should connect to the Datamuse API related words that satisfy the requirements of a Haiku (described below). Print your co Haiku for the user to enjoy. Finally, your program should allow the user to generate as Haikus as desired. For the purposes of this assignment, the requirements of Haikus are: . A Haiku is a 3-line poem, where the first line contains 5 syllables, the second line syllables, and the third line contains 5 syllables. The last words of each line in the Haiku must rhyme. A Haiku may not use the same word more than once The Datamuse API supports several forms of queries that will assist you in this assignn the first word of the Haiku, choose a word related to the topic selected by the user. Use "https://api.datamuse.com/words?md=s&rel_trg=word" to search for a word related to user's topic (replace "word" in the URL above with whatever topic you would like to This mode of the API searches for "related triggers," which the API abbreviates as "rel These words are not necessarily synonyms, but rather words that follow the same topic example, a related trigger of "cow" might be a word like "milking." These two words a synonyms but pertain to the same topic. For example, if your topic were "food," you m "https://api.datamuse.com/words?md=s&rel_trg=food" to search for related words. Th words returned by this search are "FDA", "beverage", and "nutrition". For the next words of your Haiku, rather than using related triggers, instead, use "https://api.datamuse.com/words?md=s&lc=word" to search for words that commonly previous word. The "lc" in the URL stands for "left context," meaning that the word yo commonly appears to the left of (just before) whatever words the API returns. For exam previous word in your Haiku were "jump." then you might use "https://api.datamuse.com/words?md=s&lc=jump" to search for words that commonly after "jump." The first few words returned by this search are "to", "in"; and "into". At the end of each line of the Haiku, you must meet the rhyming requirement mentione To do so, use "https://api.datamuse.com/words?md=s&lc=word&rel_rhy=rhyme" to se words that are both related to the previous word in the sentence and rhyme with the end line. This URL uses two parameters in its querystring: the "lc" or left context to 2 seard "rel_rhy" or rhyming word to match. For example, suppose that you needed a word the

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions

Question

+ What is a new product success? How can risk

Answered: 1 week ago