Document processing method, computer device, storage medium and program product
Through the combination of continuous integration tools and message digest algorithm, the repeated definition problem when generating different versions of documents is solved, and efficient document conversion and generation is achieved.
Patent Information
- Application Number
- CN202510855089.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-24
- Publication Date
- 2025-08-29
- Estimated Expiration
- 2045-06-24
AI Technical Summary
When generating offline documents of different versions, multiple documents of different versions need to be defined at the same time, resulting in a large number of duplicate content being defined in multiple versions, resulting in inefficient document processing.
The version parameters are obtained through the continuous integration tool, the document definition file is integrated, and the message digest algorithm is used to generate identification values for querying. The document conversion tool is called only when there is no match in the database to convert, and the target document is generated.
It effectively avoids duplicate work in document generation, improves document processing efficiency, and ensures the accuracy and efficiency of document generation.
Smart Images

Figure CN120371796B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a document processing method, computer equipment, storage medium, and program product. Background Art
[0002] Currently, platform user manuals are crucial for AI platforms, playing a key role in guiding user operations, promoting platform adoption, and ensuring stable operation. As a software product, AI platforms must release different versions of offline documentation simultaneously with their release.
[0003] In related technologies, in order to generate different versions of offline documents, it may be necessary to define multiple different versions of documents at the same time, among which a large amount of repeated content needs to be defined in multiple copies in multiple versions; in addition, when the processed files are relatively large or there are many lightweight markup language files involved, the document conversion will become very slow, resulting in relatively low document processing efficiency. Summary of the Invention
[0004] The present application provides a document processing method, computer device, storage medium and program product to at least solve the problem in the related art that when generating different versions of documents, different versions of files need to be defined at the same time, and there is a large amount of repeated content that needs to be defined in multiple copies in multiple versions of text, resulting in slow and low efficiency in subsequent document conversion.
[0005] The present application provides a document processing method, comprising: when triggering the generation of a target document based on a continuous integration tool, obtaining a version parameter, and obtaining multiple document definition files of the target document from a preset repository; processing the multiple document definition files according to the version parameter based on a document processing script to obtain a file to be converted; calculating the file to be converted based on a preset message digest algorithm to obtain an identification value of the file to be converted; querying a preset database based on the identification value, and when no document matching the identification value is obtained in the preset database, calling a document conversion tool based on a document generation script to convert the file to be converted to obtain the target document.
[0006] The present application also provides a document processing device, including: a first acquisition module, used to obtain version parameters when triggering the generation of a target document based on a continuous integration tool; a second acquisition module, used to obtain multiple document definition files of the target document from a preset warehouse; a processing module, used to process the multiple document definition files according to the version parameters based on a document processing script to obtain a file to be converted; a calculation module, used to calculate the file to be converted based on a preset message digest algorithm to obtain an identification value of the file to be converted; a query module, used to query a preset database based on the identification value; and a conversion module, used to call a document conversion tool based on a document generation script to convert the file to be converted to obtain the target document when no document matching the identification value is obtained in the preset database.
[0007] The present application also provides an electronic device, comprising: a memory for storing a computer program; and a processor for implementing the steps of any of the above-mentioned document processing methods when executing the computer program.
[0008] The present application also provides a computer-readable storage medium, in which a computer program is stored. When the computer program is executed by a processor, the steps of any of the above-mentioned document processing methods are implemented.
[0009] The present application also provides a computer program product, including a computer program, which implements the steps of any of the above-mentioned document processing methods when executed by a processor.
[0010] Through this application, since multiple document definition files pre-stored for the target document are obtained, when the target document needs to be generated, the multiple document definition files are integrated according to the version parameters, the file to be converted corresponding to the version parameters is obtained, and the database is queried whether the target document of the file to be converted already exists. If it does not exist, the document conversion tool is called to convert the file to be converted to obtain the target document. This solves the technical problem of needing to define different versions of files at the same time when generating different versions of target documents, and having a large amount of repeated content that needs to be defined in multiple versions of texts, resulting in slow and low efficiency in subsequent document conversion. It effectively avoids duplication of work during document generation and improves work efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0012] Figure 1A flowchart of a document processing method provided in an embodiment of the present application;
[0013] Figure 2 An example diagram of the architecture of a document processing method provided in an embodiment of the present application;
[0014] Figure 3 An example diagram of a document processing method provided in an embodiment of the present application;
[0015] Figure 4 A schematic diagram of the structure of a document processing device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0016] The following will be combined with the accompanying drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of them. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.
[0017] It should be noted that, in the description of this application, the terms "comprises," "includes," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. The terms "first," "second," etc., in this application are used to distinguish similar objects, and are not used to describe a particular order or sequence.
[0018] In order to enable those skilled in the art to better understand the present application, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.
[0019] In conjunction with the specific application environment architecture or specific hardware architecture on which the execution of the document processing method depends, the specific application environment architecture or specific hardware architecture is described here.
[0020] In practical applications, platform manuals are crucial for AI platforms, playing a key role in guiding user operations, promoting platform adoption, and ensuring stable operation. Platform manuals are typically deployed online with the platform. Users can access the manuals at any time through a browser to guide their use of the platform.
[0021] However, in some special scenarios, the online documentation service may be unavailable due to unstable network conditions, slow network speeds, or even no network connection at all. Alternatively, users may need to read the manual to understand the platform's usage before the platform is deployed. In these cases, offline documentation becomes particularly important.
[0022] PDF (Portable Document Format) is a commonly used output format for offline documents due to its strong compatibility, ease of distribution and sharing, and convenient reading. Furthermore, its tamper-resistant nature effectively protects data security and integrity.
[0023] Specifically, for the definition and generation of PDF documents, the relevant solution is to first define the document content in markdown (a lightweight markup language) format, and then convert it into a PDF document through a document conversion tool. However, as a software product, the artificial intelligence platform must simultaneously publish different versions of offline documents when it is released. Different versions of documents correspond to different titles, pictures, headers, footers and other information. In related technologies, in order to generate different versions of offline documents, it is necessary to define multiple versions of documents at the same time. Among them, there is a large amount of repeated content that needs to be defined in multiple versions; in addition, when the processed files are relatively large or there are many markdown files involved, the conversion of the document conversion tool will also become very slow.
[0024] In response to the above problems, this application proposes a document processing method, which uses a continuous integration tool to convert different versions into corresponding versions of target documents, so that when defining a document, it is only necessary to define the different contents between different versions, and only define one set of the same content, thereby realizing on-demand generation of target documents, effectively avoiding duplication of work during document definition and document generation, and improving work efficiency; in addition, before conversion, the identification value of the file to be converted is used to query whether there is a cached target document, and conversion is only performed if it does not exist, further improving document generation efficiency.
[0025] The embodiments of the present application provide a document processing method, and the method is described in detail in conjunction with the execution flow of the document processing method.
[0026] Figure 1 This is a flowchart of a document processing method provided in an embodiment of the present application. The document processing method can be executed by a document processing device, wherein the document processing device can be implemented using software and / or hardware and can generally be integrated into a computer device. Figure 1 As shown, the method includes:
[0027] Step 101: When triggering the generation of a target document based on a continuous integration tool, obtain a version parameter and obtain multiple document definition files of the target document from a preset repository.
[0028] In an embodiment of the present application, the continuous integration tool may be "Jenkins", which is a widely used open source continuous integration and continuous delivery (CI (Continuous Integration) / CD (Continuous Deployment)) tool whose main functions include automated building, automated testing, and continuous deployment.
[0029] In an embodiment of the present application, product usage information of a product to be released, such as an artificial intelligence platform, can be obtained, such as user roles, usage permissions, etc., to determine several versions, so that each version corresponds to a version parameter, and a version is uniquely identified by the version parameter; generation information of the product to be released, such as generation time, etc., can also be obtained, so as to construct the trigger time of the continuous integration tool according to the generation information to send the target document with which version parameters. Therefore, the target document is generated based on the continuous integration tool by timing triggering, so that the version parameters can be obtained.
[0030] It should be noted that the target document can also be generated based on the continuous integration tool by manual triggering, and the specific settings are selected according to the actual application scenario.
[0031] In the embodiment of the present application, the target document indicates an offline document that needs to be obtained, which is usually a PDF document. It can be understood that as many different target documents need to be generated as there are version parameters.
[0032] In an embodiment of the present application, after triggering the generation of a target document based on a continuous integration tool, it is necessary to obtain multiple document definition files of the target document from the preset warehouse, that is, it is necessary to obtain all document definition files required to generate the target document from the preset warehouse; wherein, the document definition file includes document definition information such as document title, version information, copyright information, headers and footers, etc. The document definition file may also include document chapter definition information such as defining the functional introduction content of each chapter of the platform, defining multiple markup language documents by chapter, etc. The document definition file may also include image files, etc.
[0033] Specifically, the document generation of the continuous integration tool is triggered manually or periodically, and the version parameters are passed in. The markdown files related to the document definition are downloaded from a preset repository such as Git (an open source distributed version control system) and stored as multiple document definition files in the disk directory of the continuous integration tool server.
[0034] Step 102: Process multiple document definition files according to version parameters based on the document processing script to obtain files to be converted.
[0035] In an embodiment of the present application, after obtaining multiple document definition files of the target document, one or more document definition files are further obtained from the multiple document definition files according to the version parameter and integrated to obtain a file to be converted corresponding to the version parameter.
[0036] For example, the multiple document definition files corresponding to the target document include document definition file D1, document definition file D2, document definition file D3, document definition file D4 and document definition file D5, and the two version parameters are version parameter A1 and version parameter A2, so that document definition file D1, document definition file D3 and document definition file D4 are obtained according to version parameter A1, and document definition file D1, document definition file D2, document definition file D3 and document definition file D5 are obtained according to version parameter A1.
[0037] Step 103: Calculate the file to be converted based on a preset message digest algorithm to obtain an identification value of the file to be converted.
[0038] In the embodiments of the present application, there are many message digest algorithms, such as the MD (Message Digest) series (such as MD5), the SHA (Secure Hash Algorithm) series (such as SHA-256), and the MAC (Message Authentication Code) series (such as HMAC). The specific settings are selected according to the actual application.
[0039] In an embodiment of the present application, the file to be converted is calculated based on a preset message digest algorithm to obtain an identification value of the file to be converted. In some embodiments, the file to be converted is calculated by a message digest algorithm to obtain a hash value of a fixed length corresponding to the file to be converted, that is, the message digest value is used as an identification value, and the identification value can uniquely identify a file to be converted or a target document corresponding to the file to be converted.
[0040] Step 104: query the preset database based on the identification value. When no document matching the identification value is found in the preset database, call the document conversion tool based on the document generation script to convert the file to be converted to obtain the target document.
[0041] In an embodiment of the present application, after obtaining the identification value of the file to be converted, a query is performed in the preset database to determine whether there is a document that matches the identification value. When no document that matches the identification value is obtained in the preset database, a document conversion tool is called based on a document generation script to convert the file to be converted to obtain a target document.
[0042] Among them, a preset setting database is used. In the process of generating the target document, the identification value corresponding to the file to be converted and the target document generated based on the file to be converted are associated and stored in the preset database, so that the next time the document is processed, it can be directly matched, and if it exists, it can be directly obtained, further improving the document generation efficiency.
[0043] Specifically, calling the document conversion tool based on the document generation script to convert the file to be converted to obtain the target document can be understood as calling the document conversion tool through the document generation script to associate the corresponding file to be converted with each version parameter and convert it to obtain the target document corresponding to each version parameter.
[0044] To sum up, since multiple document definition files pre-stored for the target document are obtained, when the target document needs to be generated, the multiple document definition files are integrated according to the version parameters, the file to be converted corresponding to the version parameters is obtained, and the database is queried whether the target document of the file to be converted already exists. If not, the document conversion tool is called to convert the file to be converted to obtain the target document. This solves the problem of needing to define different versions of files at the same time when generating different versions of target documents, and a large amount of repeated content needs to be defined in multiple versions of texts, resulting in slow and low efficiency in subsequent document conversion. It effectively avoids duplication of work during document generation and improves work efficiency.
[0045] In some embodiments, when a preset database obtains a document with a matching identification value, the matching document is used as the target document, thereby achieving rapid acquisition of the target document when the document content does not change, saving server resources and improving document generation efficiency.
[0046] In some embodiments, before triggering the generation of the target document based on the continuous integration tool, the method of the present application also includes: obtaining product usage information and generation information of the product to be released; determining version parameters based on the product usage information; triggering the continuous integration tool based on the generation information and sending the version parameters.
[0047] Specifically, the product to be released may be an artificial intelligence platform, a video application, etc. Different products to be released have different product usage information, which includes usage roles, usage permissions, etc. Therefore, different usage information requires the generation of different user manuals, i.e., target documents. Therefore, the specific version parameters are determined by determining how many target documents are generated.
[0048] You can also obtain the generation information of the product to be released, mainly the build and packaging time of the product to be released, so as to determine the trigger time for generating the target document according to the generation information, and trigger the generation of the target document according to the generation information through the continuous integration tool while sending the version parameters.
[0049] In the above solution, based on different products to be released, it is determined how to trigger the generation of the target document and how many versions of the target document to generate, so as to meet the target document generation requirements corresponding to the products to be released, ensure the efficiency and accuracy of document generation, and further meet the subsequent user experience of using the target document.
[0050] In some embodiments, the method of the present application also includes: obtaining document definition information; wherein the document definition information includes: document title, version information, copyright information and header and footer; obtaining functional information of the product to be released, and determining document chapter definition information and image information based on the functional information; storing the document definition information, document chapter definition information and image information as document definition files in a preset warehouse.
[0051] Specifically, the document definition file includes document definition information and document chapter definition information, etc.; the document definition information includes document title, version information, copyright information, header and footer information, etc. That is to say, the above information is defined by version. For example, in the implementation of the product to be released, it will be divided into standard version and OEM (Original Equipment Manufacturer) version. At this time, two sets of document definition information document definition files can be provided for the above two versions respectively; the document chapter definition information is used to define the functional introduction content of each chapter of the product to be released, and multiple document definition files are defined by chapter.
[0052] In the above solution, when defining a document, only the different contents between different versions need to be defined, and only one set of the same content is defined, thereby realizing on-demand generation of the target document; effectively avoiding duplication of work during document definition and document generation, and improving work efficiency.
[0053] In some embodiments, after generating the target document, the method of the present application further includes: associating the target document with the identification value of the file to be converted and storing it in a preset database.
[0054] Specifically, when generating the target document, the target document object that is finally generated is stored in the cache with the help of the cache in association with the identification value of the file to be converted, thereby achieving rapid acquisition of the target document when the document content does not change, saving server resources and improving document generation efficiency.
[0055] In some embodiments, after obtaining the file to be converted, the method of the present application also includes: traversing the text in the file to be converted, matching the text based on a preset regular expression and target information dictionary; when the match is successful, obtaining the matching text, and replacing the matching text according to a preset replacement strategy.
[0056] In an embodiment of the present application, a target information dictionary is pre-set, specifically, multiple preset target information is obtained, and a target information dictionary is constructed based on the target information; a regular expression is pre-set, specifically, the information type of each target information is obtained, and a regular expression is determined based on the information type.
[0057] Specifically, sensitive information processing is performed on the files to be converted after the integration of the above-generated version parameters, such as markdown files; this is achieved by constructing a target information dictionary, scanning the full text of the document through regular matching, and desensitizing the matched key information; markdown is a lightweight markup language with the characteristics of being easy to read and write, highly compatible, and easy to version control. It can be used to write manuals, papers, etc., and then converted into target documents such as PDF format by using corresponding tools.
[0058] Specifically, a target information dictionary is constructed. The target information can be understood as sensitive information. Common sensitive information, such as password information, IP (Internet Protocol) address, email address, user ID, etc., is collected to form a target information dictionary.
[0059] Specifically, regular expressions are designed, and corresponding regular expression patterns are designed for different types of target information; for example, email addresses, user IDs, passwords, etc. all have their own pattern characteristics.
[0060] Furthermore, each line of text in the document is traversed and matched using regular expressions and the target information dictionary. If the match is successful, the content is considered to include sensitive target information and is desensitized and replaced.
[0061] Therefore, before converting the file to be converted to generate the target document, the sensitive target information of the file to be converted is desensitized, and the sensitive information such as passwords, email addresses, mobile phone numbers in the file to be converted is fixedly replaced, which effectively ensures the compliance of the generated offline document.
[0062] In an embodiment of the present application, the text in the file to be converted is traversed and matched based on a preset regular expression and a target information dictionary and the text, including: dividing the file to be converted into blocks according to a preset file block strategy to obtain multiple file blocks; reading the text of each file block simultaneously based on multiple threads, and matching based on a regular expression and a target information dictionary and the text.
[0063] In order to improve the efficiency of document scanning and processing, a strategy of pre-compiling all regular expressions is adopted to avoid the performance overhead caused by recompiling regular expressions every time a line of text is scanned; and when reading files, a batch reading method is adopted to read the file content in blocks, and multi-threaded processing is enabled at the same time to improve processing efficiency.
[0064] For example, code is written to read files in blocks and start multi-threaded scanning for sensitive information, dividing large files into multiple file blocks, and then starting a corresponding number of threads to handle the reading of the files respectively; through this operation, the processing speed of large files can be accelerated.
[0065] In some embodiments, multiple document definition files are processed according to version parameters based on a document processing script to obtain a file to be converted, including: obtaining a target document definition file that matches the version parameters from multiple document definition files; splicing the target document definition files according to a preset splicing logic based on the document processing script to obtain a file to be converted.
[0066] Specifically, after obtaining multiple document definition files such as document content definition and document chapter definition, the corresponding files to be converted are integrated according to the version parameters, and different files to be converted will be generated according to different version parameters; then, the identification value of the file to be converted, such as the MD5 code, is calculated, and the corresponding target document in the cache is obtained through the identification value. If it cannot be obtained, the document conversion tool document generation service is called to convert the above-mentioned files to be converted into target documents.
[0067] Specifically, by calling the document processing script and passing in the version parameter, the corresponding multiple document definition files are integrated according to the version parameter, and multiple different integrated files to be converted are generated according to the version parameter, such as markdown files.
[0068] For example, different document definition files (such as markdown files) are added according to different version parameters (such as standard version and OEM version) through a processing script. The multiple added document definition files are spliced to generate an overall markdown file as the file to be converted, which is finally used to convert and generate the target document.
[0069] In this way, different document definition files are obtained according to different version parameters and integrated to obtain files to be converted, thereby improving document conversion efficiency.
[0070] It can be understood that the identification value is calculated for the file to be converted after the desensitization processing, and the corresponding target document is obtained from the cache with the identification value as the key value; if the cache hits, it is returned directly; otherwise, a document conversion tool such as Pandoc service is called to generate a new target document; among them, Pandoc is a powerful document conversion tool that can convert between multiple document formats; it supports a large number of input and output formats, and can achieve efficient and flexible conversion between different formats.
[0071] In some embodiments, when there are multiple version parameters, a document conversion tool is called based on a document generation script to convert the file to be converted to obtain a target document, including: calling a document conversion tool through a document generation script to associate the corresponding file to be converted with each version parameter and converting it to obtain a target document corresponding to each version parameter.
[0072] Specifically, the document generation process involves calling the Pandoc service, associating different Latex (a text-based typesetting system used to generate high-quality documents, particularly those containing numerous mathematical formulas, charts, and complex typesetting requirements) document definition files, and converting the Markdown file (the file to be converted) after integrating the aforementioned version parameters into the target document. In other words, the target document of the corresponding version is exported based on the different version parameters, generating the target document from the integrated file to be converted.
[0073] Therefore, the document conversion tool is called through the document generation script to associate the corresponding files to be converted according to each version parameter and convert them to obtain the target document corresponding to each version parameter, thereby realizing the on-demand generation of offline target documents and further ensuring the efficiency of document generation.
[0074] In some embodiments, the method of the present application further includes: generating a deployment file based on the target document and the code file of the product to be released and sending it to the target device; wherein the target device deploys the product to be released based on the target document and code file in the deployment file.
[0075] In an embodiment of the present application, after generating target documents with different version parameters, the target documents and the code files of the product to be released are used to generate deployment files and sent to the target device, such as a computer device, etc. Before installing the product to be released, the user can select the target document corresponding to the appropriate version parameters according to the application requirements for use, thereby improving the accuracy and flexibility of the deployment of the product to be released, further meeting the user's usage needs, and improving the user experience.
[0076] Based on the above embodiments, the document processing method of the present application realizes conversion of target documents of corresponding versions according to different versions by writing continuous integration tool scripts, and realizes cache management of documents. When the document does not change, the objects in the cache are directly used to generate the target document, thereby improving the document conversion efficiency; at the same time, considering that there may be some sensitive information in the document, by introducing sensitive content processing, the original file content is desensitized before generating the target document, further ensuring the accuracy and security of document generation.
[0077] For example, Figure 2 As shown, firstly, a document definition is performed to define the document content of the offline document. The document content includes document chapter definition, document definition information and image information. Among them, the document definition information mainly includes home page information, copyright information, version information, header and footer information, etc.; the document chapter definition includes Chapter 1, Chapter 2, etc.; the image information includes home page illustrations and chapter illustrations; the above content is defined in the target language format, such as markdown format.
[0078] Furthermore, document processing organizes corresponding document definition files such as markdown files according to version parameters, processes sensitive information, and finally generates target markdown files that meet the requirements, i.e., files to be converted, such as Figure 2 As shown, for document conversion, the preset repository includes multiple document definition files such as the document chapter file repository, the document content file repository, and the conversion script file repository. The continuous integration tool reads the document definition file according to the version parameters, reads the conversion script and executes it, and then performs document integration, including document splicing, sensitive information processing, and code block processing.
[0079] Finally, document conversion is used to call Pandoc to convert the above-mentioned files to be converted into the target document, such as Figure 2 As shown, during document generation, the target document cannot be obtained from the document object cache. The Pandoc document generation service generates the target document according to the version parameters, such as the administrator manual and the general user manual.
[0080] For example, Figure 3 As shown, the user defines the file through the terminal and stores it in the preset warehouse, thereby defining the document through the user terminal, executing step 3.1 to obtain the document definition file and script in the preset warehouse; executing step 3.2 through document conversion to integrate the corresponding markdown file according to the version parameter; step 3.3 returns the integrated markdown file to the user terminal; step 3.4 calculates the MD5 value based on the integrated markdown file and checks whether the cache is hit; step 3.5 if it is hit, directly returns the target document; step 3.6 if it is not hit, calls the generation service; step 3.7 returns the generated target document to the user terminal and updates the cache at the same time.
[0081] Among them, the specific steps of calculating the MD5 value include: expanding the integrated markdown file as the file to be converted to an integer multiple of the target number of bits, obtaining the initial link variable, dividing the expanded file to be converted into several data blocks of the target number of bits, and each data block is further divided into sub-data blocks of a certain number of bits, looping according to the preset function, and after each round of loop, adding the current link variable to the temporary variable to obtain the MD5 value of the file to be converted as the identification value, thereby further improving the document acquisition efficiency.
[0082] Exemplarily, the document content definition mainly includes the definition of document definition information and document chapter definition information; document processing and conversion is used to obtain the markdown files of the document content definition and document chapter definition, and integrate the corresponding markdown files according to the version information, and generate different target markdown files according to different roles; then, the MD5 code of the target markdown file is calculated, and the corresponding document object in the cache is obtained through the MD5 code. If it cannot be obtained, the Pandoc document generation service is called to convert the above markdown file into a PDF document as the target document; specifically, by calling the Pandoc service, different typesetting document definition files are associated according to the passed-in version parameters, and the above-mentioned target markdown document after role integration is converted into a PDF document.
[0083] Therefore, by writing continuous integration tool scripts, different versions can be converted into corresponding versions of target documents; when defining documents, only different contents between different versions need to be defined, and only one set of the same content is defined, so that offline target documents can be generated on demand; before converting the file to be converted to generate the target document, the sensitive information of the file to be converted is desensitized, and the sensitive information such as passwords, email addresses, mobile phone numbers in the file to be converted is fixedly replaced, which effectively ensures the compliance of the generated offline document; when generating the target document, with the help of cache, the final generated target document object is stored in the cache with the identification value of the corresponding file to be converted as the key value, which realizes the rapid acquisition of the target document when the document content does not change, and improves the document generation efficiency while saving server resources.
[0084] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus the necessary general hardware platform, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method.
[0085] Figure 4This is a schematic diagram of the structure of a document processing device provided in an embodiment of the present application. The device can be implemented by software and / or hardware and can generally be integrated into an electronic device. Figure 4 As shown, the device includes:
[0086] The first acquisition module 401 is configured to acquire version parameters when triggering the generation of a target document based on a continuous integration tool.
[0087] The second acquisition module 402 is configured to acquire multiple document definition files of the target document from a preset repository.
[0088] The processing module 403 is configured to process the plurality of document definition files according to the version parameters based on the document processing script to obtain files to be converted.
[0089] The calculation module 404 is configured to calculate the file to be converted based on a preset message digest algorithm to obtain an identification value of the file to be converted.
[0090] The query module 405 is configured to query a preset database based on the identification value.
[0091] The conversion module 406 is configured to, when no document with a matching identification value is found in the preset database, call a document conversion tool based on the document generation script to convert the file to be converted to obtain a target document.
[0092] Optionally, the apparatus of the present application further includes: a first determination module, configured to, when obtaining a document with a matching identification value from a preset database, use the matching document as a target document.
[0093] Optionally, the device of the present application also includes: a third acquisition module for acquiring product usage information and generation information of the product to be released; a second determination module for determining version parameters based on the product usage information; and an integration module for triggering the continuous integration tool based on the generation information and sending the version parameters.
[0094] Optionally, the device of the present application also includes: a fourth acquisition module, used to obtain document definition information; wherein the document definition information includes: document title, version information, copyright information and header and footer; a fifth acquisition module, used to obtain functional information of the product to be released, and determine the document chapter definition information and image information based on the functional information; a first storage module, used to store the document definition information, document chapter definition information and image information as a document definition file in a preset warehouse.
[0095] Optionally, the apparatus of the present application further includes: a second storage module, configured to associate and store the identification values of the target document and the file to be converted in a preset database.
[0096] Optionally, the device of the present application also includes: a matching module for traversing the text in the file to be converted and matching it based on a preset regular expression and target information dictionary and text; a replacement module for obtaining the matching text when the match is successful and replacing the matching text according to a preset replacement strategy.
[0097] Optionally, a matching module is specifically used to: divide the conversion file into blocks according to a preset file block strategy to obtain multiple file blocks; read the text of each file block simultaneously based on multi-threading, and match the text based on regular expressions and target information dictionaries.
[0098] Optionally, the apparatus of the present application further includes: a first construction module, configured to obtain a plurality of preset target information and construct a target information dictionary based on the target information.
[0099] Optionally, the apparatus of the present application further includes: a second construction module, configured to obtain the information type of each target information and determine a regular expression based on the information type.
[0100] Optionally, the processing module 403 is specifically configured to: obtain a target document definition file that matches the version parameter from multiple document definition files; and splice the target document definition files according to a preset splicing logic based on a document processing script to obtain a file to be converted.
[0101] Optionally, the conversion module 406 is specifically configured to: call a document conversion tool through a document generation script to associate a corresponding file to be converted with each version parameter and perform conversion to obtain a target document corresponding to each version parameter.
[0102] Optionally, the apparatus of the present application further includes a sending module for generating a deployment file based on the target document and the code file of the product to be released and sending the same to the target device; wherein the target device deploys the product to be released based on the target document and code file in the deployment file.
[0103] For the description of the features in the embodiment corresponding to the document processing device, please refer to the relevant description of the embodiment corresponding to the document processing method, and will not be repeated here.
[0104] An embodiment of the present application further provides an electronic device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the steps in any of the above document processing method embodiments.
[0105] An embodiment of the present application further provides a computer-readable storage medium, in which a computer program is stored. The computer program is configured to execute the steps of any of the above document processing method embodiments when run.
[0106] In an exemplary embodiment, the computer-readable storage medium may include, but is not limited to, various media that can store computer programs, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk, or an optical disk.
[0107] An embodiment of the present application further provides a computer program product, which includes a computer program. When the computer program is executed by a processor, the steps of any of the above document processing method embodiments are implemented.
[0108] An embodiment of the present application further provides another computer program product, including a non-volatile computer-readable storage medium, wherein the non-volatile computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of any of the above-mentioned document processing method embodiments are implemented.
[0109] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0110] The above is a detailed introduction to a document processing method, computer device, storage medium, and program product provided by the present application. Specific examples are used herein to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only intended to help understand the method and core ideas of the present application. It should be pointed out that, for those skilled in the art, without departing from the principles of the present application, several improvements and modifications may be made to the present application, and such improvements and modifications also fall within the scope of protection of the claims of the present application.
Claims
1. A document processing method, characterized in that: The method comprises: When triggering the generation of a target document based on a continuous integration tool, obtain the version parameter and obtain multiple document definition files of the target document from a preset repository; wherein the document definition files include document definition information, document section definition information, and image information; the document definition information includes: document title, version information, copyright information, and headers and footers; Processing the multiple document definition files according to the version parameters based on the document processing script to obtain a file to be converted; wherein, processing the multiple document definition files according to the version parameters based on the document processing script to obtain a file to be converted includes: obtaining a target document definition file that matches the version parameters from the multiple document definition files; splicing the target document definition files according to a preset splicing logic based on the document processing script to obtain the file to be converted; Calculating the file to be converted based on a preset message digest algorithm to obtain an identification value of the file to be converted; A query is performed in a preset database based on the identification value. When no document matching the identification value is obtained in the preset database, a document conversion tool is called based on a document generation script to convert the file to be converted to obtain the target document; wherein, when there are multiple version parameters, the conversion of the file to be converted to obtain the target document is called based on the document generation script, including: calling the document conversion tool through the document generation script to associate the corresponding file to be converted with each version parameter and converting it to obtain the target document corresponding to each version parameter.
2. The document processing method according to claim 1, wherein: The method further comprises: When the preset database obtains a document matching the identification value, the matching document is used as the target document.
3. The document processing method according to claim 1, wherein: Before triggering the generation of the target document based on the continuous integration tool, the method further includes: Obtain product usage information and generation information for products to be released; determining the version parameter based on the product usage information; The continuous integration tool is triggered based on the generation information and the version parameter is sent.
4. The document processing method according to claim 3, wherein: The method further comprises: Obtain document definition information; wherein the document definition information includes: document title, version information, copyright information, and header and footer; Obtaining functional information of the product to be released, and determining document section definition information and image information based on the functional information; The document definition information, the document chapter definition information and the picture information are stored in the preset warehouse as the document definition file.
5. The document processing method according to claim 1, wherein: After generating the target document, the method further includes: The identification values of the target document and the file to be converted are associated and stored in the preset database.
6. The document processing method according to claim 1, wherein: After obtaining the file to be converted, the method further includes: Traversing the text in the file to be converted, and matching the text based on a preset regular expression and a target information dictionary; When the match is successful, the matching text is obtained and replaced according to a preset replacement strategy.
7. The document processing method according to claim 6, wherein: The traversing of the text in the file to be converted and matching the text based on a preset regular expression and a target information dictionary includes: Divide the file to be converted into blocks according to a preset file block strategy to obtain multiple file blocks; The text of each file block is read simultaneously based on multiple threads, and matching is performed based on the regular expression and the target information dictionary and the text.
8. The document processing method according to claim 6, wherein: Before matching the text based on the preset regular expression and target information dictionary, the method further includes: A plurality of preset target information is acquired, and the target information dictionary is constructed based on the target information.
9. The document processing method according to claim 8, wherein: The method further comprises: Acquire the information type of each target information; The regular expression is determined based on the information type.
10. The document processing method according to claim 1, wherein: The method further comprises: A deployment file is generated based on the target document and the code file of the product to be released and sent to a target device; wherein the target device deploys the product to be released based on the target document and the code file in the deployment file.
11. A computer device, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the document processing method according to any one of claims 1 to 9 when executing the computer program.
12. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the steps of the document processing method according to any one of claims 1 to 9 are implemented.
13. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the steps of the document processing method according to any one of claims 1 to 9 are implemented.
Citation Information
Patent Citations
Method and device for automatically identifying document semantics and electronic equipment
CN115309851A
Document format conversion control method and device, computer readable medium and equipment
CN117034869A