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
