DEV Community

Generating Random Cure Song Titles with Markov Chain

Raymond Camden on April 20, 2018

Before you go any further, please note that this blog post contains absolutely nothing of value. This was a stupid idea I had last night that I dec...
Collapse
 
arj profile image
arj • Edited

I was looking for Markov chains yet you just use some library. Your post title was rather misleading.

Collapse
 
raymondcamden profile image
Raymond Camden

Sorry you didn't like it - I had thought from the title that was it obvious that I was just having a bit of fun. Hopefully the link PNS11 shared will be helpful.

Collapse
 
arj profile image
arj

After reading the title, I really thought that I would learn how you used the concept of Markov chains to generate titles.

Anyway, I just wanted to give you feedback. You see title marketing/link baiting on so many websites nowadays that people got used to it. But it annoys me EVERY time because it feels like being cheated.

Collapse
 
cess11 profile image
PNS11

While it is just another library I found crap.l to be readable and easy to learn about basic Markov chaining from, picolisp.com/wiki/?ticker .

Implementation usually goes something like this. The math behind it is basically a frequence calculation of how common it is for each word to be followed by another, then when you build your strings you use this probability estimate to choose what words to chain to one you picked (pseudo-) randomly as a kind of seed.

(googlebot seems to have kept up the indexing the ticker since the writing of that article, today it has crawled and cached thousands of pages)

Collapse
 
phlash profile image
Phil Ashby

Very nice, I think I prefer Depeche Mode...

"I Sometimes Wish I Sometimes Wish I Sometimes Wish I Sometimes Wish I Was Dead" :)

Collapse
 
dvdmuckle profile image
David Muckle • Edited

It would be pretty neat to bring this a step further and somehow let it generate songs given any band name. There must be some API that lets you get a list of songs given some band name...

EDIT: Yep! It's possible! developer.musicgraph.com/api-docs/...

Collapse
 
jfrankcarr profile image
Frank Carr

I wrote a program a few years ago that used classification and clustering algorithms to generate blog posts (mainly for use in dark SEO arts that were common at the time). My goal was to make it more powerful than the garbage text that was put together by Markov chain generators. The results were mixed depending on the blog topic. The results would read normal enough at first but would sometimes get really weird. What did surprise me was that in a number of cases blog comments from real people were posted suggesting that I learn how to speak English.

What I found is that short blurbs and titles were easy but building larger articles (500+ words) because it needed a large dictionary to draw from and building the dictionary was very tedious and time consuming. The final dictionary was around 10GB. Maybe one day I'll revisit it and see if I can improve upon the backend dictionary building part.