Fixing the Clank: Using Stylometry to Improve AI-Written Fiction

Two JAFF-reading acquaintances of mine, one broadly pro-AI and the other fairly AI-neutral, have both complained recently about the AI-written JAFF turning up in Kindle Unlimited. The ideas are often interesting. The prose is so tedious and repetitive that many of these are barely readable and absolutely unlistenable. Audio is a merciless format: it exposes every clank and clunk in a sentence, along with any typos.

For the love of Heaven, AI authors, please use stylometry to get your skynets writing with a little more human rhythm. Stylometry is the statistical analysis of literary style: sentence length and how much it varies, sentence structure, vocabulary, punctuation habits, and so on. Here’s how to get started.

  1. Install spaCy (spacy.io) in your Python environment, plus a language model such as en_core_web_sm. spaCy is a general-purpose language-processing library, and it handles the sentence splitting and part-of-speech tagging you need.
  2. Ask your AI to write a Python script that reports the statistics you care about: mean and spread of sentence length, commas and semicolons per thousand words, dialogue versus narration, and so on.
  3. Download a batch of public domain texts from Gutenberg by an author you like. Strip the Gutenberg license text from the front and back so it doesn’t muddy the numbers, then run the script on the lot.

Georgette Heyer’s Regency novels are not public domain, but Gutenberg has four of her early novels, and that’s enough to get started. They’re historicals from various eras rather than her mature Regency style, so they won’t help much if you’re trying to imitate her voice. They’re plenty for the statistics, though. When I ran a stylometric analysis on my own work, the numbers came out surprisingly consistent across first- and third-person books and every genre and setting I’d written in.

Even on a bad day, Heyer was probably a better prose stylist than you or me, and certainly a better one than our clanker friends. There’s a bonus, too. Gutenberg’s txt files render em-dashes as double hyphens, which your script won’t count as em-dashes, so the benchmarks come out em-dash free. That helps offset one of the AI’s most notorious tics.

Once you have the analysis, take the numbers back to your AI and explain that these are rough benchmarks for its writing style. It doesn’t need to hit them in the initial composition. It should audit its drafts against them afterward and rewrite where it misses. Stylometry won’t cure everything, since stock phrases and repetitive vocabulary need their own attention, but it goes a long way toward fixing the rhythm.

For a more detailed walkthrough, please see this Future Fiction Academy video on the method:

Then run the revised chapter through text-to-speech. If it still clanks, try, try again.

Ranking Georgette Heyer’s Period Pieces: Medium Rotation

These are basically the books I turn to when I remember all the high-rotation Heyers too clearly. None of them are bad books, and some of them are very highly regarded by other Heyer fans, they’re just not my absolute personal favorites.

Continue reading “Ranking Georgette Heyer’s Period Pieces: Medium Rotation”

Ranking Georgette Heyer’s Period Pieces: The Introduction

First of all, I don’t care a groat for the idiots claiming that because they can’t track down the sources she was using, she was some kind of liar or fabulist. Her biographers state that she relied heavily on memoirs and collected letters which she found in private libraries that could well have been dispersed to the four winds in the fifty to eighty years since Heyer did her homework. Her research files seem to have been destroyed or dispersed after her own death and the suicide of her husband, which doesn’t help matters either. Both the biographers and the detractors seem to be ignorant of the actual fiction writers of the period, beyond Jane Austen. Heyer, on the other hand, shows signs of knowing them well. Lona Manning’s extensive reading in the period has brought to light a couple of writers whose tropes might have influenced Heyer, and at least a couple more who were not much as story-tellers but offered a wealth of detail about the culture of their time.  

It is however reasonable to say that Heyer, like her successors, filtered what she learned about the Georgian and Regency eras through her own culture and beliefs. In that sense, she is about as much of a fabulist as her modern detractors are, because (at least in her more escapist books) she is not much interested in history as history, only as a platform for what interests her, which is also how her detractors approach the period. Her comedic banter uses Regency cant mixed with a style and cadence similar to the more flippant moments of Dorothy Sayers and Margery Allingham, and whether you like the style of characterization used by those two mystery authors is probably a better indicator of whether you will like Heyer than whether you like, say, Julia Quinn.

Over the next few posts, I will be ranking the Heyer Historicals as “low-rotation,” “medium-rotation,” and “high-rotation,” based on how often I get the urge to read them. If it’s not mentioned, either assume I haven’t read it at all (The Great Roxhythe, The Spanish BrideAn Infamous Army) or haven’t read it recently enough to have an opinion (her medieval novels, The Black MothThe Convenient Marriage, The Devil’s CubPowder and Patch). I had a publication list in front of me when I wrote these posts originally, so you may see a vague tendency towards chronological order of release for the individual entries, especially in the “low rotation” entries. Listing order within a post is otherwise random, and does not reflect anything about the relative merits of any given pair of novels mentioned in the same post.