CS 347: Lab 14 – Rhyming
Welcome to lab. By now you have already watched the lecture videos on your own. Now we will apply the ideas from those videos in an exercise, which you will complete in small groups.
Within your breakout room, designate one of your team to be the screen sharer. Screen sharer, share your screen and claim your group’s task on Crowdsource. Make sure to enter every group member’s JMU eID so that they receive credit. Your group will be assigned a task number.
Team, complete the assigned task below. Screen sharer, be careful not to dominate. All members should contribute ideas.
Task
Reverse engineer the following page, which generates a list of rhymes, using an internal stylesheet and an internal script:
Follow these guidelines in your solution:
- Query for rhymes using Rhymebrain’s API. Ignore the form at the top of the page. Skip down to the section labeled RhymeBrain.com Advanced Access. The Rhyming box shows you how to access the endpoint and interpret the JSON it sends back.
- Present the words in the order they are returned from Rhymebrain.
- Size each word accordings to its score. Set the size directly using a
style
assignment and an arithmetic expression. Do not use classes. - Ensure the words all sit on the same baseline.
- Notice there’s no button to trigger the search. On each
input
event, schedule the rhymes to be pulled down after 1 second has elapsed. If anotherinput
happens before the retrieval task fires, cancel the previously scheduled task and schedule a new one for the new word.setTimeout
is useful for scheduling tasks to run in the future. - If the user types Enter (or Return) in the input, which you can detect in a
keydown
event, cancel any scheduled task and fire off an immediate retrieval of the rhymes.
Screen sharer, when your group is done or when time is up, submit your group’s solution on Crowdsource.
Reference Implementation
…