In November 2003, Word Ways: The Journal of Recreational Linguistics challenged its readers to discover why Ed Wolpow had sent the following poem.

ADIRONDACK SHINGLES

Among old and crafty mountain men,
Far gone in their heart-held dreaming,
Nearest neighbor one mile down a rock road,
Busy poking old and peeling car bonnets,
An owl hoots past a tin ear.

The sunny period in every week
Is time for one-one hoarse chuckle.
It's not the place for foxy generals
Nor a spiffy consul, furtive, medalled.
No young and flaxen onlookers
With peach fuzz included.

Extant alumni of a meaner university
Plead for simple knots and bolts.
Home to fossil icons of steep hills,
And not fossil verses which gleam
With glib phrases that parse nicely,
A rogue element in every line.

Click here to check the answer.

As such, the poem can be seen as a poetic version of the word game where one or more hidden words have to be found in a given sentence. Usually a category of the hidden words is given beforehand. For example, can you find the countries that have been hidden in the following sentences?

  1. Vladimir and Olga are Soviet names.

  2. Have you ever heard an animal talk in dialect?

  3. The children put on galoshes to go out in the rain.

  4. Extra tuition will help an amateur to improve his painting.

  5. In the United Nations we denounce the wholesale ban on atomic weapons.

  6. Rash decisions may lead to trouble so thorough analysis is required.

  7. The king and queen eat breakfast and lunch in a fine palace.

  8. Such a display could be either really grand or rather disappointing.

  9. Give the dog a bone and give him a little water.

  10. If an iron pipe rusts you just have to shrug and accept it.

Click here to highlight the hidden countries (hint: each sentence contains two hidden countries).

Assignment

In this assignment we will find all occurrences of the words in a given list of words and highlight them in a given text file. When determining whether a string occurs in another string, only the letters in both strings must to be taken into account (all other characters must be ignored), and no distinction must be made between uppercase and lowercase letters. Your task:

Example

The following interactive session assumes that the text files hidden_elements.txt1, elements.txt2, hidden_countries.txt3 en countries.txt4 are located in the current directory. Also note that whenever the output contains an empty line, this must be represented as <BLANKLINE> in a doctest to make a distinction with the empty lines in the doctest itself (that are ignored).

>>> contains('Iron', 'ADIRONDACK SHINGLES')
True
>>> contains('GOLD', 'Among old and crafty mountain men,')
True
>>> contains('argon', 'Far gone in their heart-held dreaming,')
True

>>> uppercase('Iron', 'adirondack shingles')
'adIRONdack shingles'
>>> uppercase('GOLD', 'Among old and crafty mountain men,')
'AmonG OLD and crafty mountain men,'
>>> uppercase('argon', 'Far gone in their heart-held dreaming,')
'FAR GONe in their heart-held dreaming,'

>>> highlight('hidden_elements.txt', 'elements.txt')
adIRONdack shingles
<BLANKLINE>
amonG OLD and crafty mountain men,
fAR GONe in their heart-held dreaming,
nearest neighBOR ONe mile down a rock road,
busy pokinG OLD and peeling CAR BONnets,
an owl hoots pAST A TIN Ear.
<BLANKLINE>
the sunny perIOD IN Every week
is time for oNE-ONe hoarse chuckle.
it's not the place for fOXY GENerals
nor a spiffy conSUL, FURtive, medalled.
no young and flaXEN ONlookers
with peach fuzZ INCluded.
<BLANKLINE>
exTANT ALUMni of a meaner university
pLEAD for simple knots and bolts.
home to fosSIL ICONs of steep hills,
and not fosSIL VERses which gleam
with glib phrases that pARSE NICely,
a rogue elemenT IN every line.

>>> highlight('hidden_countries.txt', 'countries.txt')
1. vladimIR ANd olga are soVIET NAMes.
2. have you ever heard an aniMAL TAlk IN DIAlect?
3. the children puT ON GAloshes TO GO out in the rain.
4. extra tuition will helP AN AMAteur to improve hiS PAINting.
5. in the united nationS WE DENounce the wholesaLE BAN ON atomic weapons.
6. rash decisions may lead to troubLE SO THOrouGH ANAlysis is required.
7. the king and queen eat breakfast and lunCH IN A fiNE PALace.
8. suCH A Display could be either really grAND OR RAther disappointing.
9. give the doG A BONe and give hiM A LIttle water.
10. if an iron piPE RUsts you just have to shrUG AND Accept it.

Epilogue

The 1990 antitrust case United States vs. Syufy Enterprises5 settled a dispute regarding monopoly among Las Vegas movie exhibitors. But it became famous for another reason: it appears that Ninth Circuit6 judge Alex Kozinski hid more than 200 movie titles in his opinion. Here's a sample from the opinion (click here to show the movie titles):

Absent structural constraints that keep competition from performing its levelling function, few businesses can dictate terms to customers or suppliers with impunity. It's risky business even to try. As Syufy learned in dealing with Orion and his other suppliers, a larger company often is more vulnerable to a squeeze play than a smaller one. It is for that reason that neither size nor market share alone suffice to establish a monopoly. Without the power to exclude competition, large companies that try to throw their weight around may find themselves sitting ducks for leaner, hungrier competitors. Or, as Syufy saw, the tactic may boomerang, causing big trouble with suppliers.

It's a bit hard to tell how many of these are deliberate, as they appear natural in context, and Kozinski won't say. But working with Leonard Maltin’s TV Movies and Video Guide7 students of the Brigham Young University8 Law School found 215 titles in the opinion. You can try your own hand at it — the full text is here9.

Resources