Place text from two separate sources to create a mashup.

Adjust the slider to increase the weighting of either source

Week 2: Progress thus far...

Perhaps I bit of more than I could chew for week 2's assignment, seeing as the vast majority of my sticking points were easily overcome by the use of regex. The gist of the webapp is to take two different pieces of text and to "jumble" them up to create a new, and hopefully coherent, text. The slider allows the user to select the ratio of how much of each story to mix into the result. Selecting an 80:20 (A:B) ratio will result in 4x more content from source A than from Source B.

The algorithm works by breaking each source text into its constituent parts of speech. The text with the heigher weighting in the Jumble Ratio is used as the base text. The algorithm loops over every word in the base text and replaces each word with a word with the same part of speech from the other text.

I'm at the point where I've broken down each source into elements of parts of speech, I simply need to figure out how to replace the necessary words and recombine them into a final result.

There are plenty of free books available as plain text over at Project Gutenberg


Jumble Ratio (A:B) is 50:50

Source A:


Source B: