Skip to main content

USFM to Dictionary Converter

Project description

Usfm2Dict

A Python package for converting USFM (Unified Standard Format Markers) files to a dictionary format.

Credit

This package was ripped out of https://github.com/sillsdev/machine.py (sil-machine) so that it could function as more of a discreet dependency. machine.py was developed by the SIL International team and is MIT licensed. Thank you for your work!

Installation

pip install usfm2dict

Usage

Command Line

# Convert a single USFM file
usfm2dict path/to/file.usfm

# Convert multiple files
usfm2dict path/to/file1.usfm path/to/file2.usfm

# Use glob patterns
usfm2dict "path/to/*.usfm"

# Output to a file
usfm2dict path/to/file.usfm --output result.json

# Pretty print the output
usfm2dict path/to/file.usfm --pretty

Python API

from usfm2dict import parse_usfm_file, UsfmParser

# Parse a file
verses = parse_usfm_file("path/to/file.usfm")

# Or use the parser directly
parser = UsfmParser()
with open("path/to/file.usfm", "r", encoding="utf-8") as f:
    content = f.read()
verses = parser.parse(content)

# Result is a dictionary with verse references as keys
print(verses["GEN 1:1"])  # "In the beginning God created the heavens and the earth."

License

MIT

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

usfm2dict-0.1.0.tar.gz (10.7 kB view details)

Uploaded Source

Built Distribution

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

usfm2dict-0.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file usfm2dict-0.1.0.tar.gz.

File metadata

  • Download URL: usfm2dict-0.1.0.tar.gz
  • Upload date:
  • Size: 10.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for usfm2dict-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4454060e7015012d83f0d1aecdb1e14c85ae855cadc312e3c37b2b16ecace0ce
MD5 e95655731205db26be5674b1a96da1f5
BLAKE2b-256 8b604132547806af918f750ab9d11a7a1cb619e495de613ce6257f7a3f1b4527

See more details on using hashes here.

Provenance

The following attestation bundles were made for usfm2dict-0.1.0.tar.gz:

Publisher: publish.yml on jcuenod/usfm2dict

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file usfm2dict-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: usfm2dict-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 11.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for usfm2dict-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4eecefbb115b7894c7d2ef373c66eddddd64f8800b469e20ca60ecc7f04a8232
MD5 dc6eacb6c8a5a02c2cfe3633b2765338
BLAKE2b-256 dada77de659be5056b2b68945bb6a7659b0938f587e2bc03507ea79bf839bdce

See more details on using hashes here.

Provenance

The following attestation bundles were made for usfm2dict-0.1.0-py3-none-any.whl:

Publisher: publish.yml on jcuenod/usfm2dict

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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