Rhymatron.net has officially launched BETA! (4/30/2010)

The Rhymatron Python project has finally launched on a working website. Behind the scenes, the web server is running a Python script to pre-generate enormous lists of rhyming words and rhyme keys. Then a user selects from a list of pre-fabbed templates (or creates their own) and the poem/rap output gets spit out. Rather than this output being static, instead the user can adjust any word by clicking up and down arrays to cycle through other words from that same rhyme key list. A word that is intended to rhyme will continue to rhyme, even when it has been replaced.

Check it out at Rhymatron.net

Rhymatron – Markov Chain Update (4/09/2010)

After learning about word counting, ngrams, and markov chains, I’ve made some tweaks to the rhymatron script to produce a better output.

Now each word pairing is of two words that appear next to each other in natural language (and I increased the dictionary’s scope by expanding the source texts to include Alice in Wonderland and Moby Dick, in addition to Huckleberry Finn).  Still there is room for additional improvement, but the output is definitely one step closer to passing a Turing test.

Here is a link to the updated code.

And here is one example of the improved output:

guile thronged, overtaking, dipped bores, this twists,
prints paw, legs fills, pangs slicked, path sin,
edge ann, blanche lip, sophia amidst,
correspondents begin, indignity by.
spliced bors, figurative, mince froth, slit wilks,
hit ward, trim fins, stirred twists, blanc lip,
mouths mat, calf whips, worshippers cashier,
disagreement exist, circulation i.
pikes pours, gentlemanly, lids yore, lives inn,
tricked loft, grit lear, sleeps crib, dat chill,
purge van, crab slipped, whoever sincere,
discouraging wherein, malefactors stile.
time more, insensible, clipped hauled, jim string,
licked tore, holes stings, foiled chips, wrap list,
that wrapped, act sings, perception begins,
dedication until, futility child.

guile thronged, overtaking, dipped bores, this twists,

prints paw, legs fills, pangs slicked, path sin,

edge ann, blanche lip, sophia amidst,

correspondents begin, indignity by.


spliced bors, figurative, mince froth, slit wilks,

hit ward, trim fins, stirred twists, blanc lip,

mouths mat, calf whips, worshippers cashier,

disagreement exist, circulation i.


pikes pours, gentlemanly, lids yore, lives inn,

tricked loft, grit lear, sleeps crib, dat chill,

purge van, crab slipped, whoever sincere,

discouraging wherein, malefactors stile.


time more, insensible, clipped hauled, jim string,

licked tore, holes stings, foiled chips, wrap list,

that wrapped, act sings, perception begins,

dedication until, futility child.

Synchronous Stone (3/31/2010)

stone_render1

Here’s a short summary of a concept that would synchronize the lives of two people.

Two users would each have a small hand held device in the shape of a stone that is network connected and paired with a second identical device.  Embedded within the stone is a temperature sensor and force sensing resistor, which in tandem can determine when someone is holding the device.  When held for prolonged periods, and the device’s sensed temperature passes a threshold, it signals through a network to the other device.  A couple would hold the stone when thinking of the other, synchronizing their thoughts of one another and keeping their individual experiences connected in some way.  Using a pager motor and an LED, the devices communicate to one user when the other is connected.  The LED lightens and dims based on the temperature of the other device, and the pager motor vibrates when a new session begins.

Rhymatron Version 2 (3/12/2010)

yeti_mic

Concept Overview

My interest in creating a fully-autonomous, generative rap-writing script has fully bloomed with this latest carnation of Rhymatron. One major component to the progress was my use of Carnegie Melon University’s phonetic dictionary. Although I did successfully create an automated web crawling script that would ping dictionary.com and extract its contents, I was advised that CMU’s dictionary already had this same information, and using it would not put me at any risk of shutting down a web server and getting into serious trouble.

Once the CMU dictionary was properly parsed and loaded, I used it to phonetically analyze a 4 verse rap by musical artist Mos Def, featured in the song “Two Words” by Kanye West. His original lyrics can be found here and a snippet from the song can be heard here. I distilled the lyrics down to syllables, and constructed a template generating new poems with the same meter and rhyme scheme.

Rhyme Template:

