ontocast.onto.docling_helpers¶
Helpers for constructing and normalizing DoclingDocument instances.
docling-core is resolved on demand: it ships in the documents extra, and
these helpers sit on the import path of modules the light core does load.
apply_text_sanitizers(doc, *, repair_ligature_gaps_enabled=False)
¶
Apply optional post-conversion text sanitizers to a DoclingDocument.
Source code in ontocast/onto/docling_helpers.py
json_payload_text(payload)
¶
Document text inside a JSON payload, by a small top-level heuristic.
text when present, else the longest top-level string. Lives here rather
than in the conversion agent because JSON inputs are routed around the
Docling converter entirely -- anything that reads a document from a path has
to make the same choice, and two copies of the heuristic would let the CLI
and the pipeline disagree about what a file's text even is.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
payload
|
object
|
Parsed JSON, expected to be an object. |
required |
Returns:
| Type | Description |
|---|---|
str | None
|
The document text, or |
str | None
|
holds no string. |
Source code in ontocast/onto/docling_helpers.py
plain_text_to_docling_doc(text, doc_name)
¶
Wrap plain text as a single-paragraph DoclingDocument.