What happened in 2013?
A crime novel called The Cuckoo's Calling was published under the name Robert Galbraith, described as a former military police investigator. It had good reviews and modest sales. A few months later a newspaper received a tip that the real author was J. K. Rowling.
Before printing anything, the paper asked two academics to compare the text with Rowling's known work and with novels by three other crime writers. One of them, Patrick Juola, a computer scientist in Pittsburgh, ran his analysis in about half an hour. Of the four candidates, Rowling was the most consistent match across his tests. The other analyst reached the same view independently. The paper put the question to Rowling's agent, and she confirmed it.
What did the computer look at?
Nothing a reader would think of as style. Not the imagery, the plotting or the vocabulary of wizards and detectives.
Juola ran four tests. One compared the distribution of word lengths. One looked at the hundred most common words and how often each occurred. One counted pairs of adjacent words. One counted sequences of four characters, which captures bits of words, endings and punctuation.
The technique is called stylometry, and its central discovery is counter-intuitive. The most revealing words are the least interesting ones: the, of, and, to, but, on, which. They are known as function words.
Why those?
For three reasons. They are frequent, so even a short passage contains hundreds, which gives stable statistics. They are independent of subject: a novel about a murder and a novel about a school need different nouns but the same prepositions. And they are chosen without thought. A writer can decide to avoid adverbs. Almost nobody monitors how often they write upon instead of on, or begin a sentence with But.
Those unmonitored habits are remarkably steady across a writer's books and across decades.
Where did the idea come from?
The founding study was published in 1964 by two statisticians, Frederick Mosteller and David Wallace. Their subject was The Federalist Papers, the essays written in 1787 and 1788 to argue for the American constitution. Most were known to be by Alexander Hamilton or James Madison. Twelve were claimed by both.
The two men wrote in the same formal manner on the same subjects, and conventional analysis could not separate them. Mosteller and Wallace counted small words. Hamilton used upon about three times in every thousand words. Madison hardly used it at all. Hamilton wrote while; Madison wrote whilst. Combining thirty such markers, they concluded that Madison had written all twelve. Historians have largely accepted the finding.
How does a modern analysis work?
In outline, any writer can try it.
- Collect texts known to be by each candidate, ideally tens of thousands of words apiece.
- Take the hundred or so most common words across the whole collection.
- For each text, work out how often each of those words occurs per thousand.
- Each text is now a list of a hundred numbers. Measure how far the disputed text's list lies from each candidate's.
A widely used measure of that distance was devised by John Burrows in 2002. Free software packages implement it and draw the results as a tree in which texts by the same hand cluster on the same branch.
How reliable is it?
It depends heavily on the conditions.
It works best when the text is long, when there is a short list of candidates, when there is plenty of known writing by each, and when everything is in the same genre and from roughly the same period. The Galbraith case met all of those.
It weakens quickly when texts are short. A few hundred words give too few function words to count. It is unreliable across genres: a person's emails and their fiction can look like different authors. Heavy editing blurs the signal, as does collaboration and translation.
And it can only choose among the candidates it is given. If the real author is not on the list, the method will still name whoever is nearest. Juola himself was careful to say that his result made Rowling more likely than the other three, and did not prove she wrote the book.
Has it been wrong?
Yes, and the failures are instructive. In 1996 a scholar attributed an anonymous funeral elegy to Shakespeare on statistical grounds, and it was included in several editions of the complete works. Later analyses pointed firmly to another playwright, John Ford, and the original proponent accepted the correction.
Attributions have been offered as evidence in court, with mixed reception. The identities of various anonymous and pseudonymous authors have been "revealed" by this means with varying plausibility, sometimes over the objections of the person named. There is an ethical question here that the mathematics does not settle: a pseudonym is often chosen for good reason.
Can a writer disguise their style?
To a degree. Experiments in which people were asked to imitate another author, or simply to write unlike themselves, have reduced the accuracy of attribution to little better than chance. Running a text through translation and back, or through a paraphrasing tool, has a similar effect.
What is hard is sustaining the disguise over a whole novel, because the habits being measured are the ones a writer does not notice.
Does this work on machine-written text?
It is one of the approaches used to try to detect it, with limited success. Language models have their own statistical habits, including favourite words and a certain evenness of rhythm. But those habits shift with each new model and with the instructions given, and a human revising the output blends two signatures. Detection by these means is much less dependable than attribution among known human authors.
What can a writer learn from it?
Two things, I think.
The first is a mirror. Paste thirty thousand words of your own work into a word-frequency counter and look below the top twenty. You will find your tics: the adverb in every third paragraph, the three verbs your characters always use when they move across a room, the sentence openings you lean on. Authors who have done this report the experience as mildly mortifying and very useful. A book by the journalist Ben Blatt applied such counts to well-known novelists and found, for instance, each one's pet words and how their use of adverbs compared.
The second is a thought about what style is. Writers tend to believe their voice lies in their best sentences, the ones they laboured over. The numbers suggest it lies at least as much in thousands of small unconsidered choices about how to join one clause to the next. That is why it survives a change of name, genre and subject, as it did in 2013.



