From e20ca3bd78115f1d237fd588c2a9c2a28e925ef5 Mon Sep 17 00:00:00 2001 From: Nikita Shevtsov Date: Tue, 19 Sep 2023 12:11:50 +0300 Subject: [PATCH] some fixes --- dedoc/version.py | 2 +- .../dedoc_add_new_doc_type_tutorial.py | 13 +++++++++++-- ...ype.py => manager_config_example_new_doctype.py} | 0 docs/source/_static/code_examples/pdf_reader.py | 2 +- docs/source/tutorials/add_new_doc_type.rst | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) rename docs/source/_static/code_examples/{get_manager_config_example_new_doctype.py => manager_config_example_new_doctype.py} (100%) diff --git a/dedoc/version.py b/dedoc/version.py index 7602829c..e2bd0728 100644 --- a/dedoc/version.py +++ b/dedoc/version.py @@ -1 +1 @@ -__version__ = "" +__version__ = "0.11.2" diff --git a/docs/source/_static/code_examples/dedoc_add_new_doc_type_tutorial.py b/docs/source/_static/code_examples/dedoc_add_new_doc_type_tutorial.py index 7db55869..d3086613 100644 --- a/docs/source/_static/code_examples/dedoc_add_new_doc_type_tutorial.py +++ b/docs/source/_static/code_examples/dedoc_add_new_doc_type_tutorial.py @@ -1,5 +1,6 @@ -from docs.source._static.code_examples.djvu_converter import DjvuConverter -from docs.source._static.code_examples.pdf_reader import PdfReader +from dedoc import DedocManager +from djvu_converter import DjvuConverter +from pdf_reader import PdfReader import os import mimetypes @@ -27,3 +28,11 @@ document = pdf_reader.read(file_path, parameters={"with_attachments": "true"}) print(list(vars(document))) # ['tables', 'lines', 'attachments', 'warnings', 'metadata'] + + +manager = DedocManager() +result = manager.parse(file_path=file_path, parameters={}) + +print(result) # +print(result.to_dict()) # OrderedDict([('version', ''), ('warnings', []), ('content', OrderedDict([('structure', OrderedDict([('node_id', '0'), ('text', ''), ('annotations', []), ('metadata', OrderedDict([('page_id', 0), ('line_id', 0), ('paragraph_type', 'root'), ('other_fields', {})])), ... + diff --git a/docs/source/_static/code_examples/get_manager_config_example_new_doctype.py b/docs/source/_static/code_examples/manager_config_example_new_doctype.py similarity index 100% rename from docs/source/_static/code_examples/get_manager_config_example_new_doctype.py rename to docs/source/_static/code_examples/manager_config_example_new_doctype.py diff --git a/docs/source/_static/code_examples/pdf_reader.py b/docs/source/_static/code_examples/pdf_reader.py index f69beffb..64bec6e1 100644 --- a/docs/source/_static/code_examples/pdf_reader.py +++ b/docs/source/_static/code_examples/pdf_reader.py @@ -12,7 +12,7 @@ from dedoc.data_structures.unstructured_document import UnstructuredDocument from dedoc.extensions import recognized_extensions, recognized_mimes from dedoc.readers.base_reader import BaseReader -from docs.source._static.code_examples.pdf_attachment_extractor import PdfAttachmentsExtractor +from pdf_attachment_extractor import PdfAttachmentsExtractor class PdfReader(BaseReader): diff --git a/docs/source/tutorials/add_new_doc_type.rst b/docs/source/tutorials/add_new_doc_type.rst index 41917d88..a59446e1 100644 --- a/docs/source/tutorials/add_new_doc_type.rst +++ b/docs/source/tutorials/add_new_doc_type.rst @@ -246,7 +246,7 @@ The imports of the classes described above should be added to the beginning of t Then you need to add classes to the dictionary in function :meth:`get_manager_config` as follows: -.. literalinclude:: ../_static/code_examples/get_manager_config_example_new_doctype.py +.. literalinclude:: ../_static/code_examples/manager_config_example_new_doctype.py :language: python :lines: 9-29