Document processing method, device and equipment and computer readable storage medium
By parsing document directories and generating display pages, document management and display are automated, solving the problem of low document management efficiency and achieving a clear display of document hierarchical relationships.
Patent Information
- Application Number
- CN202311619323.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-11-29
- Publication Date
- 2024-10-18
AI Technical Summary
In the existing technology, document managers need to upload and manage a large number of technical description documents individually, resulting in low management efficiency and difficulty in systematically displaying the hierarchical relationship of documents.
By obtaining the document collection, parsing the document directory to determine the hierarchical relationship between document identifiers, traversing the storage path to extract the document content, and using the display template to generate the document display page, automatic document management and display are realized.
There is no need to upload documents individually, which simplifies the document management process and improves document management efficiency. The generated document display page clarifies the document hierarchical relationship and reduces the operational complexity of managers.
Smart Images

Figure CN118796764A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of document processing technology, and in particular, relates to a document processing method, device, equipment and computer-readable storage medium. Background Art
[0002] Technology companies usually have a large amount of technical documentation for software and hardware products. How to systematically manage a large number of documents and present them to users intuitively is an urgent problem to be solved.
[0003] Currently, after a document is written, the document manager will upload each document to the cloud server for storage, and then classify and sort the multiple documents in the cloud server so that multiple documents belonging to the same project can be displayed on the same document display page. However, the process of classifying and sorting multiple documents by the document manager is cumbersome and inefficient, resulting in low efficiency in document management. Summary of the invention
[0004] Embodiments of the present application provide a document processing method, apparatus, device, computer-readable storage medium, and computer program product, which can improve document management efficiency.
[0005] In a first aspect, an embodiment of the present application provides a document processing method, the method comprising:
[0006] Acquire a document set, wherein the document set includes a document directory and multiple documents, wherein the document directory includes document identifiers and document storage paths corresponding to each of the multiple documents;
[0007] Parsing the document directory to determine the hierarchical relationship between the plurality of document identifiers;
[0008] Traversing the plurality of document storage paths in the document directory, and extracting document content from the document corresponding to each document storage path;
[0009] The hierarchical relationship between the multiple document identifiers and the multiple document contents are rendered according to a document display template to generate a document display page.
[0010] In a possible implementation, parsing the document directory to determine the hierarchical relationship between the plurality of document identifiers includes:
[0011] Parsing the document directory based on the grammatical rules of the document directory to determine the level of each document identifier;
[0012] Based on the level of each of the document identifiers, the hierarchical relationship between the multiple document identifiers is determined according to the distances between the multiple document identifiers.
[0013] In a possible implementation, the determining the hierarchical relationship between the plurality of document identifiers based on the hierarchy of each of the document identifiers and according to the distances between the plurality of document identifiers includes:
[0014] traversing the plurality of document identifiers in a predetermined order;
[0015] For a target document identifier, when the level of the target document identifier is a target level, among at least one of the document identifiers that has been traversed, a document identifier that is closest to the target document identifier and is at a level above the target level is determined as a parent level identifier of the target document identifier, wherein the target document identifier is any one of the multiple document identifiers, and the target level is any level except the first level.
[0016] In a possible implementation, after determining the hierarchical relationship between the plurality of document identifiers based on the hierarchy of each of the document identifiers and according to the distances between the plurality of document identifiers, the method further includes:
[0017] The hierarchical relationship between the plurality of document identifiers is stored using a stack algorithm structure to obtain a tree-like directory structure table.
[0018] In a possible implementation, the plurality of document contents are stored in a document content table, and the hierarchical relationship between the plurality of document identifiers and the plurality of document contents are rendered according to a document display template to generate a document display page, including:
[0019] The tree-like directory structure table and the document content table are rendered according to a document display template to generate a document display page.
[0020] In a possible implementation, the document collection also includes non-document resources, and the multiple documents include a first storage path of the non-document resources;
[0021] The traversing the plurality of document storage paths in the document directory and extracting document content from a document corresponding to each of the document storage paths includes:
[0022] Traversing the plurality of document storage paths in the document directory, and locating the first storage path in the document corresponding to the document storage path;
[0023] Obtain a second storage path of the non-document resource corresponding to the first storage path in the cloud server;
[0024] Replacing the first storage path with its corresponding second storage path;
[0025] The document content is extracted from each of the documents, and the plurality of document contents include the second storage path.
[0026] In a possible implementation, before obtaining the second storage path of the non-document resource corresponding to the first storage path in the cloud server, the method further includes:
[0027] Traversing the document collection to determine non-document resources in the document collection;
[0028] Uploading the non-document resources to a cloud server;
[0029] A second storage path for storing the non-document resource in the cloud server.
[0030] In a second aspect, an embodiment of the present application provides a document processing device, the device comprising:
[0031] An acquisition module, used to acquire a document set, wherein the document set includes a document directory and a plurality of documents, wherein the document directory includes document identifiers and document storage paths corresponding to the plurality of documents;
[0032] A parsing module, used to parse the document directory and determine the hierarchical relationship between the plurality of document identifiers;
[0033] An extraction module, used to traverse the multiple document storage paths in the document directory and extract document content from the document corresponding to each document storage path;
[0034] The rendering module is used to render the hierarchical relationship between the multiple document identifiers and the multiple document contents according to the document display template to generate a document display page.
[0035] In a third aspect, an embodiment of the present application provides an electronic device, the device comprising: a processor and a memory storing computer program instructions;
[0036] When the processor executes the computer program instructions, the processor implements any possible implementation method of the first aspect described above.
[0037] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium having computer program instructions stored thereon, which, when executed by a processor, implements a method in any possible implementation method of the first aspect described above.
[0038] In a fifth aspect, an embodiment of the present application provides a computer program product. When instructions in the computer program product are executed by a processor of an electronic device, the electronic device executes a method as any possible implementation method in the first aspect above.
[0039] In the document processing method, apparatus, device, computer-readable storage medium and computer program product of the embodiments of the present application, since there is a one-to-one correspondence between document identifiers and documents, the hierarchical relationship between multiple documents can be automatically determined by parsing the document directory to determine the hierarchical relationship between multiple document identifiers. By traversing multiple document storage paths in the document directory and extracting document content from the documents corresponding to each document storage path, the document content corresponding to each of the multiple documents can be automatically determined. In this way, by rendering the hierarchical relationship between multiple document identifiers and multiple document contents according to the document display template to generate a document display page, there is no need for management personnel to upload documents one by one, and then perform complex operations on the web page to summarize and organize the documents, so that a document display page with a clear hierarchical relationship can be generated, thereby improving document management efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] In order to more clearly illustrate the technical solution of the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0041] Figure 1 It is a flowchart of a document processing method provided by an embodiment of the present application;
[0042] Figure 2 is a schematic diagram of a document directory provided in an embodiment of the present application;
[0043] Figure 3 It is a schematic diagram of the principle of using a stack algorithm structure to store a hierarchical relationship between multiple document identifiers provided in an embodiment of the present application;
[0044] Figure 4 is a structural schematic diagram of a document processing device provided in an embodiment of the present application;
[0045] Figure 5 It is a structural schematic diagram of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0046] The features and exemplary embodiments of various aspects of the present application will be described in detail below. In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only intended to explain the present application, rather than to limit the present application. For those skilled in the art, the present application can be implemented without the need for some of these specific details. The following description of the embodiments is only to provide a better understanding of the present application by illustrating the examples of the present application.
[0047] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the statement "include..." do not exclude the presence of other identical elements in the process, method, article or device including the elements.
[0048] Markdown is a lightweight markup language that allows people to write documents in a plain text format that is easy to read and write, and then convert it into a valid XHTML (or HTML) document. Due to the lightweight, easy-to-read and easy-to-write features of Markdown, and its support for images, charts, and mathematical expressions, the Markdown language is widely used to write help documents or instruction manuals.
[0049] Based on this, in order to solve the problems of the prior art, the embodiments of the present application provide a document processing method, apparatus, device, computer-readable storage medium and computer program product. Among them, the execution subject of the document processing method can be a document sharing platform.
[0050] The following first introduces the document processing method provided in the embodiment of the present application.
[0051] Figure 1 FIG. 1 is a flow chart of a document processing method provided by an embodiment of the present application. Figure 1 As shown, the document processing method provided in the embodiment of the present application includes the following steps:
[0052] S110, obtaining a document set, the document set including a document directory and multiple documents, the document directory including document identifiers and document storage paths corresponding to the multiple documents;
[0053] S120, parsing the document directory to determine the hierarchical relationship between multiple document identifiers;
[0054] S130, traversing multiple document storage paths in the document directory, and extracting document content from the document corresponding to each document storage path;
[0055] S140: Render the hierarchical relationship between the multiple document identifiers and the multiple document contents according to the document display template to generate a document display page.
[0056] In the document processing method of the embodiment of the present application, since the document identifier and the document correspond one-to-one, the hierarchical relationship between multiple document identifiers is determined by parsing the document directory, and the hierarchical relationship between multiple documents can be automatically determined. By traversing multiple document storage paths in the document directory and extracting document content from the documents corresponding to each document storage path, the document content corresponding to each of the multiple documents can be automatically determined. In this way, by rendering the hierarchical relationship between multiple document identifiers and multiple document contents according to the document display template, a document display page is generated. It is possible to generate a document display page with a clear hierarchical relationship without uploading documents one by one, and then performing complex operations on the web page to summarize and organize the documents, thereby improving document management efficiency.
[0057] The specific implementation methods of the above steps are introduced below.
[0058] In some embodiments, in S110, the document collection may be a compressed package (.zip file). The documents in the document collection may be Markdown documents (.md files). Multiple documents may belong to the same level or different levels. In the case where multiple documents belong to different levels, the multiple documents may be placed in folders of the same level or in folders of different levels, which is not limited here. In addition, the document directory may be a Markdown document (SUMMARY.md file). The document directory may include document identifiers and document storage paths corresponding to each of the multiple documents. The document identifier may be, for example, the document name. Based on this, the schematic diagram of the document directory (SUMMARY.md) may be as follows: Figure 2 shown.
[0059] In addition, the document collection may also include non-document resources. Among them, non-document resources may include, for example, image resources and video resources. By embedding the accessible storage path of non-document resources in the document, the document writer can fully display the document including non-document resources when converting the .md file to a .html file later.
[0060] As an example, a document writer or document manager can place multiple documents belonging to the same project in the same folder locally, write SUMMARY.md according to the hierarchical relationship between the multiple documents, and place SUMMARY.md and the multiple documents in the same folder. Afterwards, by compressing the folder, a compressed package of the document collection can be obtained, and the compressed package can be uploaded to the document sharing platform. That is, in the embodiment of the present application, a large number of multiple documents can be uploaded in batches.
[0061] In some embodiments, in S120, the document directory may include a hierarchical relationship between multiple document identifiers that are manually determined. Figure 2 As shown, "Overview", "Hardware Support" and "Quick Development Guide" can be first-level directories, and "Development Board", "Sensor" and "Build Code Project from Scratch" can be second-level directories. Among them, "Hardware Support" can be the parent level identifier of "Development Board" and "Sensor", and "Quick Development Guide" can be the parent level identifier of "Build Code Project from Scratch".
[0062] As an example, after receiving a document collection, the document sharing platform can traverse the document collection, determine the document directory in the document collection, and then parse the document directory based on the grammatical rules and directory parsing algorithm of the document directory to determine the hierarchical relationship between multiple document identifiers.
[0063] Based on this, in some embodiments, the above S120 may specifically include:
[0064] Parse the document directory based on the grammatical rules of the document directory to determine the level of each document identifier;
[0065] Based on the level of each document identifier, a hierarchical relationship between the multiple document identifiers is determined according to the distances between the multiple document identifiers.
[0066] Here, if the document directory is a Markdown document, the grammatical rules of the document directory may be the grammatical rules corresponding to the Markdown document.
[0067] As an example, after finding the document directory, the document directory can be traversed line by line. If a line starts with an identifier "*", it can be determined that the level of the document identification in the identifier "[]" is the first level (first-level directory). If a line starts with two spaces plus the identifier "*", it can be determined that the level of the document identification in the identifier "[]" is the second level (second-level directory). If a line starts with four spaces plus the identifier "*", it can be determined that the level of the document identification in the identifier "[]" is the third level (third-level directory).
[0068] Based on this, in some embodiments, the above-mentioned determination of the hierarchical relationship between the multiple document identifiers based on the hierarchy of each document identifier and the distance between the multiple document identifiers may specifically include:
[0069] traversing a plurality of document identifiers in a predetermined order;
[0070] For the target document identifier, when the level of the target document identifier is the target level, among at least one document identifier that has been traversed, the document identifier that is closest to the target document identifier and has a level above the target level is determined as the parent level identifier of the target document identifier, wherein the target document identifier is any one of the multiple document identifiers, and the target level is any level except the first level.
[0071] Here, the predetermined order may be, for example, the order from the first row to the last row of the document directory. For the sake of simplicity, the document identifier of the i-th row in the document directory may be recorded as id=i, where i is a positive integer greater than or equal to 1.
[0072] As an example, when i=1, the level of the document identifier in the first row (e.g., "Overview") can be determined first. If the level of the document identifier in the first row is the first level, then i=i+1 can be set, and the level of the document identifier in the second row (e.g., "Hardware Support") can be determined. If the level of the document identifier in the second row is the first level, then the document identifier in the second row can be determined to be the same level identifier as the document identifier in the first row.
[0073] Let i=i+1, and continue to determine the level of the document identifier in the third row (e.g., "development board"). If the level of the document identifier in the third row is the second level, you can search upward to determine whether the level of the document identifier in the second row is the first level. If so, you can determine the document identifier in the second row as the parent level identifier of the document identifier in the third row.
[0074] Let i=i+1, and continue to determine the level of the document identifier (e.g., "sensor") in the fourth row. If the level of the document identifier in the fourth row is the second level, you can search upward to determine whether the level of the document identifier in the third row is the first level. If not, you can continue to search upward to determine whether the level of the document identifier in the second row is the first level. If so, you can determine the document identifier in the second row as the parent level identifier of the document identifier in the fourth row.
[0075] Let i=i+1 and repeat the above steps until the document identifier traversal is completed, and the hierarchical relationship between multiple document identifiers is obtained.
[0076] Based on this, in some embodiments, after determining the hierarchical relationship between the multiple document identifiers based on the hierarchy of each document identifier and the distance between the multiple document identifiers, the following may also be included:
[0077] The stack algorithm structure is used to store the hierarchical relationship between multiple document identifiers to obtain a tree-like directory structure table.
[0078] Here, the tree-like directory structure table may include a document identification field, a level field corresponding to the document identification, and a parent level identification field corresponding to the document identification. Among them, the document identification field can be one or two, which is not limited here. If there are two document identification fields, the document identification field may include a directory name field and a serial number identification field corresponding to the directory name. In addition, the tree-like directory structure table may also include a version field, a document storage path field, a creation time field, an update time field, etc., which are not limited here.
[0079] As an example, a database table can be pre-built. In the process of using a stack algorithm structure to store the hierarchical relationship between multiple document identifiers, for each document identifier, the data corresponding to the document identifier can be added to the corresponding field of the database table to obtain a tree-like directory structure table. The schematic diagram of the tree-like directory structure table can be shown in Table 1 below:
[0080] Table 1
[0081]
[0082] In addition, the algorithm structure of the stack can satisfy the first-in-last-out algorithm rule, making it easier to determine the parent level identifier.
[0083] As an example, a schematic diagram of the principle of using a stack algorithm structure to store the hierarchical relationship between multiple document identifiers can be as follows: Figure 3 shown.
[0084] like Figure 3 As shown, in process 1, since the insertion directory is a first-level directory, the document identifier with id=1 can be pushed into the stack, and the data corresponding to the document identifier with id=1 can be added to the database table at the same time. Among them, since the document identifier with id=1 is a first-level directory, the parent level identifier of the document identifier can be recorded as 0.
[0085] In process 2, since the insertion directory is a first-level directory, the document identifier with id=2 can be pushed into the stack, and the data corresponding to the document identifier with id=2 can be added to the database table at the same time. Among them, since the document identifier with id=2 is a first-level directory, the parent level identifier of the document identifier can be recorded as 0.
[0086] In process 3, since the insertion directory is a secondary directory and the level of the insertion directory is lower than the level of the top directory in the stack, the document identifier with id=3 can be pushed into the stack, and the data corresponding to the document identifier with id=3 can be added to the database table at the same time. Among them, since the document identifier with id=3 is a secondary directory, the document identifier closest to the document identifier with id=3 in the stack is the document identifier with id=2, and the document identifier with id=2 is the upper directory of the document identifier with id=3, therefore, "2" can be determined as the parent level identifier of the document identifier with id=3.
[0087] In process 4, since the insertion directory is a secondary directory and the level of the insertion directory is equal to the level of the top directory in the stack, the top element of the stack (document identifier with id=3) can be popped out first, and then the document identifier with id=4 can be pushed into the stack, and the data corresponding to the document identifier with id=4 can be added to the database table at the same time. Among them, since the parent level identifier corresponding to the document identifier with id=3 has been determined, and there is no child level identifier corresponding to the document identifier with id=3, the hierarchical relationship corresponding to the document identifier with id=3 has been determined and completed, and the document identifier with id=3 can be popped out from the stack. In addition, since the document identifier with id=4 is a secondary directory, the document identifier closest to the document identifier with id=4 in the stack is the document identifier with id=2, and the document identifier with id=2 is the upper directory of the document identifier with id=4, therefore, "2" can be determined as the parent level identifier of the document identifier with id=4.
[0088] In process 5, since the insertion directory is a third-level directory and the level of the insertion directory is lower than the level of the top directory in the stack, the document identifier with id=5 can be pushed into the stack, and the data corresponding to the document identifier with id=5 can be added to the database table at the same time. Among them, since the document identifier with id=5 is a third-level directory, the document identifier closest to the document identifier with id=5 in the stack is the document identifier with id=4, and the document identifier with id=4 is the upper directory of the document identifier with id=5, therefore, "4" can be determined as the parent level identifier of the document identifier with id=5.
[0089] In process 6, since the insertion directory is a secondary directory and the level of the insertion directory is greater than the level of the top directory on the stack, the top element of the stack (document identifier with id=5) can be popped out. At this time, since the level of the insertion directory is equal to the level of the top directory on the stack (secondary directory), the top element of the stack (document identifier with id=4) can be popped out. At this time, since the level of the insertion directory is less than the level of the top directory on the stack (primary directory), the document identifier with id=6 can be pushed into the stack, and the data corresponding to the document identifier with id=6 can be added to the database table at the same time. Among them, since the document identifier with id=6 is a secondary directory, the document identifier closest to the document identifier with id=6 in the stack is the document identifier with id=2, and the document identifier with id=2 is the upper directory of the document identifier with id=6, therefore, "2" can be determined as the parent level identifier of the document identifier with id=6. In addition, in process 6, the principle of popping out the top element of the stack can be referred to process 4, which will not be described in detail here.
[0090] In this way, by traversing multiple document identifiers in the above manner, a tree-like directory structure table including the hierarchical relationship between the multiple document identifiers can be obtained.
[0091] In some embodiments, in S130, as Figure 2 As shown, the source code of the document directory may include a document storage path corresponding to each document identifier. In this way, multiple documents can be located by traversing multiple document storage paths in the document directory. After locating multiple documents, document content can be extracted from each document.
[0092] After extracting the document content, the document content can be stored in a database table to obtain a document content table. The document content table may include a serial number field, a document name field, a directory name field (i.e., the directory name field of the document in the tree-like directory structure table), a directory identification field (i.e., the serial number identification field of the directory name in the tree-like directory structure table), and a document content field. In addition, the document content table may also include a version identification field, a creation time field, and an update time field. A schematic diagram of the document content table may be shown in Table 2 below:
[0093] Table 2
[0094] Serial number identification file name Directory Identification Directory Name Document Content 1’ README.md 1 Overview #xxxxx1 2’ hardware_support.md 2 Hardware Support #xxxxx2 3’ demoboard.md 3 Development Boards #xxxxx3 4’ sensor.md 4 sensor #xxxxx4
[0095] In actual situations, some document content may include storage paths for non-document resources. If the document content includes storage paths for non-document resources, the storage path may be the first local storage path for non-document resources. Since the document collection has been uploaded to the cloud server, if the storage path for non-document resources is still the local storage path before the document collection was uploaded, the non-document resources will not be displayed normally.
[0096] Based on this, in order to ensure the normal display of non-document resources, in some embodiments, the above S130 may specifically include:
[0097] Traversing multiple document storage paths in the document directory, and locating a first storage path in the document corresponding to the document storage path;
[0098] Obtain a second storage path of the non-document resource corresponding to the first storage path in the cloud server;
[0099] Replacing the first storage path with its corresponding second storage path;
[0100] Document content is extracted from each document, and the plurality of document contents include a second storage path.
[0101] Here, the first storage path may be a local storage path of the non-document resource, and the second storage path may be a storage path of the non-document resource in a cloud server.
[0102] As an example, after obtaining the document directory, you can traverse multiple document storage paths in the document directory to locate the document corresponding to the document storage path. After locating the document, you can read and extract the document content line by line. In the process of reading the document content, if a reference statement about a picture or video is read (i.e., the first storage path), you can obtain the second storage path corresponding to the first storage path, and replace the first storage path with the second storage path. That is, in the process of extracting the document content, if the document content includes the first storage path, the second storage path corresponding to the first storage path can be extracted.
[0103] In this way, by replacing the first storage path with its corresponding second storage path, normal display of non-document resources can be ensured.
[0104] Based on this, in order to achieve normal display of non-document resources, in some embodiments, before obtaining the second storage path of the non-document resource corresponding to the first storage path in the cloud server, the following may also be included:
[0105] Traverse the document collection and determine the non-document resources in the document collection;
[0106] Upload non-document resources to the cloud server;
[0107] A second storage path for saving non-document resources in the cloud server.
[0108] Here, by using file storage technology (such as FastDFS), non-document resources such as pictures and videos can be uploaded to the cloud server, and a second storage path accessible to the non-document resources in the cloud server can be saved.
[0109] In this way, by converting locally stored non-document resources into Internet resources, the coupling between the Markdown document and the local resources is untied, so that when the Markdown document content is extracted and displayed again, the complete Markdown document including pictures and videos can be displayed, thereby achieving normal display of non-document resources.
[0110] In some embodiments, in S140, the document display page may be a front-end display interface in a document sharing platform. After determining the hierarchical relationship between multiple document identifiers (i.e., the hierarchical relationship between multiple documents) and the document contents corresponding to each of the multiple documents, the document display interface may be rendered to generate the document display interface.
[0111] Based on this, in order to further facilitate the review and display of multiple documents, in some embodiments, the above S140 may specifically include:
[0112] The tree-like directory structure table and multiple document content tables are rendered according to the document display template to generate a document display page.
[0113] Here, the hierarchical relationship between multiple document identifiers can be stored in a tree-like directory structure table. In this way, even when there are a large number of documents, the hierarchical relationship between multiple documents can be clearly displayed to the user. In addition, multiple document contents can be stored in a document content table. In this way, by associating the tree-like directory structure table with the document content table, it is further convenient to consult and display multiple documents.
[0114] Based on the document processing method provided in the above embodiment, the present application also provides a specific implementation of a document processing device. Please refer to the following embodiment.
[0115] like Figure 4 As shown, the document processing device 400 provided in the embodiment of the present application includes the following modules:
[0116] An acquisition module 410 is used to acquire a document set, wherein the document set includes a document directory and multiple documents, and the document directory includes document identifiers and document storage paths corresponding to each of the multiple documents;
[0117] A parsing module 420, used to parse the document directory and determine the hierarchical relationship between multiple document identifiers;
[0118] An extraction module 430 is used to traverse multiple document storage paths in the document directory and extract document content from the document corresponding to each document storage path;
[0119] The rendering module 440 is used to render the hierarchical relationship between multiple document identifiers and multiple document contents according to the document display template to generate a document display page.
[0120] The document processing device 400 is described in detail below, as follows:
[0121] In some embodiments, the parsing module 420 may specifically include:
[0122] A parsing submodule is used to parse the document directory based on the grammatical rules of the document directory and determine the level of each document identifier;
[0123] The first determination submodule is used to determine the hierarchical relationship between the multiple document identifiers based on the hierarchy of each document identifier and according to the distance between the multiple document identifiers.
[0124] In some embodiments, the first determining submodule may specifically include:
[0125] A traversal unit, used for traversing multiple document identifiers in a predetermined order;
[0126] A determination unit is used to determine, for a target document identifier, a document identifier that is closest to the target document identifier and is at a level above the target level among at least one document identifier that has been traversed, as a parent level identifier of the target document identifier, when the level of the target document identifier is a target level, wherein the target document identifier is any one of the multiple document identifiers and the target level is any level except the first level.
[0127] In some embodiments, the determining submodule may further include:
[0128] The storage unit is used to store the hierarchical relationship between multiple document identifiers using a stack algorithm structure to obtain a tree-like directory structure table.
[0129] In some embodiments, multiple document contents are stored in the document content table. Based on this, the rendering module 440 may specifically include:
[0130] The rendering submodule is used to render the tree directory structure table and the document content table according to the document display template to generate a document display page.
[0131] In some embodiments, the document set also includes non-document resources, and the plurality of documents include a first storage path of the non-document resources. Based on this, the extraction module 430 may specifically include:
[0132] A positioning submodule, used to traverse multiple document storage paths in the document directory and locate a first storage path in the document corresponding to the document storage path;
[0133] An acquisition submodule, used to acquire a second storage path of the non-document resource corresponding to the first storage path in the cloud server;
[0134] A replacement submodule, used to replace the first storage path with its corresponding second storage path;
[0135] The extraction submodule is used to extract document content from each document, wherein the plurality of document contents include the second storage path.
[0136] In some embodiments, the extraction module 430 may further include:
[0137] The second determination submodule is used to traverse the document collection and determine the non-document resources in the document collection;
[0138] The upload submodule is used to upload non-document resources to the cloud server;
[0139] The saving submodule is used to save the second storage path of the non-document resource in the cloud server.
[0140] In the document processing device of the embodiment of the present application, since there is a one-to-one correspondence between document identifiers and documents, the hierarchical relationship between multiple documents can be automatically determined by parsing the document directory to determine the hierarchical relationship between multiple document identifiers. By traversing multiple document storage paths in the document directory and extracting document content from the documents corresponding to each document storage path, the document content corresponding to each of the multiple documents can be automatically determined. In this way, by rendering the hierarchical relationship between multiple document identifiers and multiple document contents according to the document display template to generate a document display page, there is no need for management personnel to upload documents one by one, and then perform complex operations on the web page to summarize and organize the documents, so that a document display page with a clear hierarchical relationship can be generated, thereby improving document management efficiency.
[0141] In addition, in an embodiment of the present application, if there are relatively large adjustments to the document collection (the company's document resource library), such as reordering of the document structure, adding, deleting, or replacing multiple documents, there is no need to perform relatively cumbersome operations on the web page. You only need to adjust the document collection locally and re-upload it, which further facilitates the management of the document collection and improves document management efficiency.
[0142] Based on the document processing method provided in the above embodiment, the embodiment of the present application also provides a specific implementation of the electronic device. Figure 5 A schematic diagram of an electronic device 500 provided in an embodiment of the present application is shown.
[0143] The electronic device 500 may include a processor 510 and a memory 520 storing computer program instructions.
[0144] Specifically, the processor 510 may include a central processing unit (CPU), or an application specific integrated circuit (ASIC), or may be configured to implement one or more integrated circuits of the embodiments of the present application.
[0145] The memory 520 may include a large capacity memory for data or instructions. By way of example and not limitation, the memory 520 may include a hard disk drive (HDD), a floppy disk drive, a flash memory, an optical disk, a magneto-optical disk, a magnetic tape, or a universal serial bus (USB) drive or a combination of two or more of these. Where appropriate, the memory 520 may include a removable or non-removable (or fixed) medium. Where appropriate, the memory 520 may be inside or outside the electronic device 500. In a particular embodiment, the memory 520 is a non-volatile solid-state memory.
[0146] The memory may include a read-only memory (ROM), a random access memory (RAM), a magnetic disk storage medium device, an optical storage medium device, a flash memory device, an electrical, optical or other physical / tangible memory storage device. Thus, typically, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., a memory device) encoded with software including computer-executable instructions, and when the software is executed (e.g., by one or more processors), it is operable to perform the operations described with reference to the method according to the first aspect of the present application.
[0147] The processor 510 implements any one of the document processing methods in the above embodiments by reading and executing computer program instructions stored in the memory 520 .
[0148] In one example, the electronic device 500 may further include a communication interface 530 and a bus 540. Figure 5 As shown, the processor 510, the memory 520, and the communication interface 530 are connected via a bus 540 and communicate with each other.
[0149] The communication interface 530 is mainly used to implement communication between various modules, devices, units and / or equipment in the embodiments of the present application.
[0150] Bus 540 includes hardware, software or both, and the parts of electronic equipment are coupled to each other. For example, but not limitation, bus may include accelerated graphics port (AGP) or other graphics bus, enhanced industrial standard architecture (EISA) bus, front side bus (FSB), hypertransport (HT) interconnection, industrial standard architecture (ISA) bus, infinite bandwidth interconnection, low pin count (LPC) bus, memory bus, micro channel architecture (MCA) bus, peripheral component interconnection (PCI) bus, PCI-Express (PCI-X) bus, serial advanced technology attachment (SATA) bus, video electronics standard association local (VLB) bus or other suitable bus or two or more of these combinations. In appropriate cases, bus 540 may include one or more buses. Although the present application embodiment describes and shows a specific bus, the application considers any suitable bus or interconnection.
[0151] Exemplarily, the electronic device 500 may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA).
[0152] The electronic device can execute the document processing method in the embodiment of the present application, thereby realizing the combination Figure 1 and Figure 4 Described document processing method and device.
[0153] In addition, in combination with the document processing method in the above embodiment, the embodiment of the present application can provide a computer-readable storage medium for implementation. The computer-readable storage medium stores computer program instructions; when the computer program instructions are executed by a processor, any one of the document processing methods in the above embodiment is implemented.
[0154] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0155] The functional blocks shown in the above-described block diagram can be implemented as hardware, software, firmware or a combination thereof. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present application are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link by a data signal carried in a carrier wave. "Machine-readable medium" can include any medium capable of storing or transmitting information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, optical fiber media, radio frequency (RF) links, etc. The code segment can be downloaded via a computer network such as the Internet, an intranet, etc.
[0156] It should also be noted that the exemplary embodiments mentioned in this application describe some methods or systems based on a series of steps or devices. However, this application is not limited to the order of the above steps, that is, the steps can be performed in the order mentioned in the embodiment, or in a different order from the embodiment, or several steps can be performed simultaneously.
[0157] The above reference is according to the method of the embodiment of the present application, the flow chart of the device (system) and the computer program product and / or the block diagram described various aspects of the present application.It should be understood that each square box in the flow chart and / or the block diagram and the combination of each square box in the flow chart and / or the block diagram can be realized by computer program instructions.These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device to produce a machine so that these instructions executed by the processor of the computer or other programmable data processing device enable the realization of the function / action specified in one or more square boxes of the flow chart and / or the block diagram.Such a processor can be but is not limited to a general-purpose processor, a special-purpose processor, a special application processor or a field programmable logic circuit.It can also be understood that each square box in the block diagram and / or the flow chart and the combination of the square boxes in the block diagram and / or the flow chart can also be realized by the dedicated hardware that performs the specified function or action, or can be realized by the combination of dedicated hardware and computer instructions.
[0158] The above is only a specific implementation of the present application. Those skilled in the art can clearly understand that for the convenience and simplicity of description, the specific working processes of the systems, modules and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here. It should be understood that the protection scope of the present application is not limited to this. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in this application, and these modifications or replacements should be included in the protection scope of this application.
Claims
1. A document processing method, characterized in that: include: Acquire a document set, wherein the document set includes a document directory and multiple documents, wherein the document directory includes document identifiers and document storage paths corresponding to each of the multiple documents; Parsing the document directory to determine the hierarchical relationship between the plurality of document identifiers; Traversing the plurality of document storage paths in the document directory, and extracting document content from the document corresponding to each document storage path; The hierarchical relationship between the multiple document identifiers and the multiple document contents are rendered according to a document display template to generate a document display page.
2. The method according to claim 1, characterized in that: The parsing of the document directory to determine the hierarchical relationship between the plurality of document identifiers includes: Parsing the document directory based on the grammatical rules of the document directory to determine the level of each document identifier; Based on the level of each of the document identifiers, the hierarchical relationship between the multiple document identifiers is determined according to the distances between the multiple document identifiers.
3. The method according to claim 2, characterized in that The step of determining the hierarchical relationship between the plurality of document identifiers based on the hierarchical level of each document identifier and according to the distances between the plurality of document identifiers comprises: traversing the plurality of document identifiers in a predetermined order; For a target document identifier, when the level of the target document identifier is a target level, among at least one of the document identifiers that has been traversed, a document identifier that is closest to the target document identifier and is at a level above the target level is determined as a parent level identifier of the target document identifier, wherein the target document identifier is any one of the multiple document identifiers, and the target level is any level except the first level.
4. The method according to claim 2 or 3, characterized in that: After determining the hierarchical relationship between the plurality of document identifiers based on the hierarchy of each of the document identifiers and according to the distances between the plurality of document identifiers, the method further comprises: The hierarchical relationship between the plurality of document identifiers is stored using a stack algorithm structure to obtain a tree-like directory structure table.
5. The method according to claim 4, characterized in that The plurality of document contents are stored in a document content table, and the hierarchical relationship between the plurality of document identifiers and the plurality of document contents are rendered according to a document display template to generate a document display page, including: The tree-like directory structure table and the document content table are rendered according to a document display template to generate a document display page.
6. The method according to claim 1, characterized in that The document collection also includes non-document resources, and the multiple documents include a first storage path of the non-document resources; The traversing the plurality of document storage paths in the document directory and extracting document content from a document corresponding to each of the document storage paths includes: Traversing the plurality of document storage paths in the document directory, and locating the first storage path in the document corresponding to the document storage path; Obtain a second storage path of the non-document resource corresponding to the first storage path in the cloud server; Replacing the first storage path with its corresponding second storage path; The document content is extracted from each of the documents, and the plurality of document contents include the second storage path.
7. The method according to claim 6, characterized in that Before obtaining the second storage path of the non-document resource corresponding to the first storage path in the cloud server, the method further includes: Traversing the document collection to determine non-document resources in the document collection; Uploading the non-document resources to a cloud server; A second storage path for saving the non-document resource in the cloud server.
8. A document processing device, characterized in that: The device comprises: An acquisition module, used to acquire a document set, wherein the document set includes a document directory and a plurality of documents, wherein the document directory includes document identifiers and document storage paths corresponding to the plurality of documents; A parsing module, used to parse the document directory and determine the hierarchical relationship between the plurality of document identifiers; An extraction module, used to traverse the multiple document storage paths in the document directory and extract document content from the document corresponding to each document storage path; The rendering module is used to render the hierarchical relationship between the multiple document identifiers and the multiple document contents according to the document display template to generate a document display page.
9. An electronic device, characterized in that: The electronic device comprises: a processor and a memory storing computer program instructions; When the processor executes the computer program instructions, the document processing method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, and when the computer program instructions are executed by a processor, the document processing method according to any one of claims 1 to 7 is implemented.
Citation Information
Cited By
Document conversion method, electronic equipment and computer readable storage medium
CN119047428A
Markdown editor and operation method thereof, electronic equipment and storage medium
CN121920331A
