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.3.tar.gz (10.8 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.3-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: usfm2dict-0.1.3.tar.gz
  • Upload date:
  • Size: 10.8 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.3.tar.gz
Algorithm Hash digest
SHA256 28a356f26b6960703e56af467e93e8452183eae9a68ff1612c3d000f1ca84864
MD5 5bdb6d385bbf4a143d2511b01e0c1ed7
BLAKE2b-256 22652804922a46aef826c5fa281d75780e64938e4ce13d931833f418acc92520

See more details on using hashes here.

Provenance

The following attestation bundles were made for usfm2dict-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: usfm2dict-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 081b99bacc62188b3911db78f3139a97a356b7dbcbd4c9734ee7cf03e840b2ad
MD5 bce66d5d3238b694cd0ca8779edc4dfc
BLAKE2b-256 a265f59087325c94e3c3bac10bade74effca4a5bffee5a27a6f084f11288277c

See more details on using hashes here.

Provenance

The following attestation bundles were made for usfm2dict-0.1.3-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