Skip to main content

Browse TLG indices

Project description

About

This Python package facilitates the browsing of the indices of the old TLG CD-ROMs. It expects that texts have been processed by the tlgu package (tlgu homepage, rehosted code), which offers a variety of ways to convert the Beta Code of the original files into Unicode text files.

Install

Install from PyPI with:

pip install tlg-indices

Disclaimer

This repository makes no claim to ownership of the contents of the original TLG CD-ROM, which are owned by the University of California, Irvine. It is an independent effort to facilitate study of texts and does not represent or imply endorsement by the University of California, Irvine or the TLG project.

Usage overview

The main entry point is the utility functions in src/tlg_indices/utils.py, which expose prebuilt indices and convenience lookups. The quickest way to see how to call these helpers is in tlg_index_examples.py, which demonstrates:

  • Reading index data (epithets, geographies, dates, and author/work mappings).
  • Looking up authors by epithet or geography, and reversing those lookups.
  • Looking up works by author and retrieving a single work title.
  • Sorting and querying date ranges using ParsedDate and get_dates_in_range().

For a runnable walkthrough, open tlg_index_examples.py and follow the patterns there.

PHI5 index helpers live in src/tlg_indices/phi5_index_utils.py, with a runnable tour in phi5_examples.py. These cover:

  • Author id/name lookups and reverse lookups for PHI5.
  • Author-to-work id mappings for PHI5.
  • Resolving author ids from work ids.

File access utilities live in src/tlg_indices/file_utils.py. Use file_access_examples.py for runnable examples of:

  • assemble_tlg_author_filepaths() and assemble_tlg_works_filepaths().
  • assemble_phi5_author_filepaths() and assemble_phi5_works_filepaths().

Converting Beta Code with tlgu

If you have Beta Code files from the original TLG/PHI distributions, you can convert them using the tlgu wrapper in this package. See tlgu_examples.py for runnable examples of:

  • Converting a single file into an author-level file (grouping="author").
  • Splitting a single file into work-level files (grouping="work").
  • Converting an entire corpus for either grouping.

Open tlgu_examples.py and adjust the file paths for your local setup.

Development

Type checking

% uv run mypy *.py src/

Packaging

% uv build --no-sources
% uv publish --token "pypi-xxxxxxxxxxxxxxxx"

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

tlg_indices-1.3.0.tar.gz (335.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tlg_indices-1.3.0-py3-none-any.whl (338.6 kB view details)

Uploaded Python 3

File details

Details for the file tlg_indices-1.3.0.tar.gz.

File metadata

  • Download URL: tlg_indices-1.3.0.tar.gz
  • Upload date:
  • Size: 335.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.2

File hashes

Hashes for tlg_indices-1.3.0.tar.gz
Algorithm Hash digest
SHA256 e1322c5de6c4db1f8ce0b4adf80563f65da80286eccc51fde0c24034f02ff624
MD5 8bd0558ab12ce0b07be84983fa95e20d
BLAKE2b-256 8becdfc96319166bb566883dc6ae0f1ca8a32744294057e1c8c2af12be05a11c

See more details on using hashes here.

File details

Details for the file tlg_indices-1.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for tlg_indices-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e646997f384bd88fa71a9d0301bab52dbc613b355bd1cb94f8e59f50c6916357
MD5 06286b6c8653528f4878a42cf7c05797
BLAKE2b-256 e01a2124da1ed39663f75427ababe628a8c1c9659151f2e5bdcaa728149e457e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page