Skip to content

Layout misclassifies dotted poetic line as formula, export leaves text empty #3780

Description

@rkudryashov

Bug

A poetic line with dot leaders (................ жизни картиновой ................ понесло Константиново ».) is misclassified as formula by the layout model (OCR text with ellipsis, not a math formula).

The block is exported as FormulaItem with OCR text in orig, but text is empty / missing. Parse returns success, yet json_content fails DoclingDocument.model_validate_json(). Chunking then fails: Input document parsed.json is not valid.

Setting text from orig fixes validation and chunking.

Root cause (as seen downstream): classification error → invalid schema export.

Steps to reproduce

  1. Parse attached 1-page PDF (misprocessed.pdf, poetic excerpt with dot leaders)
  2. In json_content, find item with "label": "formula" and dotted Russian text in orig, no text.
  3. Validate: ```python
    from docling_core.types.doc import DoclingDocument
    DoclingDocument.model_validate_json(open("parsed.json", "rb").read())
    → fails (`text` required on formula item).
    
  4. Chunk same JSON via /v1/chunk/hybrid/source/async (from_formats: ["json_docling"]) → 0 chunks.
  5. Add "text": "<same as orig>" → validation and chunking succeed.

Parsing options used:

{
  "do_ocr": false,
  "do_formula_enrichment": false,
  "do_code_enrichment": false,
  "to_formats": ["json", "text"]
}

Minimal fragment:

		{
			"self_ref": "#/texts/5",
			"parent": {
				"$ref": "#/body"
			},
			"content_layer": "body",
			"label": "formula",
			"prov": [omitted],
			"orig": "..................... жизни  картиновой ..................... понесло  Константиново »."
		},
		{
			"self_ref": "#/texts/6",
			"parent": {
				"$ref": "#/body"
			},
			"content_layer": "body",
			"label": "text",
			"prov": [omitted],
			"orig": "(Восп.,  2,  131)",
			"text": "(Восп.,  2,  131)"
		},

Expected: classify as text/paragraph; if labeled formula, populate text (e.g. from orig) so export passes schema validation.

Docling and Python versions

docling-serve output:

Docling version: 2.107.0
Docling Core version: 2.85.0
Docling IBM Models version: 3.13.3
Docling Parse version: 7.2.0
Python: cpython-312 (3.12.13)
Platform: Linux-6.18.33.2-microsoft-standard-WSL2-x86_64-with-glibc2.34

Attachments: 1-page PDF + JSON fragment above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions