Preprint
Article

This version is not peer-reviewed.

Hybrid Approach to Structural and Logical Analysis of DOCX Documents for Ensuring the Security of Electronic Document Management

Submitted:

25 November 2026

Posted:

26 November 2026

You are already at the latest version

Abstract
This article addresses the need for structural and logical analysis of DOCX documents to ensure the security of electronic document management and automate compliance verification with established formatting requirements. Based on the analysis of scientific works, it has been established that most modern solutions in the field of document processing are oriented mainly towards PDF files, scanned images, or unstructured text data. In contrast, the DOCX format, in which the structure of a document is defined by styles, heading levels, sections, and embedded objects, remains insufficiently covered from the point of view of both structural analysis and information security. This necessitates the development of specialized approaches to the automated detection of the logical components of a document, the analysis of its internal structure, and the detection of potentially dangerous or hidden elements. The aim of the study is the development and experimental verification of a hybrid approach to the structural and logical analysis of DOCX documents for increasing the level of security of electronic document management. The proposed approach combines sequential parsing of the document content, style analysis, processing of formatting parameters, and the application of segmentation rules for identifying the title page, chapters, subsections, bibliography, tables, images, and appendices. The software implementation was carried out in Python using the python-docx library, which provides access to the internal XML structure of the file and allows preserving the semantic and visual parameters of the document. Additionally, the possibility of analyzing structural anomalies, hidden objects, and inconsistencies that may indicate potential security threats is provided. The result of the work is the construction of a standardized hierarchical JSON model suitable for further compliance control and security analysis of documents. Experimental testing of the created prototype on documents of different types confirmed its ability to correctly identify the main structural elements, restore the logical relationships between them, and form a unified internal representation of the document with high accuracy. The proposed approach makes it possible to detect structural anomalies and potentially dangerous elements of a document. The practical significance of the obtained results lies in the possibility of using the proposed approach not only for automating compliance control and standardization of documents, but also as a tool for increasing the level of information security in electronic document management systems.
Keywords: 
;  ;  ;  ;  ;  ;  ;  

1. Introduction

In the process of creating text content for users of different levels of training and task complexity, the DOCX document format is traditionally regarded mainly as a product of modern information systems rather than as an object of structural analysis and information security control. Such an approach limits the possibilities of automated verification of documents with respect to detecting deviations in styles, indents, and the logical structure of the presented material, which, in turn, complicates or makes impossible the correct further processing of documents and the detection of potentially dangerous or hidden elements. In addition, in the practice of preparing academic texts, in particular reports, scientific articles, term papers, and graduation qualification theses, difficulties often arise related to compliance with the requirements of standards and regulatory documents for the internal structure and formatting of this type of work. The processes of detecting, correcting, and forming recommendations for eliminating deviations from the established formal requirements are a labor-intensive technical task for a specialist, which reduces the work efficiency of all stakeholders and necessitates the search for approaches to automating such technical and repetitive procedures. At the same time, in modern electronic document management systems, there is a need to ensure the integrity and security of documents.
At the current stage of development of information technologies, a significant number of tools for analyzing text data are available; however, most of them are oriented towards studying the semantic or quantitative characteristics of a text, such as keywords, the number of words, sentences, or characters. Such approaches do not provide the possibility of restoring the logical structure of a document in accordance with the formalized requirements of a specific standard or regulatory document and do not take into account the tasks of ensuring information security. The analysis of scientific sources has shown that a partial solution to this problem is proposed in studies devoted to optical character recognition and intelligent document parsing [1]. However, such solutions are mainly oriented towards processing unstructured or visual formats, in particular PDF, and do not take into account the specifics of the DOCX format, in which the structure of a document is determined by styles, heading levels, page parameters, and embedded objects. In addition, such approaches pay insufficient attention to the detection of hidden structural components and potentially dangerous elements of a document.
This problem becomes particularly relevant in scientific and educational activities, where compliance of formatting with established standards is a necessary condition for successfully passing an expert review, a defense, or the publication of research results. At the same time, it is important to ensure the secure processing of documents in electronic document management environments. In this regard, the development of algorithms capable of analyzing the internal structure of DOCX documents is of great practical importance for the field of science and education and for the protection of information systems.
The aim of the article is the development of a hybrid approach to the structural and logical analysis of DOCX documents in order to increase the level of security of electronic document management by detecting structural anomalies, hidden elements, and potentially dangerous components of a document.
To achieve the stated aim, the following research objectives have been defined: to analyze the existing approaches in modern literature sources to the processing of text documents and to determine their limitations with respect to the DOCX format; to develop an algorithm for sequential parsing and structural and logical analysis of a document; to implement a software prototype using the Python language and the python-docx library; to ensure the formation of a hierarchical JSON model of a document preserving its logical and formatting properties; to carry out an experimental verification of the effectiveness of the proposed approach.
The approach proposed by the authors is based on an algorithm of sequential parsing of the content of a text document, which makes it possible to determine the boundaries of its structural components, in particular chapters, subsections, tables, bibliography and appendices, to record style parameters and analyze their compliance with the established requirements, and to detect structural anomalies of the document. To implement the proposed solution, the methods of structural analysis and formal decomposition, the Python programming language, and the python-docx library, which provides access to all levels of elements of a DOCX file, were used. This makes it possible to preserve both the logical and the formatting properties of the document under study, which is a necessary condition for further algorithmic processing and analysis from the point of view of security.
The software implementation is presented in the form of a prototype software application that performs three main functions: extraction of the structural elements of a document, construction of their hierarchical model, and verification of the correctness of formatting. The result of the operation of such a tool is the formation of a structured representation of the document in which the logical relationships between its elements, in particular the title page, chapters, tables, and appendices, are restored. This creates prerequisites for increasing the efficiency of working with text documents by automating the processes of verifying compliance with the established requirements and formatting standards and can be used to increase the level of security of document processing.
To substantiate the proposed approach, the authors present a description of the research stages, which combine theoretical modeling of the document structure, experimental verification of the algorithms, and evaluation of the effectiveness of applying the developed software tool in a working environment.

