Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions docling_core/transforms/serializer/markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -388,15 +388,12 @@ def serialize(
for row in item.data.grid
]
if len(rows) > 0:
try:
table_text = tabulate(rows[1:], headers=rows[0], tablefmt="github")
except ValueError:
table_text = tabulate(
rows[1:],
headers=rows[0],
tablefmt="github",
disable_numparse=True,
)
table_text = tabulate(
rows[1:],
headers=rows[0],
tablefmt="github",
disable_numparse=True,
)
else:
table_text = ""
if table_text:
Expand Down
4 changes: 2 additions & 2 deletions test/data/chunker/2e_out_chunks.json
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@
}
},
{
"text": "These are the trends\n| Year | Revenue (US$ bn) | Net income (US$ bn) | Employees |",
"text": "These are the trends\n| Year | Revenue (US$ bn) | Net income (US$ bn) | Employees |",
"meta": {
"schema_name": "docling_core.transforms.chunker.DocMeta",
"version": "1.0.0",
Expand Down Expand Up @@ -1073,7 +1073,7 @@
}
},
{
"text": "-\n-----|\n| 2014 | 92.7 | 12 | 379,592 |\n| 2015 | 81.7 | 13.1 | 377,757 |\nA last paragraph is down here, after the results table.",
"text": "-\n-----|\n| 2014 | 92.7 | 12.0 | 379,592 |\n| 2015 | 81.7 | 13.1 | 377,757 |\nA last paragraph is down here, after the results table.",
"meta": {
"schema_name": "docling_core.transforms.chunker.DocMeta",
"version": "1.0.0",
Expand Down
26 changes: 13 additions & 13 deletions test/data/doc/2206.01062.yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,20 +196,20 @@ In Table 2, we present baseline experiments (given in mAP) on Mask R-CNN [12], F

Table 3: Performance of a Mask R-CNN R50 network in mAP@0.5-0.95 scores trained on DocLayNet with different class label sets. The reduced label sets were obtained by either down-mapping or dropping labels.

| Class-count | 11 | 6 | 5 | 4 |
| Class-count | 11 | 6 | 5 | 4 |
|----------------|------|---------|---------|---------|
| Caption | 68 | Text | Text | Text |
| Footnote | 71 | Text | Text | Text |
| Formula | 60 | Text | Text | Text |
| List-item | 81 | Text | 82 | Text |
| Page-footer | 62 | 62 | - | - |
| Page-header | 72 | 68 | - | - |
| Picture | 72 | 72 | 72 | 72 |
| Section-header | 68 | 67 | 69 | 68 |
| Table | 82 | 83 | 82 | 82 |
| Text | 85 | 84 | 84 | 84 |
| Title | 77 | Sec.-h. | Sec.-h. | Sec.-h. |
| Overall | 72 | 73 | 78 | 77 |
| Caption | 68 | Text | Text | Text |
| Footnote | 71 | Text | Text | Text |
| Formula | 60 | Text | Text | Text |
| List-item | 81 | Text | 82 | Text |
| Page-footer | 62 | 62 | - | - |
| Page-header | 72 | 68 | - | - |
| Picture | 72 | 72 | 72 | 72 |
| Section-header | 68 | 67 | 69 | 68 |
| Table | 82 | 83 | 82 | 82 |
| Text | 85 | 84 | 84 | 84 |
| Title | 77 | Sec.-h. | Sec.-h. | Sec.-h. |
| Overall | 72 | 73 | 78 | 77 |

## Learning Curve

Expand Down
26 changes: 13 additions & 13 deletions test/data/doc/2206.01062.yaml.paged.md
Original file line number Diff line number Diff line change
Expand Up @@ -208,20 +208,20 @@ In Table 2, we present baseline experiments (given in mAP) on Mask R-CNN [12], F

Table 3: Performance of a Mask R-CNN R50 network in mAP@0.5-0.95 scores trained on DocLayNet with different class label sets. The reduced label sets were obtained by either down-mapping or dropping labels.

| Class-count | 11 | 6 | 5 | 4 |
| Class-count | 11 | 6 | 5 | 4 |
|----------------|------|---------|---------|---------|
| Caption | 68 | Text | Text | Text |
| Footnote | 71 | Text | Text | Text |
| Formula | 60 | Text | Text | Text |
| List-item | 81 | Text | 82 | Text |
| Page-footer | 62 | 62 | - | - |
| Page-header | 72 | 68 | - | - |
| Picture | 72 | 72 | 72 | 72 |
| Section-header | 68 | 67 | 69 | 68 |
| Table | 82 | 83 | 82 | 82 |
| Text | 85 | 84 | 84 | 84 |
| Title | 77 | Sec.-h. | Sec.-h. | Sec.-h. |
| Overall | 72 | 73 | 78 | 77 |
| Caption | 68 | Text | Text | Text |
| Footnote | 71 | Text | Text | Text |
| Formula | 60 | Text | Text | Text |
| List-item | 81 | Text | 82 | Text |
| Page-footer | 62 | 62 | - | - |
| Page-header | 72 | 68 | - | - |
| Picture | 72 | 72 | 72 | 72 |
| Section-header | 68 | 67 | 69 | 68 |
| Table | 82 | 83 | 82 | 82 |
| Text | 85 | 84 | 84 | 84 |
| Title | 77 | Sec.-h. | Sec.-h. | Sec.-h. |
| Overall | 72 | 73 | 78 | 77 |

## Learning Curve

Expand Down
38 changes: 19 additions & 19 deletions test/data/doc/2408.09869v3_enriched.out.dt.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/data/doc/barchart.dt.out.json

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions test/data/doc/barchart.gt.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Bar chart

| Number of impellers | single-frequency | multi-frequency |
| Number of impellers | single-frequency | multi-frequency |
|-----------------------|--------------------|-------------------|
| 1 | 0.06 | 0.16 |
| 2 | 0.12 | 0.26 |
| 3 | 0.16 | 0.27 |
| 4 | 0.14 | 0.26 |
| 5 | 0.16 | 0.25 |
| 6 | 0.24 | 0.24 |
| 1 | 0.06 | 0.16 |
| 2 | 0.12 | 0.26 |
| 3 | 0.16 | 0.27 |
| 4 | 0.14 | 0.26 |
| 5 | 0.16 | 0.25 |
| 6 | 0.24 | 0.24 |

<!-- image -->
6 changes: 3 additions & 3 deletions test/data/doc/constructed_doc.embedded.md.gt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ This paper introduces the biggest invention ever made. ...

This is the caption of table 1.

| Product | Years | Years |
| Product | Years | Years |
|-----------|---------|---------|
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |

This is the caption of figure 1.

Expand Down
6 changes: 3 additions & 3 deletions test/data/doc/constructed_doc.placeholder.md.gt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ This paper introduces the biggest invention ever made. ...

This is the caption of table 1.

| Product | Years | Years |
| Product | Years | Years |
|-----------|---------|---------|
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |

This is the caption of figure 1.

Expand Down
6 changes: 3 additions & 3 deletions test/data/doc/constructed_doc.referenced.md.gt
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ This paper introduces the biggest invention ever made. ...

This is the caption of table 1.

| Product | Years | Years |
| Product | Years | Years |
|-----------|---------|---------|
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |

This is the caption of figure 1.

Expand Down
6 changes: 3 additions & 3 deletions test/data/doc/constructed_document.yaml.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ This paper introduces the biggest invention ever made. ...

This is the caption of table 1.

| Product | Years | Years |
| Product | Years | Years |
|-----------|---------|---------|
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |

This is the caption of figure 1.

Expand Down
6 changes: 3 additions & 3 deletions test/data/doc/constructed_legacy_annot_mark_false.gt.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ This is the caption of table 1.

This is a description of table 1.

| Product | Years | Years |
| Product | Years | Years |
|-----------|---------|---------|
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |

This is the caption of figure 1.

Expand Down
6 changes: 3 additions & 3 deletions test/data/doc/constructed_legacy_annot_mark_true.gt.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ This is the caption of table 1.

<!--<annotation kind="description">-->This is a description of table 1.<!--<annotation/>-->

| Product | Years | Years |
| Product | Years | Years |
|-----------|---------|---------|
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |

This is the caption of figure 1.

Expand Down
6 changes: 3 additions & 3 deletions test/data/doc/constructed_mode_always_valid_false.gt.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ This paper introduces the biggest invention ever made. ...

This is the caption of table 1.

| Product | Years | Years |
| Product | Years | Years |
|-----------|---------|---------|
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |

This is the caption of figure 1.

Expand Down
6 changes: 3 additions & 3 deletions test/data/doc/constructed_mode_always_valid_true.gt.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ This paper introduces the biggest invention ever made. ...

This is the caption of table 1.

| Product | Years | Years |
| Product | Years | Years |
|-----------|---------|---------|
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |

This is the caption of figure 1.

Expand Down
6 changes: 3 additions & 3 deletions test/data/doc/constructed_mode_auto_valid_false.gt.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ list item 4

This is the caption of table 1.

| Product | Years | Years |
| Product | Years | Years |
|-----------|---------|---------|
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |

This is the caption of figure 1.

Expand Down
6 changes: 3 additions & 3 deletions test/data/doc/constructed_mode_auto_valid_true.gt.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ This paper introduces the biggest invention ever made. ...

This is the caption of table 1.

| Product | Years | Years |
| Product | Years | Years |
|-----------|---------|---------|
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |

This is the caption of figure 1.

Expand Down
6 changes: 3 additions & 3 deletions test/data/doc/constructed_mode_never_valid_false.gt.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ list item 4

This is the caption of table 1.

| Product | Years | Years |
| Product | Years | Years |
|-----------|---------|---------|
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |

This is the caption of figure 1.

Expand Down
6 changes: 3 additions & 3 deletions test/data/doc/constructed_mode_never_valid_true.gt.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ This paper introduces the biggest invention ever made. ...

This is the caption of table 1.

| Product | Years | Years |
| Product | Years | Years |
|-----------|---------|---------|
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |
| Product | 2016 | 2017 |
| Apple | 49823 | 695944 |

This is the caption of figure 1.

Expand Down
2 changes: 1 addition & 1 deletion test/data/doc/doc_with_kv.dt.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/data/doc/page_with_pic.dt.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions test/data/doc/page_with_pic_from_files.dt.json

Large diffs are not rendered by default.

Loading