Dorsal Adapters translates schema-validated JSON records into a number of standard file formats.
Supported Formats
Document Extraction (open/document-extraction)
md: RAG-Optimized Markdown — Injects semantic headings into the text for LLM consumption.html: Semantic HTML (.html) — Renders a responsive, visually inferred 2D DOM layout from raw spatial coordinates.hocr: hOCR (.hocr.html) — An industry-standard OCR output format embedding layout, confidence scores, and style information in standard HTML.tsv: Tab-Separated Values — Perfect for spreadsheet ingestion and tabular data analysis.txt: Plain Text — Flattens the document layout into clean, stitched paragraphs.
Audio Transcription (open/audio-transcription)
srt: SubRip Text (.srt) — The most widely used plaintext subtitle format.vtt: WebVTT (.vtt) — The W3C standard web subtitle format for HTML5 video players.md: RAG-Optimized Markdown — Merges speaker tags, non-verbal events (e.g.,[laughter]), and low-confidence warnings into clean markdown.tsv: Tab-Separated Values — Organizes segments, start/end times, and speakers into a neat table.txt: Plain Text — A continuous, readable transcript.
arXiv Metadata (dorsal/arxiv)
bib: BibTeX (.bib) — Standard bibliographic reference format.csl-json: CSL-JSON (.json) — Standard bibliographic reference format.ris: RIS (.ris) — Standard bibliographic reference format.md: RAG-Optimized Markdown — YAML frontmatter (ID, DOI, Categories, Year) and markdown formatting for ingestion into PKMs or RAG pipelines.
Installation
Dorsal Adapters is available on PyPI as dorsalhub-adapters:
pip install dorsalhub-adapters
Usage
Within Dorsal
Dorsal Adapters is a core dependency for Dorsal.
Example: using --export to generate a subtitle file:
$ dorsal run dorsalhub/whisper /home/video/test.mkv --export=srt
1
00:00:01,970 --> 00:00:05,970
You might be wondering how I ended up in this situation.
2
00:00:05,970 --> 00:00:08,970
Yeah that's me. A young subtitle.
3
00:00:08,970 --> 00:00:18,590
Little did I know what life had in store for me.
Outputs saved successfully:
↳ /home/user/sandbox/test.dorsal.json
↳ /home/user/sandbox/test.srt
--exportcan take the ID of adapter for a given output schema (e.g.mdfor Markdown ortxtfor text).
Example 2: using --export to generate a BibTeX citation from an ArXiv preprint:
$ dorsal run dorsalhub/arxiv-pdf ./examples/9304001v1.pdf --export=bibtex
@misc{solv-int_9304001,
title = {q-Discrete Toda Molecule Equation},
author = {Kenji Kajiwara and Yasuhiro Ohta and Junkichi Satsuma},
eprint = {solv-int/9304001},
archivePrefix = {arXiv},
primaryClass = {solv-int},
doi = {10.1016/0375-9601(93)90705-5},
url = {https://arxiv.org/abs/solv-int/9304001},
year = {1993}
}
Outputs saved successfully:
↳ /home/user/sandbox/arxiv-pdf/9304001v1.dorsal.json
↳ /home/user/sandbox/arxiv-pdf/9304001v1.bib
Standalone Usage
Adapters are Python classes with methods for exporting to and parsing from the supported file formats:
export(record)/export_file(record, fp): Converts a JSON record into a standard format.parse(content)/parse_file(fp): Best-effort conversion from a standard format back into a Dorsal JSON Record.
Example: Audio to Subtitles (SRT)
In this example, a valid open/audio-transcription record is converted into a subtitle file.
from dorsal_adapters.registry import get_adapter
# 1. The raw JSON record from your model
transcription = {
"track_id": 1,
"language": "eng",
"segments": [
{
"start_time": 0.5,
"end_time": 4.75,
"text": "Welcome back! Today, my guest is the renowned chef, Jean-Pierre."
}
]
}
# 2. Retrieve the adapter for the schema and target format
adapter = get_adapter("audio-transcription", "srt")
# 3. Export to the target format (.srt)
srt_string = adapter.export(transcription)
print(srt_string)
# 4. Parse the formatted string back into a Dorsal record
parsed_record = adapter.parse(srt_string)
Tip: You can programmatically check what formats are supported for a given schema using list_formats:
from dorsal_adapters.registry import list_formats
print(list_formats("document-extraction"))
Contributing
We welcome contributions! If you have written a translation script for an Open Validation Schema, please open a PR.
License
Dorsal Adapters is open source and provided under the Apache 2.0 license.
Metadata
Release files for dorsalhub-adapters 0.4.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| dorsalhub_adapters-0.4.3.tar.gz | 46.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dorsalhub_adapters-0.4.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 92.3 kB
Release files / dorsalhub_adapters-0.4.3.tar.gz
| Download URL | dorsalhub_adapters-0.4.3.tar.gz |
|---|---|
| Size | 46.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
07cb90acbda7fbafc8c2c4cd7336652f6504a890e68c37dacf009848ad516f4d
|
|
BLAKE2b-256 checksum How to use checksums |
36ecf7b90f50f068850201dd2f96c1bfb0678d0fffeaf509c3dde804efe64eda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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":null}
|
Release files / dorsalhub_adapters-0.4.3-py3-none-any.whl
| Download URL | dorsalhub_adapters-0.4.3-py3-none-any.whl |
|---|---|
| Size | 46.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e3134d1f8fb1f0959470ec564d307cbdb5ffc217061ddb6343db0e271ea3437e
|
|
BLAKE2b-256 checksum How to use checksums |
536f61a5db3add74fa162da85162b40f995beb4c2ade4b3f85dea201c4f62345
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","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":null}
|
Security for dorsalhub-adapters 0.4.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.