A quality verification method and device for converting a document, an electronic device, and a medium
By receiving document conversion requests, obtaining source documents and performing format conversion, extracting feature information, and using the source document content list and the converted document for automated quality verification, the problem of low efficiency and easy omission in the quality verification of converted documents is solved, and efficient automated verification and unified benchmark are achieved.
Patent Information
- Application Number
- CN202611635722.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-22
- Publication Date
- 2026-11-24
AI Technical Summary
In existing technologies, document quality verification is inefficient and prone to omissions, and cannot be effectively automated.
This paper provides a method for quality verification of converted documents. By receiving a document conversion request, obtaining the source document and performing format conversion, extracting the feature information of the source document, and using the content list of the source document and the converted document to perform automated quality verification, it supports multi-level verification strength and verification content, including file integrity, format consistency, coverage and content accuracy.
It has achieved automated verification of the quality of converted documents, improved verification efficiency, avoided omissions in manual verification, and provided verification results with a unified benchmark.
Smart Images

Figure CN123159267A_ABST
Abstract
Description
Technical Field
[0001] This application generally relates to the field of data processing technology. More specifically, this application relates to a method, apparatus, electronic device, and medium for verifying the quality of converted documents. Background Technology
[0002] With the development of digital office work and the online circulation of technical documents, it is often necessary to convert documents in various source formats, such as Portable Document Format (PDF), word processing document format (DOCX, .docx), presentation format (PPTX, .pptx), and spreadsheet format (XLSX, .xlsx), into structured Markdown documents for subsequent retrieval, parsing, and large-scale model reading. During the conversion process, parsing failures, content truncation, and structural loss can lead to incomplete or abnormal converted documents (i.e., Markdown documents). Therefore, it is necessary to verify the quality of the converted document after conversion.
[0003] Currently, the quality verification of converted documents is generally done manually, which involves manually checking whether the number of pages, images, and tables are missing in the source and converted documents. However, this method is inefficient and prone to omissions.
[0004] In view of this, there is an urgent need to provide a method, device, electronic device and medium for verifying the quality of converted documents, which realizes automated verification of the quality of converted documents, improves verification efficiency and avoids omissions. Summary of the Invention
[0005] In order to at least address one or more of the technical problems mentioned above, this application proposes a method, apparatus, electronic device, and medium for quality verification of converted documents in several aspects.
[0006] In a first aspect, this application provides a method for verifying the quality of a converted document, comprising: receiving a document conversion request, the document conversion request carrying a source document path; obtaining a source document based on the source document path, and performing format conversion on the source document to obtain a converted document; extracting feature information from the source document to obtain a list of source document content; and verifying the quality of the converted document using at least one of the source document content list and the source document, as well as the converted document, to obtain a verification result.
[0007] In some embodiments, before extracting feature information from the source document, the method further includes: determining a target verification strength for verifying the quality of the converted document; and determining whether to extract feature information from the source document based on the target verification strength.
[0008] In some embodiments, determining the target verification strength for verifying the quality of the converted document includes: checking whether the document conversion request carries a verification strength identifier; if it exists, then using the verification strength corresponding to the verification strength identifier carried in the document conversion request as the target verification strength; if it does not exist, further checking whether there is a system-configured verification strength; if it exists, then using the system-configured verification strength as the target verification strength; if it does not exist, then using the default verification strength as the target verification strength.
[0009] In some embodiments, determining the target verification strength for verifying the quality of the converted document includes: obtaining attribute information of the source document; if cache information matching the attribute information is found, then setting the verification strength as the target verification strength.
[0010] In some embodiments, finding cached information that matches the attribute information includes: calculating the attribute information based on a set algorithm to obtain a calculation result; using the calculation result as a keyword to search for whether there is cached information that matches the keyword; if so, determining that cached information matching the attribute information has been found.
[0011] In some embodiments, after converting the source document to obtain a converted document, the method further includes: storing the calculation result and the converted document.
[0012] In some embodiments, the target verification strength is one of a plurality of set verification strengths, and the verification content corresponding to different set verification strengths is different.
[0013] In some embodiments, the plurality of set verification strengths include: a first-level verification strength, a second-level verification strength, a third-level verification strength, and a fourth-level verification strength; wherein, the verification content corresponding to the first-level verification strength is empty; the verification content corresponding to the second-level verification strength includes: file integrity verification; the verification content corresponding to the third-level verification strength includes: file integrity verification, file format consistency verification, and coverage verification; the verification content corresponding to the fourth-level verification strength includes: file integrity verification, file format consistency verification, coverage verification, content accuracy verification, and truncation verification; wherein, the file integrity verification is used to verify the completeness of the converted document; the format consistency verification is used to verify the degree of structural preservation of the converted document; the coverage verification is used to verify the completeness of non-text in the converted document; the content accuracy verification is used to verify the completeness of text in the converted document; and the truncation verification is used to verify the loss of the tail of the converted document.
[0014] In some embodiments, determining whether to extract feature information from the source document based on the target verification strength includes: not extracting feature information from the source document when the target verification strength is the first level verification strength or the second level verification strength; verifying the quality of the converted document using the source document content list and at least one of the source documents, and the converted document includes: verifying the quality of the converted document using the source document and the converted document according to the verification content corresponding to the target verification strength; extracting feature information from the source document when the target verification strength is the third level verification strength or the fourth level verification strength; verifying the quality of the converted document using the source document content list and at least one of the source documents, and the converted document includes: verifying the quality of the converted document using the source document, the converted document, and the source document content list according to the verification content corresponding to the target verification strength.
[0015] In some embodiments, the document conversion request also carries the file type of the source document; the step of extracting the feature information of the source document to obtain a list of source document contents includes: searching for whether there is an extractor matching the file type based on the file type; if there is, using the found extractor to extract the feature information of the source document; if there is no extractor, and the file type is a set file type, then using the downgraded extraction path corresponding to the file type to extract the feature information of the source document; if there is no extractor, and the file type is not the set file type, then the feature information of the source document is not extracted.
[0016] In some embodiments, the source document content list includes: a content list and an extraction alarm list; the content list includes at least: the number of document pages, the total number of titles, the total number of paragraphs, the number of tables, the number of images, the number of worksheets, and the total number of rows in the worksheets; the extraction alarm list is used to record abnormal messages generated during the extraction process of the extractor.
[0017] In some embodiments, the file types include at least: PPTX, DOCX, PDF, XLSX; the set file type is OOXML.
[0018] In some embodiments, when the target verification strength is a third-level or fourth-level verification strength, the method further includes: modifying the target verification strength based on the content list, the file type, and the extracted alarm list.
[0019] In some embodiments, the step of modifying the target verification strength based on the content list, the file type, and the extraction alarm list includes: if the content list is empty, the target verification strength is modified to a second-level verification strength; if the file type is PDF and the extraction alarm list includes an alarm message indicating that the PDF extractor does not exist, the target verification strength is modified to a second-level verification strength; if the file type is DOCX and the extraction alarm list includes an alarm message indicating that the DOCX extractor does not exist, the file format consistency verification is skipped, and the target verification strength remains unchanged; if the file type is PPTX or XLSX and the extraction alarm list includes an alarm message indicating that the PPTX extractor or the XLSX extractor does not exist, the target verification strength remains unchanged.
[0020] In some embodiments, the verification result includes a file integrity verification sub-report; the file integrity verification includes multiple complete verification items, and different alarm levels exist for different complete verification items; verifying the file integrity of the converted document includes: for each complete verification item, performing a verification operation on the converted document based on the verification content of the complete verification item, the converted document, and the source document to obtain the alarm level of the complete verification item; determining whether the file integrity verification passes based on the alarm levels of each complete verification item, and outputting an integrity verification sub-report that includes at least the passing result of the file integrity verification and the alarm levels of each complete verification item.
[0021] In some embodiments, a complete set of validation items includes at least one of the following: non-empty validation, encoding validity validation, garbled character validation, document syntax validity validation, table syntax validity validation, image reference validity validation, and document size validation.
[0022] In some embodiments, the verification result includes a file format consistency verification sub-report; verifying the file format consistency of the converted document includes: determining a file format consistency verification method based on the file type, wherein different file types have different file format consistency verification methods; performing file format consistency verification on the converted document based on the file format consistency verification method, the converted document, and the source document content list to obtain an alarm level for the file format consistency verification; determining whether the file format consistency verification passes based on the alarm level of the file format consistency verification, and outputting a file format consistency verification sub-report that includes at least the passing result of the file format consistency verification and the alarm level of the file format consistency verification.
[0023] In some embodiments, the verification result includes a coverage verification sub-report; the coverage verification includes multiple coverage verification items, and different coverage verification items have different alarm levels; verifying the coverage of the converted document includes: for each coverage verification item, performing a verification operation on the converted document based on the verification content of the coverage verification item, the converted document, and the list of contents of the source document, to obtain the alarm level of the coverage verification item; determining whether the coverage verification passes based on the alarm levels of each coverage verification item, and outputting a coverage verification sub-report that includes at least the pass result of the coverage verification and the alarm levels of each coverage verification item.
[0024] In some embodiments, the coverage verification items include at least one of the following: page coverage, image consistency, image integrity, worksheet coverage, and title coverage.
[0025] In some embodiments, the verification result includes a content accuracy verification sub-report; the content accuracy verification includes multiple content accuracy verification items, and the alarm levels of different content accuracy verification items are different; verifying the accuracy of the converted content of the converted document includes: for each content accuracy verification item, performing a verification operation on the converted document based on the verification content of the content accuracy verification item, the converted document, and the source document to obtain the alarm level of the content accuracy verification item; determining whether the content accuracy verification passes based on the alarm levels of each content accuracy verification item, and outputting a content accuracy verification sub-report that includes at least the passing result of the content accuracy verification and the alarm levels of each content accuracy verification item.
[0026] In some embodiments, the content accuracy verification items include at least one of the following: text similarity, key number retention rate, and key term retention rate.
[0027] In some embodiments, the verification result includes a truncation verification sub-report; the truncation verification includes multiple truncation verification items, and different truncation verification items have different alarm levels; verifying the truncation of the converted document includes: for each truncation verification item, performing a verification operation on the converted document based on the verification content of the truncation verification item, the converted document, the source document, and the list of contents of the source document, to obtain the alarm level of the truncation verification item; determining whether the truncation verification passes based on the alarm level, and outputting a truncation verification sub-report that includes at least the passing result of the truncation verification and the alarm levels of each truncation verification item.
[0028] In some embodiments, the truncation verification items include at least one of the following: explicit truncation marker detection, implicit size anomaly detection, block pattern hint detection, implicit structure truncation detection, implicit length detection, and end integrity detection.
[0029] In some embodiments, the method further includes: outputting the converted document and the verification result.
[0030] In some embodiments, outputting the converted document and the verification result includes: if the file size of the converted document is greater than a set threshold, truncating the converted document according to the set threshold and outputting it; and performing a reduction operation on the verification result and outputting the reduced verification result; if the file size of the converted document is less than or equal to the set threshold, directly outputting the converted document and the verification result.
[0031] In a second aspect, this application provides a quality verification device for converted documents, comprising: a document conversion request receiving module for receiving a document conversion request, the document conversion request carrying a source document path; a document conversion module for obtaining a source document based on the source document path and performing format conversion on the source document to obtain a converted document; a source document content list extraction module for extracting feature information from the source document to obtain a source document content list; and a verification module for verifying the quality of the converted document using at least one of the source document content list and the source document, as well as the converted document, to obtain a verification result.
[0032] In a third aspect, this application provides an electronic device comprising: a processor configured to execute program instructions; and a memory configured to store the program instructions, which, when loaded and executed by the processor, cause the processor to perform the method according to the first aspect or any embodiment of the first aspect.
[0033] In a fourth aspect, this application provides a computer-readable storage medium storing program instructions that, when loaded and executed by a processor, cause the processor to perform the method according to the first aspect or any embodiment of the first aspect.
[0034] By combining document conversion and document quality verification methods, apparatus, electronic devices, and media as described above, this application embodiment avoids the problem of not being able to determine the conversion quality after format conversion is completed. Furthermore, it extracts and statistically analyzes the feature information of the source document to obtain a structured list of source document content. Then, it uses the list of source document content, at least one of the source documents, and the converted document to verify the quality of the converted document, thus achieving automated verification of the converted document quality. Compared with manual verification, this improves verification efficiency and avoids omissions. In addition, it provides a unified benchmark for verification, and the verification results are auditable. Attached Figure Description
[0035] The above and other objects, features, and advantages of exemplary embodiments of this application will become readily understood by reading the following detailed description with reference to the accompanying drawings. In the drawings, several embodiments of this application are illustrated by way of example and not limitation, and the same or corresponding reference numerals denote the same or corresponding parts, wherein: Figure 1 An exemplary flowchart of a quality verification method for converted documents according to some embodiments of this application is shown; Figure 2 An exemplary structural block diagram of a quality verification apparatus for converted documents according to some embodiments of this application is shown; Figure 3 An exemplary structural block diagram of an electronic device according to some embodiments of this application is shown. Detailed Implementation
[0036] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this application. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0037] It should be understood that the terms "comprising" and "including" used in the specification and claims of this application indicate the presence of the described features, integrals, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or collections thereof.
[0038] It should also be understood that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the application. As used in this specification and claims, the singular forms “a,” “an,” and “the” are intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in this specification and claims refers to any combination and all possible combinations of one or more of the associated listed items, and includes such combinations.
[0039] As used in this specification and claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if [described condition or event] is detected" may be interpreted, depending on the context, as "once determined," "in response to determination," "once [described condition or event] is detected," or "in response to detection of [described condition or event]."
[0040] The specific embodiments of this application will now be described in detail with reference to the accompanying drawings.
[0041] Exemplary application scenarios With the development of digital office work and the online circulation of technical documents, it is often necessary to convert documents in various source formats, such as Portable Document Format (PDF), word processing document format (DOCX, .docx), presentation format (PPTX, .pptx), and spreadsheet format (XLSX, .xlsx), into structured Markdown documents for subsequent retrieval, parsing, and large-scale model reading. During the conversion process, parsing failures, content truncation, and structural loss can lead to incomplete or abnormal converted documents (i.e., Markdown documents). Therefore, it is necessary to verify the quality of the converted document after conversion.
[0042] Currently, the quality verification of converted documents is generally done manually, which involves manually checking whether the number of pages, images, and tables are missing in the source and converted documents. However, this method is inefficient and prone to omissions.
[0043] In view of this, there is an urgent need to provide a method, device, electronic device and medium for verifying the quality of converted documents, which realizes automated verification of the quality of converted documents, improves verification efficiency and avoids omissions.
[0044] Figure 1An exemplary flowchart of a quality verification method for converted documents according to some embodiments of this application is shown. It is understood that the above-described quality verification method 100 for converted documents can be executed by any suitable device with data processing capabilities, such as, but not limited to, terminal devices, processors, and servers.
[0045] like Figure 1 As shown, the above-mentioned document conversion quality verification method 100 includes: step S110: receiving a document conversion request, the document conversion request carrying the source document path; step S120: obtaining the source document based on the source document path, and performing format conversion on the source document to obtain a converted document; step S130: extracting the feature information of the source document to obtain a source document content list; step S140: using at least one of the source document content list and the source document, as well as the converted document, to verify the quality of the converted document and obtain a verification result.
[0046] For example, the document conversion request in step S110 above refers to a request message that triggers document conversion and quality verification. This document conversion request is used to convert the source document into structured text (Markdown text). In this embodiment, the document conversion request can be entered by the user on the display interface of the electronic device, and the electronic device can simply receive the user input.
[0047] The document conversion request described above can carry the source document path and the file type of the source document. The source document path refers to the unique access path of the source document, which may include the path and file name, etc., and can be used to obtain the source document. As a specific implementation of this application, the source file path could be, for example, D:\docs\xxx.pdf.
[0048] The above file types refer to the format of the source document, which may include, but is not limited to, PPTX, DOCX, PDF, XLSX, image, txt, etc. This application embodiment does not specifically limit this.
[0049] For example, the source document in step S120 above refers to the original document to be converted. In this embodiment, after receiving the document conversion request, the source document is obtained according to the source document path in the document conversion request.
[0050] For example, the converted document in step S120 above refers to the document after format conversion, and its file type can be, for example, structured Markdown, which is the object of subsequent verification.
[0051] In this embodiment of the application, after obtaining the source document, the source document is processed for format conversion to obtain the converted document. As for the conversion method, it is a conventional method, which can be referred to the description in relevant materials, and will not be repeated here.
[0052] In this embodiment, after the conversion is completed, feature information can be extracted from the converted document to compare the source document and the converted document. The specific methods for extracting feature information from the converted document are described in the following embodiments and will not be elaborated upon here.
[0053] For example, the characteristic information in step S130 above refers to the structural features, content features, and element features inherent in the source document, such as the document page number, title, paragraph, table, image, worksheet, worksheet row number, etc.
[0054] The aforementioned source document content list refers to the standardized benchmark list data generated after pre-scanning and structured statistics of the source documents, providing a benchmark for subsequent quality comparison.
[0055] In this embodiment of the application, after obtaining the source document and extracting the list of source document contents, the quality of the converted document can be verified using at least one of the source document contents list and the source document, as well as the converted document, to obtain the verification result.
[0056] In this embodiment of the application, the quality verification of the converted document may include various verification contents such as garbled character detection, document integrity detection, structural consistency detection, element coverage detection, and text accuracy detection. This embodiment of the application does not impose specific limitations on these contents, and they can be determined according to the actual situation.
[0057] In this application embodiment, the verification content is different, and the documents used for verification are different. For example, verification is performed using a list of source document content and a converted document. Another example is verification using a source document and a converted document. Yet another example is verification using a list of source document content, a source document, and a converted document.
[0058] The specific verification content and the corresponding documents used, as well as the specific verification methods, are described in the following examples and will not be repeated here.
[0059] The verification results may include verification strength, verification reports for each verification item, alarm level, alarm details, overall score, total verification time, whether the verification passed, and the time spent on each verification item, etc. In this embodiment, the verification results may also be structured data.
[0060] This application combines document conversion and document quality verification, avoiding the problem of not being able to determine the conversion quality after format conversion. It extracts and statistically analyzes the feature information of the source document to obtain a structured list of source document content. Then, it uses the list of source document content, at least one of the source documents, and the converted document to verify the quality of the converted document, realizing automated verification of the converted document quality. Compared with manual verification, it improves verification efficiency and avoids omissions. Furthermore, it provides a unified benchmark for verification, and the verification results can be audited.
[0061] As an optional embodiment of this application, before extracting the feature information of the source document, the above-mentioned quality verification method 100 for converting the document further includes: determining the target verification strength for verifying the quality of the converted document; and determining whether to extract the feature information of the source document based on the target verification strength.
[0062] For example, the aforementioned target verification intensity refers to the verification level or verification strength adopted in this quality verification, which determines the rigor of the verification and the content of the verification.
[0063] In this embodiment of the application, multiple verification strengths can be set in advance. Different verification strengths correspond to different verification contents. The target verification strength mentioned above is one of the multiple verification strengths.
[0064] As a specific embodiment of this application, the above-mentioned multiple verification strengths may include a first-level verification strength, a second-level verification strength, a third-level verification strength, and a fourth-level verification strength.
[0065] Among them, the verification content corresponding to the first level of verification intensity (denoted as off, closed) is empty. That is to say, the first level of verification intensity does not perform any quality verification on the converted document, but directly outputs the verification results of the converted document and the empty state report. In other words, the comprehensive score is full, the verification pass status is passed, the verification reports of each verification content are empty, and only one explanatory alarm is attached (that is, there is a report in form, but no verification in substance). This is used to unify the report structure and avoid the caller judging it as empty.
[0066] The second level of verification strength (denoted as quick) includes file integrity verification, which only requires enabling the configured file integrity verifier. In this embodiment, the file integrity check is used to verify the integrity of the converted document.
[0067] The third level of verification strength (denoted as "standard") includes the following verification content: file integrity verification, file format consistency verification, and coverage verification. It requires that the configured file integrity verifier, format consistency verifier, and coverage verifier be enabled. Specifically, file format consistency verifier checks the degree to which the structure of the converted document is preserved, that is, the degree to which the pagination, headings, and other structures of the source document are preserved in the converted document. Coverage verification checks the integrity of non-text elements in the converted document, such as the completeness of tables, images, and worksheets.
[0068] The fourth level of validation strength (denoted as strict) includes the following validation functions: file integrity validation, file format consistency validation, coverage validation, content accuracy validation, and truncation validation. It requires that the configured file integrity validator, format consistency validator, coverage validator, content accuracy validator, and truncation detector be enabled. The content accuracy validation verifies the completeness of the text in the converted document, such as key numbers, key words, and the entire text. The truncation validation verifies the loss of content at the end of the converted document, such as cropped content at the end or incomplete document content.
[0069] It should be noted that the verification order of each verification content in the above-mentioned third-level verification strength and fourth-level verification strength can be executed in parallel or in sequence. This application embodiment does not impose specific limitations on this, and can be determined according to the actual situation.
[0070] As a specific implementation of this application, for the third level of verification strength, when the various verification contents are executed sequentially, the execution order can be file integrity verification → file format consistency verification → coverage verification. For the fourth level of verification strength, when the various verification contents are executed sequentially, the execution order can be file integrity verification → file format consistency verification → coverage verification → content accuracy verification → truncation verification.
[0071] The specific verification process for each verification is illustrated in the following examples and will not be repeated here.
[0072] In this application embodiment, there are many ways to determine the target verification strength, such as receiving the verification strength selected by the user, or according to the system default verification strength, etc. This application embodiment does not specifically limit this. The following embodiments describe the methods for determining the target verification strength by example, which will not be elaborated here.
[0073] As described above, not every verification strength requires the use of the source document content list. Therefore, in this embodiment, the extraction of feature information from the source document is determined based on the target verification strength. Specifically, when the target verification strength is the first or second level, the feature information of the source document is not extracted. Step S140 can be further described as follows: using the source document and the converted document, the quality of the converted document is verified according to the verification content corresponding to the target verification strength. When the target verification strength is the third or fourth level, the feature information of the source document is extracted. Step S140 can be further described as follows: using the source document, the converted document, and the source document content list, the quality of the converted document is verified according to the verification content corresponding to the target verification strength.
[0074] In this embodiment, the verification strength is determined before verification, and then the determination of whether to extract the feature information of the source document is based on the determined target verification strength, thereby realizing on-demand extraction and on-demand verification and reducing the consumption of computing resources. Furthermore, for verification content that does not require the list of source document content, the extraction of feature information of the source document is skipped, thereby improving the processing speed.
[0075] The method for determining the target verification strength is described below: (1) Check whether the document conversion request carries a verification strength identifier; if it exists, use the verification strength corresponding to the verification strength identifier carried in the document conversion request as the target verification strength; if it does not exist, further check whether there is a system-configured verification strength; if it exists, use the system-configured verification strength as the target verification strength; if it does not exist, use the default verification strength as the target verification strength.
[0076] For example, the above-mentioned verification strength identifier refers to an identifier that can uniquely represent the verification strength, such as the verification level of the verification strength (i.e., the first level, second level, third level and fourth level mentioned above), or the English name of the verification level (i.e., off, quick, standard, strict mentioned above), etc. This application embodiment does not specifically limit this, as long as it can distinguish each verification strength.
[0077] The aforementioned validation strength identifier can be entered by the user on the electronic device's display interface, or it can be passed to the electronic device via the `validation_intensity` parameter of the Model Context Protocol (MCP) and sent along with the document conversion request. When the electronic device receives the document conversion request, it directly checks whether the validation strength identifier is included in the document conversion request.
[0078] It should be noted that the verification strength identifier carried in the above document conversion request is only valid for this verification.
[0079] In this embodiment of the application, if the document conversion request carries a verification strength identifier, the verification strength corresponding to the verification strength identifier is used as the target verification strength; if the document conversion request does not carry a verification strength identifier, it is further checked whether there is a system-configured verification strength.
[0080] The verification strength configured in the above system refers to the environment variable (HQ_MD_VALIDATION_INTENSITY) configured by the deployer (the environment manager of the deployment and operation and maintenance transformation tool server). It can be any pre-configured verification strength. This embodiment of the application uses the system-configured verification strength as standard as an example for illustration. That is, if no verification strength is manually set and a system-configured verification strength exists, verification will be performed according to standard.
[0081] In this embodiment of the application, the environment variable HQ_MD_VALIDATION_INTENSITY can be configured in the operating system of the server process, which is a globally configured verification strength.
[0082] In this embodiment of the application, if a system-configured verification strength exists, the system-configured verification strength is used as the target verification strength for verification; if no system-configured verification strength exists (i.e., no environment variable is configured in advance), the default verification strength is used as the target verification strength for verification.
[0083] The aforementioned default verification strength refers to the fallback verification strength set at the system's factory default. In this embodiment, the default verification strength is set to "quick," meaning that if the first two verification strengths are not available, verification will be performed directly according to "quick." In this embodiment, the aforementioned default verification strength is hardcoded into the configuration code.
[0084] (2) Obtain the attribute information of the source document; if cache information matching the attribute information is found, the set verification strength will be used as the target verification strength.
[0085] For example, the attribute information of the source document mentioned above refers to information indicating whether the source document has changed, which may include, but is not limited to, the source document path, the latest modification time of the source document, the file size (i.e., the number of bytes) of the source document, and the concatenation string of the current conversion configuration items (e.g., desensitization switch, image mode, and extended configuration items, etc.).
[0086] In this embodiment, after obtaining the attribute information of the source document, it is possible to check whether there is cached information that matches the attribute information. Here, cached information refers to the attribute information of historical source documents that have been stored in advance.
[0087] In this embodiment, if the source document is found, it means that the source document has been previously converted and verified, and the set verification strength is used as the target verification strength. If the source document is not found, it means that the source document has not been previously verified, and the target verification strength is set to empty. In this embodiment, the above-mentioned set verification strength can be a pre-set fixed verification strength (e.g., quick), or it can be the verification strength corresponding to the cached information (i.e., the verification strength used in the last verification).
[0088] As an optional embodiment of this application, the storage and matching of the above-mentioned attribute information is not based on the attribute information itself, but rather on the calculation of the attribute information to obtain a cache key, which is then stored and matched. Specifically: The attribute information is calculated based on the set algorithm to obtain the calculation result; the calculation result is used as the key to search for whether there is cached information that matches the key; if it exists, it is determined that cached information matching the attribute information has been found.
[0089] For example, there can be many kinds of algorithms, such as Secure Hash Algorithm 256 (SHA-256) digest, etc. This application embodiment does not specifically limit this, and this application embodiment only uses SHA-256 digest as an example for illustration.
[0090] In this embodiment, after obtaining the attribute information of the source document, the attribute information is calculated based on SHA-256 to obtain the calculation result (i.e., the cache key mentioned above). Then, using the cache key as the keyword, it is searched to see if there is cache information that matches the keyword.
[0091] Specifically, the cache key calculated from the attribute information of the historical source document is stored in a designated storage location (e.g., locally on the electronic device, in the cloud, etc.). In this embodiment, the electronic device maintains a cache sequence in the designated storage location, which stores the cache information of the historical source document.
[0092] After calculating the cache key, a search is performed at the designated storage location to confirm whether cache information (i.e., cache key) matching the cache key exists at the designated storage location. If it exists, it is considered that cache information matching the cache key has been found; otherwise, it is considered that no cache information matching the cache key has been found.
[0093] Understandably, the cache sequence stored at a specified storage location can be configured with a time-to-live (TTL) cache and a capacity-based eviction mechanism. Specifically, for the time-to-live eviction mechanism, if the TTL of any cached information in the cache sequence exceeds a set time (e.g., 3600s), that cached information is deleted. For the capacity-based eviction mechanism, if the capacity of the cache sequence exceeds a set capacity threshold (i.e., 500MB), the earliest cached information stored at that specified storage location can be deleted.
[0094] It should be noted that if any of the above attribute information changes, the cache key calculated based on the attribute information will also change, and no false hits will occur.
[0095] In this embodiment of the application, when determining the target verification strength, only one method can be used (e.g., (1) or (2)), or both methods can be used simultaneously. When the target verification strength is determined using the two methods, if the target verification strength is determined to be quick, standard, or strict based on method (1), and a cache key is matched based on method (2), the target verification strength determined based on method (1) will be forcibly modified to the set verification strength (i.e., quick), and "cache_hit=true, only quick verification is performed" will be recorded in the alarm report of the verification result, that is, "cache hit, only quick verification is performed". When the target verification strength is determined to be off based on method (1), the target verification strength remains unchanged regardless of whether a cache key is matched based on method (2).
[0096] It should be noted that if the above two methods are used to determine the target verification strength, the two methods can be executed simultaneously, or method (1) can be executed first and then method (2). Of course, method (2) can be executed first and then method (1). This application embodiment does not specifically limit the two methods for determining the target verification strength, and can be determined according to the actual situation.
[0097] As an optional embodiment of this application, after converting the source document to obtain the converted document, the quality verification method 100 for the converted document further includes: storing the calculation result. In this embodiment, the calculation result (i.e., the cache key) can be stored in the designated storage location so that when there are subsequent requests for the same document conversion (e.g., the same document is called by multiple downstream tasks), the conversion operation does not need to be repeated and the resource overhead of deep verification is avoided.
[0098] As an optional embodiment of this application, the step S130 above, which extracts feature information from the source document to obtain a list of source document contents, includes: searching for an extractor that matches the file type based on the file type; if it exists, using the found extractor to extract feature information from the source document; if it does not exist, and the file type is not the set file type, then using the downgraded extraction path corresponding to the file type to extract feature information from the source document; if it does not exist, and the file type is the set file type, then not extracting feature information from the source document.
[0099] In this embodiment, the aforementioned source document content list includes a content list and an extraction alert list. The content list is a structured object extracted from the source document before conversion, and includes at least seven types of structural elements: document page count, total number of headings, total number of paragraphs, number of tables, number of images, number of worksheets, and total number of rows in worksheets. Regarding the document page count, for PDF files, it is the total number of pages; for PPTX files, it is the total number of slides; for XLSX files, this item is absent, so the resulting content list has 0 document page counts; for DOCX files, which are flow-formatted documents without fixed pagination semantics, page counts are not extracted, therefore, the resulting content list also has 0 document page counts.
[0100] The total number of headings is found in PDF files (extracted by font size) and DOCX files (extracted by paragraph style name prefixes), but not in other file types; in these cases, the corresponding item in the content list is set to 0. In this embodiment, when counting the total number of headings, it is not necessary to distinguish between heading levels; the total number of headings at each level is counted, and the hierarchical details of each heading level are recorded in the aforementioned heading details list.
[0101] For the total number of paragraphs, if the paragraphs exist in PDF files (extracted by text blocks) and DOCX files (extracted by paragraph elements), but not in other file types, the corresponding item in the content list should be set to 0.
[0102] For the total number of tables, if they exist in PDF and DOCX files but not in other file types, the corresponding content list item should be set to 0.
[0103] For the number of images, if the images exist in PDF, DOCX, and PPTX files, but not in other file types, the corresponding item in the content list should be set to 0.
[0104] Regarding the number of worksheets, this item only exists in XLSX files. Simply count the number of sheets in the XLSX file to get the number of worksheets. For PPTX, DOCX, and PDF files, the number of worksheets in the resulting list is 0.
[0105] For the total number of worksheet rows, similar to the number of worksheets, only XLSX files have this item, which is the sum of the rows in all worksheets. PPTX, DOCX, and PDF files have a total number of worksheet rows of 0 in their content lists.
[0106] It should be noted that the above list can also include the number of lists and the number of hyperlinks. The number of lists refers to the number of list structures (ordered lists / unordered lists) in the source document; the number of hyperlinks refers to the number of hyperlinks (URL anchors) in the source document. The list and hyperlink counts are general count fields declared in the list structure, but currently, none of the format extractors assign values to them (i.e., they all retain the default value of 0) and do not participate in any validation. They are used to maintain the generality and future extensibility of the list structure.
[0107] The above-mentioned alarm list is used to record abnormal messages generated during the extraction process, such as downgrade or missing events that occur during the extraction process.
[0108] Of course, the aforementioned source document content list may also include: a list of title details, metadata, extraction time, and extraction method identifier, etc. The title details list records the hierarchy, text, and position index of each extracted title. Metadata includes information accompanying the extraction process, such as the source file path and file type. Extraction time refers to the total time (in milliseconds) spent extracting the source document content list. The extraction method identifier indicates which extractor was used for this extraction (extractor name or downgrade path identifier), used to trace the source of the list.
[0109] Based on the above description of the source document content list, the specific method for extracting the source document content list is described below: For example, the extractor mentioned above refers to a program that parses feature information for a specific file type. Different file types correspond to different extractors. In this embodiment, extractors corresponding to each file type can be deployed on the electronic device in advance, such as PDF file-PDF extractor, DOCX-DOCX extractor, etc., so as to facilitate direct matching and invocation of the extracted source document content list.
[0110] It should be noted that the embodiments of this application do not pre-configure extractors for all file types; extractors for only some file types may be configured.
[0111] In this embodiment of the application, when it is determined that feature information of the source document needs to be extracted, the system searches for an extractor that matches the file type. Specifically, it searches for the corresponding extractor in the list extractor registry based on the file type. If the extractor exists, the feature information of the source document is extracted using the found extractor.
[0112] The following describes the feature extraction strategies of the extractors for each file type for extracting feature information from the source document: For PDF files, the PDF extractor uses a PDF parsing library to traverse the PDF file and obtain the document page number. It then counts images across pages based on their reference numbers (unique numbers assigned to each image object within the PDF file, xref) to avoid double counting when the same image is referenced repeatedly on multiple pages. It also counts the total number of paragraphs based on text blocks (continuous text areas composed of aggregated text). A table recognition interface is used to count the number of tables. Finally, the total number of headings is calculated based on font size; specifically, text blocks with a font size greater than or equal to max (12 points, average font size of the entire document × 1.2) are considered headings, thus yielding the total number of headings.
[0113] For DOCX files, the DOCX extractor uses the DOCX parsing library to traverse the paragraphs, tables, and images in the DOCX file to obtain the total number of paragraphs, images, and tables; and identifies and records the headings by the paragraph style name prefix (i.e., Heading x), where Heading represents the heading and x represents the heading level.
[0114] For XLSX files, the XLSX extractor uses the XLSX parsing library to traverse the worksheets and accumulate the number of rows in each table to obtain the number of worksheets and the total number of rows in the worksheets.
[0115] For PPTX files, the PPTX extractor uses the PPTX parsing library to traverse the slides and images in the PPTX file to obtain the document page number (i.e., the number of slides) and the number of images.
[0116] If it does not exist, it is necessary to further determine whether the file type is the set file type. The set file type here is a special file type that is set in advance. In this embodiment of the application, the set file type is the Microsoft Office Software Document Open Extensible Markup Language (XML) standard (Office Open XML, OOXML), that is, a collection of XML files encapsulated in a ZIP compressed package, including PPTX, XLSX, and DOCX.
[0117] In this embodiment, if the file type is not the specified file type, the feature information of the source document is not extracted, and an empty content list is directly output. If the file type is the specified file type, the compression package downgrade method is used for extraction, that is, the feature information of the source document is extracted using the downgrade extraction path corresponding to the file type to obtain the content list. At the same time, the downgrade event needs to be written in the extraction alarm list in the form of an alarm string.
[0118] The following describes the method for extracting feature information from PPTX, XLSX, and DOCX files using a downgraded extraction path: For DOCX files, the corresponding downgrade extraction path is used to traverse word / document.xml, and the total number of paragraphs and tables is obtained by counting according to the local name of the tag (p=paragraph, tbl=table); the heading count is extracted from the paragraph style attribute (i.e., Heading x above); the number of images is counted by the number of files in the word / media / directory, and the number of files is the number of images.
[0119] It should be noted that the downgraded extraction path does not require extracting the title details list.
[0120] For PPTX files, the corresponding downgrade extraction path is used for traversal. The number of files matching slideN.xml in the ppt / slides / directory is taken as the document page number (i.e., the number of slides), and the number of files in the ppt / media / directory is taken as the number of images.
[0121] For XLSX files, the corresponding downgrade extraction path is used for traversal. xl / workbook.xml records all worksheet names, and the number of extracted names is the number of worksheets. The total number of rows in the worksheet is estimated by the number of row tags appearing in each sheetN.xml file under xl / worksheets / .
[0122] In this embodiment of the application, any of the above-mentioned degradation events need to be written into the extracted alarm list in the form of an alarm string. For example, if the pymupdf library is missing, an empty list degradation scheme is adopted (pymupdf missing, using emptyinventory fallback); if the python docx library is missing, a compressed file degradation scheme is adopted (python-docxmissing, using zipfile fallback), and so on.
[0123] It should be noted that during the entire source document content list extraction process, no errors will be output if the source file is not modified. If there is no extractor for a certain file type (e.g., md, txt, etc.), an empty source document content list will be returned directly, and the alarm string "No extractor for this format list" will be written into the extraction alarm list.
[0124] As an optional embodiment of this application, when the target verification strength is the third level verification strength or the fourth level verification strength, the above-mentioned document quality verification method 100 further includes: modifying the target verification strength based on the content list, file type and extracted alarm list.
[0125] In this embodiment of the application, for the third-level verification strength (i.e., standard) and the fourth-level verification strength (i.e., strict), the target verification strength needs to be dynamically adjusted based on the content list, file type and extracted alarm list before the verification is performed.
[0126] Specifically, if the content list is empty (i.e., content list extraction failed), the format consistency validator and coverage validator are skipped. If the validation strength is level four, the content accuracy validator and truncation validator are also skipped, and the target validation strength is adjusted to level two (i.e., quick). If the file type is PDF and the extraction alert list includes an alert that the PDF extractor does not exist, the format consistency validator and coverage validator are skipped. If the validation strength is level four, the content accuracy validator and truncation validator are also skipped, and the target validation strength is adjusted to level two (i.e., quick). If the file type is DOCX and the extraction alert list includes an alert that the DOCX extractor does not exist, only the format consistency validator (i.e., file format consistency verification; the title details are empty, so title count comparison cannot be performed) is skipped, keeping the target validation strength unchanged. If the file type is PPTX or XLSX and the extraction alert list includes an alert that the PPTX extractor or XLSX extractor does not exist, no validators need to be skipped, and the target validation strength remains unchanged.
[0127] Of course, for other cases where the alarm list is not empty, the format consistency validator and coverage validator can be skipped. If it is the fourth level of validation strength, the content accuracy validator and truncation validator should also be skipped, and the target validation strength should be adjusted to the second level of validation strength (i.e., quick).
[0128] In this embodiment, the downgrade decision for the target verification strength can be written into the verification result as an alarm, while simultaneously recording the downgrade reason, the list of skipped validators, and the actual effective strength. Thus, the verification process is linked to the missing extractor status of the verified object, ensuring that meaningful verification items are retained rather than becoming completely invalid in scenarios where extractors are missing.
[0129] The specific verification methods for each verification item are described below: As an optional embodiment of this application, the verification result includes a file integrity verification sub-report; the file integrity verification includes multiple complete verification items, and the alarm levels of different complete verification items are different; the file integrity of the converted document is verified, including: for each complete verification item, performing a verification operation on the converted document based on the verification content of the complete verification item, the converted document, and the source document, and obtaining the alarm level of the complete verification item; determining whether the file integrity verification passes based on the alarm levels of each complete verification item, and outputting an integrity verification sub-report that includes at least the passing result of the file integrity verification and the alarm levels of each complete verification item.
[0130] For example, the above-mentioned document integrity verification sub-report is used to record the integrity verification results of the converted document. In this application embodiment, the above-mentioned document integrity verification includes multiple integrity verification items. As a specific implementation of this application, the above-mentioned integrity verification items include at least one of the following: non-empty verification, encoding validity verification, garbled character verification, document syntax validity verification, table syntax validity verification, image reference validity verification, and document size verification.
[0131] The above-mentioned non-empty verification checks whether the converted document is empty; the above-mentioned encoding validity verification checks whether the character encoding is valid; the above-mentioned garbled character verification checks whether there is garbled character in the converted document; the document syntax validity verification checks whether the converted document's structure and syntax are correct; the table syntax validity verification checks whether the converted document's table structure is correct; the image reference validity verification checks whether the converted document's image references are valid; and the document size verification checks whether the converted document's file size is normal. The specific verification methods for each complete verification item are described with examples in the following embodiments, and will not be elaborated here.
[0132] In this embodiment, the alarm levels for different complete verification items are different. For example, the alarm level for the non-empty verification is severe, the alarm level for the encoding validity verification is severe, and the alarm level for the table syntax validity verification is warning, etc. This embodiment does not specifically limit the alarm level for each complete verification item, and it can be determined according to the actual situation.
[0133] In this embodiment of the application, for each complete verification item, a verification operation is performed on the converted document based on the verification content of the complete verification item, the converted document, and the source document to obtain the alarm level of the complete verification item.
[0134] Specifically, for non-empty verification (FI-01), if the converted document is empty, the alarm level for this non-empty verification is severe; otherwise, it is normal. For encoding validity verification (FI-02), it checks whether the converted document can be encoded as UTF-8 (a Unicode variable-length character encoding). If not, the alarm level for this encoding validity verification is severe. For garbled character verification (FI-03), the garbled character judgment logic of the conversion pipeline can be reused (using the source file path for auxiliary judgment). Specifically, for DOCX / .PPTX / .XLSX / .DOC / .XLS, after obtaining the source file path, it enters the character concatenation detection. Other formats (PDF, md, txt, etc.) are directly judged as non-garbled characters and returned. If garbled characters are found in the converted document, the alarm level for this garbled character verification is severe. For document syntax validity verification (FI-04), it checks the Markdown in the converted document. The document syntax validity check includes checks for issues such as unclosed code blocks, empty headings, and broken links. If any of these exist, the document syntax validity check is at the warning level. For table syntax validity (FI-05), the document checks for tables with vertical lines but missing separators. If any of these exist, the document syntax validity check is at the warning level. For image reference validity (FI-06), the document checks for missing image references. If any of these exist, the document reference validity check is at the warning level. For document size verification (FI-07), the document size verification checks the ratio of the number of bytes in the converted document to the number of bytes in the source document. If the ratio exceeds the set range [0.01, 100], the document size verification is at the warning level.
[0135] In this embodiment of the application, after obtaining the alarm level of each complete verification item, the score of file integrity verification is calculated based on the alarm level of each complete verification item, and the file integrity verification is determined as passed based on the alarm level of each complete verification item.
[0136] The score for file integrity verification is calculated based on the alarm level of each complete verification item. Specifically, the maximum score for each complete verification item is 1, with 1 point deducted for a severe level and 0.2 points deducted for a warning level, until all points are deducted. In other words, the lower limit for the score of file integrity verification is 0 points.
[0137] It should be noted that the above-mentioned full score of 1 point, serious level deduction of 1 point, and warning level deduction of 0.2 points are only examples and are not intended to limit this application.
[0138] Determining whether a file integrity verification passes based on the alarm level of each complete verification item can be as follows: if there are no critical issues, the file integrity verification passes; if there is one critical issue, the file integrity verification fails.
[0139] In this embodiment of the application, after calculating the result of whether the file integrity verification passed and the score of the file integrity verification, the output includes at least the file integrity verification passing result, the file integrity verification score, the alarm level of each complete verification item, and the problem list of the file integrity verification sub-report.
[0140] As an optional embodiment of this application, the above verification result includes a file format consistency verification sub-report; verifying the file format consistency of the converted document includes: determining the file format consistency verification method based on the file type, wherein different file types have different file format consistency verification methods; performing file format consistency verification on the converted document based on the file format consistency verification method, the converted document, and the source document content list to obtain the alarm level of the file format consistency verification; determining whether the file format consistency verification passes based on the alarm level of the file format consistency verification, and outputting a file format consistency verification sub-report that includes at least the passing result of the file format consistency verification and the alarm level of the file format consistency verification.
[0141] For example, the above-mentioned file format consistency verification sub-report is used to record the file format consistency verification results. In this embodiment, the file format consistency verification methods are different for different file types. Therefore, in this embodiment, the file format consistency verification method of the converted document can be determined first based on the file type of the source document. Then, the determined file format consistency verification method, the converted document, and the list of contents of the source document are used to perform file format consistency verification on the converted document to obtain the alarm level of the file format consistency verification.
[0142] Specifically, for PDF files, the format consistency verification (FC-PDF-01) calculates the ratio of the number of pages in the converted document (obtained by counting form breaks "\f") to the number of pages in the source document's content list. If this ratio is less than 0.9, the file format consistency verification alarm level is warning; otherwise, it is normal. For PPTX files, the format consistency verification (FC-PPTX-01) compares the number of slides in the converted document (obtained by counting "## slides" or "## Slide") with the number of pages in the source document's content list. If they do not match, the file format consistency verification alarm level is warning; otherwise, it is normal. For XLSX files, the format consistency verification (FC-XLSX-01) compares the number of worksheets in the converted document (obtained by counting "##" or "## Slide") with the number of pages in the source document's content list. The number of sheets obtained is compared with the number of worksheets in the source document's content list. If they are inconsistent, the alarm level for file format consistency verification is warning; otherwise, it is normal. For DOCX files, the format consistency verification of DOCX files (denoted as FC-DOCX-01) constructs a source document title tree based on the title details list in the source document's content list and scans the "## title" of the converted document. Based on the scanned "## title", a converted document title tree is constructed. The source document title tree and the converted document title tree are compared. That is, for each title in the source document title tree, a title (level + text) that matches the title is searched in the converted document title tree. If a match is found, the title in the converted document title tree is marked as matched to avoid duplicate matching of an output title. After matching all titles in the source document title trees, the similarity (i.e., number of matched titles / number of source titles) is calculated. If the text similarity is less than or equal to 0.8, the alarm level for file format consistency verification is warning; otherwise, it is normal.
[0143] In this embodiment of the application, after obtaining the alarm level of the file format consistency verification, the score of the file format consistency verification is calculated based on the alarm level of the file format consistency verification, and the file format consistency verification is determined as to whether the file format consistency verification has passed based on the alarm level of the file format consistency verification.
[0144] The alarm level calculation for file format consistency verification can be specifically as follows: the maximum score is 1, and 0.2 points are deducted for each warning level.
[0145] It should be noted that the above-mentioned maximum score of 1 point and warning level deduction of 0.2 points are merely examples and are not intended to limit this application.
[0146] The determination of whether a file format consistency verification passes or fails based on the alarm level of the file format consistency verification can be as follows: if there are no warning-level issues, the file format consistency verification is considered to have passed; if there are warning-level issues, the file format consistency verification is considered to have failed.
[0147] In this embodiment of the application, after calculating the result of whether the file format conformance verification passed and the score of the file format conformance verification, a file format conformance verification sub-report is output, which includes at least the result of whether the file format conformance verification passed, the score of the file format conformance verification, the alarm level of the file format conformance verification, the problem list, and the missing title, etc.
[0148] As an optional embodiment of this application, the above verification result includes a coverage verification sub-report; the coverage verification includes multiple coverage verification items, and the alarm levels of different coverage verification items are different; the verification of the coverage of the converted document in the above verification module 240 includes: for each coverage verification item, performing a verification operation on the converted document based on the verification content of the coverage verification item, the converted document, and the list of source document content, to obtain the alarm level of the coverage verification item; determining whether the coverage verification passes based on the alarm levels of each coverage verification item, and outputting a coverage verification sub-report that includes at least the pass result of the coverage verification and the alarm levels of each coverage verification item.
[0149] For example, the coverage verification sub-report is used to record the coverage verification results. In this application embodiment, the coverage verification includes multiple coverage verification items. As a specific implementation of this application, the coverage verification items include at least one of the following: page number coverage, image consistency, image integrity, worksheet coverage, and title coverage.
[0150] In this embodiment, the alarm levels for different coverage verification items are different. For example, the alarm level for page coverage is a warning, and the alarm level for image coverage is a severe alarm. This embodiment does not specifically limit the alarm level for each coverage verification item, and it can be determined according to the actual situation.
[0151] In this embodiment of the application, for each coverage verification item, a verification operation is performed on the converted document based on the verification content of the coverage verification item, the converted document, and the list of source document content to obtain the alarm level of the complete verification item.
[0152] Specifically, page coverage can be calculated for converted documents from source documents of PDF or PPTX file types. For PDF page coverage (denoted as CV-01 PDF), the ratio of the number of page breaks (i.e., "\f") in the converted document to the number of pages in the source document's content list is calculated. If the ratio is less than 0.9, the page coverage warning level is considered warning; otherwise, it is normal. For PPTX page coverage (denoted as CV-02 PPTX), the ratio of the number of slides (i.e., the number of "## slides" or "## Slide") in the converted document to the number of pages in the source document's content list is calculated. If the ratio is less than 1, the page coverage warning level is considered warning; otherwise, it is normal. For worksheet coverage (CV-03), this can only be calculated for converted documents obtained from source documents of file type XLSX. The ratio of the number of worksheets in the converted document (extraction method can be found in the above example) to the number of worksheets in the source document's content list is calculated. If the ratio is less than 1, the worksheet coverage alarm level is warning; otherwise, it is normal. For image integrity (CV-05-1), each image reference in the converted document is checked to see if its corresponding file exists on the disk. If it does not exist, the image integrity alarm level is severe; otherwise, it is normal. For image consistency (CV-05-2), the number of image references is verified to be consistent with the number of images in the source document's content list. If they are inconsistent, the image consistency alarm level is warning; otherwise, it is normal. For title coverage (CV-07), the ratio of the total number of titles in the converted document (extraction method can be found in the above example description) to the total number of titles in the source document's content list is calculated. If the ratio is less than 0.8, the title coverage alarm level is warning; otherwise, it is normal.
[0153] It should be noted that for all the coverage validation items mentioned above, if the count in the source document content list is 0, the validation of that item will be skipped to avoid the denominator being 0.
[0154] In this embodiment of the application, after obtaining the alarm level of each coverage verification item, the score of coverage verification is calculated based on the alarm level of each coverage verification item, and the pass or fail of coverage verification is determined based on the alarm level of each coverage verification item.
[0155] The score for coverage verification is calculated based on the alarm level of each coverage verification item. Specifically, the maximum score for each coverage verification item is 1, with 0.5 points deducted for severe level, 0.2 points deducted for warning level, and 0.05 points deducted for alert level, until all points are deducted. In other words, the lower limit for the score of coverage verification is 0 points.
[0156] It should be noted that the above-mentioned maximum score of 1 point, deduction of 0.5 points for serious level, deduction of 0.2 points for warning level, and deduction of 0.05 points for prompt level are only examples and are not intended to limit this application.
[0157] Determining whether coverage verification passes based on the alarm level of each coverage verification item can be as follows: if there is no critical problem, coverage verification passes; if there is a critical problem, coverage verification fails.
[0158] In this embodiment of the application, after calculating whether the coverage verification passed and the score of the coverage verification, the output includes at least the coverage verification passing result, the coverage verification score, the alarm level of each coverage and the problem list of the coverage verification sub-report.
[0159] As an optional embodiment of this application, the above verification result includes a content accuracy verification sub-report; the content accuracy verification includes multiple content accuracy verification items, and the alarm levels of different content accuracy verification items are different; verifying the accuracy of the converted content of the converted document includes: for each content accuracy verification item, performing a verification operation on the converted document based on the verification content of the content accuracy verification item, the converted document, and the source document to obtain the alarm level of the content accuracy verification item; determining whether the content accuracy verification passes based on the alarm levels of each content accuracy verification item, and outputting a content accuracy verification sub-report that includes at least the passing result of the content accuracy verification and the alarm levels of each content accuracy verification item.
[0160] For example, the above-mentioned content accuracy verification sub-report is used to record the content accuracy verification results of the converted document. In this embodiment of the application, the above-mentioned content accuracy verification includes multiple content accuracy verification items. As a specific implementation of this application, the above-mentioned content accuracy verification items include at least one of the following: text similarity, key number retention rate, and key term retention rate.
[0161] The text similarity mentioned above is used to check the degree of similarity between the source document and the converted document; the key figure retention rate mentioned above is used to check the proportion of key figures retained after conversion; and the key term retention rate mentioned above is used to check the proportion of key terms retained after conversion.
[0162] In this embodiment, the alarm levels for different content accuracy verification items are different. For example, the alarm level for text similarity is a warning level, and the alarm level for key term retention rate is a prompt level, etc. This embodiment does not specifically limit the alarm level for each content accuracy verification item, and it can be determined according to the actual situation.
[0163] In the embodiments of the present application, for each content accuracy verification item, a verification operation is performed on the converted document based on the verification content of the content accuracy verification item, the converted document, and the source document, to obtain an alarm level of the content accuracy verification item.
[0164] First, it should be noted that for strict, degraded extraction needs to be performed on the source document to obtain a degraded document. That is, extract text page by page from a PDF source document, traverse paragraph text from a DOCX source document, directly read a source document of a text type (for example, md / txt / csv / json / xml), and return an empty string for remaining binary formats (for example, PPTX, XLSX, images, and the like). In addition, an empty string is returned when any exception occurs, and content accuracy verification is skipped.
[0165] Specifically, for text similarity (denoted as CA-01), word segmentation extraction is performed on the degraded document and the converted document by using a hybrid word segmentation method, to obtain a source word segmentation result and a converted word segmentation result. Specifically, Chinese is segmented by character, English is segmented by lowercased letter words with a length greater than or equal to 2, and numbers are segmented by consecutive digit sequences with a length greater than or equal to 2 (for example, "2026" is extracted from "year 2026"; "14" is extracted from "3.14", and "3" is a single digit and is not extracted; "5" in "Chapter 5" is not extracted). Then, a Jaccard similarity is calculated based on an intersection of the source word segmentation result and the converted word segmentation result and a union of the source word segmentation result and the converted word segmentation result. If the similarity is less than 0.5, an alarm level is a prompt level (a short text has a large similarity fluctuation) when a quantity in the source word segmentation result is less than 100; otherwise, the alarm level is a warning level. For a key number retention rate (denoted as CA-02), a ratio of an intersection of number word segmentation (after deduplication) in the source word segmentation result and number word segmentation (after deduplication) in the converted word segmentation result to a quantity of number word segmentation in the source word segmentation result is calculated. If the ratio is less than 0.9, an alarm level of the key number retention rate is a warning level; otherwise, the alarm level is normal. For a key term retention rate (denoted as CA-03), key terms in the degraded document and the converted document are separately extracted, to obtain a source key term set and a converted key term set. Specifically, Chinese is extracted by using consecutive two characters (for example, "conversion" and "quality" can be extracted from "conversion quality"), and English is extracted by using letter words with a length greater than or equal to 4. Then, occurrence frequency of extracted words is sorted, and a set of words with top 20 ranks extracted from the source document is used as the source key term set. Similarly, a set of words with top 20 ranks extracted from the converted document is used as the converted key term set. Then, a ratio of a quantity of terms in an intersection of the source key term set and the converted key term set to a quantity of terms in a union of the source key term set and the converted key term set is calculated. If the ratio is less than 0.8, an alarm level of the key term retention rate is a prompt level; otherwise, the alarm level is normal.
[0166] In this embodiment of the application, after obtaining the alarm level of each content accuracy verification item, the score of content accuracy verification is calculated based on the alarm level of each content accuracy verification item, and the content accuracy verification is determined as to whether it passes based on the alarm level of each content accuracy verification item.
[0167] The score for content accuracy verification is calculated based on the alarm level of each content accuracy verification item. Specifically, the maximum score for each content accuracy verification item is 1, with a deduction of 0.5 points for a severe level and 0.1 points for a warning level, until all points are deducted. In other words, the lower limit for the content accuracy verification score is 0 points.
[0168] It should be noted that the above-mentioned maximum score of 1 point, deduction of 0.5 points for serious level and deduction of 0.1 points for warning level are only examples and are not intended to limit this application.
[0169] The content accuracy verification pass or fail is determined based on the alarm level of each content accuracy verification item. Specifically, if there is no critical issue, the content accuracy verification passes; if there is a critical issue, the content accuracy verification fails.
[0170] In this embodiment of the application, after calculating the result of whether the content accuracy verification passed and the score of the content accuracy verification, the output includes at least the content accuracy verification passing result, the content accuracy verification score, the alarm level of each content accuracy verification item, and the problem list of the content accuracy verification sub-report.
[0171] As an optional embodiment of this application, the above verification result includes a truncation verification sub-report; the truncation verification includes multiple truncation verification items, and the alarm levels of different truncation verification items are different; the verification of the truncation of the converted document includes: for each truncation verification item, performing a verification operation on the converted document based on the verification content of the truncation verification item, the converted document, the source document, and the list of contents of the source document, to obtain the alarm level of the truncation verification item; determining whether the truncation verification passes based on the alarm level, and outputting a truncation verification sub-report that includes at least the passing result of the truncation verification and the alarm levels of each truncation verification item.
[0172] For example, the above-mentioned truncation verification sub-report is used to record the truncation verification results of the converted document. In this embodiment of the application, the above-mentioned truncation verification includes multiple truncation verification items. As a specific implementation of the application, the above-mentioned truncation verification items include at least one of the following: explicit truncation mark detection, implicit size anomaly detection, block pattern hint detection, implicit structure truncation detection, implicit length detection, and end integrity detection.
[0173] Specifically, the above-mentioned explicit truncation mark detection is used to check whether the converted document contains marks such as "..." or "omission"; the above-mentioned implicit size anomaly detection is used to check whether the file size of the converted document is abnormally small; the above-mentioned block mode hint detection is used to check whether the pagination and block division in the converted document are normal; the above-mentioned implicit structure truncation detection is used to check whether the structural nodes in the converted document are missing; the above-mentioned implicit length detection is used to check whether the text length of the converted document is significantly shorter than that of the source document; and the above-mentioned end integrity detection is used to check whether the last page, last paragraph, and last table of the converted document are complete.
[0174] In this embodiment, the alarm levels for different truncation verification items are different. For example, the alarm level for the end integrity detection is a warning level, and the alarm level for the implicit structure truncation detection is a severe level, etc. This embodiment does not specifically limit the alarm level for each truncation verification item; it can be determined according to the actual situation.
[0175] In this embodiment of the application, for each truncated verification item, a verification operation is performed on the converted document based on the verification content of the truncated verification item, the converted document, the source document, and the list of contents of the source document to obtain the alarm level of the truncated verification item.
[0176] In this embodiment of the application, the verification of this truncation case also needs to be performed using the aforementioned extracted degradation list. For empty strings, skip the L5 verification below.
[0177] Specifically, for the truncation mark detection (denoted as L1), if the conversion document includes preset truncation marks such as "output truncated", the alarm level for the truncation mark detection is warning. For the chunk mode prompt detection (denoted as L2), it checks whether there are prompts such as "chunk mode / use chunk / use chunk" in the conversion document. If there are, the alarm level for the chunk mode prompt detection is prompt. For the implicit size anomaly detection (denoted as L3), it can coordinate with FI-07 alarms. Only when an alarm is triggered in FI-07 will it further check whether the ratio is less than 0.001. If so, the alarm level for the implicit size anomaly detection is severe. If FI-07 does not trigger an alarm, the implicit size anomaly detection will not trigger an alarm to avoid duplicate alarms. For implicit structure truncation detection (denoted as L4), the ratio of the number of pages in the converted document to the number of pages in the source document's content list is calculated (i.e., the number of page breaks in the converted PDF document / the number of pages, and the number of slide markers in the converted PPTX document / the number of pages), and the ratio of the number of worksheets in the converted document to the number of worksheets in the source document's content list is calculated. If any of these ratios is less than 0.5, the alert level for implicit structure truncation detection is severe. In this embodiment, the percentage of content loss can be calculated as (1 - ratio) × 100%. For implicit length detection (denoted as L5), the ratio of the number of characters in the converted document to the number of characters in the source document is checked. If it is less than 0.5, the alert level for implicit length detection is warning. For end integrity detection (denoted as L6), if the converted document contains at least one of the following: an odd number of code block fences, an unclosed table at the end, no sentence terminator at the end of short text, or an empty header line, the alert level for end integrity detection is warning.
[0178] In this embodiment of the application, after obtaining the alarm level of each truncation verification item, the score of the truncation verification is calculated based on the alarm level of each truncation verification item, and the pass or fail of the truncation verification is determined based on the alarm level of each truncation verification item.
[0179] The score for the truncation verification is calculated based on the alarm level of each truncation verification item. Specifically, if a critical problem exists, the score is 0 points; if no critical problem exists, the score is 1 point.
[0180] The determination of whether the truncation verification passes or fails is based on the alarm level of each truncation verification item. Specifically, if there is no critical problem, the truncation verification passes; if there is a critical problem, the truncation verification fails.
[0181] In this embodiment of the application, after obtaining the result of whether the file truncation verification passed and the score of the truncation verification, the output includes at least the passing result of the truncation verification, the score of the truncation verification, the alarm level of each truncation verification item, and the truncation verification sub-report of the problem list.
[0182] In this embodiment, after executing the verification content corresponding to the target verification strength, the various verification sub-reports can be summarized. The total score of the converted document is the average score of each verification sub-report, and the verification pass status of the converted document is the logical AND of the pass results in each verification sub-report. The time consumed in each of the above stages (file integrity verification, source document content list extraction, format consistency verification, coverage verification, content accuracy verification, truncation verification, etc., in milliseconds) is summarized and recorded in the stage time field of the verification result. The total time consumed in the conversion document verification is the sum of the time consumed in each stage.
[0183] In this embodiment of the application, if any of the above verifiers fails to verify, only an alarm is recorded, which will not affect the delivery of the converted document. If all sub-reports are missing, the total score of the converted document is full marks, and the pass status of the converted document is passed by default.
[0184] In this embodiment, the stage tracker of the conversion pipeline (a thread-local tracker that enumerates and records entries according to eight stages: initialization, parsing, extraction, formatting, post-processing, verification, completion, and failure) can bind each verification sub-report, the time spent in each stage, and the total time spent together using the same audit identifier (i.e., Universally Unique Identifier, UUID). When verification is completed, an audit log with an event type of verification is written, which includes the audit identifier, timestamp, source file path, source file type, operator, verification strength, overall score, pass status, scores of each sub-report, whether truncation was detected, the number of issues graded by severity, and the total time spent, etc.
[0185] As an optional embodiment of this application, the above-described method 100 for verifying the quality of converted documents further includes: outputting the converted document and the verification result.
[0186] In this embodiment, after completing the conversion of the source document and the verification of the converted document, the converted document and the verification result need to be output to the user or caller for their use and judgment, thus achieving a closed loop of conversion and verification. In this embodiment, the converted document and verification result can be directly displayed on the screen of an electronic device, or output to other devices via wired or wireless connection. This embodiment does not specifically limit the output method of the converted document and verification result, and can be determined according to the actual situation.
[0187] As an optional embodiment of this application, outputting the converted document and verification result includes: if the file size of the converted document is greater than a set threshold, truncating the converted document according to the set threshold and outputting it; and reducing the verification result and outputting the reduced verification result; if the file size of the converted document is less than or equal to the set threshold, directly outputting the converted document and verification result.
[0188] For example, the aforementioned threshold is a pre-defined upper limit for the file size, which can be configured through the environment variable HQ_MD_MCP_OUTPUT_LIMIT_KB. In this embodiment, the aforementioned threshold can be configured based on the transmission threshold of the MCP channel. For example, the threshold can be configured to be the same as the transmission threshold of the MCP channel (i.e., 18KB). Alternatively, to ensure transmission quality, the threshold can be configured to be less than the transmission threshold of the MCP channel, such as 15KB or other reasonable values. This embodiment does not specifically limit this.
[0189] In this embodiment, if the file size of the converted document is less than or equal to the aforementioned set threshold, the converted document and verification result can be output directly. For example, the verification result can be appended to the converted document before output. If the file size of the converted document is greater than the aforementioned set threshold, the converted document is truncated according to the set threshold before output, that is, the converted document is truncated to the set threshold before output, for example, the converted document is truncated to 18KB before output.
[0190] At the same time, the verification results need to be reduced and the reduced verification results should be output. Specifically, the verification results should be output as a single-line concise summary of less than, for example, 500 characters (i.e., the reduced verification results). Of course, the concise summary can also include guidance information to prompt the call to the independent verification tool (verify_conversion) to obtain the complete verification results.
[0191] In this embodiment, the aforementioned independent verification tool verify_conversion does not perform a conversion operation. It directly reuses the same verification link (default standard file) for the Markdown text provided by the user and returns a complete verification report. Its output only contains the verification report (usually less than 5KB), and there is no risk of transmission truncation.
[0192] In this embodiment of the application, the verification result can be reduced according to a set format. The set format can be, for example, "Verification result: overall score = ..., verification pass status = ..., critical warning = ..., warning = ..., ".
[0193] This application embodiment outputs small conversion documents directly, truncates large conversion documents, and reduces the verification results. This can adapt to the transmission limitations of large model MCP channels, reduce transmission pressure, and ensure the traceability of verification results.
[0194] As a specific implementation of this application, the source document is a PDF document, and the target verification strength is standard: a 20-page source PDF document (containing 8 images and 3 tables) is converted to Markdown through a conversion pipeline, and the verification strength is configured as standard. The source document content list extracted by the PDF parsing library includes: 20 pages, 8 images, 3 tables, and the number of paragraphs and headings is heuristically counted by text blocks and font size. The extracted alarm list is empty. The various verification contents of standard are executed, specifically: FI-01 to FI-07 outputs are not empty, the encoding is valid, and there are no garbled characters. FI-07 calculates the output / input byte ratio to be 0.35, which is within the range of [0.01, 100] and does not trigger. FC-PDF-01 is executed: the conversion result contains 20 page break marks, and the page ratio of 1.0 is not less than 0.9; CV-01 is also passed; CV-05 checks that all 8 image reference files exist and the number of references is consistent with the number of images in the list. Since the extracted alarms were empty, no downgrade was performed. The overall score for all verifications was 1.0, the average of the scores from the three sub-reports (file integrity verification, format consistency verification, and coverage verification), which is considered a pass. Because the converted text was 25KB, exceeding the 18KB transmission threshold, the main text was truncated to 18KB. The verification report was delivered with the converted text as a single-line concise summary "verification: score=1.00, status=PASS, critical=0, warning=0, intensity=standard," and a prompt was given that verify_conversion could be used to obtain the complete report; a verification audit event was also written. If the PDF actually only converted 15 page breaks, the page ratio of FC-PDF-01 to CV-01 would be 0.75, below the 0.9 threshold, generating one warning-level issue for each. The report provided a quantitative missing location for "source 20 pages, output 15 page breaks," still passing overall (no critical issues), but the overall score decreased.
[0195] As a specific implementation of this application, the source document is a DOCX document, the target validation strength is standard, and the downgrade validation is performed due to the missing parsing library of the extractor: A DOCX document is converted in an environment without the python-docx library installed, and the validation strength is standard. When extracting the content list of the source document, if the preferred parsing path is unavailable, the compressed package downgrade path is automatically switched, that is, the DOCX file is opened as a compressed package, word / document.xml is parsed, 120 paragraph elements and 5 table elements are counted by element local names, the heading level is identified from the paragraph style attributes and the heading count is 15, the number of images is counted as 4 based on the number of files in the word / media / directory, the heading details list is empty, and the alarm list is extracted and written with "python-docx missing, using zipfile fallback". The downgrade detection is hit, the format consistency validator is skipped (the heading tree comparison cannot be executed because the heading details are empty), the coverage validator is retained, and the actual effective strength remains standard. Then the standard validation is performed, CV-05 is executed, and it is checked that the files corresponding to the 4 images in the conversion result exist and the number of references is consistent with the number of images in the list of 4, so it passes. The verification sub-report alarm records the reason for the downgrade, the skip list, and the strength of the effect. The audit event accurately records the scope of verification after the downgrade. Compared to the situation where the entire verification is interrupted or skipped due to missing parsing libraries, this embodiment still retains the key verification capability of image asset integrity even in scenarios with missing dependencies.
[0196] As another specific implementation of this application, taking the aforementioned PDF document as an example, if the PDF document is requested to be converted again within the cache validity period (default TTL 3600 seconds), and the cache key (SHA-256 digest of the concatenation string of source path, modification time, file size, and conversion configuration) is matched, the system directly returns the cached text (i.e., the converted document). At this time, even if the configured verification strength is strict, the actual effective strength (i.e., the target verification strength) will be forcibly reduced to the quick level, and only file integrity verification, i.e., FI-01 to FI-07, will be performed, and an alarm "cache_hit=true, only perform quick verification" will be recorded to avoid the overhead of repeatedly performing list extraction and multi-dimensional verification on results that have already been fully verified.
[0197] Figure 2 An exemplary structural block diagram of a quality verification apparatus for converted documents according to some embodiments of this application is shown.
[0198] like Figure 2As shown, the document conversion quality verification device 200 includes: a document conversion request receiving module 210, used to receive a document conversion request, the document conversion request carrying the source document path; a document conversion module 220, used to obtain the source document based on the source document path and perform format conversion on the source document to obtain a converted document; a source document content list extraction module 230, used to extract feature information from the source document to obtain a source document content list; and a verification module 240, used to verify the quality of the converted document using at least one of the source document content list and the source document, as well as the converted document, to obtain a verification result.
[0199] As an optional embodiment of this application, the quality verification device 200 for the converted document further includes: a target verification strength determination module, used to determine the target verification strength for verifying the quality of the converted document; and an extraction determination module, used to determine whether to extract feature information of the source document based on the target verification strength.
[0200] As an optional embodiment of this application, the target verification strength determination module is specifically used to: check whether the document conversion request carries a verification strength identifier; if it exists, take the verification strength corresponding to the verification strength identifier carried in the document conversion request as the target verification strength; if it does not exist, further check whether there is a system-configured verification strength; if it exists, take the system-configured verification strength as the target verification strength; if it does not exist, take the default verification strength as the target verification strength.
[0201] As an optional embodiment of this application, the target verification strength determination module is further configured to: obtain the attribute information of the source document; if cache information matching the attribute information is found, then set the verification strength as the target verification strength.
[0202] As an optional embodiment of this application, the search for cached information matching the attribute information in the target verification strength determination module includes: calculating the attribute information based on a set algorithm to obtain a calculation result; using the calculation result as a keyword to search for whether there is cached information that matches the keyword; if so, determining that cached information matching the attribute information has been found.
[0203] As an optional embodiment of this application, the quality verification device 200 for the converted document further includes: a storage module for storing calculation results and the converted document.
[0204] As an optional embodiment of this application, the target verification strength is one of a plurality of set verification strengths, and the verification content corresponding to different set verification strengths is different.
[0205] As an optional embodiment of this application, multiple verification strength settings include: a first-level verification strength, a second-level verification strength, a third-level verification strength, and a fourth-level verification strength; wherein, the verification content corresponding to the first-level verification strength is empty; the verification content corresponding to the second-level verification strength includes: file integrity verification; the verification content corresponding to the third-level verification strength includes: file integrity verification, file format consistency verification, and coverage verification; the verification content corresponding to the fourth-level verification strength includes: file integrity verification, file format consistency verification, coverage verification, content accuracy verification, and truncation verification; wherein, file integrity verification is used to verify the completeness of the converted document; format consistency verification is used to verify the degree of structural preservation of the converted document; coverage verification is used to verify the completeness of non-text in the converted document; content accuracy verification is used to verify the completeness of text in the converted document; and truncation verification is used to verify the loss of the tail of the converted document.
[0206] As an optional embodiment of this application, the extraction and determination module is specifically used to: when the target verification strength is the first level verification strength or the second level verification strength, not extract the feature information of the source document; the verification module 240 is specifically used to: use the source document and the converted document to verify the quality of the converted document according to the verification content corresponding to the target verification strength; when the target verification strength is the third level verification strength or the fourth level verification strength, extract the feature information of the source document; the verification module 240 is specifically used to: use the source document, the converted document, and the source document content list to verify the quality of the converted document according to the verification content corresponding to the target verification strength.
[0207] As an optional embodiment of this application, the document conversion request also carries the file type of the source document; the source document content list extraction module 230 is specifically used to: search for whether there is an extractor that matches the file type based on the file type; if there is, use the found extractor to extract the feature information of the source document; if there is no extractor, and the file type is a set file type, then use the downgrade extraction path corresponding to the file type to extract the feature information of the source document; if there is no extractor, and the file type is not a set file type, then do not extract the feature information of the source document.
[0208] As an optional embodiment of this application, the source document content list includes: a content list and an extraction alarm list; the content list includes at least: the number of document pages, the total number of titles, the total number of paragraphs, the number of tables, the number of images, the number of worksheets, and the total number of rows in the worksheets; the extraction alarm list is used to record abnormal messages generated during the extraction process of the extractor.
[0209] As an optional embodiment of this application, the file types include at least: PPTX, DOCX, PDF, XLSX; the file type is set to OOXML.
[0210] As an optional embodiment of this application, when the target verification strength is the third level verification strength or the fourth level verification strength, the quality verification device 200 of the converted document further includes: a correction module, used to correct the target verification strength based on the content list, file type and extracted alarm list.
[0211] As an optional embodiment of this application, the above-mentioned correction module is specifically used for: if the content list is empty, then the target verification strength is corrected to the second-level verification strength; if the file type is PDF, and the alarm list includes alarm information indicating that the PDF extractor does not exist, then the target verification strength is corrected to the second-level verification strength; if the file type is DOCX, and the alarm list includes alarm information indicating that the DOCX extractor does not exist, then the file format consistency verification is skipped, and the target verification strength remains unchanged; if the file type is PPTX or XLSX, and the alarm list includes alarm information indicating that the PPTX extractor or XLSX extractor does not exist, then the target verification strength remains unchanged.
[0212] As an optional embodiment of this application, the above verification result includes a file integrity verification sub-report; the file integrity verification includes multiple complete verification items, and the alarm levels of different complete verification items are different; the verification module 240 verifies the file integrity of the converted document, including: for each complete verification item, performing a verification operation on the converted document based on the verification content of the complete verification item, the converted document, and the source document, and obtaining the alarm level of the complete verification item; determining whether the file integrity verification passes based on the alarm levels of each complete verification item, and outputting an integrity verification sub-report that includes at least the passing result of the file integrity verification and the alarm levels of each complete verification item.
[0213] As an optional embodiment of this application, the complete verification items include at least one of the following: non-empty verification, encoding validity verification, garbled character verification, document syntax validity verification, table syntax validity verification, image reference validity verification, and document size verification.
[0214] As an optional embodiment of this application, the verification result includes a file format consistency verification sub-report; the verification module 240 above verifies the file format consistency of the converted document, including: determining the file format consistency verification method based on the file type, with different file format consistency verification methods for different file types; performing file format consistency verification on the converted document based on the file format consistency verification method, the converted document, and the source document content list to obtain the alarm level of the file format consistency verification; determining whether the file format consistency verification passes based on the alarm level of the file format consistency verification, and outputting a file format consistency verification sub-report that includes at least the passing result of the file format consistency verification and the alarm level of the file format consistency verification.
[0215] As an optional embodiment of this application, the verification result includes a coverage verification sub-report; the coverage verification includes multiple coverage verification items, and the alarm levels of different coverage verification items are different; the verification of the coverage of the converted document in the above-mentioned verification module 240 includes: for each coverage verification item, performing a verification operation on the converted document based on the verification content of the coverage verification item, the converted document, and the list of source document content, and obtaining the alarm level of the coverage verification item; determining whether the coverage verification passes based on the alarm levels of each coverage verification item, and outputting a coverage verification sub-report that includes at least the pass result of the coverage verification and the alarm levels of each coverage verification item.
[0216] As an optional embodiment of this application, the coverage verification items include at least one of the following: page coverage, image consistency, image integrity, worksheet coverage, and title coverage.
[0217] As an optional embodiment of this application, the verification result includes a content accuracy verification sub-report; the content accuracy verification includes multiple content accuracy verification items, and the alarm levels of different content accuracy verification items are different; the verification of the conversion content accuracy of the conversion document in the above-mentioned verification module 240 includes: for each content accuracy verification item, performing a verification operation on the conversion document based on the verification content of the content accuracy verification item, the conversion document, and the source document to obtain the alarm level of the content accuracy verification item; determining whether the content accuracy verification passes based on the alarm levels of each content accuracy verification item, and outputting a content accuracy verification sub-report that includes at least the passing result of the content accuracy verification and the alarm levels of each content accuracy verification item.
[0218] As an optional embodiment of this application, the content accuracy verification items include at least one of the following: text similarity, key number retention rate, and key term retention rate.
[0219] As an optional embodiment of this application, the verification result includes a truncation verification sub-report; the truncation verification includes multiple truncation verification items, and the alarm levels of different truncation verification items are different; the verification of the truncation of the converted document in the above-mentioned verification module 240 includes: for each truncation verification item, performing a verification operation on the converted document based on the verification content of the truncation verification item, the converted document, the source document, and the list of source document content, to obtain the alarm level of the truncation verification item; determining whether the truncation verification passes based on the alarm level, and outputting a truncation verification sub-report that includes at least the passing result of the truncation verification and the alarm levels of each truncation verification item.
[0220] As an optional embodiment of this application, the truncation verification items include at least one of the following: explicit truncation mark detection, implicit size anomaly detection, block pattern hint detection, implicit structure truncation detection, implicit length detection, and end integrity detection.
[0221] As an optional embodiment of this application, the above-mentioned quality verification device for converted documents further includes: an output module for outputting the converted documents and verification results.
[0222] As an optional embodiment of this application, the above output module is specifically used for: if the file size of the converted document is greater than a set threshold, truncating the converted document according to the set threshold and outputting it; and reducing the verification result and outputting the reduced verification result; if the file size of the converted document is less than or equal to the set threshold, directly outputting the converted document and the verification result.
[0223] For detailed implementation methods and beneficial effects, please refer to the description of the above method embodiments, which will not be repeated here.
[0224] Correspondingly, embodiments of this application also provide Figure 2 The hardware structure diagram of the device shown is as follows: Figure 3 As shown, the electronic device 300 can be a device for implementing the above-described quality verification method 100 for converted documents. For example... Figure 3 As shown, the electronic device 300 includes a processor 310 and a memory 320. The memory 320 is configured to store program instructions; the processor 310 is configured to load and execute the program instructions stored in the memory 320 to implement an embodiment of the corresponding converted document quality verification method 100 as shown above.
[0225] As one embodiment, memory 320 can be any electronic, magnetic, optical, or other physical storage device that can contain or store information such as program instructions, data, etc. For example, memory 320 can be volatile memory, non-volatile memory, or similar storage media. Specifically, memory 320 can be RAM (Random Access Memory), flash memory, storage drives (such as hard disk drives), solid-state drives, any type of storage disk (such as optical discs, DVDs, etc.), or similar storage media, or combinations thereof.
[0226] This concludes the process. Figure 3 Description of the electronic device shown.
[0227] While numerous embodiments of this application have been shown and described herein, it will be apparent to those skilled in the art that such embodiments are provided by way of example only. Many modifications, alterations, and alternatives will arise for those skilled in the art without departing from the spirit and intent of this application. It should be understood that various alternatives to the embodiments of this application described herein may be employed in the practice of this application. The appended claims are intended to define the scope of protection of this application and therefore cover equivalents or alternatives within the scope of these claims.
Claims
1. A quality verification method of converting a document, characterized by, include: Receive a document conversion request, the document conversion request carrying the source document path; The source document is obtained based on the source document path, and the format of the source document is converted to obtain the converted document; The feature information of the source document is extracted to obtain a list of source document contents; The quality of the converted document is verified using the source document content list and at least one of the source documents, as well as the converted document, to obtain a verification result.
2. The method of claim 1, wherein, Before extracting the feature information of the source document, the method further includes: Determine the target verification strength for verifying the quality of the converted document; Whether to extract feature information from the source document is determined based on the target verification strength.
3. The method of claim 2, wherein, Determining the target verification strength for verifying the quality of the converted document includes: Check whether the document conversion request carries a verification strength identifier; If it exists, the verification strength corresponding to the verification strength identifier carried in the document conversion request shall be used as the target verification strength; If not, further check whether there is system configuration verification strength; If it exists, the verification strength configured in the system will be used as the target verification strength; If it does not exist, the default verification strength will be used as the target verification strength.
4. The method according to claim 2 or 3, characterized in that, Determining the target verification strength for verifying the quality of the converted document includes: Obtain the attribute information of the source document; If cached information matching the attribute information is found, the verification strength will be set as the target verification strength.
5. The method of claim 4, wherein, Locating cached information that matches the attribute information includes: The attribute information is calculated based on the set algorithm to obtain the calculation result; Using the calculation result as the keyword, search for whether there is cached information that matches the keyword; If it exists, confirm that cached information matching the attribute information has been found.
6. The method of claim 5, wherein, After converting the source document to obtain the converted document, the method further includes: Store the calculation results and the converted document.
7. The method of claim 2, wherein, The target verification strength is one of multiple set verification strengths, and the verification content corresponding to different set verification strengths is different.
8. The method of claim 7, wherein, The multiple set verification strengths include: a first-level verification strength, a second-level verification strength, a third-level verification strength, and a fourth-level verification strength; wherein, the verification content corresponding to the first-level verification strength is empty; the verification content corresponding to the second-level verification strength includes: file integrity verification; the verification content corresponding to the third-level verification strength includes: file integrity verification, file format consistency verification, and coverage verification; the verification content corresponding to the fourth-level verification strength includes: file integrity verification, file format consistency verification, coverage verification, content accuracy verification, and truncation verification; The document integrity verification is used to verify the completeness of the converted document; the format consistency verification is used to verify the degree of structural preservation of the converted document; the coverage verification is used to verify the completeness of non-text in the converted document; the content accuracy verification is used to verify the completeness of text in the converted document; and the truncation verification is used to verify the loss of the tail of the converted document.
9. The method of claim 8, wherein, The step of determining whether to extract feature information from the source document based on the target verification strength includes: When the target verification strength is the first level verification strength or the second level verification strength, the feature information of the source document is not extracted; The step of verifying the quality of the converted document using the source document content list and at least one of the source documents, as well as the converted document, includes: Using the source document and the converted document, the quality of the converted document is verified according to the verification content corresponding to the target verification strength; When the target verification strength is the third level verification strength or the fourth level verification strength, the feature information of the source document is extracted; The step of verifying the quality of the converted document using the source document content list and at least one of the source documents, as well as the converted document, includes: Using the source document, the converted document, and the list of contents of the source document, the quality of the converted document is verified according to the verification content corresponding to the target verification strength.
10. The method according to claim 8 or 9, characterized in that, The document conversion request also carries the file type of the source document; the extraction of feature information from the source document to obtain a list of source document content includes: Based on the file type, search for whether there is an extractor that matches the file type; If it exists, use the found extractor to extract the feature information of the source document; If it does not exist, and the file type is a set file type, then the feature information of the source document is extracted using the downgrade extraction path corresponding to the file type; If the file does not exist and the file type is not the specified file type, then the feature information of the source document will not be extracted.
11. The method of claim 10, wherein, The source document content list includes a content list and an extraction alarm list; the content list includes at least the following: document page number, total number of titles, total number of paragraphs, number of tables, number of images, number of worksheets, and total number of rows in the worksheets; the extraction alarm list is used to record abnormal messages generated during the extraction process.
12. The method of claim 11, wherein, The file types include at least: PPTX, DOCX, PDF, and XLSX; the set file type is OOXML.
13. The method of claim 12, wherein, When the target verification strength is level 3 or level 4 verification strength, the method further includes: The target verification strength is adjusted based on the content list, the file type, and the extracted alarm list.
14. The method of claim 13, wherein, The step of modifying the target verification strength based on the content list, the file type, and the extracted alarm list includes: If the list of contents is empty, the target verification strength is adjusted to the second level of verification strength; If the file type is PDF and the extraction alarm list includes alarm information indicating that the PDF extractor does not exist, then the target verification strength is modified to the second level of verification strength. If the file type is DOCX and the extraction alarm list includes alarm information indicating that the DOCX extractor does not exist, then the file format consistency verification is skipped and the target verification strength remains unchanged. If the file type is PPTX or XLSX, and the extraction alarm list includes alarm information indicating that the PPTX extractor or XLSX extractor does not exist, then the target verification strength remains unchanged.
15. The method of claim 14, wherein, The verification result includes a file integrity verification sub-report; the file integrity verification includes multiple complete verification items, and the alarm levels of different complete verification items are different; Verifying the file integrity of the converted document includes: For each complete verification item, a verification operation is performed on the transformed document based on the verification content of the complete verification item, the transformed document, and the source document to obtain the alarm level of the complete verification item; The system determines whether the file integrity verification passes based on the alarm level of each complete verification item, and outputs an integrity verification sub-report that includes at least the passing result of the file integrity verification and the alarm level of each complete verification item.
16. The method of claim 15, wherein, A complete set of validation items includes at least one of the following: non-empty validation, encoding validity validation, garbled character validation, document syntax validity validation, table syntax validity validation, image reference validity validation, and document size validation.
17. The method of claim 14, wherein, The verification results include a file format consistency verification sub-report; verifying the file format consistency of the converted document includes: The file format consistency verification method is determined based on the file type, and the file format consistency verification method is different for different file types; Based on the file format consistency verification method, the converted document, and the source document content list, file format consistency verification is performed on the converted document to obtain the alarm level for file format consistency verification; Based on the alarm level of the file format consistency verification, determine whether the file format consistency verification has passed, and output a file format consistency verification sub-report that includes at least the passing result of the file format consistency verification and the alarm level of the file format consistency verification.
18. The method of claim 14, wherein, The verification results include a coverage verification sub-report; the coverage verification includes multiple coverage verification items, and the alarm levels of different coverage verification items are different. Verifying the coverage of the converted documents includes: For each coverage verification item, a verification operation is performed on the conversion document based on the verification content of the coverage verification item, the conversion document, and the list of contents of the source document to obtain the alarm level of the coverage verification item. The system determines whether the coverage verification passes based on the alarm level of each coverage verification item, and outputs a coverage verification sub-report that includes at least the pass result of the coverage verification and the alarm level of each coverage verification item.
19. The method of claim 18, wherein, The coverage verification items include at least one of the following: page coverage, image consistency, image integrity, worksheet coverage, and title coverage.
20. The method of claim 14, wherein, The verification results include a content accuracy verification sub-report; the content accuracy verification includes multiple content accuracy verification items, and the alarm levels for different content accuracy verification items are different. Verifying the accuracy of the converted content of the document includes: For each content accuracy verification item, a verification operation is performed on the converted document based on the verification content of the content accuracy verification item, the converted document, and the source document to obtain the alarm level of the content accuracy verification item; Based on the alarm level of each content accuracy verification item, determine whether the content accuracy verification passes or fails, and output a content accuracy verification sub-report that includes at least the passing result of the content accuracy verification and the alarm level of each content accuracy verification item.
21. The method of claim 20, wherein, The content accuracy verification items include at least one of the following: text similarity, key number retention rate, and key term retention rate.
22. The method of claim 14, wherein, The verification results include a truncation verification sub-report; the truncation verification includes multiple truncation verification items, and the alarm levels of different truncation verification items are different; Verification of the truncation of the converted document includes: For each truncated verification item, a verification operation is performed on the converted document based on the verification content of the truncated verification item, the converted document, the source document, and the list of contents of the source document to obtain the alarm level of the truncated verification item. Based on the alarm level, determine whether the truncation verification passes, and output a truncation verification sub-report that includes at least the passing result of the truncation verification and the alarm level of each truncation verification item.
23. The method of claim 22, wherein, The truncation verification items include at least one of the following: explicit truncation marker detection, implicit size anomaly detection, block pattern hint detection, implicit structure truncation detection, implicit length detection, and end integrity detection.
24. The method of claim 1, wherein, The method further includes: Output the converted document and the verification result.
25. The method of claim 24, wherein, Output the converted document and the verification result, including: If the file size of the converted document exceeds a set threshold, the converted document will be truncated according to the set threshold and then output; and The verification result is reduced, and the reduced verification result is output. If the file size of the converted document is less than or equal to the set threshold, the converted document and the verification result are directly output.
26. A quality verification apparatus for converting a document, characterized by include: A document conversion request receiving module is used to receive document conversion requests, wherein the document conversion request carries the source document path; The document conversion module is used to obtain the source document based on the source document path, and to convert the format of the source document to obtain the converted document; The source document content list extraction module is used to extract the feature information of the source document to obtain the source document content list; The verification module is used to verify the quality of the converted document using the source document content list and at least one of the source documents, as well as the converted document, and to obtain a verification result.
27. An electronic device, comprising: include: A processor, configured to execute program instructions; as well as A memory configured to store the program instructions, which, when loaded and executed by the processor, cause the processor to perform the method according to any one of claims 1-25.
28. A computer readable storage medium having stored therein program instructions, wherein, When the program instructions are loaded and executed by the processor, the processor performs the method according to any one of claims 1-25.
