From 43f60e7cfca7aa0314fe52bb8ea06478b1810f54 Mon Sep 17 00:00:00 2001 From: funkpower Date: Tue, 24 Nov 2026 09:01:57 -0500 Subject: [PATCH] colophon: a byline line opening on an article names nobody "A Novel", "A History", "A Psychoanalytic View" were read as people with the initial A. Over the front matter of 5,551 books: 14 fewer wrong names, no right one lost (precision 85.9% -> 86.7%). A rule dropping any name made of the title's own words was tried and left out: it also dropped real authors named in their titles ("Isaac Newton: Philosophical Writings"). --- crates/colophon/src/title.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/colophon/src/title.rs b/crates/colophon/src/title.rs index d748374..787c516 100644 --- a/crates/colophon/src/title.rs +++ b/crates/colophon/src/title.rs @@ -320,6 +320,12 @@ fn people(who: &str) -> Vec { .flat_map(|part| part.split(" and ")) .map(|name| name.trim().trim_end_matches(['.', ',']).trim().to_string()) .filter(|name| name.len() >= 3 && name.split_whitespace().count() <= 5) + // "A Novel", "A History": an article opens a line of the title, and + // would otherwise be read as the initial A. + .filter(|name| { + let first = name.split_whitespace().next().unwrap_or(""); + !["a", "an", "the"].contains(&first.to_lowercase().as_str()) + }) .filter_map(|name| bibclean::author::clean(&name)) .filter(|name| crate::cip::reads_as_a_name(name)) .filter(|name| name.split_whitespace().count() >= 2 || is_known_mononym(name)) @@ -669,6 +675,13 @@ mod person_tests { } } + #[test] + fn a_line_opening_on_an_article_names_nobody() { + assert!(people("A Novel").is_empty()); + assert!(people("A Psychoanalytic View").is_empty()); + assert_eq!(people("A. J. Ayer"), ["A. J. Ayer"]); + } + #[test] fn initials_are_still_a_person() { for line in ["A. J. Ayer", "A.J. Ayer", "Anne Carson"] {