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
Release history Release notifications | RSS feed
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 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
28a356f26b6960703e56af467e93e8452183eae9a68ff1612c3d000f1ca84864
|
|
| MD5 |
5bdb6d385bbf4a143d2511b01e0c1ed7
|
|
| BLAKE2b-256 |
22652804922a46aef826c5fa281d75780e64938e4ce13d931833f418acc92520
|
Provenance
The following attestation bundles were made for usfm2dict-0.1.3.tar.gz:
Publisher:
publish.yml on jcuenod/usfm2dict
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
usfm2dict-0.1.3.tar.gz -
Subject digest:
28a356f26b6960703e56af467e93e8452183eae9a68ff1612c3d000f1ca84864 - Sigstore transparency entry: 208150306
- Sigstore integration time:
-
Permalink:
jcuenod/usfm2dict@d4135f8474ac2a86570b3fe473f2993dc2492826 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/jcuenod
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d4135f8474ac2a86570b3fe473f2993dc2492826 -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
081b99bacc62188b3911db78f3139a97a356b7dbcbd4c9734ee7cf03e840b2ad
|
|
| MD5 |
bce66d5d3238b694cd0ca8779edc4dfc
|
|
| BLAKE2b-256 |
a265f59087325c94e3c3bac10bade74effca4a5bffee5a27a6f084f11288277c
|
Provenance
The following attestation bundles were made for usfm2dict-0.1.3-py3-none-any.whl:
Publisher:
publish.yml on jcuenod/usfm2dict
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
usfm2dict-0.1.3-py3-none-any.whl -
Subject digest:
081b99bacc62188b3911db78f3139a97a356b7dbcbd4c9734ee7cf03e840b2ad - Sigstore transparency entry: 208150309
- Sigstore integration time:
-
Permalink:
jcuenod/usfm2dict@d4135f8474ac2a86570b3fe473f2993dc2492826 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/jcuenod
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@d4135f8474ac2a86570b3fe473f2993dc2492826 -
Trigger Event:
push
-
Statement type: