-
Notifications
You must be signed in to change notification settings - Fork 4.4k
fix(docx): split multiple OMML equations into separate formula items #3123
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cau-git
merged 10 commits into
docling-project:main
from
giulio-leone:fix/omml-multi-equation-paragraph
Mar 24, 2026
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
fc700b8
fix(msword): split multiple OMML equations into separate formula items
6611356
test(msword): add multi-equation paragraph test document
5c294db
test(msword): regenerate multi-equation indented-text snapshot
6a0d0ef
test: replace test doc with issue #3121 attachment
giulio-leone 940a1ee
test: regenerate groundtruth for omml_multi_equation_paragraph
giulio-leone 84cc70b
style(docx): rerun ruff formatter for msword backend
giulio-leone eb45bda
refactor(docx): drop unused tag_name binding
giulio-leone c78617f
DCO Remediation Commit for giulio-leone <giulio97.leone@gmail.com>
giulio-leone 5e11b37
test(docx): cover equation paragraph branches
giulio-leone 8ebb44d
test(docx): reuse backend fixture in msword tests
giulio-leone File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
7 changes: 7 additions & 0 deletions
7
tests/data/groundtruth/docling_v2/omml_multi_equation_paragraph.docx.itxt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| item-0 at level 0: unspecified: group _root_ | ||
| item-1 at level 1: section: group header-0 | ||
| item-2 at level 2: section_header: Issue 3: Concatenated equation blocks | ||
| item-3 at level 3: text: The paragraph below contains thr ... ts are siblings inside a single <w:p>. | ||
| item-4 at level 3: formula: a=b | ||
| item-5 at level 3: formula: c=d | ||
| item-6 at level 3: formula: e=f |
132 changes: 132 additions & 0 deletions
132
tests/data/groundtruth/docling_v2/omml_multi_equation_paragraph.docx.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| { | ||
| "schema_name": "DoclingDocument", | ||
| "version": "1.9.0", | ||
| "name": "omml_multi_equation_paragraph", | ||
| "origin": { | ||
| "mimetype": "application/vnd.openxmlformats-officedocument.wordprocessingml.document", | ||
| "binary_hash": 17520448227351822398, | ||
| "filename": "omml_multi_equation_paragraph.docx" | ||
| }, | ||
| "furniture": { | ||
| "self_ref": "#/furniture", | ||
| "children": [], | ||
| "content_layer": "furniture", | ||
| "name": "_root_", | ||
| "label": "unspecified" | ||
| }, | ||
| "body": { | ||
| "self_ref": "#/body", | ||
| "children": [ | ||
| { | ||
| "$ref": "#/groups/0" | ||
| } | ||
| ], | ||
| "content_layer": "body", | ||
| "name": "_root_", | ||
| "label": "unspecified" | ||
| }, | ||
| "groups": [ | ||
| { | ||
| "self_ref": "#/groups/0", | ||
| "parent": { | ||
| "$ref": "#/body" | ||
| }, | ||
| "children": [ | ||
| { | ||
| "$ref": "#/texts/0" | ||
| } | ||
| ], | ||
| "content_layer": "body", | ||
| "name": "header-0", | ||
| "label": "section" | ||
| } | ||
| ], | ||
| "texts": [ | ||
| { | ||
| "self_ref": "#/texts/0", | ||
| "parent": { | ||
| "$ref": "#/groups/0" | ||
| }, | ||
| "children": [ | ||
| { | ||
| "$ref": "#/texts/1" | ||
| }, | ||
| { | ||
| "$ref": "#/texts/2" | ||
| }, | ||
| { | ||
| "$ref": "#/texts/3" | ||
| }, | ||
| { | ||
| "$ref": "#/texts/4" | ||
| } | ||
| ], | ||
| "content_layer": "body", | ||
| "label": "section_header", | ||
| "prov": [], | ||
| "orig": "Issue 3: Concatenated equation blocks", | ||
| "text": "Issue 3: Concatenated equation blocks", | ||
| "level": 1 | ||
| }, | ||
| { | ||
| "self_ref": "#/texts/1", | ||
| "parent": { | ||
| "$ref": "#/texts/0" | ||
| }, | ||
| "children": [], | ||
| "content_layer": "body", | ||
| "label": "text", | ||
| "prov": [], | ||
| "orig": "The paragraph below contains three separate <m:oMath> elements.\nExpected: three separate $$ blocks ($$a = b$$, $$c = d$$, $$e = f$$)\nDocling produces: one $$ block with all equations concatenated.\n\nAll three <m:oMath> elements are siblings inside a single <w:p>.", | ||
| "text": "The paragraph below contains three separate <m:oMath> elements.\nExpected: three separate $$ blocks ($$a = b$$, $$c = d$$, $$e = f$$)\nDocling produces: one $$ block with all equations concatenated.\n\nAll three <m:oMath> elements are siblings inside a single <w:p>.", | ||
| "formatting": { | ||
| "bold": false, | ||
| "italic": false, | ||
| "underline": false, | ||
| "strikethrough": false, | ||
| "script": "baseline" | ||
| } | ||
| }, | ||
| { | ||
| "self_ref": "#/texts/2", | ||
| "parent": { | ||
| "$ref": "#/texts/0" | ||
| }, | ||
| "children": [], | ||
| "content_layer": "body", | ||
| "label": "formula", | ||
| "prov": [], | ||
| "orig": "a=b", | ||
| "text": "a=b" | ||
| }, | ||
| { | ||
| "self_ref": "#/texts/3", | ||
| "parent": { | ||
| "$ref": "#/texts/0" | ||
| }, | ||
| "children": [], | ||
| "content_layer": "body", | ||
| "label": "formula", | ||
| "prov": [], | ||
| "orig": "c=d", | ||
| "text": "c=d" | ||
| }, | ||
| { | ||
| "self_ref": "#/texts/4", | ||
| "parent": { | ||
| "$ref": "#/texts/0" | ||
| }, | ||
| "children": [], | ||
| "content_layer": "body", | ||
| "label": "formula", | ||
| "prov": [], | ||
| "orig": "e=f", | ||
| "text": "e=f" | ||
| } | ||
| ], | ||
| "pictures": [], | ||
| "tables": [], | ||
| "key_value_items": [], | ||
| "form_items": [], | ||
| "pages": {} | ||
| } |
13 changes: 13 additions & 0 deletions
13
tests/data/groundtruth/docling_v2/omml_multi_equation_paragraph.docx.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| ## Issue 3: Concatenated equation blocks | ||
|
|
||
| The paragraph below contains three separate <m:oMath> elements. | ||
| Expected: three separate $$ blocks ($$a = b$$, $$c = d$$, $$e = f$$) | ||
| Docling produces: one $$ block with all equations concatenated. | ||
|
|
||
| All three <m:oMath> elements are siblings inside a single <w:p>. | ||
|
|
||
| $$a=b$$ | ||
|
|
||
| $$c=d$$ | ||
|
|
||
| $$e=f$$ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.