docs: fix batch convert (#177)

Signed-off-by: Michele Dolfi <dol@zurich.ibm.com>
This commit is contained in:
Michele Dolfi 2024-10-26 05:50:34 +02:00 committed by GitHub
parent 7d19418b77
commit 189d3c2d44
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -13,7 +13,7 @@ from docling.document_converter import DocumentConverter
_log = logging.getLogger(__name__) _log = logging.getLogger(__name__)
USE_V2 = True USE_V2 = True
USE_LEGACY = False USE_LEGACY = True
def export_documents( def export_documents(
@ -77,7 +77,7 @@ def export_documents(
with (output_dir / f"{doc_filename}.legacy.doctags.txt").open( with (output_dir / f"{doc_filename}.legacy.doctags.txt").open(
"w", encoding="utf-8" "w", encoding="utf-8"
) as fp: ) as fp:
fp.write(conv_res.legacy_document.export_to_doctags()) fp.write(conv_res.legacy_document.export_to_document_tokens())
elif conv_res.status == ConversionStatus.PARTIAL_SUCCESS: elif conv_res.status == ConversionStatus.PARTIAL_SUCCESS:
_log.info( _log.info(