ArticleslgStudy

computer science

Stylometry

Stylometry is a computer science topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Stylometry rather than just read about it. In short: Stylometry is the application of the study of linguistic style, usually to written language. It has also been applied successfully to music, paintings, chess, and source code.

Key takeaways

  • Stylometry belongs to computer science; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Stylometry to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Stylometry from memory before moving on to harder problems.

Reference excerpt

Stylometry is the application of the study of linguistic style, usually to written language. It has also been applied successfully to music, paintings, chess, and source code. Stylometry is often used to attribute authorship to anonymous or disputed documents. It has legal as well as academic and literary applications, ranging from the question of the authorship of Shakespeare's works to forensic linguistics, and has methodological similarities with the analysis of text readability. Stylometry may be used to unmask pseudonymous or anonymous authors, or to reveal some information about the author short of a full identification. Authors may use adversarial stylometry to resist this identification by eliminating their own stylistic characteristics without changing the meaningful content of their communications. It can defeat analyses that do not account for its possibility, but the ultimate effectiveness of stylometry in an adversarial environment is uncertain: stylometric identification may not be reliable, but nor can non-identification be guaranteed; adversarial stylometry's practice itself may be detectable.

History Stylometry grew out of earlier techniques of analyzing texts for evidence of authenticity and author identity. The modern practice of the discipline received publicity from the study of authorship problems in English Renaissance drama. Researchers and readers observed that some playwrights of the era had distinctive patterns of language preferences, and attempted to use those patterns to identify authors of uncertain or collaborative works. Early efforts were not always successful: in 1901, one researcher attempted to use John Fletcher's preference for "⁠ ⁠'em", the contractional form of "them", as a marker to distinguish between Fletcher and Philip Massinger in their collaborations—but he mistakenly employed an edition of Massinger's works in which the editor had expanded all instances of "⁠ ⁠'em" to "them". The basics of stylometry were established by Polish philosopher Wincenty Lutosławski in Principes de stylométrie (1890). Lutosławski used this method to develop a chronology of Plato's Dialogues. During the early 1960s, Rev. A. Q. Morton produced a computer analysis of the fourteen Epistles of the New Testament attributed to St. Paul, which indicated that six different authors had written that body of work. A check of his method, applied to the works of James Joyce, gave the result that Ulysses, Joyce's multi-perspective, multi-style novel, was composed by five separate individuals, none of whom apparently had any part in the crafting of Joyce's first novel, A Portrait of the Artist as a Young Man. One notable early success was the resolution of disputed authorship of twelve of The Federalist Papers by Frederick Mosteller and David Wallace. As well, the successful application of textual analysis to the Fletcher canon by Cyrus Hoy and others yielded clear results during the late 1950s.

Applications Applications of stylometry include literary studies, historical studies, social studies, information retrieval, and many forensic cases and studies. Recently, long-standing debates about anonymous medieval Icelandic sagas have been advanced through its utilization. It can also be applied to computer code and intrinsic plagiarism detection, which is to detect plagiarism based on the writing style changes within the document. Stylometry can also be used to predict whether someone is a native or non native English speaker by their typing speed. Stylometry as a method is vulnerable to the distortion of text during revision. There is also the case of the author adopting different styles in the course of their career as was demonstrated in the case of Plato, who chose different stylistic policies such as those adopted for the early and middle dialogues addressing the Socratic problem.

Features Textual features of interest for authorship attribution are on the one hand computing occurrences of idiosyncratic expressions or constructions (e.g., checking for how the author uses interpunction or how often the author uses agentless passive constructions) and on the other hand similar to those used for readability analysis such as measures of lexical variation and syntactic variation. Since authors often have preferences for certain topics, research experiments in authorship attribution mostly remove content words such as nouns, adjectives, and verbs from the feature set, only retaining structural elements of the text to avoid overfitting their models to topic rather than author characteristics. Stylistic features are often computed as averages over a text or over the entire collected works of an author, yielding measures such as average word length or average sentence length. This enables a model to identify authors who have a clear preference for wordy or terse sentences but hides variation: an author with a mix of long and short sentences will have the same average as an author with consistent mid-length sentences. To capture such variation, some experiments use sequences or patterns over observations rather than average observed frequencies, noting e.g., that an author shows a preference for a certain stress or emphasis pattern, or that an author tends to follow a sequence of long sentences with a short one. One of the first approaches to authorship identification, by Mendenhall, can be said to aggregate its observations without averaging them. More recent authorship attribution models use vector space models to automatically capture what is specific to an author's style, but they also rely on judicious feature engineering for the same reasons as more traditional models.

Adversarial stylometry

… excerpt ends here. Continue reading the full article.

Worked examples

Example 1 — a first encounter with Stylometry

Start with the simplest possible case. Write down what Stylometry claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In computer science, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Stylometry before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Stylometry ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Stylometry

In research
Stylometry appears in computer science research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Stylometry in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Stylometry is common in secondary-school and first-year university syllabi. It links to neighbouring topics Authorship debates, Computational fields of study, Digital humanities, so understanding it makes those chapters shorter.
In everyday life
Look for Stylometry outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.

Affiliate

Preply — study more efficiently by working with a personal tutor. 50% off.

How to study Stylometry in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Stylometry means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Stylometry out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Stylometry in simple terms?

Stylometry is the application of the study of linguistic style, usually to written language. It has also been applied successfully to music, paintings, chess, and source code.

Why does Stylometry matter?

Because it connects several computer science ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Stylometry?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Stylometry.

Tags

  • Authorship debates
  • Computational fields of study
  • Digital humanities
  • Forensic disciplines
  • Natural language processing
  • Personal identification
  • Quantitative linguistics
  • Stylistics

Keep exploring