I treat an input as a 2d array -- lines vs words -- and pad it so that all of the lines are of the maximum length. Then, I make a markov model wherein, for each word, I keep track of the words that occur above, below, before, and after.
To generate the output, I create a blank word array of equivalent size, seed exactly one cell from the input, and then fill in the rest of the document by cross formations -- starting from the seeded cell, I fill in all four adjacent sections (by randomly choosing from the markov model, with the existing item in that cell -- if any -- added as an option), and then proceed in all directions.
I treat an input as a 2d array -- lines vs words -- and pad it so that all of the lines are of the maximum length. Then, I make a markov model wherein, for each word, I keep track of the words that occur above, below, before, and after.
To generate the output, I create a blank word array of equivalent size, seed exactly one cell from the input, and then fill in the rest of the document by cross formations -- starting from the seeded cell, I fill in all four adjacent sections (by randomly choosing from the markov model, with the existing item in that cell -- if any -- added as an option), and then proceed in all directions.
Code: https://github.com/enkiv2/misc/blob/master/nanogenmo-2017/2d-markov.py Output: https://github.com/enkiv2/misc/blob/master/nanogenmo-2017/2dneuro.txt
Next steps: I would like to use word2vec to sum the existing word with the newly chosen option, rather than typically replacing it altogether.