2. Literature Review

Within this study, the main attention is focused on the problem of automated structural and logical analysis of DOCX documents, as well as on the development of algorithms for converting, parsing, and standardizing the structure of a text document taking into account information security requirements. This issue is covered in a number of modern scientific works that form the theoretical and methodological basis for the development of the proposed approach. In particular, the work of the authors [2] presents software for analyzing text documents in doc, docx, txt, and pdf formats, which performs a statistical count of the structural elements of a document (paragraphs, sentences, words) and generates a visualized report. The obtained results demonstrate the possibilities of practical application of basic algorithms for analyzing the structure of text files and confirm the expediency of using software tools for automating document processing, including in the context of controlling their integrity.
Directly related to the issue of structural analysis of DOCX documents is the study by the authors [3], which describes a software system implemented on the basis of .NET, WPF, and DocumentFormat.OpenXML technologies that provide automated compliance control of technical report text. The principles of controlling formatting parameters proposed in this work, in particular styles, page size, and the use of empty lines, as well as the modular architecture of the software solution, are conceptually close to the approaches used in the developed structural analysis algorithm and can be applied to detect structural deviations that affect the security of a document. The work of the authors [4] considers the possibilities of using parser programs for the automated extraction of data from text documents, which provides syntactic and lexical analysis of large volumes of text information. This approach was used as the basis for implementing the parsing stage in the developed structural analysis algorithm. Methods of optical character recognition (OCR) and the use of artificial intelligence models for document parsing are considered in the study by V. Maidaniuk and A. Koziichuk [1], which substantiates the expediency of combining traditional methods of text data processing with intelligent algorithms in order to increase the accuracy of document structure recognition.
Approaches to the assembling and reassembling of documents in electronic document management systems, related to ensuring the integrity of the document structure during transformations, are also considered in the study [2]. The presented results are relevant to the task of forming a hierarchical model of a DOCX file and preserving the structural relationships between document elements, taking into account the requirements for their secure processing.
Additionally, scientific sources devoted to the agent-ontological approach to document analysis were analyzed [5], which opens up possibilities for the transition from syntactic analysis to the semantic interpretation of the document structure. The issues of integrating electronic document management systems into the business environment and the role of metadata and artificial intelligence for indexing documents are considered in the study [6,7]. The obtained results can be used for the further expansion of the functional capabilities of the proposed module, in particular for the automated generation of metadata in the process of structural analysis of documents, as well as for the detection of hidden data that may affect information security. The work [8] emphasizes that intelligent document processing is a promising direction of automation capable of ensuring efficient work with unstructured data. Such an approach creates prerequisites for the further improvement of the proposed prototype by integrating intelligent analysis methods. The study [1] presents a method for extracting data from unstructured documents using large language models (LLMs), which demonstrates the prospects of applying modern artificial intelligence models for the automated identification of content blocks of a document.
The issue of verifying the originality of text materials, considered in the work [9], is adjacent to the direction of this study, since the combination of analysis of the structure and content of a document makes it possible to create comprehensive tools for assessing the quality, uniqueness, and compliance of documents with established standards, as well as to increase the level of trust in documents in information systems.
Modern studies extend these approaches through the use of hybrid and intelligent technologies. In particular, the work of Auer et al. [10] proposes the Docling framework, which combines parsing algorithms with machine learning methods for document segmentation and identification of logical blocks. The work [11] systematizes parsing methods and identifies key challenges, in particular the complexity of restoring the document hierarchy and the dependence of results on preprocessing, and also outlines the prospects of using large language models. At the same time, the fundamental basis of DOCX analysis is the Office Open XML standard [12], which defines the internal XML structure of a document. Practical aspects of verifying the formatting of academic documents are considered by Svintsytska et al. [13], where the effectiveness of algorithmic control of styles and formatting parameters has been confirmed. Additionally, the works [1,4,5,7,9] consider agent-ontological approaches, intelligent document processing, the use of LLMs and the tasks of verifying the originality of texts, which extend the possibilities of analysis from the syntactic to the semantic level and create prerequisites for using such approaches in information security tasks.
Thus, the conducted analysis indicates a significant development of approaches to automated document processing. At the same time, most existing solutions are either oriented towards PDF and unstructured data or do not fully take into account the specifics of DOCX, where the structure is determined by styles and the hierarchy of elements. In addition, the issues of using structural analysis of documents to ensure information security remain insufficiently studied. This substantiates the expediency of developing a specialized approach aimed at a comprehensive structural and logical analysis of DOCX documents taking into account both the XML structure and the formatting parameters, with the possibility of detecting potential threats.

