CS 161 - Workshop 8: Measuring Literary Style

Consider the following two passages:

Excerpt from Confidence by Henry James (1843-1916)

Some three evenings after he received this last report of the progress of affairs in Paris, Bernard, upon whom the burden of exile sat none the more lightly as the days went on, turned out of the Strand into one of the theatres. He had been gloomily pushing his way through the various London densities-- the November fog, the nocturnal darkness, the jostling crowd. He was too restless to do anything but walk, and he had been saying to himself, for the thousandth time, that if he had been guilty of a misdemeanor in succumbing to the attractions of the admirable girl who showed to such advantage in letters of twelve pages, his fault was richly expiated by these days of impatience and bereavement. He gave little heed to the play; his thoughts were elsewhere, and, while they rambled, his eyes wandered round the house. Suddenly, on the other side of it, he beheld Captain Lovelock, seated squarely in his orchestra-stall, but, if Bernard was not mistaken, paying as little attention to the stage as he himself had done. The Captain's eyes, it is true, were fixed upon the scene; his head was bent a little, his magnificent beard rippled over the expanse of his shirt-front. But Bernard was not slow to see that his gaze was heavy and opaque, and that, though he was staring at the actresses, their charms were lost upon him. He saw that, like himself, poor Lovelock had matter for reflection in his manly breast, and he concluded that Blanche's ponderous swain was also suffering from a sense of disjunction. Lovelock sat in the same posture all the evening, and that his imagination had not projected itself into the play was proved by the fact that during the entractes he gazed with the same dull fixedness at the curtain. Bernard forebore to interrupt him; we know that he was not at this moment socially inclined, and he judged that the Captain was as little so, inasmuch as causes even more imperious than those which had operated in his own case must have been at the bottom of his sudden appearance in London. On leaving the theatre, however, Bernard found himself detained with the crowd in the vestibule near the door, which, wide open to the street, was a scene of agitation and confusion. It had come on to rain, and the raw dampness mingled itself with the dusky uproar of the Strand. At last, among the press of people, as he was passing out, our hero became aware that he had been brought into contact with Lovelock, who was walking just beside him. At the same moment Lovelock noticed him-- looked at him for an instant, and then looked away. But he looked back again the next instant, and the two men then uttered that inarticulate and inexpressive exclamation which passes for a sign of greeting among gentlemen of the Anglo-Saxon race, in their moments of more acute self-consciousness.

Except from Feathers by Raymond Carver (1938-1988)








  1. As a class, discuss differences in style between the two passages. Come up with a list of at least 6 measurable properties of the texts that could, in principle, be computed mechanically, and which would distinguish the two. Be creative about the properties, you need not be limited to simple ones such as sentence length (although that certainly would be an obvious property). In many cases it might not be clear if a property could really be measured by an algorithm, or would fundamentally require human judgment. Discuss these difficult cases.
  2. Break into smaller groups. Assign each group one of the properties, with the task of developing an algorithm expressed in English for measuring the property. Develop the algorithm in a top down fashion, starting with a general statement of the property, and then fill in the details. You do not need to go all the way to actual Python code. Instead, the goal is just to be specific enough that it would be absolutely clear to a ordinary person how each step could be carried out. After each group has developed their algorithm, come back together as a class and discuss what was done. Does everyone agree that each algorithm could (with sufficient time and expertise) be turned into a computer program?