Rhythming Words?

This weekend I was listening to an interview with Stephen Sondheim on public radio. He commented that a rhyming dictionary was one of the key tools that he used for creating lyrics for his musicals.

Has anyone created a tool that accepts a word as input and returns a list of rhyming words?

There are several online rhyming dictionaries like Data Muse with an API that returns a list of rhyming words:

            https://www.datamuse.com/api/

Possibly this could be used to create a tool in Snap!

image

Of course, there may also be ways to do this entirely in Snap!

Thoughts?

Those six words are all one syllable. Doesn't that dictionary think that "Mandalay," for example, rhymes with "day"?

Would could get the community to build a library of words for you. (Of course make it so only people you trust can do it)

@bh I haven't full explored the possibilities of Data Muse, but there are a number of switches that can be used to shape output - the number of syllables and other parameters, etc.

@joecooldoo Crowdsourcing a library of rhyming words sounds like a great project.

I can create a database for this.

OK, done. Snap! 6.9.2 Build Your Own Blocks
If anybody wants to add to the database, just post something like this:

RhymingWord1A RhymingWord2A RhymingWord3A
RhymingWord1B RhymingWord2B RhymingWord3B

MAKE SURE TO MAKE IT IN A CODE BOX LIKE ABOVE!!

The following script generates rhyming words that are sent to the console:

image

This is the output that results:

image

How can a JavaScript variable (such as "response" in the example above) be imported as a variable in Snap!

What's wrong with the
untitled script pic - 2021-12-05T235702.116

You can SPLIT BY JSON:

For me at least, "fretful" doesn't rhyme with "let phil".

@dardoro That's perfect ... just what we needed. Thanks!

Not that useful for a demo :wink:
untitled script pic - 2021-12-06T001151.543
"blockify" result
untitled script pic - 2021-12-06T001239.040

The dictionary might not have that word in it.

Maybe a JSON pretty-printer?

@dardoro OK, using your suggestion, I'm getting rhyming words as output:

image

However, the way in which I'm achieving this is a kind of brute force approach. (Give someone a hammer and everything looks like a nail.)

image

Is there a more elegant way to accomplish this or is this a reasonable approach?

Yes:


untitled script pic - 2021-12-05T190108.310

P.S. who said "orange" didn't rhyme with anything?:
untitled script pic - 2021-12-05T190414.915

(I would add "cringe" and "hinge")

P.P.S.


"purple strawberry guava" isn't a word.

@warped_wart_wars Thanks!

WWW's use of KEEP makes the code easier to understand as well as smaller, but as a general rule, whenever you have a MAP directly inside another MAP, you can combine them by making a composition of the functions each one calls. So:


This is exactly your procedure, but condensed to a single MAP call.