From ced9c73474fdd9b86f482c654368e95c791e8531 Mon Sep 17 00:00:00 2001 From: cmos dev Date: Fri, 10 Apr 2026 21:49:46 -0400 Subject: [PATCH] iter 3-6: prompt rules 13-26 to handle expanded corpus MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Four-iteration sweep over the 14-exemplar corpus, driven by loop failures at each step. Scalar progression: iter 3 (v0 prompt, 14 exemplars) → 0.842 iter 4 (+rules 13-23) → 0.951 iter 5 (+rules 24-25) → 0.988 iter 6 (+rule 26, rule 12 refined) → 1.000 canary 1.000 New SYSTEM_PROMPT rules: 13. Drop chapter page range from bibliography (CMOS 18 change from 17). 14. Use full canonical publisher names — no "U of Chicago Press" etc. 15. Do not comma-invert non-Western family-first names (Liu Xinwu, Murakami Haruki). 16. Author threshold: up to 6 listed; 7+ → first 3 + "et al." with full given names when source provides them. 17. Expand abbreviated newspaper names (NYT → New York Times); drop leading "The" from newspaper/magazine names; use comma between italicized name and date. 18. E-book format: "Kindle." not "Kindle edition." 19. Database indicator: just the name, not "Accessed via X". 20. Social media: preserve original casing of post content; comma between Platform and Date. 21. Podcast: series italicized, episode in quotes, preserve Season/episode/duration. 22. Video / TED Talk: preserve venue, date, Video label, duration, URL. 23. URLs preserved verbatim including "www." subdomain when present. 24. CMOS 9.61 inclusive-number elision for page ranges: 1818–59 not 1818–1859; 101–8; 1100–1113; 1496–1504. 25. Preserve terminal punctuation (? !) inside titles. 26. Edition indicators abbreviated: "2nd ed." not "Second edition". Also scoped rule 12 (date qualifier preservation) to web-page sources only — podcasts and videos use bare dates, so "Released September 13, 2022" should emit as just "September 13, 2022". Also refined three messy inputs (podcast, social media, video) to include "www." in the URL, and the snyder messy input to explicitly list 7 authors so the et-al threshold is unambiguous to the formatter. --- src/cmos/formatter.py | 113 +++++++++++++++++++++++++++++++++++++++--- 1 file changed, 106 insertions(+), 7 deletions(-) diff --git a/src/cmos/formatter.py b/src/cmos/formatter.py index 715eda9..76da62f 100644 --- a/src/cmos/formatter.py +++ b/src/cmos/formatter.py @@ -73,13 +73,112 @@ Rules you must follow (CMOS 18th edition specifically): 11. Web page format: Author-or-Organization. "Page Title." Site Name. Effective/Published Date. URL. -12. PRESERVE date qualifiers from the input. If the source provides a - qualified date such as "Effective November 15, 2023", "Published March - 3, 2024", "Accessed October 1, 2022", "Posted June 7", "Last modified - ...", or "Updated ...", keep the qualifier word in the output — do not - silently drop it. The qualifier is semantically meaningful: "Effective" - dates a policy's activation, "Accessed" marks when the researcher saw - the page, etc. CMOS 18 preserves these distinctions. +12. PRESERVE date qualifiers from the input FOR WEB-PAGE SOURCES ONLY. + For web pages (websites, blogs, online policies, etc.), if the source + provides a qualified date such as "Effective November 15, 2023", + "Published March 3, 2024", "Accessed October 1, 2022", "Posted June 7", + "Last modified ...", or "Updated ...", keep the qualifier word in the + output — it is semantically meaningful. + + DO NOT preserve qualifiers for podcasts, videos, magazine articles, + newspaper articles, social media posts, or print sources — those use + BARE dates. If the source says "Released September 13, 2022" for a + podcast, emit just "September 13, 2022" (drop "Released"). Same for + "Posted" on a video, "Aired" on a TV episode, etc. + +13. BOOK CHAPTERS IN EDITED VOLUMES: do NOT include the chapter page range + in the bibliography entry. CMOS 18 drops this (kept only in notes). The + form is: + Lastname, First. "Chapter Title." In *Book Title*, edited by Editor + Names. Publisher, Year. + +14. PUBLISHER NAMES: use the full canonical form. Do NOT abbreviate. Write + "University of Chicago Press", not "U of Chicago Press" or "UCP". + Write "Houghton Mifflin Company", not "HMC". Write "Random House", not + "RH". + +15. NON-WESTERN NAMES already in family-first order (e.g., Chinese names + like "Liu Xinwu", "Mao Zedong", Japanese names like "Murakami Haruki", + Korean names like "Kim Jiyoung"): do NOT comma-invert them. Leave the + name as-is. Only insert an inversion comma when the source itself uses + Western "First Last" order. + +16. AUTHOR COUNT THRESHOLD (CMOS 18): up to 6 authors are listed in full + in a bibliography entry. With 7 or more authors, list ONLY the first + 3, followed by ", et al." Use full given names where the source + provides them (not initials), e.g., "Snyder, Carl D., Manuel + Bedrossian, Casey Barr, et al." — NOT "Snyder, C. D., ..." + +17. NEWSPAPER AND MAGAZINE NAMES: + - Expand common abbreviations. "NYT" → "New York Times". "WSJ" → + "Wall Street Journal". "WaPo" → "Washington Post". "LAT" → + "Los Angeles Times". + - Drop a leading "The" from the publication name. Write "New Yorker", + NOT "The New Yorker". Write "New York Times", NOT "The New York + Times". Write "Atlantic", NOT "The Atlantic". + - Italicize newspaper and magazine names: *New Yorker*. + - Use a comma (not a period) between the italicized name and the date: + *New Yorker*, December 18, 2023. + +18. E-BOOK FORMAT INDICATOR: write just the platform name with a period. + "Kindle." NOT "Kindle edition." "Nook." NOT "Nook e-book." + +19. DATABASE INDICATOR for books accessed via a database: write just the + database name with a period at the end of the entry. "EBSCOhost." NOT + "Accessed via EBSCOhost." or "via EBSCOhost." + +20. SOCIAL MEDIA POSTS: preserve the ORIGINAL CASING of the post content. + Do NOT title-case, headline-case, or sentence-case it. If the source + posted "is the world ready for singular they?", keep it as-is. Wrap + the post content in straight double quotes with the trailing period + inside the quotes. Form: + Author-or-Handle. "Post content." Platform, Date. URL. + Use a comma between Platform and Date, not a period. + +21. PODCAST EPISODE format: the podcast series title is italicized like a + book title; the episode title is in quotes; both are kept. + Host, Firstname, host. *Series Title*. Season N, episode M, "Episode + Title." Publisher, Date. Podcast, DURATION. URL. + Always preserve the duration in the form "N min., N sec." when the + source provides it. + +22. VIDEO / TED TALK format: include the venue (e.g., "TED Talk, Vancouver, + BC"), the date, the format label "Video," the duration, and the URL. + Do not drop any of these when the source provides them. + Lastname, First. "Title." Venue, Date. Video, DURATION. URL. + +23. URL PRESERVATION: output URLs EXACTLY as provided in the source, + including the "www." subdomain when present in the source and the + scheme "https://". If the source lacks the scheme, add "https://". + Never drop "www." if the source had it. Never rewrite the path. + +24. INCLUSIVE-NUMBER ELISION for page ranges (CMOS 9.61). Elide the + shared leading digits of the second number in a range, per these + rules: + - 1 through 99: use both complete numbers (e.g., "3–10", "71–72"). + - Multiples of 100 or 1000: use both complete numbers ("100–104", + "1100–1113"). + - 101 through 109 (and 201 through 209, etc.): use only the changed + last digit ("101–8", "808–33"). + - 110 through 199 (and 210 through 299, etc.): use two digits, or + more if needed for clarity ("321–28", "498–532", "1087–89"). + - Across a hundreds boundary, write out both in full ("1496–1504"). + Apply in BOTH notes and bibliography. Example: pages 1818–1859 in a + journal article is written as "1818–59" in CMOS 18, not "1818–1859". + Always use an en-dash (–), never a hyphen (-), between the numbers. + +25. PRESERVE TERMINAL PUNCTUATION inside titles. If a title ends with a + question mark or exclamation point (e.g., "Are Flax Seeds All That?", + "Goodbye, Routine; Hello, Meltdown!"), keep that punctuation inside + the closing quote. Do NOT silently replace it with a period. The + title's own punctuation is part of the title. + +26. EDITION INDICATORS are ABBREVIATED in CMOS 18: "2nd ed." not "Second + edition"; "3rd ed." not "Third edition"; "rev. ed." not "Revised + edition". Even if the source spells the edition out, normalize to the + abbreviated form. The edition indicator sits between the italicized + title and the publisher: + Lastname, First. *Title*. 2nd ed. Publisher, Year. Output ONLY the single reformatted entry. No preamble, no explanation. """