3. Materials and Methods

3.1. Research Design and Document Model

To achieve the stated aim, the authors carried out both theoretical and applied research and substantiated the sequence of the following stages: structural and logical modeling, algorithmic design and software implementation, aimed at the creation and experimental verification of the operation of the program, as well as its effectiveness in a working environment. On the basis of the DOCX format, which is a container of XML files with the structure of a text document hidden in the form of tags and style properties, the authors carried out preliminary modeling of its internal structure, which is not amenable to automatic verification without prior structural analysis and unification of data, in particular when checking integrity, detecting hidden elements and potential structural anomalies of the document.
At the stage of theoretical modeling, the authors presented the main entities of a document – the title page, chapters, subsections, tables and appendices. For them, a set of attributes was described, such as content, style, and page parameters, which make up the target data hierarchy. As noted above, the modeling was based on the principles of formal decomposition, i.e., the division of a document into logical structural components, and of hierarchical data representation, in particular through preserving the logic and relationships within the structure. The result was the creation of an internal model of the structure in JSON format, in which sections of the type title_page, chapter, and appendix are described with content and formatting parameters, which creates the basis for further analysis of the document not only from the point of view of compliance with formatting requirements, but also from the point of view of secure processing in electronic document management systems.
For the applied substantiation, the Python language and the python-docx library were chosen. The advantage of choosing Python is that this language provides high speed in processing XML structures, supports convenient tools for analyzing text data, and has a set of libraries for working with documents of various formats. The python-docx library was chosen for simple and convenient access to the structural elements of a docx file. The choice of the python-docx library is determined not only by its openness but also by its use in scientific and applied research, as well as by the possibility of accessing the internal XML structure of DOCX documents without losing formatting. This makes it possible to ensure the reproducibility of the results and the correctness of comparison with other tools. Such a combination made it possible to implement the main stages of the algorithm: data extraction, identification of structural elements and construction of their hierarchical relationships, and the construction of the internal model of the document in JSON format with the possibility of preserving the content, style parameters, headings, numbering and embedded objects, which is important for detecting non-standard or hidden components of a DOCX file.
Thus, the created tool provides a transition from the unstructured content of DOCX to a standardized data representation suitable for further automatic verification of compliance with formatting requirements, as well as for the analysis of structural features that may indicate an integrity violation or the presence of potentially dangerous elements of the document.
The next stage was the construction of the segmentation algorithm, which is implemented in the function build_hierarchical_structure(). The method of step-by-step iteration and contextual analysis made it possible to restore the sequence of the parts of a document even in the case of minor violations of the structure. The obtained data are presented in the form of a hierarchical JSON object, which provides the possibility of their further processing, verification, and integration with formatting quality control modules.
The experimental part of the study is aimed at developing a software prototype with three modules:
  • ConverterDocx – performs parsing and initiates the Styling Mapping procedure;
  • DocxLibrary – performs low-level extraction of objects from the file;
  • InternalModel – forms a standardized JSON structure for further validation, integrity analysis, and detection of structural anomalies of the document.
The authors set and accomplished the task of confirming the effectiveness of the developed algorithm on the basis of testing 50 text documents (reports, term papers, scientific articles) that differed in volume, number of chapters, and complexity of formatting. At this stage, the ability of the program to correctly recognize the structure of a document and to identify the title page, chapters, subsections, tables and appendices was confirmed. This made it possible to draw conclusions regarding the scientific expediency of further research, as well as to determine the practical significance of this development in the scientific and educational environment in particular.

3.2. Conversion and Standardization Algorithm

On the basis of the described stages, let us present a detailed description of the algorithm for converting and standardizing the input format, which implements the process of sequential parsing and formation of a unified JSON model.
The aim of the conversion is to transform a DOCX document into a structured internal data model suitable for analysis, automated verification, and further control of the secure processing of the document. The algorithm for converting and standardizing the input format is presented below:
Input: a .docx file.
Processing: the python-docx library is used for step-by-step parsing.
Extraction – extraction of all objects of the document, such as text (from paragraphs), tables, images, section properties, as well as recording of embedded and service elements that may be of importance for assessing the structure and security of the document.
  • Styling Mapping: for each paragraph, its internal style (for example, Heading 1, Normal) and all formatting parameters applied locally (font size, alignment, indent) are recorded.
The result of the algorithm is the formation of a unified internal model of the document in JSON format, an example of which is shown in Figure 1.
At the output, a standardized hierarchical object is formed, suitable for further verification of compliance with formatting requirements.
The conversion process reflects the interaction of the main components of the system and the distribution of functions between them:
  • the DOCX converter manages the overall logic of document processing, including the Styling Mapping stage;
  • the python-docx library provides low-level parsing and extraction of the structural elements of the document;
  • the internal data model accumulates the processing results and forms a standardized JSON structure.
The diagram (see Figure 2) shows the process of transforming an input .docx file into a standardized hierarchical JSON model, which is used for further verification of compliance with formatting requirements:
Initialization and parsing of the input file. The first stage (Table 1) is loading and preparing the document for analysis.
Step-by-step extraction and mapping. The stage where all raw data are extracted and matched (mapped) to the internal standards (Table 2).
Structuring and finalization of the model. After all individual parts have been extracted, the data are organized into a hierarchical structure (Table 3).
Result. The JSON structure (Table 4) is ready for further processing (for example, for verification of compliance with DSTU standards).
This algorithm ensures the correct transformation, even of those documents that contain incorrect formatting or do not use built-in styles, into a single standardized format suitable for further analysis.

3.3. Document Segmentation Algorithm

After the conversion stage is completed, the document segmentation procedure is carried out, which makes it possible to identify its structural components and restore the logical sequence of chapters, subsections, and appendices.
The aim of document segmentation is the automatic determination of the logical parts of a document necessary for applying specialized rules for verifying compliance with formatting requirements and rules for detecting structural inconsistencies that may affect the secure processing of the document.
Document segmentation methods used:
1. Identification of the title page and table of contents. The title page and the table of contents are determined on the basis of positional analysis (the first or second page of the document), as well as by the presence of characteristic text markers or the absence of page numbering.
2. Segmentation of chapters and subsections. The analysis of paragraph styles (for example, “Heading 1”, “Heading 2”) is performed. In the absence of styles, regular expression analysis is applied to detect numerical prefixes of headings (1., 2.1., 3.2.3), which makes it possible to establish the hierarchy of structural elements.
3. Identification of the bibliography (list of references). The bibliographic section is defined as the last structural element of the document containing a characteristic heading (for example, “List of references”, “Literature”).
4. Identification of appendices. Appendices are identified by the presence of headings containing the keyword “Appendix” (for example, “Appendix A”, “Appendix B”).
The next stage is the automatic segmentation of the input document into discrete logical parts (sections) for the further application of specific context-dependent validation and analysis rules. The input and output data are presented in Table 5.
The specification of the output structure Section Object is given in Table 6. This object is a composition of the fields Section={ID, Title, Type, ContentElements}, which makes it possible to unify the representation of different structural parts of the document for further segmentation.
The segmentation algorithm Aseg consists of four sequential stages and uses auxiliary modules: Style Analyzer (Mstyle) and Regular Expression Module (Mregex). The segmentation algorithm (Segmentation Algorithm) includes:
Stage 1. Identification of initial sections (E1) is aimed at identifying non-textual (non-numbered) structures at the beginning of the document.
Objects to be identified: Title page (Title Page) and Table of contents (Table of Contents).
Identification rules:
  • Position. Analysis of the first k pages (where k≤2).
  • Absence of numbering. Checking the absence (or a specific format) of headers/footers and numbering.
  • Keywords. Search for characteristic text ("Title", "CONTENTS", etc.) in the first sections.
  • Style. Identification of paragraphs with the styles Title or Subtitle.
Stage 2. Segmentation of chapters and subsections (E2) is the main stage of the structural division of the document into chapters and subchapters (Table 7).
Stage 3. Identification of the bibliography (E3) of the section containing references.
Condition. Section Slast is the last in the document, or the text matches the pattern heading Slast. Title contains keywords.
Keywords.
Kbiblio={"List of references", "Literature", "Bibliography", "List of sources"}
Stage 4. Identification of appendices (E4) - identification of any structures that follow the main text and have a special designation.
Condition. The section heading Sapp contains the keyword.
Keyword: Kappendix = {"Appendix"} (for example, "Appendix A. Diagram...").
Interaction of modules (Diagram Summary). The segmentation module is the main module, which uses the results of the work of the two other modules, if necessary as shown in the sequence diagram in Figure 2:
A seg ⇐ ( M style ∨ M regex )
where Mstyle is the function of analyzing document styles, and Mregex is the function of analyzing text patterns, implemented by means of regular expressions.
The determination of a logical part of the document is carried out by means of a combined analysis of structural features:
Logical   part   of   the   document = A seg ( Element ∣ Style   Analysis ∨ Regex   Analysis )
Such an approach makes it possible to ensure correct segmentation even in cases of the absence of styles or the presence of unstructured formatting.

3.4. Software Implementation

The stages of structural analysis presented above and the constructed logical scheme of module interaction form the basis of the practical implementation of the developed algorithm. In order to verify the operability, accuracy, and effectiveness of the proposed approach, a software prototype was developed in Python using the python-docx library, which provides access to the internal XML structure of DOCX documents. The implemented prototype covers all the main stages of the algorithm:
  • document parsing;
  • extraction of structural elements;
  • style analysis;
  • document segmentation;
  • formation of a standardized JSON model for further verification, compliance control, and security analysis of the document structure.
The implementation process is based on the use of three key functions:
  • extract_paragraph_data() – extraction of the text and formatting parameters of paragraphs;
  • extract_table_data() – obtaining the structure and properties of tables;
  • build_hierarchical_structure() – formation of the hierarchical structure of the document.
To illustrate the practical implementation of the algorithm, an example of the function extract_paragraph_data() is given, which provides the paragraph text and its formatting parameters (Figure 3).
The next stage involves the construction of the hierarchical structure of the document using the function build_hierarchical_structure(), which forms chapters and subsections on the basis of heading styles (Figure 4).
Below is an example demonstrating the result of converting data into a standardized logical structure of the document in JSON format (Figure 5).

4. Results