A B, – – – C, D B, D C,
D B, – C, E C, E C,
– E, E C, – – – EC,
– – – – EC, – – – – A

Process

I approached the code writing portion of the project from numerous directions, and settled on this script. (Click for SOURCE CODE). Using custom functions, I am essentially plugging the above template directly into the program, which means that I can easily use the same program with different templates to get dramatically different results.

I played around with alliteration as well as rhyme, but this additional code would consistently cause errors from returning no matching words. I’d like to sort this out and implement the alliteration functionality, as well as adding in patterned parts of speech like adj-noun, noun-verb, etc, for more convincing word pairings.

Rather than feeding in the entire dictionary of words, instead I used Mark Twain’s, “Huckleberry Finn,” as a dictionary source so that only common language words would be used. I’d like to collect the lyrics from a few hundred hip hop songs to better acclimate the language of the outputted text to the genre from which the templates are derived.

Each time the script is run, entirely new content is made. Here are three different results from the script running:

(output one)

fished raise, embellishment, told bray, strokes numb,
folks brain, ones ones, pump wrung, shrunk crush,
licks flung, bulged skull, countenance enough,
ironical nonesuch, speculation drink.

spilt snakes, gratifying, shoals play, toes gusts,
strode shape, buts stubbed, bean crusts, frum crusts,
quaint nuts, hum mumps, occupied result,
altogether insult, hospitable jeer.

sink pay, circulation, broke knave, hoped lunch,
doan may, dad doves, blasts rush, jug buck,
phased ones, bluff rough, conclusions somewhat,
resurrected repulse, secondary if.

chips reigned, ultimately, low snake, jo pump,
dough rains, fished buzz, hens cuffed, crusts jumps,
fear huts, slough hump, bothersome construct,
prosecuted occult, indignity wrist.

(output two)

rows swam, animation, sniffs slapped, mere cul,
brings sag, guise dusk, white hunt, lined duds,
watched crime, stile buzzed, deliver discuss,
inquiries results, material so.

bolt slack, millennium, peer jabbed, quick mum,
bricks sass, clews crush, guy monk, chimed buzz,
thatch dried, buy hung, vacancy succumb,
execution nonesuch, tumultuous dough.

boat mapped, incognito, til snag, whip snug,
kin flags, beats snuffed, nines blood, live shunned,
style mild, twine sums, wantonly nonesuch,
memorable occult, unspeakable pope.

joke grabbed, comfortable, sting clang, lists us,
ing bang, whisked run, fist nub, time judge,
foe prime, sigh hum, augmented become,
testimony somewhat, astonishing yoked.

(output three)

flown sewed, resembling, laced poked, phased hill,
changed slowed, sheep crisp, toned thinks, grown winced,
gone goat, tote hilt, hurrying exist,
administered wherein, material owned.

cote bones, accomplishing, wail spoke, snakes cheers,
gray oaks, arms rigged, sock whip, owed springs,
floats knowed, smoke ridge, reasoning chagrin,
authorities wherein, military ode.

snow prose, recipients, brain ropes, waved ticks,
strange blow, trance pierced, blowed whips, rose pig,
sap holes, vogue fierce, occasioned severe,
unnatural admit, intelligent rome.

sew o, delivering, flayed growth, changed licked,
paint clothes, spilled its, been lip, strode stint,
nag stow, floats limp, palestine consist,
counterfeited appear, exhibited coaxed.

Source Code and Supporting Files

If you want to try running the source code yourself, here is a link to a zipped up file with all the necessary parts. (although its up to you to learn how to run python scripts from the command line.) LINK TO ZIPPED FILE.

Gear Simulation in Solidworks (2/25/2010)

Test of Simulated Gears in Solidworks from Noah King on Vimeo.

After learning about gearing and simple geared mechanisms today, I thought I would try to simulate this type of physical movement in solidworks. After constructing several gear shapes, it was fairly easy to get them dynamically moving with one another. I’m definitely looking forward to building some complex contraptions using this workflow as a development tool.

The Speed of Innovation (2/24/2010)

stages

————————————————————————————

Project Overview:

Theme: The scale of time increments

