Knowee
Questions
Features
Study Tools

The goal of this assignment is to explore natural language processing (NLP) tech-niques to generate creative and expressive poetry. Students will leverage theselanguage models to construct three stanzas, each comprising four verses with 7 to10 words in each verse, resulting in a cohesive and meaningful poem that not onlyexhibit technical proficiency but also evoke emotions and imagery. The providedstanza serves as an example, and the generation model will be trained on a PoetryCorpus containing works by renowned poets such as William Shakespeare and MayaAngelou.Below mentioned poem is a computer-generated poem in William Shake-speare styleUpon yon stage, where moonlight gently plays,A soliloquy of stars in cosmic ballet.Whispers of fate in the evening’s embrace,Shall we dance with destiny, in this sacred space?In fair Verona, where love blooms like spring,Romeo’s heart, a sonnet that sweetly sings.Juliet, a rose by any other name,In the garden of passion, love’s eternal flame.Morn breaks, as the sun’s golden chariot rides,A symphony of dawn, where darkness hides.Oh, the world’s a stage, and we but players,In life’s grand drama, love the sweetest layers.Task:Your task is to print three stanzas with an empty line between them, generatedusing unigram, bigram and trigram models. Follow these steps to accomplish theassignment:(a) Load the Poetry Corpus:i. Import the provided Poetry Corpus containing works by William Shake-speare and Maya Angelou.ii. Tokenize each corpus separately to create a list of words in each poet style.(b) Generate N-gram Models:i. Develop unigram, bigram, and trigram models for each poet.ii. Select the first word randomly from the starting words in the vocabulary.iii. Use the unigram, bigram and trigram model to predict the next word,continuing until the verse is complete.iv. Apply the same approach to generate the next four lines.(c) Algorithm for Poetry Generation:For each stanza:For each verse:Generate a random number in the range [7...10].Select the first word.Choose subsequent words until the end of the verse.Print the verse.Print an empty line after the stanza.Implementation Challenges:(a) Word Prediction:Selecting subsequent words after choosing the first word requires predicting themost probable next word. Utilize Conditional Frequency Distribution (CFD)to determine the set of words that occur most frequently after the selectedword.(b) Rhyming:Bonus - Rhyming the generated verses poses an additional challenge. Considerbuilding a rhyming dictionary to enhance the artistic quality of the poem.(c) Standard N-gram Models:We can develop our model using the Conditional Frequency Distribution method.First, develop a unigram model (Unigram Model), then the bigram model (Bi-gram Model), and then the trigram model. Select the first word of each linerandomly from the starting words in the vocabulary and then use the bigrammodel to generate the next word until the verse is complete. Generate the nextthree lines similarly. Follow the same steps for the trigram model and comparethe results of the two n-gram models.Desired output:Ask the user in which style they want to generate the poem. Give him two options ->William Shakespeare and Maya Angelou. Then display the poem in that generatedstyle.

Question

The goal of this assignment is to explore natural language processing (NLP) tech-niques to generate creative and expressive poetry. Students will leverage theselanguage models to construct three stanzas, each comprising four verses with 7 to10 words in each verse, resulting in a cohesive and meaningful poem that not onlyexhibit technical proficiency but also evoke emotions and imagery. The providedstanza serves as an example, and the generation model will be trained on a PoetryCorpus containing works by renowned poets such as William Shakespeare and MayaAngelou.Below mentioned poem is a computer-generated poem in William Shake-speare styleUpon yon stage, where moonlight gently plays,A soliloquy of stars in cosmic ballet.Whispers of fate in the evening’s embrace,Shall we dance with destiny, in this sacred space?In fair Verona, where love blooms like spring,Romeo’s heart, a sonnet that sweetly sings.Juliet, a rose by any other name,In the garden of passion, love’s eternal flame.Morn breaks, as the sun’s golden chariot rides,A symphony of dawn, where darkness hides.Oh, the world’s a stage, and we but players,In life’s grand drama, love the sweetest layers.Task:Your task is to print three stanzas with an empty line between them, generatedusing unigram, bigram and trigram models. Follow these steps to accomplish theassignment:(a) Load the Poetry Corpus:i. Import the provided Poetry Corpus containing works by William Shake-speare and Maya Angelou.ii. Tokenize each corpus separately to create a list of words in each poet style.(b) Generate N-gram Models:i. Develop unigram, bigram, and trigram models for each poet.ii. Select the first word randomly from the starting words in the vocabulary.iii. Use the unigram, bigram and trigram model to predict the next word,continuing until the verse is complete.iv. Apply the same approach to generate the next four lines.(c) Algorithm for Poetry Generation:For each stanza:For each verse:Generate a random number in the range [7...10].Select the first word.Choose subsequent words until the end of the verse.Print the verse.Print an empty line after the stanza.Implementation Challenges:(a) Word Prediction:Selecting subsequent words after choosing the first word requires predicting themost probable next word. Utilize Conditional Frequency Distribution (CFD)to determine the set of words that occur most frequently after the selectedword.(b) Rhyming:Bonus - Rhyming the generated verses poses an additional challenge. Considerbuilding a rhyming dictionary to enhance the artistic quality of the poem.(c) Standard N-gram Models:We can develop our model using the Conditional Frequency Distribution method.First, develop a unigram model (Unigram Model), then the bigram model (Bi-gram Model), and then the trigram model. Select the first word of each linerandomly from the starting words in the vocabulary and then use the bigrammodel to generate the next word until the verse is complete. Generate the nextthree lines similarly. Follow the same steps for the trigram model and comparethe results of the two n-gram models.Desired output:Ask the user in which style they want to generate the poem. Give him two options ->William Shakespeare and Maya Angelou. Then display the poem in that generatedstyle.

...expand
🧐 Not the exact question you are looking for?Go ask a question

Solution

Sure, I can do that. However, you haven't provided any text for me to respond to. Could you please provide the text?

Similar Questions

According to the information presented in the article, why is teaching a computer to generate original poems such a complex task? Explain your answer using evidence from the text.

Multiple Choice: Which detail from the text best highlights how Mary Flanagan's view of machine-generated poetry differs from other experts, like Kevin Knight?A. "I feel the presence of the machine, stuck in the literary uncanny valley." (Paragraph 13)B. "'Humans are already good at producing human-sounding sonnets, so why get a computer to do that? Do something new!'" (Paragraph 15)C. "We could think of 'machine-generated' as a kind of literary G.M.O. tag" (Paragraph 16)D. "Perhaps machine sonnet-making is part of that resistance, a literary cyberpunk movement, a Dada-esque move." (Paragraph 17)

What gives lyric poetry its musical nature?figurative languageprosemetaphorssound devices

Which of the following describes poetic devices?Particular ways of selecting and arranging wordsElectronic tools used to record written documentsIntroductory phrases that establish a poem’s settingRhyming word pairs that have the same meaning

Which is an element of poetry that slam poets focus on more than other poets?A.Catching and keeping the audience's attentionB.Creating original and interesting imageryC.Breaking their lines in unexpected new waysD.Engaging complex emotions and themes

1/2

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.