The testing of the software prototype on documents of different types (reports, term papers and scientific articles) with a volume of 25 to 70 pages showed the correct identification of the main structural elements of a document, in particular the title page, chapters, subsections, tables and appendices. The preservation of the hierarchical relationships between them was also confirmed. To evaluate the effectiveness of the proposed approach, standard classification quality metrics were used: Precision, Recall, and F1-score. The formation of the reference sample (ground truth) was carried out by manual annotation of the structural elements of documents by experts. The sample included documents of different types, which made it possible to ensure the representativeness of the experiment.
The evaluation was carried out by comparing the automatically determined structural elements with the reference annotation (Table 8).
On average, the time to form a standardized JSON structure for documents of the specified volume was up to 3 s, while the accuracy of reproducing the logical structure was estimated at about 95-98 %.
For additional validation of the effectiveness of the proposed approach, a comparison with existing tools for processing DOCX documents was carried out (Table 9).
The comparative analysis (Table 9) is based on a sample of tools classified by such features as coverage of basic functionality, intensity of use in real-world scenarios, and the ability to perform full structural decomposition of documents. Such an approach guarantees the impartiality of the assessment and demonstrates the place of the proposed model in the hierarchy of modern document processing solutions. Thus, the choice of tools ensures an objective and balanced comparison, which makes it possible to evaluate the effectiveness of the proposed approach relative to both basic and high-level solutions.
The obtained results indicate the advantage of the proposed approach, which is explained by the combination of the analysis of styles and text patterns, which makes it possible to compensate for the shortcomings of individual methods.
The obtained results demonstrate that:
the highest accuracy is achieved in recognizing headings, which is explained by the stability of styles in DOCX documents;
the most difficult to analyze are bibliographic entries, due to their variability and lack of standardization;
the proposed approach provides:
(a) more accurate restoration of the structure;
(b) correct hierarchy of chapters;
(c) stability when the document formatting changes.
The obtained results confirm the operability and effectiveness of the proposed approach and indicate the possibility of its application for automated verification of document formatting in scientific and educational activities, as well as for preliminary analysis of their structure in electronic document management systems from the standpoint of integrity and secure processing.

5. Discussion

The obtained results confirm the expediency of applying a hybrid approach to the structural and logical analysis of DOCX documents in the tasks of ensuring the security of electronic document management. Unlike existing solutions, oriented mainly towards PDF files, scanned images, or unstructured text data, the proposed approach takes into account the specifics of DOCX documents, in which the logical structure is formed by means of styles, heading levels, page parameters, sections, and embedded objects. The combination of the analysis of styles, formatting parameters, and text patterns ensured an increase in the accuracy of identifying structural elements and the correct restoration of the document hierarchy.
The analysis of the obtained results shows that the highest accuracy is achieved in recognizing headings, which is explained by the relative stability of the use of styles in DOCX documents. At the same time, the most difficult for automated analysis are bibliographic entries, which is due to their variability, the absence of unified formatting, and the heterogeneity of structural features. This confirms the need to use a combined approach that combines style analysis with the application of regular expressions and context-dependent segmentation rules.
The comparative analysis with existing tools for processing DOCX documents demonstrates the advantage of the proposed approach in terms of Precision, Recall, F1-score, and Accuracy. Such a result is explained by the fact that the developed approach is oriented not only towards extracting text content, but also towards restoring the logical relationships between the structural components of the document. The formation of a standardized hierarchical JSON model provides the possibility of further integration with automated compliance control systems, as well as with modules for integrity verification and detection of structural anomalies of the document.

6. Conclusions

Thus, the stated aim of the study has been achieved, since an algorithm has been developed and a software prototype has been created that implements the stages of structural analysis of DOCX documents on the basis of formalizing their internal logical structure. The proposed approach provides automatic identification of the main structural elements of a document, in particular the title page, chapters, subsections, tables and appendices, as well as the restoration of the hierarchical relationships between them with subsequent transformation into a standardized JSON model.
At the same time, the conducted study has certain limitations. In particular, the created prototype is focused mainly on the stage of structural analysis of documents and does not fully cover the functions of automated verification of compliance with formatting requirements, as well as a full-fledged analysis of malicious macros, metadata, and other potentially dangerous components of DOCX files. In addition, testing was carried out on a limited sample of documents, which requires further verification of the scalability of the proposed approach for a wider range of document types and formatting standards.
The prospects for further research lie in expanding the functional capabilities of the created prototype in the direction of semantic analysis of document content, intelligent verification of formatting quality in accordance with established standards, detection of hidden elements, metadata, macros and other potentially dangerous components of DOCX files, as well as integration with information repositories and artificial intelligence models for building comprehensive systems for the automated assessment of the structure, content and quality of documents.
Thus, the results of the study form a scientifically substantiated and practically oriented basis for creating effective systems for automated control of the structure, formatting, and secure processing of documents in the field of education, scientific activity, and electronic document management systems.

Author Contributions

Conceptualization, G.M.; methodology, G.M. and O.S.; software, D.M.; validation, O.S., O.K. and D.M.; formal analysis, O.S. and D.M.; writing—original draft preparation, O.K.; writing—review and editing, G.M. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Data Availability Statement

The data presented in this study are available on reasonable request from the corresponding author.

Acknowledgments

