As my knowledge of data science and coding grows, I become more interested in the similarities between language and coding. The category of language I am exploring in this post is poetry, and how it compares to coding.
Both Coding and Poetry are specialized instances or sub-category of language where setting up some rules and limitations beforehand actually enables the creation of something that would otherwise not emerge from the boundless chaos.
Here's an excerpt from a scene in the 1983 film Educating Rita:
Rita: What does assonance mean?
…
Professor: Well, in [Yeat's] poem The Wild Swans At Coole, Yeats rhymes the word "swan" with the word "stone". You see? That's an example of assonance.
Rita: Oh, yeah, means getting the rhyme wrong.
Professor: … I've never thought of it like that.
Poetry, like code, has specific rules in addition to those merely grammatical that should be followed for it to "work". Otherwise it either will not rhyme, will have the wrong meter, or use words that should have better been replaced by a simile.
For example Dr. Suess' lines keep strongly to meter, rhyming and age-appropriateness, so to complete this verse:
Would you? Could you? In a car?
Eat them! Eat them! Here they _
At this point the rules require choosing from the whole English language corpus.
- A single-syllable word (meter)
- that rhymes with car (rhyme)
- is a common word familiar to a young child.
Matching the rule ("are") makes it correct and thus satisfying.
In python, assonance can be akin to using a variable for both a string and a integer - you can do it but it is getting it wrong:
x = 'somestring'
x = 50
You can take the "poetic license" too far and get it wrong in python:
'foo' + 3 #TypeError
Coding has the advantage of either being compiled or interpreted - the characters typed out by humans need to be transformed into computer instructions. This compilation step will fail if the rules are not followed, or an unexpected or unwanted result will be produced. Poetry, on the other hand, has the advantage of being able to break the rules, though rarely with success, as noted by Rita.
By utilizing the existing rules about coding, you can infer what is missing or incorrect in broken code; this is known as debugging.
Take a look and see what may be wrong in this code in python:
def function():
string = "hello world"
return string
Although all the words that you need to run this function correctly are there, it still won't run when you call it. The reason is that return string
is not indented and in a function in python the whole function code block after def
needs to be indented.
I would say that very recently coding, poetry, and even language as a whole has coalesced, in the ChatGPT phenomenon. In my understanding, the underpinnings of this technology is the "transformer" illustrated below, which in simple terms finds patterns throughout all the texts fed through it and records the statistics of these patterns. Entering a "prompt" feeds back the statistically prominent patterns based on the prompt.
(note, I do not claim to understand this diagram, but it shows that there are mathematical transformations being applied to text patterns)
Since the patterns are from what is already existing, the likelihood is that it is what humans expect according to our empirical rules.
Aldous Huxley, in Brave New World underestimated the prevalence of patterns:
A small boy asleep on his right side, the right arm stuck out, the right hand hanging limp over the edge of the bed. Through a round grating on the side of a box a voice speaks softly.
“The Nile is the longest river in Africa and the second in length of all the rivers of the globe.…”
At breakfast the next morning, “Tommy,” some one says, “do you know which is the longest river in Africa?”
A shaking of the head.
“But don’t you remember something that begins: The Nile is the …”
“The - Nile - is - the - longest - river - in - Africa - and - the - second - in - length - of - all - the - rivers - of - the - globe …” The words come rushing out. “Although - falling - short - of …”
“Well now, which is the longest river in Africa?”
The eyes are blank. “I don’t know.”
In reality, although a sleeping child does not understand the words, a listening child will. ChatGPT does not need to "listen", and can extract the expected string of words that is being requested, but this is not "intelligence" in the sense of the program being sentient, but it is reasonable to call the output "intelligent" as it is coherent, relevant, and useful.
Top comments (0)