Able was I ere I saw Elba
I ran a search for palindromic sentences. It turned out to be a tricky problem.
The easy part: find a sequence of dictionary words which form a palindromic sentence.
The hard part: generate sentences which have some meaning.
- To I did I put so stupid idiot.
This is actually a nice example, compared to most of the sentences that my program generated. It, at least, has some hint of meaning.
- Decal persistent obese botnets is replaced.
I downloaded a gigabyte of Wikipedia text, and counted a tally of the words that follow (or precede) a given word. Then strung the words using those statistics. Still, very few of the millions of palindromic sentences were interesting. Like
- Met in all acts all last call an item.
I pruned the search in various ways: got rid of garbage short words, restricted the number of consecutive common words, blocked repetition. Things got better, but still it was becoming clearer that to get what I wanted, I'd need a full-on grammar system, to get adjectives, nouns, and verbs in the right patterns, and, more importantly, to build proper subject-verb-object structures, with connectives. This will have to wait for another time.
- Mood for ever of doom.
Here are some highlights:
- In uneven uni.
That's where I am. The uni spends millions on bragging.
- No gold lost if its old logon.
Change your online banking password often.
Here is a triple:
- Now I won.
- Draw an award.
- No, we won.
I rediscovered some well-known classics:
- Evil I live.
- Bats I stab.
- No solos on.
- Air an aria.
- Popes oppose pop.
- Popes reverse pop.
- Popes use pop.
Since I used Wikipedia as my corpus, I wasn't too surprised to get:
- Be wiki, web!
- Night I wiki with gin.
- Edit "Peptide".
- Put it up.
- Demanded nematodes use dot amended named.
Close, but no cigar. Disappointing, I must say.
- Cigar too tragic.
- Worst in its row.
Further poetic palindromes:
- Aimed academia, maimed academia.
- Steer tsar bra streets.
- Someday alpaca playa demos.
- Snort celesta eats electrons.
(A celesta is a musical instrument.)
- No iron even or ion.
- Revenge bee, beg never.
- Regal liver-aware villager.
- Nonabelian DNA I lebanon.
I wonder what's it like to lebanon nonabelian DNA.
One of the reasons I went looking for them is superstition. Palindromic sentences are sparse, they say only a few meaningful things. Each one is a coincidence, like a smile that is invisible.
- Revere her ever.
Here's a coincident coincidence. As I'm editing this page, I'm watching Carl Sagan's Cosmos, episode 9, where he has just said: "Our ancestors worshipped the Sun, and they were far from foolish. It makes good sense to revere the Sun and the stars, because ... we are their children."
This activity isn't as odd as you may think: poetry is exactly the same thing, except that the constraints on the letter patterns are much more loose. In fact, nowadays a paragraph of text doesn't have to have any constraints on it to be called poetry, except the requirement that lines are reasonably short. That kind of poetry is all about the second force of poetry — creating a sequence of words that sounds good emotionally.
- Rob all Labor.
- Slam in all animals.
- Step on no pets.
- Do go to God.
It also likes order:
- Pals to not slap!
- Pans to not snap!
Some deep truths:
- Slang is signals.
I've never thought about it that way. How fascinating, you can learn from computer-generated palindromes.
- Salt an atlas.
It's giving me strange commands. But ... what the heck.
Another of its suggestions:
- Do own ox on wood.
- Red iron, no rider.
Palindromes are notorious for misusing language:
- Me open one poem.
- Did I lol I did.
And speaking back-to-front:
- Net food I do often.
- Stunning is sign in nuts.
- A man, a plan, a canal — Panama! (That's a famous one.)
- Resume so pacific a pose, muser.
- Marge let a moody baby doom a telegram.
- Now saw ye no mosses or foam, or aroma of roses. So money was won.
- Some men interpret nine memos.
- Dennis sinned.
- No, it is open on one position.
- No, it can assess an action.
- No, it is opposition.
- Senile felines.
- Rise to vote, sir.
- Was it a bar or a bat I saw?
- Was it a car or a cat I saw?
- Lepers repel.
- Stressed was I ere I saw desserts.
- Doc, note, I dissent. A fast never prevents a fatness. I diet on cod.
- Note: this one is by Peter Hilton, a British code-breaker working with Turing on the team that solved the Enigma code. (According to palindromist.org.) He composed this one during a sleepless night in between deciphering encrypted Nazi messages, at Bletchley Park, during the war. Saving countless allied lives ...
- Name now one man.
- Dennis and Edna sinned.
- God, a red nugget! A fat egg under a dog!
- Did Hannah say as Hannah did?
- Ah, Satan sees Natasha.
- Do Good's deeds live on? No, Evil's deeds do, O God.
- Oh who was it I saw, oh who?
- No, it never propagates if I set a gap or prevention.
- A dog! A panic in a pagoda!
- Eve saw diamond, erred, no maid was Eve.
- Niagara, O roar again!
- "Not New York," Roy went on.
- Was it a rat I saw?
- Did I do, O God, did I as I said I'd do? Good, I did!
- Never odd or even.
- Here so long? No loser, eh?
- Gate-man sees name, garage-man sees name-tag.
- Are we not drawn onward, we few, drawn onward to new era?
- Dammit, I'm mad!
- Golf? No sir, prefer prison-flog.
- Murder for a jar of red rum.
- A nut for a jar of tuna.
- Yo, banana boy!
- Don't nod.
- Dogma: I am God.
- Oozy rat in a sanitary zoo.
- Do geese see God?
- Nurse, save rare vases, run!
I found some nurses palindromes too:
- Nurse often lets telnet foes run.
- Nurses iron imam, amino rises, run!
- Nurses ordered roses run.
- Nurse memes run.
The key observation for me was that the bottleneck is finding the first and the last words that go together well. Firstly, there is simply the pattern of letters itself that makes the set sparse. Secondly, words that match are almost always a pair that you'll never have in a sentence. There are really only a few start-end pairs that work well, like nurses and run. Here are ten thousand start-end pairs, with the more useful ones generally closer to the top of the file. It seems that, if you were looking for a good pair to start, you'll make the best progress by considering the last word on each line.
Well, I think I've exhausted my thirst for palindromes for the time being ...
- Note: go, do get on.