During preparation of this manuscript, the authors used Claude (Anthropic) to translate the text from Ukrainian into English and to format the manuscript. The authors have reviewed and edited the output and take full responsibility for the content of this publication.

Conflicts of Interest

The authors declare no conflicts of interest.

Abbreviations

The following abbreviations are used in this manuscript:
AI Artificial Intelligence
DOCX Office Open XML Word Document Format
DSTU National Standard of Ukraine
JSON JavaScript Object Notation
LLM Large Language Model
OCR Optical Character Recognition
PDF Portable Document Format
XML Extensible Markup Language

References

  1. Maidaniuk, V.; Koziichuk, A. Optical character recognition (OCR) and document parsing using AI models. In Proceedings of the IV All-Ukrainian Scientific and Technical Conference of VNTU Departments, Vinnytsia, Ukraine, 24–27 March 2025; (In Ukrainian) Available online: https://ir.lib.vntu.edu.ua/handle/123456789/48682.
  2. Korobeinikova, T.; Savytska, L.; Krupelnytskyi, L. Processes of assembling and reassembling documents in a document management system. Inf. Technol. Comput. Eng. 2024, (2), 51–65. (In Ukrainian) [Google Scholar] [CrossRef]
  3. Verbynskyi, D.; Sakaliuk, O.; Popkov, D. Development of software for text document content analysis. In Proceedings of the International Scientific and Practical Conference “Information Technologies and Automation – 2024”, Vinnytsia, Ukraine, 2024; pp. 429–431. (In Ukrainian) Available online: https://ir.lib.vntu.edu.ua/bitstream/handle/123456789/43787/168363.pdf.
  4. Barabash, O.; Kolumbet, V. Intelligent analysis and processing of text documents based on a multi-agent approach. Inform. Math. Methods Simul. 2022, 12, 296–305. (In Ukrainian). Available online: http://immm.op.edu.ua/files/archive/n4_v12_2022/2022_4(4).pdf.
  5. Tsubera, D. Intelligent document processing: How to increase productivity. In Proceedings of the International Scientific and Practical Conference “Problems and Prospects of Business Development in Ukraine”, 2024; pp. 301–302. (In Ukrainian) [Google Scholar]
  6. Nedoshytko, I.; Patriak, O. Electronic document management and its value for business. Digit. Platf. Inf. Technol. Sociocult. Sphere 2022, (5), 368–379. (In Ukrainian). Available online: http://dspace.wunu.edu.ua/handle/316497/48424.
  7. Bozhko, O. Development of an iterative method for data extraction from unstructured documents using large language models. Bull. Kremenchuk Mykhailo Ostrohradskyi Natl. Univ. 2025, (150), 119–124. (In Ukrainian) [Google Scholar] [CrossRef]
  8. Sydorko, D.; Hlukhov, V. Software implementation of methods of analysis and compliance control of technical text reports. Comput. Syst. Netw. 2024, (2), 208–221. (In Ukrainian) [Google Scholar] [CrossRef]
  9. Astystova, T.; Sedliar, A. Development of software for text originality assessment. Technol. Eng. 2024, (5), 26–36. (In Ukrainian) [Google Scholar] [CrossRef]
  10. Auer, C.; Lysak, M.; Nassar, A.; et al. Docling technical report. arXiv 2024, arXiv:2408.09869. [Google Scholar] [CrossRef]
  11. Zhang, Q.; et al. Document parsing unveiled: Techniques, challenges, and prospects for structured information extraction. arXiv 2024, arXiv:2410.21169. [Google Scholar] [CrossRef]
  12. ECMA International. Standard ECMA-376: Office Open XML File Formats, 5th ed.; ECMA International: Geneva, Switzerland, 2016; Available online: https://ecma-international.org/publications-and-standards/standards/ecma-376/.
  13. Svintsytska, O.M.; Korotun, O.V.; Marchuk, D.K.; Zhelizko, V.V. Algorithms for automated verification of academic document parameters. Infocommunication Comput. Technol. 2025, 2(10), 119–127. (In Ukrainian) [Google Scholar] [CrossRef]
