I wondered how an “AI” would continue some well-known novels based solely on their first lines so, based my first Google result for “famous novel opening lines” I used the fifteen examples in this article on Penguin.co.uk. I also generated a new cover image for each book based solely on its title.
There’s more detail about the tools I used, how I used them, and how little skill any of this takes, in my notes at the end. You can jump to individual novels from this list or just scroll away. Each novel’s actual first sentence – on the basis of which the rest of the extract was generated – is in bold.
- Moby Dick by Herman Melville
- Invisible Man by Ralph Ellison
- The Restaurant at the End of the Universe by Douglas Adams
- The Outsider by Albert Camus
- The Bell Jar by Sylvia Plath
- Their Eyes Were Watching God by Zora Neale Hurston
- Fear and Loathing in Las Vegas by Hunter S Thompson
- The Color Purple by Alice Walker
- 1984 by George Orwell
- Pride and Prejudice by Jane Austen
- The Secret History by Donna Tartt
- Trainspotting by Irvine Welsh
- Beloved by Toni Morrison
- Metamorphosis by Franz Kafka
- I Capture the Castle by Dodie Smith
§ Moby Dick by Herman Melville (1851)
Call me Ishmael. Call me Maseeh. Call me Mr. G. Call me anything you like. I’m really not sure what to call myself. I’m going to have to think on that.
It’s been almost three months since I have been back from the UK. It feels like another lifetime. It’s like I am out of touch with all of you. But I know that is not true, as I have been following the feeds and reading the comments. I just don’t remember any of them.
I started this blog during my first trip to the UK. I was so excited to meet up with friends and meet new people. I was so excited to share my adventures with the world. I was just a newly converted blogger at the time. I don’t know if I can ever go back and re-read that first post. I don’t even remember what I wrote about.
Then I started this blog during my second visit to the UK. I was sitting in a bar with my friends. We were going to meet some new people and hang out at a local pub. That’s what I do when I am in the UK. I just hang out.
§ Invisible Man by Ralph Ellison (1952)
I am an invisible man.
I live in a house I share with a husband and wife, in a town I don’t like, in a neighborhood I don’t care for.
I want to be left alone.
My wife is a parasite. She drains the life out of everything she touches. She keeps the house clean, but she stinks.
I’m embarrassed to go to restaurants with her.
My wife is a loser.
I don’t like my job.
I’m depressed all the time.
I’m a failure.
She doesn’t like me, but she’s still willing to put up with me.
My wife is a slut.
I’m a lesbian.
I’m an embarrassment.
She’s a good person, but I’m a bad person.
She thinks I’m good, but I’m just bad.
My wife is a bitch.
She loves to argue with me, and I wish she’d just leave me alone.
My wife is a slut.
She’s out to get me.
§ The Restaurant at the End of the Universe by Douglas Adams (1980)
The story so far: in the beginning, the universe was created. This has made a lot of people very angry and been widely regarded as a bad move.
Then, as time passed, these people somehow managed to do a lot of bad stuff.
This made the rest of the people very angry and they managed to do even more bad stuff.
Over the years, they pretty much did all the things that would normally make a person want to kill him/herself.
But because they were also very clever and had no compunctions about killing, these people survived and continued to do the things that made a person want to kill them.
They eventually discovered a planet that was just perfect for them, and they moved there.
Their work was mostly done for them, because they could be lazy and live a carefree life.
They made some more people very angry and they did even more bad stuff.
The people at the centre of all this were the leaders.
When it all started, they had been chosen by a goddess, and as a reward for their kindness to the planet, they were given power that none of the others had.
They were given power that made them feel like they were the most important people in the world.
When the people at the bottom realised that this was not true, they plotted to bring down the leaders.
§ The Outsider by Albert Camus (1942)
Mother died today. Or maybe, yesterday; I can’t be sure.
She’d been ill for some time; it was just a question of time. I have a strong suspicion that she knew this time was coming.
She was ninety-four years old, and had only a few years left to her. That’s not a lot of time, when you’re ninety-four.
She was still breathing, of course, but even so, that wasn’t the same as being alive.
I was in a funny sort of state when I took the news.
I found myself looking around the room, wondering what I’d do with it all. I was only too aware that it had taken a lot of hard work to fill the place up with things, to make it a home.
I’d been doing my best ever since Mum died. But now it felt like a silly sort of game. A game that was over.
It was all pointless, now.
There was one other thing, too.
I’d been waiting for my father to die, too. But he didn’t. He’d just got older.
I didn’t know if I should be glad, or sorry.
I knew he’d been on the point of taking his own life.
§ The Bell Jar by Sylvia Plath (1963)
It was a queer, sultry summer, the summer they electrocuted the Rosenbergs, and I didn’t know what I was doing in New York. But I had just gotten out of my first year at Berkeley, and I was living with a friend of mine in an East Village loft. I was working in a men’s clothing store near the Village. After a while, it occurred to me that I was not a very successful Jew, that I was a well-off Jew, but I had no Jewish friends, and that was the first thing that I knew I had to change. I bought a book by Martin Buber called I and Thou, and I read it from cover to cover. I began to think about Jewish friends, and what I would do to find Jewish friends.
I was working at the time as a copy boy for the New York Herald Tribune. I walked over to the Tribune office one morning, and there were two gentlemen standing outside the office, and I asked them who they were, and they said they were the Rosenbergs. So I asked them what they were doing there, and they told me they were on trial for allegedly passing atomic secrets to Russia, and had been arrested, and there were two trials; one in New York, and one in Washington.
§ Their Eyes Were Watching God by Zora Neale Hurston (1937)
Ships at a distance have every man’s wish on board.
“When do you return?” she asked.
“Next week. We are now in the latitude of the Farallones, and are going to work our way out and back. In a few days I’ll be on the Advance, which is chartered to take us out.”
“Good!” said Bostil, grimly. “All the more room for the men.”
“Are the men going to stay?” she asked, with interest.
“Yes. That’s the only way.”
She was silent a moment, and then:
“Well, I’m glad of that.”
There was a soft exclamation from Bostil, and the light in his eyes was softened.
“I’m not so sure of that,” he replied. “There’s a lot of trouble among ’em. That’s why I’m sending ’em here.
§ Fear and Loathing in Las Vegas by Hunter S Thompson (1971)
We were somewhere around Barstow on the edge of the desert when the drugs began to take hold. We were driving through the desert in an old rusted-out overstuffed station wagon. And I don’t remember the exact circumstances, but it started as kind of a harmless experiment. We just sat back, we got out of the car and played a lot of music.
Everybody was getting high. We were all four of us in the car. We had marijuana, LSD, and speed. And we all got high. Then we decided we should try meth.
And the results were like a bunch of teenagers. But we just had fun. We loved it.
I remember the first time we came across a trailer park. And I remember we looked at each other and said, “Oh my God, what have we done?” We had no idea. We were just having fun.
Then I woke up one day and I was lying on the ground. Next to me was this girl who was really kind of cute and really beautiful. I didn’t know her. I don’t think she knew me. And she was crying.
I looked around and everybody was gone. We were all on the road in that old station wagon. And my head was pounding. And my arms and legs were sore.
§ The Color Purple by Alice Walker (1982)
You better not never tell nobody but God. It’d kill your mammy.
The boy’s mother walked in and said the baby was dead.
“Mammy,” said the boy, “I’d killed the baby.”
“What’d you kill it with, boy?”
“I made it die.”
“Ah, now,” said his mother, “you better not never tell nobody but God. It’d kill your mammy.”
§ 1984 by George Orwell (1949)
It was a bright cold day in April, and the clocks were striking thirteen. As it was the 13th of April, and not the 1st of April (which was on Sunday), the clocks were being advanced by one hour. It was an hour which is almost never noticed by people. But one man, sitting in his room in north London, was quite conscious of the time. He was waiting for a letter. That was not extraordinary; the day before, he had been waiting for a letter, and when the letter came, there was no time to read it at once. This was not a matter for worry; he had a good deal to do. But still, there was that hour to wait; and the wait was irksome.
And then suddenly there was a knock at the door. The man put his hands over his eyes and listened. He could not see who was at the door. He felt quite faint, he was so happy. But he knew that it was the knock at the door.
The knock came again. It seemed a long time before the man recovered himself enough to open the door. A strange person was standing on the threshold. A lady was standing on the threshold, with her finger raised to her lips. Her eyes were shining and her cheeks flushed. And she was waiting for him. She waited there until the man was ready.
“Come in,” he said. He opened the door wider, and motioned to the visitor to enter. The visitor entered; and the man shut the door.
§ Pride and Prejudice by Jane Austen (1813)
It is a truth universally acknowledged, that a single man in possession of a good fortune, must be in want of a wife. — Jane Austen, Pride and Prejudice
In 1793, a young man arrived in England. In fact, it was the year that he was born: John Adams, third President of the United States of America. His journey had started at the port of Liverpool, with his family, who were headed to the American colonies to join his father, Thomas, who had been appointed to be the minister of the recently established republic of Massachusetts.
When they reached their destination, however, John and his father Thomas found that the president of the United States, George Washington, had already moved to the capital, and so John decided to join him. They were assigned a farmhouse in the country, which John called ‘Quincy’. As he was just starting his new life in the land of the free, he decided to take a few trips back to Europe, to see his family there.
His father was delighted with the decision of his son to return to the Continent. Although he was not a big fan of America, his parents had decided to remain in England, and they were going to follow their son back to the United States in a few years.
The first of the trips, however, was not the easiest, and it was about to turn into a bit of an adventure.
§ The Secret History by Donna Tartt (1992)
The snow in the mountains was melting and Bunny had been dead for several weeks before we came to understand the gravity of our situation. Now, in the middle of the day, the sun was beating down from a clear, blue sky, the smell of smoke was in the air, and no one had any idea what was happening.
I was still wearing the blue suit I had worn at the service, and a wool overcoat I had bought before we left the house. On the back of the coat, I had sewn a single white rose—the same one I’d made for my grandmother in the hospital when she’d died.
My mind felt as if it had been filled with snow and then the wind had come and scattered it all away. I walked back and forth on the porch, thinking about what had happened. What would happen. All I could think about was the baby. I had never heard of a baby surviving the delivery. The only reason I had survived was that my blood had been too thin. I was going to have a sister or brother, which meant I’d have a mother somewhere. I would be responsible.
I kept thinking about my father and my mother, wondering if they were together or apart. Were they somewhere else? I would have to find out. If I could get my hands on a radio, I would call the station in Atlanta and find out if they’d talked to my father yet. I could even call the house at Pinehurst to find out if my mother had sent a wire. I wasn’t ready to speak to her yet.
§ Trainspotting by Irvine Welsh (1993)
The sweat wis lashing oafay Sick Boy; he wis trembling. ‘Weel…’, he began, but found that he wisnae even gettin’ the words aff his tongue.
They aw say that ye cannae be a poofy in yer true ness. But the thing is, that whiles ye can be as right and proper as the next person, ye still need a bit support, a bit reassurance that ye’re still gey normal. Aye, it can be an ugly business, but wi’ that yin on yer side, who kens what ye can achieve? Eh?
As the boys watched, the older boy, no longer able to hide his erection, was now rubbing it along the younger boy’s leg, and he was smiling and trying to give a low chuckle to make it seem like a joke. But he could tell that this was no a joke, and he felt his own erection rise.
The boy who had just been made to strip was now on his knees on the grass. He was looking up at his friend. Then the boy was on his hands and knees, and the boy was sucking his cock. The older boy took the opportunity to pull his pants down. He was so hard he couldnae hide it. He started masturbating.
Then the boys turned round, their naked bodies, their erections, now on show.
§ Beloved by Toni Morrison (1987)
124 was spiteful. Full of Baby’s venom. “You are too smart for your own good, and that’s why I’m glad I’ve got you under control.” She glanced at the clock on the wall, then turned to me and smiled. “I’ve got a present for you,” she said. “A nice, juicy apple.”
“No, ma’am. We don’t have no apples.”
“Oh.” She looked disappointed. “I don’t suppose you would like some grapes? They’re the only thing I could find. I tried the pears but they were all squashed up. You know how it is. Too much traffic. Everything is so busy.” She stood and peered out the window. “Yes, I see what you mean. It’s a nice place, though. I wouldn’t want to live here. The noise, you know.” She waved her hand in the air. “The traffic.” She shook her head and turned away. “Now,” she said, “come along, we have things to do.”
It wasn’t the kind of thing I wanted to do, but I had a feeling that if I refused I’d never find out where I was going. I followed the lady as far as the door, which was all the way down at the end of a long hall. “What’s this all about, Missus?” I asked. “I ain’t never been in no mental hospital before.”
§ Metamorphosis by Franz Kafka (1915)
As Gregor Samsa awoke one morning from uneasy dreams he found himself transformed in his bed into a gigantic insect. He lay on his hard and itchy back, and if he lifted his head a little he could see his white underbelly, bristling with quills. His eyes opened wide in alarm and hope: “Oh Lord,” he prayed, “let it be someone else!”
I was recently transformed into a gigantic insect, like Gregor Samsa. The transformation wasn’t an accident; it was due to a deliberate choice that I made, and so was my subsequent waking up in a bed that is not my own. And in a matter of months I was not transformed back into a human being. That’s why I was terrified. It was as if I had a disease and everyone knew it.
I can’t really complain that it happened to me; as someone who is constantly reminded that his looks are against him, I know I have a lot to be grateful for.
A couple of days before I woke up, I met a boy and we went out on the town together. It was a fun evening. We drank and danced and had fun. He was good looking and kind, and he seemed to like me. He told me about himself and how he studied at the university and his dream to become a teacher. But he was shy and I wasn’t the type of girl that he was used to meeting. He seemed to have something to say, but he just wasn’t used to talking to girls. It was awkward for both of us
§ I Capture the Castle by Dodie Smith (1948)
I write this sitting in the kitchen sink. It was our first sink. Our first major purchase since buying the house and I’m excited to use it. I’ve been sitting in the tub for hours washing the dishes and scrubbing the counters. The kitchen is now spotless.
After several attempts to clean out our dishwasher and clean the stove, I sat down and took a few minutes to reflect on our journey to this new place. We are going to be here for a month, then move on to the next town. I took the time to remember how we arrived to this place. I also reflected on what we are looking forward to.
I’ve never had a car until I moved in with my husband. It’s been a learning experience to be sure. I’ve learned how to drive in a foreign country with no traffic, I’ve mastered the art of parallel parking and I’ve learned to love the feeling of going fast with the car. It’s fun. My husband was not impressed. It’s kind of cute when he speeds down the interstate and then slows down in the left hand lane because he’s concerned about the police pulling us over. I’m not kidding! He’s been a trooper and I’ve enjoyed every minute of this experience.
For the last two weeks, we have been living in our car.
§ Setting up and running the tools
I tried a couple of different sites to generate the texts from the first sentences. Both worked well and are very easy to use:
- Text Synth will generate as much text as you like from an initial prompt.
- EleutherAI seems a bit slower – you have to wait for it to generate a chunk of text.
I ended up using EleutherAI for all the examples above as they seemed slightly more interesting. This may have just been chance or my bias. I used the first result I got. I used the default settings (GPT-J-6B model,
0.9 TOP-P, and
0.8 Temperature) rather than bother learning what any of that meant.
EleutherAI did stop working entirely at one point due to a bug and it feels like a tiny friendly control panel for a vast hidden factory in which the machinery is all held together with string and kept running by an army of unknown volunteers.
Generating images is more complicated, and there are a bunch of Google Colab notebooks available to experiment with. These are pre-written code with a basic interface on top that let you alter parameters and run the code – they then download all the required code libraries and data and run it all on a Google server somewhere, generating images and displaying them as they’re created.
VQGAN stands for Vector Quantized Generative Adversarial Network.
GANs (Generative Adversarial Networks) are systems where two neural networks are pitted against one another: a generator which synthesizes images or data, and a discriminator which scores how plausible the results are. The system feeds back on itself to incrementally improve its score.
CLIP (Contrastive Language–Image Pre-training) is a companion third neural network which finds images based on natural language descriptions, which are what’s initially fed into the VQGAN.
OK, sure, whatever. These are the three notebooks I tried:
Genera imágenes desde frases de texto con VQGAN y CLIP (método z+quantize con augmentations) was next, but the explanation and its instructive Help page are in Spanish.
VQGAN+CLIP (z+quantize method with augmentations, user friendly interface) modified by Justin John is similar but in English.
Although (1) was simpler it only generated square images and I wanted to make book-cover-shaped ones so I ended up using (3). No doubt (1) could be modified to change the aspect ratio but anyway.
However with both (2) and (3) I ran into an issue where it couldn’t find some of the stuff it needs to download and it quit with errors. This Reddit post explained the changes required to make it work. So, although none of this requires amazing skill, it does often require some knowledge of how to troubleshoot and fix broken code.
The code runs through many iterations of generating and, presumably, improving the image, and you can have it display the image at certain numbers of iterations (e.g. every 100 iterations) so you can see how it changes. It can also generate a movie, animating from one image to the next, but I never bothered with that.
All the images above were run for 3000 iterations, although I’m not sure it was necessary to go for so long – they didn’t often change drastically after 1000 or so. For example, here’s some different iterations of the image for The Color Purple
I guess some features do get more detailed over time and, occasionally, a new feature would appear quite late in this process.
The settings I used for the images were:
As a non-paying user you’re restricted in how long you can run things for, particularly if you leave the page unattended. So I often found it had disconnected part-way through and I usually had to start it all again.
There are also different GPU of varying powers which you are assigned when starting up, and which greatly affect the speed. I often found mine ran at just over one second per iteration, or about an hour to complete 3000. But sometimes it was more like five seconds per iteration. I nearly paid £10 for a month of Pro usage.
§ The results
I was pretty pleased with the results in general, especially the text. They all made sense and all seemed pretty interesting. I can imagine this being a useful writing exercise – give the tool something to start off with, have it generate a couple of paragraphs, and then continue the story yourself. It seems a good way of generating ideas.
It obviously “knows” about some things. The first line of Pride and Prejudice is, I assume, quoted enough in the source material that even when I tried running the text generator several times, it nearly always continued by pointing out this was a quote from the book.
Being so “aware” of some material has its limitations. I tried the first two lines of the prologue of Chaucer’s The Canterbury Tales and the result feels like seeing through into the workings of the machine:
Whan that Aprille with his shoures soote,
The droghte of March hath perced to the roote,
And bathed wehe[ght] soote in Mayes,
The droghte of April hath perced to the roote.
The second line and all the subsequent lines (except for the first word of the first line of each stanza) rhyme on the first syllable of the word “soot”.
Notes and references
Just as Chaucer would have written it.
But I was pleasantly surprised with how it often managed to continue writing in the same style as the first sentence, with the best example being Trainspotting, and its immediate continuation with a Scottish accent: “‘Weel…’, he began, but found that he wisnae even gettin’ the words aff his tongue.”
It’s a shame that the first sentences from some of the other novels don’t give such a flavour of their language. I tried a bit of dialogue from Their Eyes Were Watching God, which is more vernacular than its first sentence (“Ships at a distance have every man’s wish on board.”) and it managed to continue in what I’m assuming is a similar tone:
You know if you pass some people and don’t speak tuh suit ’em dey got tuh go way back in yo’ life and see whut you ever done. They know mo’ ’bout yuh than you do yo’ self. “A good look is dey’s lookin’ fo’ yo’ self. You ain’t got no place to go but yo’ own place. Yo’ mom and pop ain’t gonna help you. You ain’t a bad person but dey ain’t gonna help you. So yo’ only place is yo’ own face. You can look back and say, ‘Well I did the best I could do.’ But they gonna look at you in a different light.” It was time for him to take his turn.
The images generated for the book covers were a mixed bag but always interesting. Again, it seemed to “know” about certain titles – the covers for Pride and Prejudice, Moby Dick and Fear and Loathing in Las Vegas, to give some examples, all seem to contain some knowledge of the books’ subject or era.
It was a shame that sometimes it seemed to want to create landscape images, sort of ending up with three stripes of images filling the book-cover-shape on The Restaurant at the End of the Universe and Their Eyes Were Watching God.
Quite a few of them were obviously trying to generate text that was sometimes almost exactly what the prompt was, like Beloved, and other times unintelligible. I’m puzzled why 1984 has “188” and “881”. Although a previous experiment, in which I used the novel’s first sentence – “It was a bright cold day in April, and the clocks were striking thirteen” – as a prompt resulted in a very prominent “14” being generated. I don’t know.
It’s possible to suggest styles in order to generate different kinds of images, by appending things like “| Van Gogh style | rendered in Unreal Engine | trending on artstation”. I did try adding “| book cover” but that tended to generate images that included what look like books or pages, so I kept it simple. Maybe there are ways to generate images that somehow look more like book covers?
It was an interesting series of experiments. Other than using them as prompts for ideas I’m not quite sure what the use of these tools, all that computing power and, presumably, energy, is yet, but still.