Sunday, March 14, 2010

Vertical and diagonal words

Unix systems often have a quite handy file called /usr/share/dict/words that contains almost 40,000 or so words for use by spell checking tools. It's sorted, and each word is separated by a newline. So it looks something like

aback
abaft
abandon
abandoned

etc.

On a random whim I set out to examine to what extent words existed vertically in this dictionary, using a quite ugly brute-force approach that tested a 1,081,332 character long string that was basically a concatenation of every single word in the dictionary for the 40,000 sub-strings that made up the dictionary, running for a minute or so.

Perhaps not surprisingly, there weren't a lot of these words. And in fact, the longest words were only five letters long; but in case someone wants to build a crossword puzzle or something, here is a list of those words:



adder
multistage
multitude
multitudes
multiuser
multivariate

doors
surged
surgeon
surgeons
surgery
surges

fills
mindfulness
minding
mindless
mindlessly
minds

fills
doubtfully
doubting
doubtless
doubtlessly
doubts

fills
fruitfulness
fruition
fruitless
fruitlessly
fruits

guess
amalgams
amanuensis
amaretto
amass
amassed

guess
resting
restitution
restive
restless
restlessly

hills
motherhood
mothering
motherland
motherly
mothers

noose
compactness
compactor
compactors
compacts
companies

sauce
samplings
sanatoria
sanatorium
sanctification
sanctified

sneer
assesses
assessing
assessment
assessments
assessor

steep
horseshoer
horticulture
hose
hoses
hospitable

stint
despising
despite
despoil
despondent
despot



Diagonally, though, is quite a lot more interesting. Not only are the words quite a lot longer, the diagonal word is almost always the same as—or very similar to—the last word, which is a semi-obvious consequence of sorting when you think about it.

The longest few I found were


differentiation
diets
differ
differed
difference
differences
different
differentiable
differential
differentials
differentiate
differentiated
differentiates
differentiating
differentiation
differentiations

representatives
repositions
repositories
repository
reprehensible
represent
representable
representably
representation
representational
representationally
representations
representative
representatively
representativeness
representatives

1 comment:

  1. That's pretty cool. At first I didn't get what you meant by vertical words, because of the lack of bolding, but that was just me being dense. Cool post.

    ReplyDelete