NaNoGenMo / 2018

National Novel Generation Month, 2018 edition.
https://nanogenmo.github.io/
112 stars 6 forks source link

mechanical top-down novel generation #94

Open ghost opened 5 years ago

ghost commented 5 years ago

I made a couple Python scripts that parse text for word to word weights, and then uses those edges to build a novel in a very top-down, mechanical way by:

  1. Generating a set of main and secondary characters and a narrator, each with a tag to load sets of word to word edge weights (from ParseText.py) for generating sentences
  2. Generating a set of scenes by choosing a pair of characters to interact, with each main character having a scene with most other main characters (up to twice), and each secondary character having a scene with a third of all main characters
  3. Each scene alternates a paragraph from the narrator, then one character then another until a minimum number of words has been reached (50,000 words / number of scenes).
  4. Each paragraph is a set of sentences starting either with a random capitalized word, or a topic chosen from the nouns in the previous paragraph

You can see the code here, including a sample novel: request, anything, and kindness.txt:

Chapter 0: Jackson Morris and Malachi discuss side and side

Third. Im very dark common contrasts strongly of the backs seemed likely to a child, it as that they said Holmes pushed the dollars won the change will do what I pieced on the next to Joe alone with tears filled my spirit, as yet discovered that each side of purely speculative thought he could see, sighing heavily, whom he's side, O me. Belemnite that best nurses, colouring with her. 

"There is the other side you, why he came into our young friend Jonathan still advanced to Tate Hill, having paid for I know of the multitude of forest." said Jackson Morris. "Turning to my head, and give to triumph! Answer me out. That has not contradict her head is arranged that you say that side in doubt as I wonder if wrapped it seemed to me right across so far behind, that lay his position."

"I got one of gaslight or other side, theoretical and glimmer from her an equal candour, she read it again and she added." said Malachi. "Revueltas and have always breaks from Nebo and then, that Mulligan cad he find one who took Stephens ear, and explained to Simonlionel first countess of energy can have put query, and hands for the ottoman."

The gaslight sprang up in the service in degree of himself in his fingers in a shudder ran on the constancy through them. Dormouse, and unsatisfied, practising. Confidentially You know how much delighted with Paris is also true that might make him to be that all sorts of Four Hundred feet, I dressed it was standing near it would not give me to-morrow? Ophelia was the political morality of Pumblechook being. Us two or convenience until the danger, well know by the peoples. 
hugovk commented 5 years ago

Well done!

Here's a link to the same sample novel with line breaks:

https://raw.githubusercontent.com/mattdmarch/nanogenmo2018/master/request%2C%20anything%2C%20and%20kindness.txt

ghost commented 5 years ago

Thanks! This was fun. Big thank you to everyone organizing (and participating)!