mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-27 04:24:45 +00:00
switch to code formula model v1.0.1 and new test pdf
Signed-off-by: Matteo-Omenetti <Matteo.Omenetti1@ibm.com>
This commit is contained in:
parent
89844a5725
commit
68d1713802
@ -62,7 +62,7 @@ class CodeFormulaModel(BaseItemAndImageEnrichmentModel):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
images_scale = 1.66 # = 120 dpi, aligned with training data resolution
|
images_scale = 1.66 # = 120 dpi, aligned with training data resolution
|
||||||
expansion_factor = 0.05
|
expansion_factor = 0.03
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
|
Binary file not shown.
@ -48,11 +48,11 @@ def test_code_and_formula_conversion():
|
|||||||
code_blocks = [el for el in results if isinstance(el, CodeItem)]
|
code_blocks = [el for el in results if isinstance(el, CodeItem)]
|
||||||
assert len(code_blocks) == 1
|
assert len(code_blocks) == 1
|
||||||
|
|
||||||
gt = 'int main() {\n printf("Hello, World!");\n return 0;\n}'
|
gt = 'function add(a, b) {\n return a + b;\n}\nconsole.log(add(3, 5));'
|
||||||
|
|
||||||
predicted = code_blocks[0].text.strip()
|
predicted = code_blocks[0].text.strip()
|
||||||
assert predicted == gt, f"mismatch in text {predicted=}, {gt=}"
|
assert predicted == gt, f"mismatch in text {predicted=}, {gt=}"
|
||||||
assert code_blocks[0].code_language == CodeLanguageLabel.C_PLUS_PLUS
|
assert code_blocks[0].code_language == CodeLanguageLabel.JAVASCRIPT
|
||||||
|
|
||||||
formula_blocks = [
|
formula_blocks = [
|
||||||
el
|
el
|
||||||
@ -61,6 +61,6 @@ def test_code_and_formula_conversion():
|
|||||||
]
|
]
|
||||||
assert len(formula_blocks) == 1
|
assert len(formula_blocks) == 1
|
||||||
|
|
||||||
gt = "a ^ { 2 } + 8 = 1 2"
|
gt = "x ^ { 2 } + 8 = 1 2"
|
||||||
predicted = formula_blocks[0].text
|
predicted = formula_blocks[0].text
|
||||||
assert predicted == gt, f"mismatch in text {predicted=}, {gt=}"
|
assert predicted == gt, f"mismatch in text {predicted=}, {gt=}"
|
||||||
|
Loading…
Reference in New Issue
Block a user