Generate a Cutter-Sanborn call number. Can be used as CLI tool or Python library.
Project description
CSAN: Cutter-Sanborn Call Number Generator
csan generates a Cutter-Sanborn call number, given a last name and an optional first name. It can be used as a CLI tool or as a Python library.
The Cutter-Sanborn call number, commonly called "Cutter number", is an alphanumeric code that forms part of the call number in library classification systems in order to arrange books alphabetically by author. It consists of the first letter of the author's last name followed by three-digit number derived from a predefined table. This system was originally developed by Charles Cutter, and revised by Kate Sanborn and Swanson-Swift.
Installation
You can install this tool using uv or pip:
uv tool install csan
pip install csan
CLI Usage
usage: csan [-h] [-f FIRST_NAME] -l LAST_NAME [-t TITLE] [-v]
Cutter-Sanborn identifier generator.
options:
-h, --help show this help message and exit
-f, --first-name FIRST_NAME
-l, --last-name LAST_NAME
-t, --title TITLE
-v, --verbose
For instance:
Examples
csan -f John -l Doe-> D649csan -f John -l Doe -t "My Book"-> D649mcsan -f First -l Last -v-> L349, with log output to the consolecsan -f Jorge -l "De la Cruz"-> D332
The following table shows expected Cutter call numbers for their respective names, using CLI:
| First Name | Last Name | Cutter Call Number |
|---|---|---|
| Jane | Austen | A933 |
| Eric | Blair | B635 |
| Agatha | Christie | C555 |
| Samuel | Clemens | C625 |
| Jorge | De la Cruz | D332 |
| Charles | Dickens | D548 |
| Emily | Dickinson | D553 |
| Fyodor | Dostoyevsky | D724 |
| Stephen | King | K52 |
| VERA | LVX | L979 |
| Herman | Melville | M531 |
| George | Orwell | O79 |
| William | Shakespeare | S527 |
| Lord | Sith | S622 |
| Ivan | Smith | S649 |
| William | Smith | S664 |
| Leo | Tolstoy | T654 |
| Mark | Twain | T969 |
| Virginia | Woolf | W913 |
| Emile | Zola | Z86 |
Library Usage
Add package to virtual environment:
uv add csan
There are two relevant functions in csan package:
csan.cutter.cutter_number: return the integer part of the Cutter call numbercsan.cutter.cutter_call_number: return the Cutter call number
Also, the entire Cutter-Sanborn table can be retrieved as a Python dict:
csan.table.CUTTER_TABLE
Example
from csan.cutter import cutter_call_number, cutter_number
from csan.table import CUTTER_TABLE
def main():
print(CUTTER_TABLE)
cutter_num = cutter_number("First", "Last")
cutter_call_num = cutter_call_number("Last", cutter_num)
print(cutter_num)
print(cutter_call_num)
if __name__ == "__main__":
main()
License
This project is released under the Apache-2.0 license.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file csan-0.4.2.tar.gz.
File metadata
- Download URL: csan-0.4.2.tar.gz
- Upload date:
- Size: 69.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ea7727398b86aca0718ad2c5686f0f60fd190641b35d91a675992f6582e6cbfb
|
|
| MD5 |
5e47f6f1abfe824f51eab8425ce25048
|
|
| BLAKE2b-256 |
d63e8c4df731c3fd9c9ea928febb89a865c58e4211af7f98ebabf98cf5795b98
|
File details
Details for the file csan-0.4.2-py3-none-any.whl.
File metadata
- Download URL: csan-0.4.2-py3-none-any.whl
- Upload date:
- Size: 69.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9e57a5bd159d35ff197f57f3c7ab3a65a496add22fa3691cbb5f0d3d050dd4ce
|
|
| MD5 |
c5cbd5a91b59f21c58378e9c18d16b54
|
|
| BLAKE2b-256 |
29c7c5dfeaeba1efc0e86ae43114a80388458f7cb224b9989147470e6ae2192e
|