From 79c1f0b59d97c8223851284ca9db5431591980f2 Mon Sep 17 00:00:00 2001 From: funkpower Date: Sun, 20 Sep 2026 17:10:44 -0400 Subject: [PATCH] citefind: a bibliography is not a page of notes, however its lines begin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mellor, Hugh (1974) "In Defense of Dispositions," Philosophical Review 83:157- 81. Reprinted in Mellor (1991):104-22. `81.` there is the second half of a page range whose first line ran out of room. It is also, at the start of a line, exactly what a note marker looks like — and two of them on a page of twenty-three references were enough to send the whole page down the numbered-notes path, where it was cut into two enormous entries and both were thrown away for running past a hundred and twenty words. Heil's *Philosophy of Mind* came out of the corpus with one citation. The page above gives nineteen. The two readings are now weighed against each other: more lines opening on a surname and a comma than there are note markers means it is a bibliography. A real page of notes has many markers and no line that opens on a surname, because every line opens on its number. Over the 202 reference sections sampled from the corpus: 10,047 to 10,405. --- crates/citefind/src/split.rs | 38 +++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/crates/citefind/src/split.rs b/crates/citefind/src/split.rs index 87cbb20..026c4e9 100644 --- a/crates/citefind/src/split.rs +++ b/crates/citefind/src/split.rs @@ -130,7 +130,16 @@ static ID_MARKER: LazyLock = /// Cut a block into entries. pub fn entries(text: &str) -> Vec { let numbered = numbered_notes(text); - let cut = match numbered.len() >= MIN_NOTES { + // A bibliography is not a page of notes, however many of its lines begin + // on a number. `81. Reprinted in Mellor (1991):104-22.` is the second + // line of an entry whose first line ran out of room, and two of those on + // a page of twenty-three references used to cut the page in two and + // throw both halves away for running on. + let surnames = text + .lines() + .filter(|line| SURNAME_FIRST.is_match(line.trim_start())) + .count(); + let cut = match numbered.len() >= MIN_NOTES && numbered.len() >= surnames { true => numbered, false => unnumbered(text), }; @@ -431,6 +440,33 @@ mod tests { assert!(found[0].text.starts_with("John Smith"), "{:?}", found[0]); } + #[test] + fn a_line_of_a_bibliography_that_begins_on_a_number_is_not_a_note() { + // `81. Reprinted in Mellor (1991):104-22.` is the second line of an + // entry whose first line ran out of room. Two of those on a page of + // references used to cut the page into two enormous entries. + let page = "\ +Martin, C.B. and Heil, John (forthcoming) \u{201c}Rules and Powers,\u{201d} Philosophical + Perspectives. + Mele, Alfred R. (1987) Irrationality: An Essay on Akrasia, New York: Oxford. + Mellor, Hugh (1974) \u{201c}In Defense of Dispositions,\u{201d} Philosophical Review 83:157- + 81. Reprinted in Mellor (1991):104-22. + Mellor, Hugh (1991) Matters of Metaphysics, Cambridge: Cambridge University + Press."; + let found = entries(page); + assert!(found.len() >= 4, "{found:#?}"); + assert!( + found.iter().any(|e| e.text.starts_with("Mele")), + "{found:#?}" + ); + assert!( + found + .iter() + .any(|e| e.text.starts_with("Mellor, Hugh (1991)")), + "{found:#?}" + ); + } + #[test] fn a_note_that_cites_nothing_is_not_a_reference() { let page = "\