diff --git a/src/bib/sync.py b/src/bib/sync.py index 5de9ac7..81c7886 100644 --- a/src/bib/sync.py +++ b/src/bib/sync.py @@ -474,6 +474,11 @@ def _zotero_collection_path(item: Item) -> list[str]: if guidance: return [*base, guidance] return base + if "source:ml-library" in item.tags: + return ["ML library", "Books" if "ml:book" in item.tags else "Articles"] + if "source:lead-snowball" in item.tags: + # Works the LEAD corpus cites, pulled from open-access sources. + return ["LEAD corpus", "Cited works"] if "source:lead-corpus" in item.tags: # dev/scripts/import_lead_corpus.py: research papers by the topic # folder they were staged in (first lead-topic: tag), dataset diff --git a/tests/bib/test_sync_deeper.py b/tests/bib/test_sync_deeper.py index 3298b63..216c644 100644 --- a/tests/bib/test_sync_deeper.py +++ b/tests/bib/test_sync_deeper.py @@ -248,6 +248,22 @@ class TestCollectionPathEdge: "Measure specifications", ] + def test_ml_library_books_and_articles(self): + book = Source(title="Elements of Statistical Learning") + for t in ("source:ml-library", "ml:book"): + book.add_tag(t) + paper = Source(title="Conformal prediction tutorial") + for t in ("source:ml-library", "ml:article"): + paper.add_tag(t) + assert _zotero_collection_path(book) == ["ML library", "Books"] + assert _zotero_collection_path(paper) == ["ML library", "Articles"] + + def test_lead_snowball_cited_works(self): + item = Source(title="Pope 2004") + item.add_tag("source:lead-snowball") + item.add_tag("lead-topic:risk_adjustment") + assert _zotero_collection_path(item) == ["LEAD corpus", "Cited works"] + def test_oig_no_sector_no_guidance(self): """Line 421: OIG with neither sector nor guidance → base only.""" item = Source(title="OIG doc")