There are approximately 365.242199 days in a year. But that number is changing…constantly. Atomic clocks count 9,192,631,770 cycles per second of the cesium-133 atoms to maintain a precise second. Time operates differently depending on the scale of the time increment. Our perception of time is often bound by measurements of time that we cannot perceive. How can we reinterpret these out-of-scale increments into increments we can understand?

Assignment:

Build a relational clock that corresponds to a time scale that is not normally perceivable to humans. How can we visualize an imperceivable increment in relation to a perceivable increment?

Our group was comprised of: Alex Vessels, Patricia Adler, and Digital Noah.

————————————————————————————

Initial Ideas:

We began exploring ideas visualizing destruction in the world. One developed concept was to print lots of iconic symbols of natural resources on a long roll of paper, and then pass the paper through a hand-cranked shredder. As we thought together about developing this idea, it occurred to us to make the speed of the shredder accelerate to represent the acceleration of resource depletion.

As we focused more and more on the concept of time acceleration, the direction of our project changed all together.

img155
————————————————————————————

Selected Concept: Acceleration of Time

The very notion of time being flexible is quite amazing. We treat time as a constant, when in reality it is quite abstract and mutable. This is particularly clear when you focus on the in-between times, rather than on the time increments themselves: What if you measured time by the intervals in between significant events? Depending on your scope, time could be perceived as accelerating, decelerating or stable. If you consider the creation of matter and the universe, then time is decelerating as many initial significant changes took place quite rapidly and now matter shifts slowly over billions of years. Meanwhile, if you look at the evolution of intelligence, time is is accelerating, as fewer and fewer years separate the changes of highly intelligent life forms.

For the scope of our project, we focused directly on the intervals of time between significant inventions in human society.
————————————————————————————

Kurzweil’s Work:

The concept of time acceleration and deceleration has been explored in great detail by many scientist and thinkers, one of whom is Ray Kurzweil. In his book, The Age of Spiritual Machines, he writes extensively about the history of the universe and shows how it is both accelerating and decelerating. To read more of Kurzweil’s writing, follow this link.

————————————————————————————

Wikipedia Content:

Looking for data to read through and analyze, we stumbled on this wikipedia page. We scrubbed through the data, extracted much of it into a spreadsheet, and then wrote a Processing sketch to visualize this data.

————————————————————————————

Our Visualization:

proc_sketch_TIME

Click here for the Interactive Processing Sketch.

Rhymatron – Generative Text Poetry Robot (2/18/2010)

PROJECT OVERVIEW

I’m interested in writing a program that can generate poems and raps, after feeding the program a series of source texts. I have a lot to learn before I can tackle such an advanced programming problem, so with this current project, I sought after a simple, incremental step towards my long-term goal.

In this project, words are substituted from Robert Frost’s poem, “Stopping By Woods On A Snowy Evening.” Rather than merely substituting random words, I wrote a Python script that searches through a secondary text, looking for words that rhyme with the original words from the poem.

————————————————-

link to SOURCE CODE

————————————————-

DESCRIPTION OF CODE

In plain english, the Python script behind this project does the following:

Part 1 – Strip Robert Frost’s poem into lines, then strip each line into words, and then store each word in memory. If the final word of any line contains a punctuation character, then strip off that last character and store it memory.

Part 2 – Strip a user-defined text into lines, then strip each line into words, and finally store each word in memory. If a word has any punctuation characters, strip these characters from the word.

Part 3 – Try to find rhyming words in the user-defined text. Look through each word and search for the patterns eep, ake, ear, ough. If the word is a match, then store the word in memory.

Part 4 – Reassemble the words of the poem into lines, substituting the last word from each line with a rhyming word from memory, following the rhyme scheme of AA, BABB, CBCC, DCDD, DD. Append each line with punctuation characters as needed. Print out all the lines of the new poem.

————————————————-

DEMONSTRATION 1 – Frost meets Twain

Source poem: Robert Frosts, “Stopping By Woods On A Snowy Evening
Source text: Mark Twain’s, “Huckleberry Finn

Outputted Poem:

Whose woods these are I think I bough.
His house is in the village below.
He will not see me stopping anywhere.
To watch his woods fill up with widow.
My little horse must think it tear.
To stop without a farmhouse interfere.
Between the woods and frozen namesake.
The darkest evening of the sincere.
He gives his harness bells a flake.
To ask if there is some sake.
The only other sound’s the asleep.
Of easy wind and downy bake.
The woods are lovely, dark and sheep.
But I have promises to deep.
And miles to go before I weep.
And miles to go before I weep.

————————————————-

DEMONSTRATION 2 – Frost meets Shakespeare

Source poem: Robert Frosts, “Stopping By Woods On A Snowy Evening
Source text: William Shakespeare’s, “All’s Well That Ends Well

Outputted Poem:

Whose woods these are I think I flow.
His house is in the village though.
He will not see me stopping interfere.
To watch his woods fill up with barlow.
My little horse must think it appear.
To stop without a farmhouse gear.
Between the woods and frozen cake.
The darkest evening of the bedivere.
He gives his harness bells a strake.
To ask if there is some take.
The only other sound’s the weep.
Of easy wind and downy bake.
The woods are lovely, dark and sweep.
But I have promises to peep.
And miles to go before I keep.
And miles to go before I keep.

————————————————-

NEXT STEPS

Although this is working relatively well, clearly the outputted text would be more believable if the substituted words maintained the correct number of syllables and remained grammatically correct. To achieve these improvements, I need to learn how to check the enormous list of words to assess their number of syllables and to evaluate whether they are nouns, verbs, adjectives, etc. Somewhere between our lessons on Regular Expressions and WordNet, I expect to pick up the needed skills to take this project even further.

Suicide Clock (2/10/2010)

In the Time class last week, we had a great discussion about the concept of creep. It is when a material changes over time as the result of stress. The stress could be moisture, gravity, tension, temperature change, etc.

Thinking about this concept, I saw a trend that creep tends to happen very slowly over time. And it tends to be a hindrance, rather than an addition to any design or construction. So I began thinking about what creep could look like at a very fast rate and how to build the concept of creep into a design, rather than try to work around it. Thus the suicide clock was born.

Suicide Clock - Version 1, wired to breadboard

Suicide Clock - Version 1, wired to breadboard

Suicide Clock Close-Up

Suicide Clock Close-Up

Suicide Clock Ultra-Close-Up of Circuit

Suicide Clock Ultra-Close-Up of Circuit

The concept of this clock is that it does not measure time in terms of seconds, minutes, hours, etc. Rather it measures the time between each one of it’s death/resuscitation cycles. When switched on, a circuit is connected which sends power to a solenoid. When the solenoid fires, it disconnects the circuit and causes the the machine’s electrical death. But once it dies, gravity forces the circuit to connect again, and the solenoid fires once more. This cycle happens over and over, keeping time.

Suicide Clock in Action from Noah King on Vimeo.

Suicide Clock Ultra Close Up from Noah King on Vimeo.

Generative Text Mashups with Python (2/04/2010)

THE TAO OF BUSINESS

1
If businesses fail to honor their responsibilities to society and don’t believe in corporate stewardship, who in our society will?
Therefore the sage goes about doing nothing, teaching no-talking.
What does a business enterprise owe its customers and consumers?
The sage stays behind, thus he is ahead.
What standards of conduct and performance should an enterprise set for its employees and agents?
Therefore the sage is guided by what he feels and not by what he sees.
What is the role of industry and government in setting business and professional standards?
Therefore the sage, traveling all day, does not lose sight of his baggage.

2
What is the optimal mix of values and rules to guide decision-making and action?
Therefore the sage takes care of all men.
What structures, systems, practices, and procedures will best implement the values and rules of the enterprise?
When the sage uses it, he becomes the ruler.
What outcomes should one reasonably expect from an enterprise’s decisions and activities, and how can an enterprise track, measure, and report them?
Therefore the sage avoids extremes, excesses, and complacency.
What can they reasonably expect?
Thus the sage knows without traveling.