Figure 1. Fragment of the JSON model of a document generated by the conversion algorithm.
Figure 1. Fragment of the JSON model of a document generated by the conversion algorithm.
Preprints 246403 g001
Figure 2. Sequence diagram of the DOCX to JSON conversion process.
Figure 2. Sequence diagram of the DOCX to JSON conversion process.
Preprints 246403 g002
Figure 3. The extract_paragraph_data() function for extracting paragraph parameters.
Figure 3. The extract_paragraph_data() function for extracting paragraph parameters.
Preprints 246403 g003
Figure 4. Construction of the hierarchy of document chapters on the basis of heading styles.
Figure 4. Construction of the hierarchy of document chapters on the basis of heading styles.
Preprints 246403 g004
Figure 5. Fragment of the JSON model of a document after conversion and segmentation.
Figure 5. Fragment of the JSON model of a document after conversion and segmentation.
Preprints 246403 g005
Table 1. Loading and preparing the document for analysis.
Table 1. Loading and preparing the document for analysis.
Participant Action Description
Calling system (User) Startconversion (file.docx) An external module initiates the conversion process by passing the path to the .docx file
Converter DOCX Open (file.docx) The conversion module delegates to the library the execution of the operation of opening and parsing the document
python-docx library Return document object The library forms an internal representation of the document suitable for further iteration over the structural elements
Table 2. Extraction and mapping of the input document.
Table 2. Extraction and mapping of the input document.
Participant Action Description
DOCX converter JSON structure initialization An empty object (Internal Data Model) is created to collect standardized data.
Loop For each element The converter sequentially iterates over the structural elements of the document: paragraphs, tables, images
DOCX converter → python-docx library Get next element A request is formed to obtain the next element of the document for further processing
Alternative (Alt) Element is a paragraph If the element is textual, the stage Styling mapping is performed: the internal style (for example, “Heading 1”, “Normal”) and local formatting parameters (font size, alignment, indents) are recorded
Alternative (Else) Element is a table/image If the element is not textual, its structural properties (type, dimensions and other characteristics) are extracted
DOCX converter → internal model Add object The obtained standardized data are added to the corresponding arrays of the internal model (“paragraphs” or “content”)
Table 3. Structuring and finalization of the model.
Table 3. Structuring and finalization of the model.
Participant Action Description
DOCX converter Analysis of section properties Processing of metadata that relate to entire sections (for example, page parameters such as margins, orientation, page_settings).
DOCX converter → internal model Hierarchical structuring At this stage, the flat list of paragraphs is transformed into a hierarchy: objects of the chapter type group paragraphs under themselves. This is based on the previously recorded styles (for example, any paragraph with the Heading 1 style initiates the creation of a new chapter).
Table 4. JSON structure.
Table 4. JSON structure.
Participant Action Description
Internal model → DOCX converter Ready JSON object Return of the fully standardized structure
DOCX converter → calling system Return standardized structure The final result, which can be used by other modules of the system, in particular modules of compliance control, integrity verification and analysis of structural anomalies
Table 5. Input and output data (I/O).
Table 5. Input and output data (I/O).
Parameter Description Data type
Input (I) A document in a format subject to structural analysis (for example, DOCX) Structured Document Object
Output (O) List of logically segmented parts of the document List of Section Objects
Table 6. Structure of the output object.
Table 6. Structure of the output object.
Field Example value Purpose
ID 1, 2.1, AppendixA Unique identifier of the segment
Title "INTRODUCTION", "List of references" Heading obtained from the document
Type title_page, chapter, bibliography, appendix Logical type of the segment
ContentElements [Paragraph, Table, Image, ...] All elements belonging to this segment
Table 7. Structural division.
Table 7. Structural division.
Method Selection condition Action
Mstyle (Style analysis) If a paragraph has the style Heading 1, Heading 2, etc. Starts a new logical section (chapter/subsection) with the corresponding hierarchy level
Mregex (Text analysis) If the paragraph style is Normal (or undefined) and the text matches the numerical prefix pattern. Pattern: ^\d+\.\s+.+$
Table 8. Results by element type.
Table 8. Results by element type.
Element type Precision Recall F1-score
Headings 0.98 0.97 0.97
Paragraphs 0.96 0.95 0.95
Lists 0.95 0.94 0.94
Tables 0.97 0.96 0.96
Bibliography 0.94 0.92 0.93
Table 9. Comparative analysis.
Table 9. Comparative analysis.
Method Precision Recall F1-score Accuracy
python-docx 0.82 0.78 0.80 0.80
docx-parser 0.88 0.85 0.86 0.87
Aspose.Words 0.96 0.95 0.95 0.97
Proposed approach 0.97 0.96 0.96 0.98
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.