There’s an elephant in my pajamas!

Last night I shot an elephant in my pajamas.

Elephant in pajamas – by: Amy Block

A sentence like this one above has two possible meanings, even though you probably only thought of one. One option is the logical meaning where “I” am the one wearing the pyjamas while the elephant being shot. The other possible meaning is that “the elephant” is the one in my pyjamas last night and that’s why I shot it. Now obviously, this meaning is a bit of a stretch (ha!), but that’s only because it is an elephant that was shot. If you change out “elephant” for something a little more realistic, it is easier to convince yourself of this alternate meaning.

Last night I shot a burglar in my pyjamas.

Here you can likely imagine both interpretations, although it does raise the new question of why is this burglar wearing your pyjamas?

There is also a way that we can modify this sentence so that the “I” subject is likely not the one that is “in” something.

Last night I trapped a burglar in my closet.

Just by changing two words, we have made it so it is most likely the burglar who is in the closet, and not me.

Now obviously these sentences are just one silly example of how changing a word or two can change how we might interpret a sentence, but ambiguous sentences show up quite often in one context quite often.

In a newspaper headline like this, we can see the same kind of ambiguity problem. Namely, there is a prepositional phrase (with knife) at the end of the sentence that could reasonably apply to either the subject of the sentence (the cops), or the direct object of it (the man).

Sentences like these don’t often pose a problem for us because we have out own logic and intuition to rely on. Let’s take it one step further and imagine the effects that this might have on a computer. If a computer were to try and “read” these sentences, what conclusion do you think it would draw?

Computers rely on several processes when it comes to interpreting language, but one of the biggest ones (and the easiest one to explain here) is known as statistical learning. Statistical learning is a process by which you take a large set of data, known as a training set, and feed it to a computer program that reads the data one chunk at a time, and makes note of what comes after each chunk. These chunks can be set to a certain number of words to be processed all at once, known as a window.

If you feed the computer a large enough set of data, you can then ask it to start making predictions (like you see in the predictive text on your phone). The computer is able to make guesses on what is most likely to come next based on how often that combination appeared in the training data that was fed to it. This is where all of the statistical stuff comes in.

This process is all very math heavy and quite hard to wrap your head around, but let’s try and simplify it with an example. Imagine I asked you to fill in the remainder of this phrase:

To kill two birds with one _______.

If you guessed stone, then congratulations! Your internal statistical learning system is working normally. If you put in a word like bullet, you might not be incorrect based on your own experience, it might just mean you are working from a different set of training data from most people and you are not familiar with this idiom.

The idiom “to kill two birds with one stone” is very common in North American English and you have likely seen or heard it so many times that you can intuitively know how to finish it. You can probably think of other examples too where after seeing one word come up, you would know for certain what the next word is.

Computers are working on the exact same principle that you just employed to complete that idiomatic expression, but they are doing it on a much different level than you are. Being able to change the scale of the “window” (how big of a chunk) that they are looking through allows them to notice patterns in language that you or I could never notice on our own.

The biggest problem with this from a computing standpoint is that memory is finite for computers so if you make these windows too big, the computer will not be able to handle it. If you make it too small, you won’t get enough useful data to make good predictions. You were able to easily predict the last word of that idiom because you have a large window and you are able to have access to the entire sentence at once. Imagine you were only able to see something like “with one ___”. It would be a lot harder to make a good prediction with this small amount of information.

Another problem is, computers don’t know the meaning of these phrases that they are reading and predicting. This leads us back to the ambiguous sentences from the beginning of this post.

Imagine you could design a program where you could give a “trained” computer the sentence “I shot an elephant in my pyjamas” and then ask it who was wearing the pyjamas. The computer would likely wrongly assume that the elephant was the one in the pyjamas because more often than not in English, when we have a preposition like “in” after a noun, it is meant to be associated with that nearest noun.

There is a chance that the computer might be tipped off in some way somehow by the fact that they are MY pyjamas though, and because of this first person possessive pronoun would correctly associate them. What about a sentence that only uses inanimate objects and pronouns?

The trophy would not fit in the cabinet because it was too big.

We as humans are able to reason that the trophy being too big is the most likely problem here. But again, the computer would likely make the wrong prediction here because it would want to associate the it pronoun with the closest possible noun in the sentence.

All these sentences can be easily disambiguated to ensure that the computer makes the right choice every time.

I shot an elephant while I was in my pyjamas.

The trophy would not fit in the cabinet because the trophy was too big.

Without any ambiguities the computers will be happier knowing that they can understand the sentences just like we can. All of this is to say that when you are writing, be kind to your computer and make sure that you are writing in clear, unambiguous sentences for their benefit too.

Alternatively, the takeaway might be that we should write needlessly ambiguous sentences to confuse the computers and hope it slows down the inevitable terminator-style uprising. I’ll leave the interpretation of this blog post to you the reader.

Thank you for reading folks! I hope this was informative and interesting to you. Be sure to come back next week for more interesting linguistic insights. If you have any topics that you want to know more about, please reach out and I will do my best to write about them. In the meantime, remember to speak up and give linguists more data.

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s