Alif Wahid

Posts tagged with "emergence"

Nov 5

Animated and superimposed map of five million bicycle journeys around London. They have these bikes that you can rent and ride around. That’s where this data set came from. Link to New Scientist article. Watch how the ultra-bright glowing patterns emerge out of the chaotic self-organising blue worms.

(Source: Guardian)

Generating Random Sentences

I very recently came across a Python package called Natural Language Toolkit (NLTK). It’s an impressive and extensive library of classes and functions to process the texts from various natural languages of the world. From what I can gather, it seems to be among the top three most used toolkits for natural language processing and linguistic analysis of various kinds worldwide. Strangely enough, it also turns out that the people developing NLTK are based only couple of doors down the corridor from my lab here at The University of Melbourne! I’ve been living under a rock :P

Anyway, during lunch time today I had a little fiddle with NLTK, and it is ridiculously easy to pick up (well, for me that is, since I know a bit about Python already). I managed to verify the output of my own dinky little program for parsing texts, counting words and building radix trees. They were consistent with the output of NLTK in each case - Yee haa!

Bonus part is that NLTK makes it easy to do n-gram analysis, which are just sequences of N words and their frequency distributions. Once you have such distributions, you can sample from them and start generating random sentences in the flavour of the underlying text that you used for building the distributions. So, in the space of mere minutes, I managed to analyse Hamlet and Ulysses and start generating random sentences. The results are utterly spooky! Here’s a sample of randomly generated sentences based on Hamlet.

The Tragedy of Hamlet sits smiling to my sick soul , freeze thy young
blood , make you from Wittenberg , Horatio , as sin ‘s true nature is
fine , it argues an act that blurs the grace and blush of modesty ,
calls virtue hypocrite , takes off his crown , kisses it , where he
goes to heaven ; send hither to see your father ‘s signet in my
imagination it is not his own too much of water hast thou done ? first
priest her obsequies have been my Hammlet ‘s Hamlet give the first dost

These are totally random and yet they appear Shakespearean in essence, ignoring the obvious semantic nonsense. Check out a randomly generated sample of sentences based on Ulysses below.

Episode 8 - Lestrygonians PINEAPPLE ROCK , LEMON PLATT , BUTTER
SCOTCH. A SUGARSTICKY GIRL shovelling scoopfuls of creams for a man
looks like with figures juggling. Always find out so long as possible
of proof is with tiny hands. Weeny bones. Almost see them with him.
Bloom stops , points a mailed hand against the Rt. Hon. Mr Justice
Fitzgibbon , John Henry Menton ‘s office. He ‘s stinking with money .
BLOOM I saw her at the grand stand while the land of Egypt to hanker
after. Wallow in it. Is she , Simon , with statements

See what I mean! This is thoroughly entertaining to read since I can just keep generating more and more new samples! But I better stop here for now. Looks like a world of possibilities is now open before me in this endeavour :)

Sep 1

Generating Random Words

I’ve been fiddling around with a simple script to randomly sample letters from the English alphabet and string them into words of random lengths. The programming effort has been negligible so far due to the crudeness of my model, and correspondingly the results are meaningless for the most part. However, once in a while some meaningful words prop up as in the sample of 50 randomly generated words below.

eiuttri ircroo slaai eioehdsa nfegovi ehholhiri nulthe spifei ihmwpo hrdthcimi itdsflgna tiitohe ygiaotaei ntaedmmai ie rsa ense eesbio feio du stle plardtto mwe oattefo sureterso ftuoi a ua mgtoi hrtihei rya lisa tnkteea oyhnuhomae no etmora siarii piauatevci eriihi ni tyo tea derviie efa wto tatttrtea i o otoildeei fe

When scattered among a large body of totally meaningless words, the appearance of a name like “lisa” or a word like “tea” seem to just lose all meaning as they blend in so well. I guess I’m used to always reading grammatically correct text with connotations, such that reading gibberish interspersed with something actually meaningful has a very strange effect on my eyes and on my brain. What effect do these random words have on you?

In an entropic sort of way, I’m pondering why so few meaningful words exist within such a vast space of meaningless words? If you think about the raw combinations, then from an alphabet of 26 letters you can create a seemingly infinite number of words of any length regardless of what they could mean. Even if we imposed some finitude to this mind bending space of possibilities by way of limiting the maximum length of a word and adding some syntactical rules, we still have to acknowledge that there is a very very very large number of possible denotations, out of which less than a million have any associated connotations in English.

Anyhow, I’m slowly working towards a program to randomly generate entire sentences that are syntactically correct for the most part. I’m hoping to then string together sentences via a second layer of random programming into prose and verse. Ultimately, this is an experiment to falsify the hypothesis that meaning is emergent. That is, meaningful prose, verse, narratives and stories could just randomly emerge at some point from a simple random number generator without intervention from anyone whatsoever (other than the initial jump starting of the program). So watch this space if you’re interested. I’ve used the special tag #wordtropy to signify this experiment involving words and entropy. Feel free to make suggestions, or if you want to take part with a bit of Python programming then let me know and it could be quite interesting.