This is a computer-generated book produced for NaNoGenMo 2017.
- Entry on the NaNoGenMo 2017 repo
- Downloadable bundle of 100 generated books
- Notes on the concept and approach
The book is generated using elementary cellular automata with two contrasting elements randomly selected from a set of common literary themes. Each generation of the automaton represents a single chapter, with the individual cells representing sentences and sequences of cells with the same state representing paragraphs. Each paragraph thus flips from one theme to the next, depending on the pattern generated by the automaton.
Sentences are generated using word frequency n-grams chained from a corpus of sentences sourced from public domain fiction on Project Gutenberg. Each theme has a number of registered synonyms which are used to select a subset of potential sentences from the broader corpus. This is fairly brute force and inexact. It relies on the dubious assumption that a matching word in a sentence means that sentence relates to the theme. The diversity or uniformity of the source sentences thus has a massive impact on the quality and coherence of the resulting output.
Use Bundler to install the required gems:
bundle
Or install them manually:
gem install rake calyx png prawn punkt-segmenter
Run the generate
task using Rake to output a PDF. By default, it goes into the output
directory.
mkdir output
rake generate
The MIT License (MIT)
Copyright © 2017 Mark Rickerby https://maetl.net
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.