mirror of
https://github.com/DS4SD/docling.git
synced 2025-07-26 20:14:47 +00:00
update examples
Signed-off-by: rmdg88 <rmdg88@gmail.com>
This commit is contained in:
parent
cde671cf34
commit
3a6690ca75
@ -27,19 +27,19 @@ def export_documents(
|
|||||||
doc_filename = conv_res.input.file.stem
|
doc_filename = conv_res.input.file.stem
|
||||||
|
|
||||||
# Export Deep Search document JSON format:
|
# Export Deep Search document JSON format:
|
||||||
with (output_dir / f"{doc_filename}.json").open("w") as fp:
|
with (output_dir / f"{doc_filename}.json").open("w", encoding='utf-8') as fp:
|
||||||
fp.write(json.dumps(conv_res.render_as_dict()))
|
fp.write(json.dumps(conv_res.render_as_dict()))
|
||||||
|
|
||||||
# Export Text format:
|
# Export Text format:
|
||||||
with (output_dir / f"{doc_filename}.txt").open("w") as fp:
|
with (output_dir / f"{doc_filename}.txt").open("w", encoding='utf-8') as fp:
|
||||||
fp.write(conv_res.render_as_text())
|
fp.write(conv_res.render_as_text())
|
||||||
|
|
||||||
# Export Markdown format:
|
# Export Markdown format:
|
||||||
with (output_dir / f"{doc_filename}.md").open("w") as fp:
|
with (output_dir / f"{doc_filename}.md").open("w", encoding='utf-8') as fp:
|
||||||
fp.write(conv_res.render_as_markdown())
|
fp.write(conv_res.render_as_markdown())
|
||||||
|
|
||||||
# Export Document Tags format:
|
# Export Document Tags format:
|
||||||
with (output_dir / f"{doc_filename}.doctags").open("w") as fp:
|
with (output_dir / f"{doc_filename}.doctags").open("w", encoding='utf-8') as fp:
|
||||||
fp.write(conv_res.render_as_doctags())
|
fp.write(conv_res.render_as_doctags())
|
||||||
|
|
||||||
elif conv_res.status == ConversionStatus.PARTIAL_SUCCESS:
|
elif conv_res.status == ConversionStatus.PARTIAL_SUCCESS:
|
||||||
|
@ -28,19 +28,19 @@ def export_documents(
|
|||||||
doc_filename = conv_res.input.file.stem
|
doc_filename = conv_res.input.file.stem
|
||||||
|
|
||||||
# Export Deep Search document JSON format:
|
# Export Deep Search document JSON format:
|
||||||
with (output_dir / f"{doc_filename}.json").open("w") as fp:
|
with (output_dir / f"{doc_filename}.json").open("w", encoding='utf-8') as fp:
|
||||||
fp.write(json.dumps(conv_res.render_as_dict()))
|
fp.write(json.dumps(conv_res.render_as_dict()))
|
||||||
|
|
||||||
# Export Text format:
|
# Export Text format:
|
||||||
with (output_dir / f"{doc_filename}.txt").open("w") as fp:
|
with (output_dir / f"{doc_filename}.txt").open("w", encoding='utf-8') as fp:
|
||||||
fp.write(conv_res.render_as_text())
|
fp.write(conv_res.render_as_text())
|
||||||
|
|
||||||
# Export Markdown format:
|
# Export Markdown format:
|
||||||
with (output_dir / f"{doc_filename}.md").open("w") as fp:
|
with (output_dir / f"{doc_filename}.md").open("w", encoding='utf-8') as fp:
|
||||||
fp.write(conv_res.render_as_markdown())
|
fp.write(conv_res.render_as_markdown())
|
||||||
|
|
||||||
# Export Document Tags format:
|
# Export Document Tags format:
|
||||||
with (output_dir / f"{doc_filename}.doctags").open("w") as fp:
|
with (output_dir / f"{doc_filename}.doctags").open("w", encoding='utf-8') as fp:
|
||||||
fp.write(conv_res.render_as_doctags())
|
fp.write(conv_res.render_as_doctags())
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user