Sam Lavigne has an excellent text-generating, or at least -transforming, system that produces patent applications based on source texts. See, for instance, the one generated using Kafka’s “The Hunger Artist.” A full explanation of the code is provided on the page.