bindings: the catalogue audit book-pipeline had its own copy of

bibclean is "catalogue records audited and repaired, with a reason for every
change", and book-pipeline's metadata module was a second implementation of
the same thing — ported from it in the first place. Twelve functions bound:
the audit, its severity, the two commonest faults, the three repairs that
need no lookup, ISBNs checked and found, and whether two titles name the same
work.

Checked against that Python across all 5,385 books in the library — every
title, every author, every ISBN, every filename, and four thousand title
pairs. Identical on all of it but one: `The Soul After Death: Contemporary
'After-Death' Experiences`, where the Python lowercased a word inside the
quotation marks and bibclean leaves it alone.
This commit is contained in:
funkpower
2026-09-20 15:22:06 -04:00
parent b28e272506
commit d1ed82d112
5 changed files with 221 additions and 2 deletions
+26 -2
View File
@@ -12,48 +12,72 @@ lines of JSON.
from ._catena import (
__version__,
cue_windows,
canonical_subject,
chunk_markdown,
citation_prompt,
clean_record,
clean_underscores,
compose_subjects,
count_tokens,
cue_windows,
find_citations,
fuse_hits,
identify,
is_shouting,
isbn_from_filename,
isbn_from_text,
looks_like_footnote_citations,
looks_like_person,
merge_citation_reply,
needs_subject,
pack_cues,
parse_identifier,
parse_subtitles,
record_problems,
record_severity,
same_work,
scrub,
segment_cues,
series_of,
split_collection,
suggest_author,
title_case,
title_in_author,
valid_isbn,
)
__all__ = [
"__version__",
"cue_windows",
"canonical_subject",
"chunk_markdown",
"citation_prompt",
"clean_record",
"clean_underscores",
"compose_subjects",
"count_tokens",
"cue_windows",
"find_citations",
"fuse_hits",
"identify",
"is_shouting",
"isbn_from_filename",
"isbn_from_text",
"looks_like_footnote_citations",
"looks_like_person",
"merge_citation_reply",
"needs_subject",
"pack_cues",
"parse_identifier",
"parse_subtitles",
"record_problems",
"record_severity",
"same_work",
"scrub",
"segment_cues",
"series_of",
"split_collection",
"suggest_author",
"title_case",
"title_in_author",
"valid_isbn",
]
@@ -61,3 +61,17 @@ def parse_identifier(text: str) -> dict[str, Any] | None: ...
def series_of(
title: str, author: str | None = ...
) -> dict[str, Any] | None: ...
def clean_record(book: Mapping[str, Any]) -> dict[str, Any]: ...
def record_problems(
title: str | None = ..., author: str | None = ..., isbn: str | None = ...
) -> list[str]: ...
def record_severity(reasons: Iterable[str]) -> int: ...
def title_in_author(title: str | None = ..., author: str | None = ...) -> bool: ...
def looks_like_person(author: str) -> bool: ...
def is_shouting(title: str) -> bool: ...
def title_case(title: str) -> str: ...
def clean_underscores(title: str) -> str: ...
def valid_isbn(text: str) -> bool: ...
def isbn_from_text(text: str) -> str | None: ...
def isbn_from_filename(name: str) -> str | None: ...
def same_work(ours: str, theirs: str) -> bool: ...