3
Who speaks for the environment and future generations as stakeholders?
The sage has no mind of his own.
What is the role of business in sustainable development?
The sage is shy and humble – to the world he seems confusing.
Who can rightfully claim the power to govern an enterprise?
Therefore the sage says: I take no action and people are reformed.
How can the board of directors and management best protect the rights of shareholders, especially minority shareholders?
Therefore the sage is sharp but not cutting, pointed but not piercing, straightforward but not unrestrained, brilliant but not blinding.

4
How can the board of directors best guide management to meet the reasonable expectations of shareholders?
Not only will it do no harm to others, but the sage himself will also be protected.
If the employees want to bargain as a group, how should the RBE relate to its workers?
The sage does not attempt anything very big, and thus achieved greatness.
Should it bargain with the group of employees?
Because the sage always confronts difficulties, he never experiences them.
Are there circumstances under which such a contract should not be enforced?
The sage does not act, and so is not defeated.

5
What does it mean to be a responsible business?
Therefore the sage seeks freedom from desire.
Is this easy?
If the sage would guide the people, he must serve with humility.
What does it mean to be the owner or manager of a responsible business enterprise?
In this way when the sage rules, the people will not feel oppressed.
What challenges does your enterprise face in the years ahead?
Therefore the sage wears rough clothing and holds the jewel in his heart.

—————————————————————————-

What is the source material?

The above passage is a “mash-up” of texts from two original sources:

Source 1 – Tao Te Ching, by Lao-Tzu
Source 2 – Business Ethics, by the US Secretary of Commerce

Both texts were combined into one giant String and were processed and outputted with a Python script:
Combined Source Text
Python Script Source Code

—————————————————————————-

What does the script do?

The Python script is designed to search for two different keywords within a body of text. Any line of text from the source that contains one of the keywords is extracted and stored in a list of saved lines. Next the script outputs alternating lines from the saved lists. After four paired lines are outputted, one line is skipped to create stanzas of text. After five stanzas, the script stops.

This script could be used with any text input to search for any two distinct terms. For example, you could input the text of the newspaper and search for the words “peace” and “war”. The script would find any lines that contain either of those two terms, and then would construct a new text body where one line spoke of peace and the next line spoke of war, alternating back and forth. The output could be constrained to have line breaks after any number of lines and could continue for any desired length.

Digestive Clock (2/03/2010)

With the intent of designing a time keeping device that is based off of a human life cycle, the concept for a clock which mimics the body’s digestive process was conceived.

render1

For most people, the timing of our meals and our trips to the bathroom are fairly regular and a framework for measuring the passing of time. Not only is this approach novel and unique, but it would likely encourage people to be more connected to their body, more aware of the food they are putting into themselves, and more aware of the extremely important cycle of flushing waste from our systems.

The initial concept emerged as a alternative type of hour glass. Rather than sand falling from one conical section to another, instead food and liquids would pass from virtual mouth to virtual anus. The details of the form were developed in a series of sketches in which the human digestive system was incrementally abstracted.

sketch2

Combining inspiration from the steampunk aesthetic found in the below lamp by Frank Buchwald and the classical chemistry set shown below, a developed form was created.

Frank Buchwald_steamp punk lamp

chemistry set

Developed Concept Sketch

Developed Concept Sketch

To visualize the idea, Processing was employed to program an animation of particles moving through the clock and measuring the cycles of a day. The below sketch indicates the intended design of a simple processing test in which a single particle would move along a curving path.

Illustration of intended Processing sketch

Illustration of intended Processing sketch

Unfortunately, the needed curving movement was much more difficult to program than originally estimated due to the complex math involved to capture the curvature of the path. Several equations were investigated in Grapher, seen below, to begin to flesh out this program, but much more resource will be needed to implement the idea as an animation.

Grapher equations for curved paths

Grapher equations for curved paths

At this point in time, the concept has been visualized to communicate the form and styling of the piece.

render_2

It is still under debate whether a user would “feed” the clock throughout the day to match their own eating schedule, or whether the clock would recycle the liquid and solid elements, much like a fountain. The daily cycle would include several feedings, several liquid waste expulsions, and one single solid waste expulsion. The concept of sleep would be of importance as well, as it’s function within digestion is thought to be critical.

Consistent with the overarching message and spirited tone of the book, “Everybody Poops,” this clock is intended to be universally appealing and engaging to all human beings.