Files
catena/crates/bindings/python/catena/__init__.pyi
T
funkpower d1ed82d112 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.
2026-09-20 15:22:06 -04:00

78 lines
2.7 KiB
Python

from typing import Any, Iterable, Mapping, Sequence
__version__: str
def chunk_markdown(
markdown: str,
*,
target: int | None = ...,
overlap: int | None = ...,
min_tokens: int | None = ...,
hard_max: int | None = ...,
) -> list[dict[str, Any]]: ...
def scrub(markdown: str, *, pages: bool = ...) -> str: ...
def count_tokens(text: str) -> int: ...
def parse_subtitles(
content: str, *, keep_repeats: bool = ...
) -> list[dict[str, Any]]: ...
def pack_cues(
cues: Iterable[Mapping[str, Any]],
*,
seconds: float | None = ...,
max_tokens: int | None = ...,
) -> list[dict[str, Any]]: ...
def segment_cues(
cues: Iterable[Mapping[str, Any]],
*,
duration: float | None = ...,
embeddings: Sequence[Sequence[float]] | None = ...,
) -> list[dict[str, Any]]: ...
def cue_windows(cues: Iterable[Mapping[str, Any]]) -> list[str]: ...
def split_collection(markdown: str) -> list[dict[str, Any]]: ...
def fuse_hits(
hits: Iterable[Mapping[str, Any]],
*,
k: float | None = ...,
weights: Mapping[str, float] | None = ...,
limit: int | None = ...,
) -> list[dict[str, Any]]: ...
def identify(name: str, data: bytes) -> dict[str, Any]: ...
def find_citations(text: str) -> list[dict[str, Any]]: ...
def looks_like_footnote_citations(text: str) -> bool: ...
def canonical_subject(
scheme: Mapping[str, Any], name: str
) -> str | None: ...
def compose_subjects(
scheme: Mapping[str, Any],
subjects: Iterable[str],
title: str | None = ...,
) -> list[str]: ...
def needs_subject(
scheme: Mapping[str, Any], existing: Iterable[str]
) -> bool: ...
def suggest_author(
title: str, front_matter: str | None = ...
) -> dict[str, Any] | None: ...
def citation_prompt(references: Iterable[Mapping[str, Any]]) -> str | None: ...
def merge_citation_reply(
references: Iterable[Mapping[str, Any]], reply: str
) -> list[dict[str, Any]]: ...
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: ...