Tag Archives: writing

Phrase Maker

A tool for helping with song lyrics and creative writing projects / journals etc.

I love random generators:  This has been one of my favorite sites for years:

http://www.seventhsanctum.com/index-writ.php

You can create a random romance novel plot, or random dark-elf name or government conspiracy… or a few dozen other things.  It’s fun try it.  Here are some random story ideas it came up with just now:

In this story, a smooth witch-hunter falls in love with an impostor escpaing the past – all thanks to a repentance. What role will a studious tomb-robber play in their relationship?
In this story, a rascal who is from a parallel universe falls passionately in love with an energetic computer programmer – all thanks to a lecture.
In this story, a noisy dungeon delver is in love with a seasoned plumber. What role will a construction worker who had a near-death experience that changed them significantly play in their relationship?

This is yet another project I’ve been toying around with.  Back in the 90s somebody made a vb program that took your text input, and generated a response –like a chatbot, but with absolutely no pre-written response words or anything.  It was called “Talker.”  and I believe it’s the earliest incarnation of the kind of text generator that now does “My next status” on Facebook or “My Next Tweet” on Twitter based on your previous updates or tweets.

http://yes.thatcan.be/my/next/tweet/

All it does is take the words you put in and generates a random response based on the word order.   I’ve been searching for it for years, but the author and website disappeared and I can’t find the original.

Fortunately he explained it well enough at the time, that I was recently able to make my own… the algorithm is really simple.  It’s just like a random generator that picks from lists of things and puts them together. My kids had a talking story book toy that did this:

http://www.youtube.com/embed/We85BvXnF1E?

Take a random element from a list of nouns, a random element from a list of verbs, then objects and you have a much larger set of possibilities… thus from:

He saw the cat
She ate a pie
They sat on chairs

You can generate new sentences like He ate the cat, she ate chairs, They sat on a pie and so on.

What I’m working on does exactly the same thing –only instead of a set list of phrases… it uses all the lines or punctuated sentences you put in.

Now all your phrases won’t be in neet and tidy “subject verb object” format –but my program doesn’t care one bit.  It only cares where the words are, and what words likely come right after those words.

Take the phrases:

You can dance if you want to
You can leave your friends behind
Because your friends don’t dance
And if they don’t dance
Then they are no friends of mine
You can dance if you want to
If you don’t nobody will
You can act real rude and totally removed
I can act like an imbecile

It reads in each line marking the words as starting, ending, and the word after (if any) each word has.

STARTER WORDS

ENDING WORDS

You

to

You

behind

Because

dance

And

dance

Then

mine

You

to

If

will

You

removed

I

imbecile

The rules are simple:

Start with a random one of the starter words.
Find a random instance of the word after that.
Find a random instance of the word after that word.
Keep doing that until your next word happens to be an ending word.
Done

Let’s try it:

Find a starter word:

You  (let’s randomly pick the first “You”)

The word after that is “can.”  In this case, all the starter instances of “you” are followed by a “can” so if you start with “you” the next word is always going to be “can.”  But which “can?”

Find a random “can” in the sentences:

This can be either the “can” from “can dance”  or “can leave” or “can act” depending on which “can” we pick.  Let’s pick the one for “can leave,” so our next word is “leave.”

“Your” follows the only instance of “leave” so you’ll either end up with:

You can leave your friends behind

or

You can leave your friends of mine.

When you hit an Ending Word, you stop.

And those are the rules.

Other possibilities might be

Because your friends behind

Then they are no friends don’t dance

And you want to

and so on.   “And you want to“ might be a good next line or repeated refrain in that song.

What’s really funny is if you put that whole song minus “you can dance” it comes up with that line on its own.  Oooooh…

Okay now imagine you put every lyric by Nine Inch Nails in there and added  some code that said the next line had to rhyme with the last line.

Well I did.

I used a simple phoenitc dictionary and tagged each word with it’s phoenetic spelling and number of syllables…

It starts coming up with loose couplets like:

I don’t care what I’m supposed to.
My God sits in two.

And we’re living in my brain .
i should have to worry about no pain .

and I could have feeling.
I’m running .

I’m not picking the “best ones” either –those were the first 3 it came up with just now.  If it can’t find a rhyme after a while it gives up and says stuff like:

I feel you .
From dust .

How cool is that?

If you’re really stuck on song lyrics or poetry or whatever this can help.

But originally I didn’t write it for song lyrics.  I wrote it to be a “journal helper.” type thing.   So your journal can read more like a conversation and its response can help guide the next things you write about.  For creative writing in general.  For example I’ll put the text of this whole blog entry into it…

…and it responds:

Because your previous updates or

I take this as a question.  I could spend a few paragraphs answering it.  But I hit it again for another response:

I’ve been toying around with “you” the next word is always going to be “can.”

It sounds very positive and encouraging.. and at the same time a little creepy..  Heh….

Anyhow it’s not really supposed to generate original thoughts that make sense.  It’s a crude lever to help pry out whatever’s stopping your creative writing process.  Or a few words jumbled together in a way you might not have thought of to “prime the pump” of your own creative thought.

Besides rhyming, I can use the syllables to add rhythm.  I also added an option to use the 2nd words that come after words so instead of looking at just 2 word groups, it looks at 3 word groups –which is a common unit of english language construction.

This is good for dealing with prose –things with longer lines or sentences than song lyrics typically have.

Here’s an example.  I put in the entire text of Pride and Prejudice by Jane Austen –and set my program to “use 3 word groups.”

No I believe not before they are packed up .

It is really ill and keeps her room in earnest meditation; his brow contracted his air gloomy .

None of these sentences are in the book itself, but “his brow contracted, his air gloomy.” is a direct quote –which is the danger when being more strict with word order.  You drift toward repetition, but then as you loosen the reigns you drift toward senselessness.

If I turn off 3 word groups it falls apart and makes no sense at all.

But does Lydia should then we may gain some great neglect I was as I returned home the regiment after a point of all were all removed to the first quartered in her by dinner-time the whole of the corps she is .

Still it’s pretty cool for a random jumble of words.  “The whole of the corps she is…” and “quartered in her by dinner-time” are pretty cool phrases…  and not anywhere in the book.

I’m going to keep experimenting with this.   Maybe add a little bit of natural language processing –though that’s kind of what I’m trying to stay away from.  I don’t want it to “make sense” because then it’s less likely to make up things you wouldn’t have thought of.  It’s designed to break the rules… not follow them.

Here’s what happens when I turn on Rhyming with P&P:

Consent to every chance of opening her power .
Darcy was on Sunday night concerned in half an hour .

I was here as soon as your thanks .
Enough of making many weeks .

Now I cheated a little by taking only the last parts of the two lines it generated… but in doing so I just figured out how to make the syllables match!  Just arbitrarily cut off the first words until the lines match whatever you want them to syllable-wise!

Anyhow that’s one more project I started.

Advertisements