mirror of
https://git.pumpin.online/funkpower/catena.git
synced 2026-10-22 18:57:14 +00:00
colophon: file a book's printed subjects onto a shelf someone has
A cataloguing block states subjects in Library of Congress form, which is precise, deep and no use for browsing. Real blocks from this library read 'Political science – Early works to 1800' and 'English literature—Middle English, 1100–1500—History and criticism'. Nobody has a shelf called that. --shelf takes the closed list the library is actually browsed by and files the printed headings onto it, longest term first so a period of thought does not collapse into its parent. Matching is on whole words after folding punctuation away, because a cataloguing block separates with em dashes, en dashes, full stops and plain hyphens, often three in one heading, and OCR turns any of those into any other. What matches nothing comes back under unshelved rather than being dropped: a subject silently discarded is indistinguishable from a book that printed none, and the difference is the whole value of reading the block.
This commit is contained in:
@@ -21,6 +21,38 @@ Every field names the page it was read off. Nothing is inferred: a scan that
|
||||
begins at the preface printed no title page, and the record of that is an
|
||||
empty one with every field listed in `unsettled`.
|
||||
|
||||
## A shelf of your own
|
||||
|
||||
A cataloguing block states subjects the way a national library does:
|
||||
|
||||
```text
|
||||
Political science – Early works to 1800
|
||||
English literature—Middle English, 1100–1500—History and criticism
|
||||
```
|
||||
|
||||
Nobody browses by those. `--shelf` takes the closed list you actually file by
|
||||
and returns the headings from it that the book's own subjects hit:
|
||||
|
||||
```sh
|
||||
colophon --shelf shelf.txt book.md
|
||||
```
|
||||
|
||||
```text
|
||||
# one heading per line; `= terms` gives the words that match it,
|
||||
# and a heading with no terms matches its own name.
|
||||
Byzantine History = byzantium, byzantine, constantinople
|
||||
Political Science = political science, politics
|
||||
Ethics
|
||||
```
|
||||
|
||||
The longest term wins, so `Ancient Philosophy` beats `Philosophy` and a period
|
||||
of thought does not collapse into its parent. Matching is on whole words after
|
||||
punctuation is folded away, because a block separates with em dashes, en
|
||||
dashes, full stops and hyphens, and OCR turns any of those into any other.
|
||||
|
||||
Headings that match nothing come back under `unshelved`, kept as printed. A
|
||||
subject quietly dropped reads exactly like a book that printed none.
|
||||
|
||||
## When you would use it
|
||||
|
||||
- **Cataloguing scans and secondhand files**, where the embedded metadata is
|
||||
|
||||
Reference in New Issue
Block a user