liveBook · Manning

Authorship identification

As explained in Learn AI-Assisted Python Programming, Second Edition

Authorship identification is the task of determining which known author most likely produced an unknown text by comparing characteristics of the texts.

Authorship identification determines which known author most likely produced an unknown text. It treats books as labeled training data, extracts measurable writing features, and predicts the closest author for a new book. section 11.1 section 11.8

A practical program follows three stages:

  • Input: ask for the filename of the mystery book. section 11.2
  • Process: create a signature for the mystery book and signatures for books with known authors, then compare them. section 11.2
  • Output: report the known signature closest to the unknown signature as the prediction. section 11.2
  • Use top-down design to divide the large task into functions such as make_guess, make_signature, get_sentences, and get_phrases. section 11.0 section 11.3.1

Building a writing signature

A signature can combine features such as average word length, average words per sentence, and average sentence complexity. A simple sentence rule splits text at periods, question marks, or exclamation points; phrase complexity uses commas, semicolons, and colons. Comparing two signatures weights each feature's difference and sums the contributions. For example, “Mrs. Cecil Forrester” can be split incorrectly because the period in “Mrs.” resembles a sentence boundary. section 11.3.1

How Learn AI-Assisted Python Programming, Second Edition covers it

How deep it goes
Explains feature extraction, signature comparison, and function decomposition, but stops short of industry-strength identification.
Examples
Demonstrates signatures from word and sentence features, weighted comparisons, and sentence-boundary errors involving “Mrs.”.
What it assumes
Assumes basic programming practice while teaching feature-based supervised learning and decomposition through a concrete application.
What you can do after
Build it from scratch as a decomposed program that extracts signatures and predicts the closest known author.
How it connects
Connects supervised learning with machine learning, top-down design, feature extraction, and refactoring.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Learn AI-Assisted Python Programming, Second Edition. The section links point to the parts of the book it draws on.