My First Decent PERL (-made) Poem
Finally, after months battling with it, I've managed to get good enough with PERL (still not very good) to create one of the programs I've wanted to make for some time. The poem below is the first 3 pages of what was 600-odd pages of output. I'll briefly try to explain the program. You can skip this and go straight to the poem if you want. The poem was made using an interview with Brian Kim Stefans called potentially suitable for running in a loop, Gertrude Stein's Tender Buttons, Wittgenstein's Tractatus Logico-Philosophicus, Wilkie Collins' The Woman in White, and Brontë's Jane Eyre.
The PERL script opens 5 plain text (.txt) files behind the scenes. Once open, it works out how many paragraphs there are in each, and works out the average number of paragraphs across the 5 files. The 6 values (number of paragraphs in each and the average) are noted by the code (this becomes important later).
In sequence, from text file #1 to #5, the following happens:
The PERL script opens 5 plain text (.txt) files behind the scenes. Once open, it works out how many paragraphs there are in each, and works out the average number of paragraphs across the 5 files. The 6 values (number of paragraphs in each and the average) are noted by the code (this becomes important later).
In sequence, from text file #1 to #5, the following happens:
- A random integer is chosen from 0 to whatever the number of paragraphs is present in that file, minus 1. So, for example, if a file contains 120 paragraphs, the random function will choose one number between 0 and 119. This is the allocated paragraph from which to source text. If 0 is chosen, I believe this results in a line break or two.
- A random number is chosen, stating how many characters into this paragraph to begin sourcing the text. If the sentence were to begin "Once upon a time" and the number generated was 7, the output would begin "pon a time". The limit of this random number is assigned by me in the code as a variable, so can be changed easily. I think that the greater the number, the less likely to begin at the beginning of the paragraph.
- In a similar way to above, the selection length, in characters, is chosen at random, again with a limit set by me. These limits for the random values are constant across the 5 files, although the random numbers themselves may differ from file to file.
- Now that the paragraph number, selection start number and selection length have been set, these are applied to the files.
- Each chunk of text is written to a separate output file.
- Now that the file has been written into 5 times - once from each source file - the process is repeated until each writing of the 5 sources has been completed the same number of times as there are average paragraphs across the 5 files.
- Phew!
I am in the process of writing through the results. Reading up on Brian Kim Stefans' thoughts on Computer Poems has really helped here in terms of conceptualising how much or little I do with the output, which varies from complete nonsense to full sentences. I cleaned up minimally the text I looked at. Some entire lines of text were deleted as seemed appropriate. I wanted the poem to hint at an air of subjective creation, whilst at the same time displacing the certainty of the language's purpose, keeping it very obvious that this was produced through algorithm. Making the poem as sensical or 'clean' as possible was therefore not my objective, and indeed sometimes I worked in opposition to this idea.
So here it is:
not a body of
northward
punctually
as the last
cake shaved into fragmen
Bessie would rather have stayed, bu
nonsense.
e totality of exis
hearsay evidence.
eBook
Yes, exactly --
(i.e. we should have to be able t
and yet I know
1.
of elementary proposition
Italy for political reasons (
your roo
together. There is
0251 Space, time, colour (being
"But you comprehend me?" he
a kind.
of log
thing about the animated De Camp
away. Not giving it a
2.15121
; of that I was sure.
aim of the book is
a moment;
We know from your
from a false proposition.
making the persons
couldn’t perform the Ballet Mécan
whatsoever
we, the weary pilgrims of
oak; the staircase window was high
no more, it shadows the sta
had some
be.
now have to answer a priori the
active habits; such is
coat i
chosen. But God sees not as man
left
glance over a world quivering
My spirit,"
was what I was trying to d
termined by the negated proposition. Th
ankle is sprained."
.
one else
ring the past year I had not managed
led under his feet: taking a f
KEN.
(Negation reverses
the moonbeams; I heard onl
this sense that concrete
he schemata
yself from
immortality.'"
in and not less noisy
Proof in logic
lf from the book which
had some extrem
purse; and the story is l
nothing
to spend with my mother
an instant; it began again, louder:
A table was
equality have the same
physically speak
interesting, never
consider a lecture, to consider it
assistance only
sir, she sees you!"
reside in the symbol
, 'Do this,' and it
is called bake and
A formal concept
survivors of a family of five
on
this
e world.
--------------------------------
not a body of
northward
punctually
as the last
cake shaved into fragmen
Bessie would rather have stayed, bu
nonsense.
e totality of exis
hearsay evidence.
eBook
Yes, exactly --
(i.e. we should have to be able t
and yet I know
1.
of elementary proposition
Italy for political reasons (
your roo
together. There is
0251 Space, time, colour (being
"But you comprehend me?" he
a kind.
of log
thing about the animated De Camp
away. Not giving it a
2.15121
; of that I was sure.
--------------------------------
aim of the book is
a moment;
We know from your
from a false proposition.
making the persons
couldn’t perform the Ballet Mécan
whatsoever
we, the weary pilgrims of
oak; the staircase window was high
no more, it shadows the sta
had some
be.
now have to answer a priori the
active habits; such is
coat i
chosen. But God sees not as man
left
glance over a world quivering
My spirit,"
was what I was trying to d
termined by the negated proposition. Th
ankle is sprained."
.
one else
ring the past year I had not managed
led under his feet: taking a f
KEN.
(Negation reverses
--------------------------------
the moonbeams; I heard onl
this sense that concrete
he schemata
yself from
immortality.'"
in and not less noisy
Proof in logic
lf from the book which
had some extrem
purse; and the story is l
nothing
to spend with my mother
an instant; it began again, louder:
A table was
equality have the same
physically speak
interesting, never
consider a lecture, to consider it
assistance only
sir, she sees you!"
reside in the symbol
, 'Do this,' and it
is called bake and
A formal concept
survivors of a family of five
on
this
e world.