In November 2003 daagde het tijdschrift Word Ways: The Journal of Recreational Linguistics zijn lezers uit om uit te vissen waarom Ed Wolpow het volgende gedicht had ingestuurd.

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.

Als je goed kijkt, dan zal je zien dat er in elke regel van het gedicht minstens één chemisch element verborgen zit (waarbij de Engelse benamingen van de elementen gebruikt worden). Er zijn zelfs twee regels waarin twee verschillende chemische elementen verborgen zitten.

Dit gedicht is dus een poëtische variant van het woordspelletje waarbij je in een gegeven zin op zoek moet gaan naar één of meer verborgen woorden. Meestal wordt daarbij een categorie gegeven waartoe de verborgen woorden behoren. Kan je bijvoorbeeld de landen vinden die verborgen zitten in de volgende zinnen (tip: in elke zin zitten twee landen verborgen).

  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.

Opgave

Voor deze opgave moet je alle voorkomens van de woorden uit een gegeven woordenlijst markeren in een gegeven tekstbestand. Hierbij bepalen we of een string voorkomt in een andere string door in beide strings enkel rekening te houden met de letters (en alle andere karakters te negeneren), zonder daarbij onderscheid te maken tussen hoofdletters en kleine letters.

Gevraagd wordt:

Onderstaande voorbeeldsessie geeft aan hoe de functies hoofdletters en markeren moeten kunnen gebruikt worden. We gaan er van uit dat het bestand oplossing.sh de twee functies bevatten.

We gebruiken de bestanden gedicht.txt1 , elementen.txt2, verborgen_landen.txt3 en landen.txt4.

$ . oplossing.sh #inladen van de functies

$ hoofdletters "gold" "busy poking old and peeling car bonnets,"
busy pokinG OLD and peeling car bonnets,
$ echo $?
0
$ hoofdletters "Carbon" "busy pokinG OLD and peeling car bonnets,"
busy pokinG OLD and peeling CAR BONnets,
$ hoofdletters "Silver"
Syntaxis: hoofdletters <woord> <zin>
$ echo $?
1

$ markeren gedicht.txt elementen.txt
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.
$ echo $?
0
$ markeren verborgen_landen.txt landen.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.
$ markeren gedicht.txt
Syntaxis: markeren <tekst> <woordenlijst>
$ echo $?
1