Range text updating method and device, computer equipment, readable storage medium and program product
By calculating the similarity array and index list of the charter text, the charter text is automatically updated, which solves the problem of low manual revision efficiency and achieves efficient automatic revision.
Patent Information
- Application Number
- CN202410640678.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-22
- Publication Date
- 2025-07-29
AI Technical Summary
The revision of the existing charter text mainly relies on labor, resulting in waste of resources and inefficiency.
By calculating the similarity in the articles text, building a similarity array, traversing and determining the maximum value, adding it to the index list, determining the matching article text group, and automatically updating the original articles text.
The automated revision of the charter text has been achieved, saving human resources and improving the revision efficiency.
Smart Images

Figure CN120387428A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, the field of big data, and can be used in the field of fintech. In particular, it relates to a method, device, computer device, computer-readable storage medium, and computer program product for updating charter text. Background Art
[0002] The charter is the basic system of an organization and is crucial for the operation and development of an enterprise. However, with the revision of laws and regulations, the change of regulatory requirements, and the change of the social environment, the charter text needs to be continuously modified and improved.
[0003] When the charter text is revised, a large amount of the original charter text needs to be updated. The existing revision of the charter text mainly relies on manual work, wasting a large amount of human resources and having a very low efficiency of manual revision. Summary of the Invention
[0004] Based on this, it is necessary to provide a method, device, computer device, computer-readable storage medium, and computer program product for updating charter text that can save human resources and improve the efficiency of revising the charter text in view of the above technical problems.
[0005] In a first aspect, this application provides a method for updating charter text. The method includes:
[0006] For each piece of node text in the node text of the first chapter, determine the similarity between the current piece of node text and each piece of node text in the node text of the second chapter, and construct a similarity array based on the similarities corresponding to each piece of node text in the node text of the first chapter; wherein, the node text of the first chapter is included in the updated charter text, the node text of the second chapter is included in the original charter text, and the node text of the first chapter and the node text of the second chapter form a matching chapter text group;
[0007] Traverse each row in the similarity array, determine the first maximum value of the similarities in each row, determine the column corresponding to the first maximum value in the similarity array, and determine the second maximum value of the similarities in the column; in the case where the second maximum value is not greater than the first maximum value, add the row index of the row and the column index of the column to the index list;
[0008] Determine the target row index and the target column index from the index list, and determine a matching piece of text group based on the target row index and the target column index;
[0009] Remove the bar similarity indicated jointly by the target row index and the target column index from the similarity array to obtain an updated similarity array, use the updated similarity array as the similarity array, clear the index list, return to execute the step of traversing each row in the similarity array and continue to execute until a preset stop condition is reached;
[0010] Update the original charter text based on the obtained matching bar text groups.
[0011] In one embodiment, before determining the bar similarity between each bar node text in the node text of the first chapter and each bar node text in the node text of the second chapter, the method further includes:
[0012] Obtain the original charter text and the updated charter text;
[0013] For each chapter node text in the original charter text, determine the chapter similarity between the current chapter node sub-text and each chapter node text in the updated charter text;
[0014] Based on the chapter similarities respectively corresponding to all the chapter node texts of the original charter text, determine a target chapter similarity that meets a preset similarity condition from the chapter similarities respectively corresponding to all the chapter node texts;
[0015] Use the chapter node text in the updated charter text corresponding to the target chapter similarity as the node text of the first chapter, use the chapter node text in the original charter text corresponding to the target chapter similarity as the node text of the second chapter, and construct the matching chapter text group based on the node text of the first chapter and the node text of the second chapter.
[0016] In one embodiment, after returning to execute the step of traversing each row in the similarity array and continuing to execute until a preset stop condition is reached, and before updating the original charter text based on the obtained matching bar text groups, the method further includes:
[0017] Use the updated charter text that does not contain the node text of the first chapter as the updated charter text, use the original charter text that does not contain the node text of the second chapter as the original charter text, return to execute the step of determining the chapter similarity between the current chapter node sub-text and each chapter node text in the updated charter text for each chapter node text in the original charter text and continue to execute until the target chapter similarity is not greater than the chapter similarity threshold;
[0018] Correspondingly, updating the original charter text based on the obtained matching bar text groups includes:
[0019] Determine the matching relationship between the article node text in the updated charter text and the article node text in the original charter text based on the matching article text groups corresponding to each chapter node text in the updated charter text;
[0020] Update the original charter text based on the matching relationship.
[0021] In one embodiment, the method further includes:
[0022] In the case where the second maximum value is greater than the first maximum value, add the row index and the blank column index to the index list;
[0023] Correspondingly, determining the target row index and the target column index from the index list includes:
[0024] In the case where not all column indexes in the index list are blank column indexes, obtain a first column index from the index list;
[0025] Judge whether the number of the first column indexes in the index list is not greater than a quantity threshold;
[0026] If it is not greater than the quantity threshold, use the first column index as the target column index, and use the row index corresponding to the target column index as the target row index;
[0027] If it is greater than the quantity threshold, determine the target column index from the first column indexes based on the article similarity corresponding to the first column indexes, and use the row index corresponding to the target column index as the target row index.
[0028] In one embodiment, updating the original charter text based on the obtained matching article text groups includes:
[0029] Based on the obtained matching article text groups, determine the first article node text that has no matching relationship with the updated charter text from the original charter text, and determine the second article node text that has no matching relationship with the original charter text from the updated charter text;
[0030] Determine the target article similarity between the first article node text and the second article node text;
[0031] In the case where the target article similarity is greater than the corresponding similarity threshold, based on the node position of the second article node text in the updated charter text, determine the moving node position corresponding to the node position in the original charter text, and move the first article node text in the original charter text to the moving node position.
[0032] In one embodiment, the preset stop condition includes: the similarity array is a blank array or all column indexes in the index list are blank column indexes.
[0033] In one embodiment, updating the original charter text based on the obtained matching clause text group includes:
[0034] For each node text in the first chapter node text, use the current node text as the query text, input the query text into the deep paragraph retrieval model, and determine the similarity between the query text and each retrieval text in the retrieval library through the deep paragraph retrieval; the retrieval text includes the first node rule text in the modified rule text and the second node rule text corresponding to the first node rule text, and the second node rule text is included in the rule text before modification;
[0035] Based on the similarity between the query text and each retrieval text in the retrieval library, determine the target retrieval text from the retrieval text;
[0036] Based on the target retrieval text, determine the revision basis information of the clause node rule text, and based on the revision basis information, determine the revision basis information of the current clause node text;
[0037] Update the original charter text based on the revision basis information corresponding to each clause node text and the matching clause text group.
[0038] In a second aspect, the present application also provides a charter text update device, including:
[0039] A first construction module, configured to determine the clause similarity between each clause node text in the first chapter node text and each clause node text in the second chapter node text, and construct a similarity array based on the clause similarities corresponding to each clause node text in the first chapter node text; wherein, the first chapter node text is included in the updated charter text, the second chapter node text is included in the original charter text, and the first chapter node text and the second chapter node text form a matching chapter text group;
[0040] A traversal module, configured to traverse each row in the similarity array, determine the first maximum value of the clause similarities in each row, determine the column corresponding to the first maximum value in the similarity array, and determine the second maximum value of the clause similarities in the column; in the case where the second maximum value is not greater than the first maximum value, add the row index of the row and the column index of the column to the index list;
[0041] A first determination module, configured to determine a target row index and a target column index from the index list, and determine a matching bar text group based on the target row index and the target column index;
[0042] A first loop module, configured to remove the bar similarity indicated jointly by the target row index and the target column index from the similarity array, obtain an updated similarity array, use the updated similarity array as the similarity array, clear the index list, return to execute the step of traversing each row in the similarity array and continue to execute until a preset stop condition is reached;
[0043] An update module, configured to update the original charter text based on the obtained matching bar text group.
[0044] In a third aspect, the present application further provides a computer device, including a memory and a processor, where the memory stores a computer program, and when the processor executes the computer program, the steps of the methods in the embodiments are implemented.
[0045] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the methods in the embodiments are implemented.
[0046] In a fifth aspect, the present application further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the steps of the methods in the embodiments are implemented.
[0047] The above-mentioned method, device, computer device, computer-readable storage medium and computer program product for updating the charter text determine the line similarity between each line of node text in the node text of the first chapter and each line of node text in the node text of the second chapter, and construct a similarity array based on the line similarity corresponding to each line of node text in the node text of the first chapter; wherein, the node text of the first chapter is included in the updated charter text, the node text of the second chapter is included in the original charter text, and the node text of the first chapter and the node text of the second chapter form a matching chapter text group. In this way, for the matching node text of the first chapter and the second chapter, by calculating the line similarity, a similarity array can be constructed. Then, by traversing each row in the similarity array, the first maximum value of the line similarity in each row is determined, the column corresponding to the first maximum value in the similarity array is determined, and the second maximum value of the line similarity in the column is determined; in the case where the second maximum value is not greater than the first maximum value, the row index of the row and the column index of the column are added to the index list, the target row index and the target column index are determined from the index list, and a matching line text group is determined based on the target row index and the target column index. In this way, two matching line text groups can be determined, the line similarity indicated by the common target row index and target column index is removed from the similarity array to obtain an updated similarity array, the updated similarity array is used as the similarity array, and the index list is cleared. Then, the step of traversing each row in the similarity array is returned and continued until a preset stop condition is reached. Through the loop, multiple groups of two matching line text groups can be determined, and based on the obtained matching line text groups, the original charter text is updated, realizing the automatic revision of the original charter text without manual participation and with high revision efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] In order to more clearly illustrate the technical solutions in the embodiments of the present application or related technologies, the following will briefly introduce the drawings required to be used in the description of the embodiments of the present application or related technologies. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other related drawings can also be obtained based on these drawings.
[0049] Figure 1 It is a flowchart of the method for updating the charter text in one embodiment;
[0050] Figure 2 It is a flowchart of the method for updating the charter text in another embodiment;
[0051] Figure 3 It is a flowchart of the method for updating the charter text in another embodiment;
[0052] Figure 4It is a structural block diagram of a charter text update device in an embodiment;
[0053] Figure 5 It is an internal structure diagram of a computer device in an embodiment. Specific implementation manners
[0054] In order to make the objectives, technical solutions and advantages of the present application clearer and more understandable, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0055] In an embodiment, as Figure 1 shown, a method for updating a charter text is provided. In this embodiment, an example is given where this method is applied to a terminal. It can be understood that this method can also be applied to a server, and can also be applied to a system including a terminal and a server, and is implemented through the interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0056] Step 102: For each piece of node text in the node text of the first chapter, determine the similarity between the current piece of node text and each piece of node text in the node text of the second chapter, and construct a similarity array based on the similarities corresponding to each piece of node text in the node text of the first chapter; wherein, the node text of the first chapter is included in the updated charter text, the node text of the second chapter is included in the original charter text, and the node text of the first chapter and the node text of the second chapter form a matching chapter text group;
[0057] The original charter text includes one or more pieces of node text of the second chapter, the updated charter text is a text obtained by updating on the basis of the original charter text, and the updated charter text includes one or more pieces of node text of the first chapter;
[0058] The terminal selects the node text of the first chapter from the updated charter text, and selects the node text of the second chapter similar to the node text of the first chapter from the original charter text. The node text of the first chapter and the node text of the second chapter similar to the node text of the first chapter together form a matching chapter text group.
[0059] Any piece of node text (the node text of the first chapter or the node text of the second chapter) includes one or more pieces of item node text;
[0060] For each piece of item node text in the node text of the first chapter, determine the similarity between the current piece of item node text and one or more pieces of item node text in the node text of the second chapter, and obtain one or more similarities;
[0061] Construct a similarity array based on the bar similarities corresponding to all bar node texts in the node text of the first chapter. Each element in the constructed similarity array corresponds to a bar similarity, and the data in each row of the similarity array represents the similarity between a bar node text in the node text of the first chapter and one or more bar node texts in the node text of the second chapter.
[0062] For example, the first chapter text includes bar node text 1, bar node text 2, and bar node text 3, and the second chapter text includes bar node text 4, bar node text 5, and bar node text 6; for bar node text 1, determine the bar similarities between bar node text 1 and bar node text 4, bar node text 5, and bar node text 6 respectively; for bar node text 2, determine the bar similarities between bar node text 2 and bar node text 4, bar node text 5, and bar node text 6 respectively; for bar node text 3, determine the bar similarities between bar node text 3 and bar node text 4, bar node text 5, and bar node text 6 respectively. Then, construct a similarity array based on the determined bar similarities.
[0063] Step 104: Traverse each row in the similarity array, determine the first maximum value of the bar similarities in each row, determine the column corresponding to the first maximum value in the similarity array, and determine the second maximum value of the bar similarities in the column; when the second maximum value is not greater than the first maximum value, add the row index of the row and the column index of the column to the index list.
[0064] In this embodiment, the terminal sequentially traverses each row in the similarity array. For example, when traversing the first row in the similarity array for the first time, determine the first maximum value of the bar similarities in the first row, determine the column corresponding to the first maximum value in the similarity array, determine the second maximum value of the bar similarities in this column, and when the second maximum value is not greater than the first maximum value, add the row index of this row and the column index of this column to the index list; when traversing the second row in the similarity array for the second time, similar to traversing the first row in the similarity array, also obtain the corresponding row index and column index of the second row and add them to the index list; when traversing the third row in the similarity array for the third time, similar to traversing the first row in the similarity array, also obtain the corresponding row index and column index of the third row and add them to the index list; until traversing the last row in the similarity array, similar to traversing the first row in the similarity array, also obtain the corresponding row index and column index of the last row and add them to the index list, and after the traversal ends, obtain the final index list.
[0065] In this application, there are only two possible situations where the second maximum value is greater than the first maximum value and the second maximum value is equal to the first maximum value. Therefore, the situation where the second maximum value is not greater than the first maximum value actually refers to the situation where the second maximum value is equal to the first maximum value.
[0066] When traversing any row in the similarity array, for example, the first maximum value of the item similarities in the first row is 0.8, and the column corresponding to the first maximum value in the similarity array is the 5th column. If the second maximum value of the item similarities in the 5th column is 0.8, then add the row index 1 and the column index 5 to the index list.
[0067] Step 106: Determine the target row index and the target column index from the index list, and determine the matching item text group based on the target row index and the target column index;
[0068] After the traversal ends to obtain the final index list, determine the target column index from the index list, and based on the determined target column index, determine the target row index from the index list. Determine the corresponding item node text from the first chapter node text based on the target row index, determine the corresponding item node text from the second chapter node text based on the target column index, and construct a matching item text group based on the item node text determined from the first chapter node text and the item node text determined from the second chapter node text;
[0069] Step 108: Remove the item similarity indicated jointly by the target row index and the target column index from the similarity array to obtain an updated similarity array. Take the updated similarity array as the similarity array, clear the index list, return to execute the step of traversing each row in the similarity array and continue to execute until a preset stop condition is reached;
[0070] Remove an item similarity indicated jointly by the target row index and the target column index from the above similarity array to obtain an updated similarity array. For example, if the target row index and the target column index indicate the item similarity in the 5th row and the 3rd column, then remove the item similarity in the 5th row and the 3rd column from the similarity array to obtain an updated similarity array.
[0071] Take the updated similarity array as the similarity array, clear the index list, and loop to execute the following steps: Traverse each row in the similarity array, determine the first maximum value of the item similarities in each row, determine the column corresponding to the first maximum value in the similarity array, and determine the second maximum value of the item similarities in the column; In the case where the second maximum value is not greater than the first maximum value, add the row index of the row and the column index of the column to the index list; The steps of determining the target row index and the target column index from the index list and determining the matching item text group based on the target row index and the target column index until a preset stop condition is reached.
[0072] Step 110: Update the original charter text based on the obtained matching item text group.
[0073] Integrate the matching bar text groups obtained by executing the above steps in each loop, and update the bar text in the second chapter node text based on the bar text in the first chapter node text of the matching bar text group, so as to update the original charter text.
[0074] In this embodiment, for each bar text in the first chapter node text, determine the bar similarity between the current bar text and each bar text in the second chapter node text, and construct a similarity array based on the bar similarities respectively corresponding to the bar texts in the first chapter node text; wherein, the first chapter node text is included in the updated charter text, the second chapter node text is included in the original charter text, and the first chapter node text and the second chapter node text form a matching chapter text group. In this way, for the matching first chapter node text and the second chapter node text, by calculating the bar similarity, a similarity array can be constructed, and then traverse each row in the similarity array to determine the first maximum value of the bar similarities in each row, determine the column corresponding to the first maximum value in the similarity array, and determine the second maximum value of the bar similarities in the column; in the case where the second maximum value is not greater than the first maximum value, add the row index of the row and the column index of the column to the index list, determine the target row index and the target column index from the index list, and determine the matching bar text group based on the target row index and the target column index. In this way, two matching bar text groups can be determined, remove the bar similarity indicated jointly by the target row index and the target column index from the similarity array to obtain an updated similarity array, use the updated similarity array as the similarity array, clear the index list, return to execute the step of traversing each row in the similarity array and continue to execute until the preset stop condition is reached. Through the loop, multiple groups of two matching bar text groups can be determined, and then based on the obtained matching bar text groups, the original charter text is updated, realizing the automatic revision of the original charter text, without manual participation and with high revision efficiency.
[0075] In one of the embodiments, the preset stop condition includes: the similarity array is a blank array or all the column indexes in the index list are blank column indexes.
[0076] Each time the above steps are executed in a loop, the bar similarity indicated jointly by the target row index and the target column index is removed from the similarity array to obtain an updated similarity array. Then, if the similarity array is a blank array after multiple loops, it is determined that the preset stop condition is reached, the loop is stopped, and the step of updating the original charter text based on the obtained matching bar text groups is executed.
[0077] It is also possible that after traversing each row in the similarity array, all the column indexes in the index list are blank indexes, then it is determined that the preset stop condition is reached, the loop is stopped, and the step of updating the original charter text based on the obtained matching bar text groups is executed.
[0078] It can be seen that the present application defines in detail the loop stop conditions, which facilitates the implementation of the solution and improves the feasibility of the solution of the present application.
[0079] In an embodiment of the present application, it is necessary to first determine the second chapter node text that matches the first chapter node text of the updated charter text from the original charter text, and then determine the matching clause text group for the matching first chapter node text and the second chapter node text. Specifically, the process of determining the matching first chapter node text and the second chapter node text is as follows:
[0080] In an embodiment of the present application, before determining the clause similarity between each clause node text in the first chapter node text and each clause node text in the second chapter node text, the method further includes: Step 202, obtaining the original charter text and the updated charter text; Step 204, for each chapter node text in the original charter text, determining the chapter similarity between the current chapter node sub-text and each chapter node text in the updated charter text; Step 206, based on the chapter similarities respectively corresponding to all the chapter node texts of the original charter text, determining the target chapter similarity that meets the preset similarity condition from the chapter similarities respectively corresponding to all the chapter node texts; Step 208, taking the chapter node text in the updated charter text corresponding to the target chapter similarity as the first chapter node text, taking the chapter node text in the original charter text corresponding to the target chapter similarity as the second chapter node text, and constructing a matching chapter text group based on the first chapter node text and the second chapter node text.
[0081] The terminal obtains the original charter text, disassembles the original charter text in the manner of chapters and clauses to form a corresponding tree structure. The tree structure includes chapter nodes, each chapter node corresponds to a second chapter node text, there is one or more clause nodes under each chapter node, and each clause node corresponds to a clause node text;
[0082] The terminal obtains the updated charter text, disassembles the updated charter text in the manner of chapters and clauses to form a corresponding tree structure. The tree structure includes chapter nodes, each chapter node corresponds to a first chapter node text, there is one or more clause nodes under each chapter node, and each clause node corresponds to a clause node text;
[0083] For each chapter node text in the original charter text, determine the chapter similarity between the current chapter node sub-text and each chapter node text in the updated charter text. Among them, considering the advantages and limitations of the text similarity calculation method, a combination of Jaccard similarity, edit distance, and cosine similarity can be used, and the product of the calculation results of the above methods is used as the chapter similarity between the current chapter node sub-text and each chapter node text in the updated charter text.
[0084] For example, the original charter text includes chapter node text 1, chapter node text 2, and chapter node text 3, and the updated charter text includes chapter node text 4, chapter node text 5, and chapter node text 6; for the chapter node text 1 in the original charter text, determine the chapter similarity between the chapter node text 1 and the chapter node text 4, the chapter node text 5, and the chapter node text 6 respectively; for the chapter node text 2 in the original charter text, determine the chapter similarity between the chapter node text 2 and the chapter node text 4, the chapter node text 5, and the chapter node text 6 respectively; for the chapter node text 3 in the original charter text, determine the chapter similarity between the chapter node text 3 and the chapter node text 4, the chapter node text 5, and the chapter node text 6 respectively.
[0085] In this embodiment, based on the chapter similarities respectively corresponding to all the chapter node texts of the original charter text, determine the target chapter similarity with the largest similarity value from the chapter similarities respectively corresponding to all the chapter node texts as the target chapter similarity that meets the preset similarity condition. If the largest target chapter similarity is not unique, for each largest target chapter similarity, determine the first chapter node text and the second chapter node text respectively corresponding to the largest target chapter similarity, calculate the article similarity between each article node text in the first chapter node text and the corresponding article node text in the second chapter node text, and perform weighted averaging on the calculated article similarities to obtain the weighted chapter similarity between the first chapter node text and the second chapter node text; based on the weighted chapter similarities respectively corresponding to multiple largest target chapter similarities, determine the target chapter similarity corresponding to the largest weighted chapter similarity, and use the target chapter similarity corresponding to the largest weighted chapter similarity as the target chapter similarity that meets the preset similarity condition;
[0086] For example, the chapter similarities respectively corresponding to all the chapter node texts refer to: the chapter similarities between the chapter node text 1 in the original charter text and the chapter node text 4, the chapter node text 5, and the chapter node text 6 respectively, the chapter similarities between the chapter node text 2 and the chapter node text 4, the chapter node text 5, and the chapter node text 6 respectively, and the chapter similarities between the chapter node text 3 and the chapter node text 4, the chapter node text 5, and the chapter node text 6 respectively; if it is determined from the chapter similarities respectively corresponding to all the chapter node texts that the chapter similarity between the chapter node text 1 in the original charter text and the chapter node text 4 is the largest, then use the largest chapter similarity as the target chapter similarity;
[0087] If the chapter similarity between the chapter node text 1 and the chapter node text 4, and the chapter similarity between the chapter node text 2 and the chapter node text 5 in the original charter text are determined to be the same and both are the largest from the chapter similarities corresponding to all chapter node texts respectively, then calculate the article similarity between each article node text in the chapter node text 1 and the corresponding article node text in the chapter node text 4, and perform weighted average on the calculated article similarities to obtain the weighted chapter similarity; calculate the article similarity between each article node text in the chapter node text 2 and the corresponding article node text in the chapter node text 5, and perform weighted average on the calculated article similarities to obtain the weighted chapter similarity, compare the weighted chapter similarities obtained from the two calculations, and take the chapter similarity corresponding to the larger weighted chapter similarity as the target chapter similarity.
[0088] Take the chapter node text in the updated charter text corresponding to the target chapter similarity as the above-mentioned first chapter node text, and take the chapter node text in the original charter text corresponding to the target chapter similarity as the second chapter node text. It can be seen that the first chapter node text and the second chapter node text obtained in this way are the two chapter node texts with the highest matching degree. Therefore, a matching chapter text group is constructed based on the first chapter node text and the second chapter node text, ensuring that the second chapter node text that highly matches the first chapter node text can be used to update the first chapter node text.
[0089] After step 208, the charter text update method further includes:
[0090] Step 210: For each article node text in the first chapter node text, determine the article similarity between the current article node text and each article node text in the second chapter node text, and construct a similarity array based on the article similarities corresponding to each article node text in the first chapter node text;
[0091] Step 212: Determine whether the similarity array is a blank array;
[0092] Step 214: If not, traverse each row in the similarity array, determine the first maximum value of the article similarities in each row, determine the column corresponding to the first maximum value in the similarity array, and determine the second maximum value of the article similarities in the column; in the case where the second maximum value is not greater than the first maximum value, add the row index of the row and the column index of the column to the index list;
[0093] Step 214: After the traversal is completed, determine the target row index and the target column index from the index list, and determine the matching article text group based on the target row index and the target column index;
[0094] Step 216: Remove the bar similarity indicated by the target row index and the target column index from the similarity array to obtain an updated similarity array. Take the updated similarity array as the similarity array, clear the index list, return to the step of determining whether the similarity array is an empty array and continue to execute until a preset stop condition is reached;
[0095] It can be seen that according to the solution of this application, the first chapter node text and the second chapter node text with the highest matching degree can be selected from the original charter text and the updated charter text, so as to determine a matching bar text group based on the first chapter node text and the second chapter node text with the highest matching degree to update the original charter text, so that the second chapter node text that matches can be updated based on the first chapter node text, thus realizing accurate and automated revision of the original charter text.
[0096] In this embodiment, for a group of matching chapter text groups, after obtaining the matching bar text group, the process of determining the first chapter node text that matches the second chapter node text of the original charter text from the updated charter text in this application can be looped to execute to determine the next matching chapter text group and obtain the matching bar text group. Specifically:
[0097] Before returning to execute the step of traversing each row in the similarity array and continuing to execute until a preset stop condition is reached, and then updating the original charter text based on the obtained matching bar text group, the method further includes: Step 218: Take the updated charter text that does not contain the first chapter node text as the updated charter text, take the original charter text that does not contain the second chapter node text as the original charter text, return to execute the step of determining the chapter similarity between the current chapter node sub-text and the chapter node texts in the updated charter text for each chapter node text in the original charter text and continue to execute until the target chapter similarity is not greater than the chapter similarity threshold;
[0098] Correspondingly, the above step 110 updates the original charter text based on the obtained matching bar text group, including: Step 220: Determine the matching relationship between the bar node text in the updated charter text and the bar node text in the original charter text based on the matching bar text groups respectively corresponding to the chapter node texts in the updated charter text; Step 222: Update the original charter text based on the matching relationship.
[0099] Remove the node text of the first chapter from the updated charter text, and use the updated charter text that does not contain the above-mentioned node text of the first chapter as the new updated charter text. Remove the node text of the second chapter from the original charter text, and use the original charter text that does not contain the node text of the second chapter as the new original charter text. Return to execute the steps of determining the chapter similarity between the current chapter node sub-text and the chapter node texts in the updated charter text for each chapter node text in the original charter text. Based on the chapter similarities corresponding to all the chapter node texts of the original charter text, determine the target chapter similarity that meets the preset similarity condition from the chapter similarities corresponding to all the chapter node texts. Use the chapter node text in the updated charter text corresponding to the target chapter similarity as the node text of the first chapter, and use the chapter node text in the original charter text corresponding to the target chapter similarity as the node text of the second chapter. Construct a matching chapter text group based on the node text of the first chapter and the node text of the second chapter, until the target chapter similarity is not greater than the chapter similarity threshold, which means that the node text of the first chapter and the node text of the second chapter with a chapter similarity greater than the chapter similarity threshold cannot be determined.
[0100] For each matching chapter text group, a corresponding matching article text group can be determined. By repeatedly executing the above steps, multiple matching chapter text groups can be obtained, and multiple groups of matching article text groups can be correspondingly determined. Based on the matching article text groups determined respectively for each matching chapter text group, determine the matching relationship between the article node texts in the updated charter text and the article node texts in the original charter text. Thus, based on this matching relationship, update the original charter text based on the content of the updated charter text.
[0101] In one embodiment, the method further includes: when the second maximum value is greater than the first maximum value, add the row index and the blank column index to the index list;
[0102] In this embodiment, after constructing the similarity array, traverse each row in the similarity array, determine the first maximum value of the article similarities in each row, determine the column corresponding to the first maximum value in the similarity array, and determine the second maximum value of the article similarities in the column. When the second maximum value is not greater than the first maximum value, add the row index of the row and the column index of the column to the index list. When the second maximum value is greater than the first maximum value, set the column index to a null value, and add the row index and the blank column index to the index list, until each row in the similarity array is traversed to obtain the final index list;
[0103] Correspondingly, determine the target row index and the target column index from the index list, including: when not all column indexes in the index list are blank column indexes, obtain the first column index from the index list; determine whether the number of the first column indexes in the index list is not greater than the quantity threshold; if not greater than the quantity threshold, use the first column index as the target column index, and use the row index corresponding to the target column index as the target row index; if greater than the quantity threshold, determine the target column index from the first column indexes based on the item similarity corresponding to the first column indexes, and use the row index corresponding to the target column index as the target row index.
[0104] Determine whether all column indexes in the index list are blank column indexes; if all are blank column indexes, determine that the preset stop condition is reached.
[0105] If not all are blank column indexes, skip the blank column indexes in the index list, obtain the first column index from the index list, determine whether the number of the first column indexes in the index list is not greater than the quantity threshold, the quantity threshold can be 1, if not greater than 1 and the value of the first column index is unique in the column index list, use the first column index as the target column index, and use the row index corresponding to the target column index as the target row index; if greater than 1, that is, the value of the first column index is not unique in the column index list, determine the item similarity corresponding to the two or more first column indexes in the two-dimensional array, and use the first column index corresponding to the maximum item similarity in the item similarity as the target column index, and use the row index corresponding to the target column index as the target row index.
[0106] In this embodiment, the first column index may be the column index that is the first in the index list and is not a blank column index.
[0107] For example, the column index that is the first in the index list and is not a blank column index is the 5th column. The index list records the 3rd row and the 5th column and the 5th row and the 5th column, indicating that the value of the first column index is not unique. Then determine the item similarity A corresponding to the 3rd row and the 5th column in the two-dimensional array and the item similarity B corresponding to the 5th row and the 5th column in the two-dimensional array. If the item similarity B is greater than the item similarity A, use the 5th row as the target row index and the 5th column as the target column index.
[0108] In this embodiment, the situation where the second maximum value is greater than the first maximum value and the situation where the first column index is not unique are also considered, enhancing the feasibility of the solution.
[0109] In an embodiment of the present application, after obtaining the matching bar text groups corresponding to all the matching chapter text groups, a matching list is constructed based on the matching bar text groups. For the bar node texts that do not exist in the matching bar text groups but exist in the bar node texts of the original charter text and the bar node texts of the updated charter text, they can be added to the matching list. For the matching list, a difference algorithm (diff algorithm) is used to compare the bar node texts to obtain the item differences. Among them, according to different comparison results, the bar node texts in the matching list can obtain three status results: modification, addition, and deletion. Traverse all the chapters to obtain the text differences between the updated charter text and the original charter text. Finally, the moving item processing module is used to calculate the similarity of all the newly added and deleted bar node texts using the text similarity calculation module. When the calculation result is greater than the corresponding threshold, the bar status of the corresponding bar node text is modified to move. Specifically:
[0110] In an embodiment of the present application, based on the obtained matching bar text groups, the original charter text is updated, including: based on the obtained matching bar text groups, determining the first bar node text that has no matching relationship with the updated charter text from the original charter text, and determining the second bar node text that has no matching relationship with the original charter text from the updated charter text; determining the target bar similarity between the first bar node text and the second bar node text; in the case where the target bar similarity is greater than the corresponding similarity threshold, based on the node position of the second bar node text in the updated charter text, determining the moving node position corresponding to the node position in the original charter text, and moving the first bar node text in the original charter text to the moving node position.
[0111] Case where the bar node text is in the modified state: Modify one bar node text in the matching bar text group based on another bar node text in the matching bar text group, where one bar node text is from the updated charter text and the other bar node text is from the original charter text;
[0112] Case where the bar node text is in the added state: Based on the obtained matching bar text groups, determining the second bar node text that has no matching relationship with the original charter text from the updated charter text; based on the position of the second bar node text in the updated charter text, adding the second bar node text to the corresponding position in the original charter text;
[0113] Case where the bar node text is in the deleted state: Based on the obtained matching bar text groups, determining the first bar node text that has no matching relationship with the updated charter text from the original charter text, and deleting the first bar node text from the original charter text.
[0114] Case where the article node text is in a moved state: Based on the obtained matching article text group, determine the first article node text in the original charter text that has no matching relationship with the updated charter text, and determine the second article node text in the updated charter text that has no matching relationship with the original charter text; if the target article similarity between the first article node text and the second article node text is greater than the corresponding similarity threshold, it indicates that the contents of the first article node text and the second article node text are similar, and in the updated charter text, the article node text has been moved. Then, based on the node position of the second article node text in the updated charter text, determine the corresponding moved node position in the original charter text, and then for the original charter text, move the first article node text to this moved node position; if the target article similarity between the first article node text and the second article node text is not greater than the corresponding similarity threshold, it indicates that the contents of the first article node text and the second article node text are not similar. Then, based on the position of the second article node text in the updated charter text, add the second article node text to the corresponding position in the original charter text, and delete the first article node text from the original charter text.
[0115] In this embodiment, the case where the article node text is in a moved state is for the relative original charter text. The new charter text moves the article node text in a certain chapter node text to another chapter node text. The chapter node text where the first article node text is located and the chapter node text where the second article node text is located are two non-matching chapter node texts.
[0116] In this embodiment, three states of addition, deletion, and movement of the article node text are also considered, rather than only considering the modification of the article node text, realizing the comprehensive update of the original charter text.
[0117] In the existing solution, when modifying the charter, the revised content of the charter is manually checked against the legal and regulatory text or regulatory rule text to clarify what laws, regulations, or regulatory rule modifications the charter modification is based on. This method is manually checked, time-consuming and laborious, and prone to omissions and errors. To solve this problem, in the solution of this application:
[0118] In one embodiment, based on the obtained matching clause text group, the original charter text is updated, including: for each clause node text in the first chapter node text, using the current clause node text as the query text, inputting the query text into the deep paragraph retrieval model, and determining the similarity between the query text and each retrieval text in the retrieval library through deep paragraph retrieval; the retrieval texts include the first clause node rule text in the modified rule text and the second clause node rule text corresponding to the first clause node rule text, and the second clause node rule text is included in the rule text before modification; based on the similarity between the query text and each retrieval text in the retrieval library, determining the target retrieval text from the retrieval texts; determining the revision basis information of the clause node rule text based on the target retrieval text, and determining the revision basis information of the current clause node text based on the revision basis information; updating the original charter text based on the revision basis information corresponding to each clause node text and the matching clause text group.
[0119] First, the construction of the retrieval library is carried out, specifically including:
[0120] Obtain the predefined rule text, which includes the rule text before modification and the rule text after modification. The rule text before modification includes the legal and regulatory text before modification and / or the regulatory rule text before modification. Correspondingly, the rule text after modification includes the legal and regulatory text after modification and / or the regulatory rule text after modification;
[0121] For the rule text before modification and the rule text after modification, similarly obtain the matching clause text group according to the charter text update method of this application, and perform comparison of clause node texts through the difference algorithm to obtain the item differences between the rule text before modification and the rule text after modification. It can be understood that when obtaining the matching clause text group according to the charter text update method of this application, the rule text before modification is equivalent to the original charter text, and the rule text after modification is equivalent to the updated charter text.
[0122] Construct a retrieval library, which includes multiple retrieval texts. Each retrieval text includes the first clause node rule text in the modified rule text, the second clause node rule text in the rule text before modification corresponding to the first clause node rule text, and the item differences between the two clause node rules;
[0123] Retrieve the target retrieval text that matches each clause node text in the updated charter text from the retrieval library, so that when revising the clause node text in the original charter text based on the updated charter text, the modification basis information can be determined. Specifically:
[0124] The Deep Passage Retrieval (DPR) model is a retrieval model based on deep neural networks, which is used to find the most relevant documents from a large amount of text. It achieves this by learning the similarity between each document and the query. The basic idea of the DPR model is to represent each document as a vector and also represent the query as a vector. Then, it calculates the cosine similarity between these two vectors to determine their relevance.
[0125] In one implementation, for each node text in the updated charter text, the current node text in the updated charter text is used as the query text. Through the DPR model, the similarity between the query text and each retrieval text in the retrieval library is calculated. Based on this similarity, the target retrieval text is retrieved from the retrieval library. Specifically, the retrieval text with the highest similarity to the query text can be used as the target retrieval text, so as to obtain the target retrieval text respectively matched with each node text in the updated charter text.
[0126] In another implementation, for each node text in the updated charter text, the entry difference between the current node text and the corresponding node text in the original charter text is used as the query text. Through the DPR model, the similarity between the query text and each retrieval text in the retrieval library is calculated. Based on this similarity, the target retrieval text is retrieved from the retrieval library. Specifically, the retrieval text with the highest similarity to the query text can be used as the target retrieval text, so as to obtain the target retrieval text respectively corresponding to each node text in the updated charter text.
[0127] Based on the node rule text in the modified rule text, the node rule text in the rule text before modification, and the entry difference between the two node rule texts in the retrieved target retrieval text, it can be seen according to which revision basis information the second node rule text in the target retrieval text is revised to the first node rule text. The revision basis information can be laws, regulations or regulatory rules, and this revision basis information is used as the revision basis information for the current node text in the updated charter text;
[0128] Based on the revision basis information corresponding to each node text and the matching text group, the original charter text is updated. Specifically, when updating the original charter text based on the matching text group, for two node texts in the matching text group, when revising the node text from the original charter text with reference to the current node text from the updated charter text, based on the revision basis information of the current node text, it can be determined that the corresponding node text in the original charter text is revised according to this revision basis information, so as to determine according to which laws, regulations or regulatory rules the corresponding node text in the original charter text is revised.
[0129] The specific application scenario of this application is as follows: The retrieval library includes multiple retrieval texts, for example, specifically including: Retrieval Text 1, Retrieval Text 2, Retrieval Text 3, and Retrieval Text 4. Among them, Retrieval Text 1 includes: the node rule text 1 modified according to Regulation A, the node rule text 1 before modification, and the entry difference between the modified node rule text 1 and the node rule text 1 before modification; Retrieval Text 2 includes: the node rule text 2 modified according to Regulation B, the node rule text 2 before modification, and the entry difference between the modified node rule text 2 and the node rule text 2 before modification; Retrieval Text 3 includes: the node rule text 3 modified according to Regulatory Requirement A, the node rule text 3 before modification, and the entry difference between the modified node rule text 3 and the node rule text 3 before modification; Retrieval Text 4 includes: the node rule text 4 modified according to Regulatory Requirement B, the node rule text 4 before modification, and the entry difference between the modified node rule text 4 and the node rule text 4 before modification.
[0130] For any node text in the updated charter text, input the node text into the DPR model to calculate the similarity between the node text and each retrieval text in the retrieval library. The text with the highest similarity is Retrieval Text 4. Then, for the two node texts in the matching text group, when modifying the corresponding node text in the original charter text based on the node text in the updated charter text, the modification basis of the corresponding node text in the original charter text is Regulatory Requirement B.
[0131] It can be seen that this application can retrieve the target retrieval text that matches each node text in the updated charter text. Therefore, when this application revises the original charter text based on the updated charter text, based on the target retrieval text, it can determine specifically which legal or regulatory rule text's modification content is used for the corresponding modification, and can determine the modification basis of each node text in the original charter text. The process of retrieving the target retrieval text is realized by machine automation without manual participation, avoiding the problems of time-consuming, laborious, and easy omission and error in the existing solutions.
[0132] In summary, referring to Figure 3 , the overall solution of this application is as follows:
[0133] A text processing module for reading new and old charter documents to obtain a content tree structure; in this embodiment, the new charter document refers to the above-mentioned updated charter text, and the old charter document refers to the above-mentioned original charter text;
[0134] The matching chapter processing module performs the following steps:
[0135] Calculate the similarity of the chapters in the new and old charter documents to obtain the chapter matching relationship;
[0136] Specifically: for each chapter node text in the original charter text, determine the chapter similarity between the current chapter node sub - text and each chapter node text in the updated charter text;
[0137] Judge whether the highest similarity value (referring to the chapter similarity) is unique. If the highest similarity value is not unique, calculate the similarity of each section in the chapters with repeated similarities, and then compare the weighted average value to obtain the most similar chapter, and then judge whether the similarity is greater than the corresponding threshold. If the highest similarity value is unique, judge whether the similarity is greater than the corresponding threshold. If the similarity is greater than the corresponding threshold, record the chapter matching relationship (corresponding to the process of determining the first - chapter node text and the second - chapter node text to construct the matching chapter text group above); if the similarity is not greater than the corresponding threshold, determine the new chapter (chapter node text) corresponding to this similarity in the updated charter text, add the new chapter to the original charter text, determine the old chapter (chapter node text) corresponding to this similarity in the original charter text, and delete the old chapter from the original charter text.
[0138] In this embodiment, the chapter refers to the above - mentioned chapter node text, and the section refers to the article node text.
[0139] The matching article processing module performs the following steps:
[0140] Loop through the chapter matching relationship, and get a matching chapter text group each time. Calculate the two - dimensional array of the similarity of the content inside the articles in the new and old documents (corresponding to the process of constructing the two - dimensional array above), and judge whether the two - dimensional value is empty. If the two - dimensional value is empty, obtain the article matching relationship in the current chapter; if the two - dimensional value is not empty, loop through each row of data in the two - dimensional array, record the maximum value A of the current row of data, obtain the maximum value B of the column data according to the column where A is located, judge whether A is equal to B. If A is equal to B, record the row and column indexes and the maximum value A in the row - column index list. If A is not equal to B, in this case, A is less than B, then there is no matching maximum value in this row, record the row index and the null value (corresponding to the above, traverse each row in the similarity array, determine the first maximum value of the article similarity in each row, determine the column corresponding to the first maximum value in the similarity array, and determine the second maximum value of the article similarity in the column; in the case where the second maximum value is not greater than the first maximum value, add the row index of the row and the column index of the column to the index list, and in the case where the second maximum value is greater than the first maximum value, add the row index and the blank column index to the index list);
[0141] After looping through each row in the two-dimensional array, check if all column indices in the row-column index list are empty. If not all are empty, obtain the column indices in the record row-column index list, skip the empty values, and check if the value of the first column index is unique in the column indices (corresponding to checking if the number of the first column index in the index list is not greater than the quantity threshold). If it is unique, record this row-column index as a matching relationship. If it is not unique, obtain the row-column index corresponding to the maximum value of the repeated column index's corresponding value A, and record this row-column index as a matching relationship (corresponding to the above, if not greater than the quantity threshold, use the first column index as the target column index and the row index corresponding to the target column index as the target row index; if greater than the quantity threshold, determine the target column index from the first column index based on the bar similarity corresponding to the first column index, and use the row index corresponding to the target column index as the target row index).
[0142] Remove the corresponding row-column data from the two-dimensional array, and return to the step of judging whether the two-dimensional array is empty and continue to execute until the two-dimensional array is empty or all column indices in the index list are blank column indices, and obtain the matching relationships of the current chapter. (Corresponding to the above, remove the bar similarity indicated by the target row index and the target column index from the similarity array to obtain an updated similarity array, use the updated similarity array as the similarity array, clear the index list, return to execute the step of looping through each row in the similarity array and continue to execute until the preset stop condition is reached);
[0143] Use the updated charter text that does not contain the node text of the first chapter as the updated charter text, and use the original charter text that does not contain the node text of the second chapter as the original charter text, and return to execute the loop chapter matching relationship (corresponding to the above, use the original updated charter text that does not contain the node text of the first chapter as the original updated charter text, use the updated original charter text that does not contain the node text of the second chapter as the updated original charter text, return to execute the step of determining the chapter similarity between the current chapter node sub-text and the chapter node texts in the updated charter text for each chapter node text in the original charter text and continue to execute until the target chapter similarity is not greater than the chapter similarity threshold).
[0144] After obtaining the matching bar node texts corresponding to each matching chapter node text, construct a matching list with the matching bar node texts, and add the bar node texts of the original charter text that do not exist in the matching bar node texts and the bar node texts of the updated charter text that do not exist in the matching bar node texts to the bar node matching list;
[0145] The diff calculation module is used to calculate the differences using the diff algorithm after the loop chapter matching relationship ends, and obtain the added, modified, and deleted statuses for each bar node text in the matching list.
[0146] The mobile item processing module is used to perform the following steps: loop through all newly added states, calculate the similarity between each newly added state and the deleted state. If the similarity is greater than 99, modify the current state to moved (corresponding to determining, based on the obtained matching item text group, the first node text in the original charter text that has no matching relationship with the updated charter text, and the second node text in the updated charter text that has no matching relationship with the original charter text; determining the target item similarity between the first node text and the second node text; in the case where the target item similarity is greater than the corresponding similarity threshold, determining the moved node position corresponding to the node position in the original charter text based on the node position of the second node text in the updated charter text, and moving the first node text in the original charter text to the moved node position).
[0147] Obtain the difference content between the new and old charter documents, so as to update the old charter document based on the content of the new charter document.
[0148] Meanwhile, for each node text in the updated charter text, use the current node text in the updated charter text as the query text, calculate the similarity between the query text and each retrieval text in the retrieval library through the DPR model, and use the retrieval text with the highest similarity to the query text as the target retrieval text. Determine the modification basis for the corresponding node text when updating the original charter text based on the updated charter text, based on the laws, regulations, or regulatory rules referred to when modifying the target retrieval text.
[0149] It should be understood that although the steps in the flowcharts involved in the above-described embodiments are shown in sequence according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless there is a clear indication in this article, the execution of these steps has no strict order limit, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above-described embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily sequential, but can be executed alternately or in turn with at least a part of other steps or steps or stages in other steps.
[0150] Based on the same inventive concept, the embodiments of the present application also provide a charter text update device for implementing the above-mentioned charter text update method. The solution provided by this device to solve the problem is similar to the solution described in the above method. Therefore, the specific limitations in one or more embodiments of the charter text update device provided below can refer to the limitations on the charter text update method in the above text, and will not be repeated here.
[0151] In an exemplary embodiment, asFigure 4 As shown, a charter text update device 400 is provided, including:
[0152] A first construction module 401, configured to determine the article similarity between each article of node text in the first chapter node text and each article of node text in the second chapter node text, and construct a similarity array based on the article similarities respectively corresponding to each article of node text in the first chapter node text; wherein, the first chapter node text is included in the updated charter text, the second chapter node text is included in the original charter text, and the first chapter node text and the second chapter node text form a matching chapter text group;
[0153] A traversal module 402, configured to traverse each row in the similarity array, determine the first maximum value of the article similarities in each row, determine the column corresponding to the first maximum value in the similarity array, and determine the second maximum value of the article similarities in the column; in the case where the second maximum value is not greater than the first maximum value, add the row index of the row and the column index of the column to the index list;
[0154] A first determination module 403, configured to determine a target row index and a target column index from the index list, and determine a matching article text group based on the target row index and the target column index;
[0155] A first loop module 404, configured to remove the article similarity indicated jointly by the target row index and the target column index from the similarity array, obtain an updated similarity array, use the updated similarity array as the similarity array, clear the index list, return to execute the step of traversing each row in the similarity array and continue to execute until a preset stop condition is reached;
[0156] An update module 405, configured to update the original charter text based on the obtained matching article text group.
[0157] In one embodiment, the device further includes an acquisition module, a second determination module, a third determination module, and a second construction module. Before the first construction module 401 determines the article similarity between each article of node text in the first chapter node text and each article of node text in the second chapter node text;
[0158] An acquisition module, configured to acquire the original charter text and the updated charter text;
[0159] A second determination module, configured to determine the chapter similarity between the current chapter node sub-text and each chapter node text in the updated charter text for each chapter node text in the original charter text;
[0160] A third determination module, configured to determine a target chapter similarity that meets a preset similarity condition from the chapter similarities respectively corresponding to all the chapter node texts of the original charter text;
[0161] A second construction module, configured to use the chapter node text in the updated charter text corresponding to the target chapter similarity as the first chapter node text, and use the chapter node text in the original charter text corresponding to the target chapter similarity as the second chapter node text, and construct the matching chapter text group based on the first chapter node text and the second chapter node text.
[0162] In one embodiment, the device further includes a second loop module;
[0163] After the traversal module 402 returns to execute the step of traversing each row in the similarity array and continues to execute until a preset stop condition is reached, and before the update module 405 updates the original charter text based on the obtained matching bar text group;
[0164] The second loop module is configured to use the updated charter text that does not include the first chapter node text as the updated charter text, and use the original charter text that does not include the second chapter node text as the original charter text, and return to execute the step of determining the chapter similarity between the current chapter node sub - text and each chapter node text in the updated charter text for each chapter node text in the original charter text and continue to execute until the target chapter similarity is not greater than the chapter similarity threshold;
[0165] Correspondingly, when the update module 405 updates the original charter text based on the obtained matching bar text group, it is specifically configured to:
[0166] Based on the matching bar text groups respectively corresponding to the chapter node texts in the updated charter text, determine the matching relationship between the bar node text in the updated charter text and the bar node text in the original charter text; and update the original charter text based on the matching relationship.
[0167] In one embodiment, the device further includes an addition module, configured to add the row index and the blank column index to the index list when the second maximum value is greater than the first maximum value;
[0168] Correspondingly, when the first determination module 403 determines the target row index and the target column index from the index list, it is specifically configured to:
[0169] When the column indexes in the index list are not all blank column indexes, obtain a first column index from the index list;
[0170] Determine whether the number of the first column indexes in the index list is not greater than a quantity threshold;
[0171] If it is not greater than the quantity threshold, use the first column index as the target column index, and use the row index corresponding to the target column index as the target row index;
[0172] If it is greater than the quantity threshold, based on the similarity of the entries corresponding to the first column indexes, determine the target column index from the first column indexes, and use the row index corresponding to the target column index as the target row index.
[0173] In one embodiment, the update module 405 is specifically configured to:
[0174] Based on the obtained matching entry text groups, determine the first node text that has no matching relationship with the updated charter text from the original charter text, and determine the second node text that has no matching relationship with the original charter text from the updated charter text;
[0175] Determine the target similarity of the first node text and the second node text;
[0176] When the target similarity is greater than the corresponding similarity threshold, based on the node position of the second node text in the updated charter text, determine the moving node position corresponding to the node position in the original charter text, and move the first node text in the original charter text to the moving node position.
[0177] In one embodiment, the preset stop condition includes: the similarity array is a blank array or all column indexes in the index list are blank column indexes.
[0178] In one embodiment, the update module 405 is specifically configured to, for each node text in the first chapter node text, use the current node text as the query text, input the query text into the deep paragraph retrieval model, and determine the similarity between the query text and each retrieval text in the retrieval library through the deep paragraph retrieval; the retrieval text includes the first node rule text in the modified rule text and the second node rule text corresponding to the first node rule text, and the second node rule text is included in the rule text before modification; based on the similarity between the query text and each retrieval text in the retrieval library, determine the target retrieval text from the retrieval text; determine the revised basis information of the node rule text based on the target retrieval text, and determine the revised basis information of the current node text based on the revised basis information; update the original charter text based on the revised basis information corresponding to each node text and the matching entry text groups.
[0179] Each module in the above-mentioned charter text updating device can be implemented in whole or in part by software, hardware, or a combination thereof. Each of the above modules can be embedded in the processor in the computer device in the form of hardware or be independent of the processor, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to each of the above modules.
[0180] In an exemplary embodiment, a computer device is provided. The computer device can be a terminal, and its internal structure diagram can be as Figure 5 shown. The computer device includes a processor, a memory, an input / output interface, a communication interface, a display unit, and an input device. Among them, the processor, the memory, and the input / output interface are connected through a system bus, and the communication interface, the display unit, and the input device are connected to the system bus through the input / output interface. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The input / output interface of the computer device is used for the processor to exchange information with external devices. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner. The wireless manner can be implemented through WIFI, a mobile cellular network, near field communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a method for updating a charter text. The display unit of the computer device is used to form a visually visible picture, which can be a display screen, a projection device, or a virtual reality imaging device. The display screen can be a liquid crystal display screen or an electronic ink display screen. The input device of the computer device can be a touch layer covering the display screen, or a button, a trackball, or a touchpad provided on the housing of the computer device, or an external keyboard, touchpad, or mouse, etc.
[0181] Those skilled in the art can understand that Figure 5 the structure shown in
[0182] is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different component layout.
[0183] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the methods of the embodiments are implemented.
[0184] In one embodiment, a computer program product is provided, including a computer program. When the computer program is executed by a processor, the steps of the methods of the embodiments are implemented.
[0185] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of relevant data need to comply with relevant regulations.
[0186] Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above methods. Among them, any reference to a memory, database, or other medium used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetoresistive random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc. The databases involved in the embodiments provided in this application can include at least one of relational databases and non-relational databases. Non-relational databases can include distributed databases based on blockchain, etc., without limitation. The processors involved in the embodiments provided in this application can be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, data processing logics based on quantum computing, artificial intelligence (AI) processors, etc., without limitation.
[0187] The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity of description, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, it should be considered as the scope recorded in this application.
[0188] The above-described embodiments merely represent several implementation manners of the present application. The description thereof is relatively specific and detailed, but it should not be construed as a limitation to the patent scope of the present application. It should be noted that for those of ordinary skill in the art, without departing from the concept of the present application, several modifications and improvements can still be made, and these all fall within the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the appended claims.
Claims
1. A method for updating a charter text, characterized in that, The method includes: For each piece of node text in the node text of the first chapter, determine the similarity between the current piece of node text and each piece of node text in the node text of the second chapter, and construct a similarity array based on the similarities corresponding to each piece of node text in the node text of the first chapter; wherein, the node text of the first chapter is included in the updated charter text, the node text of the second chapter is included in the original charter text, and the node text of the first chapter and the node text of the second chapter form a matching chapter text group; Traverse each row in the similarity array, determine the first maximum value of the similarities in each row, determine the column corresponding to the first maximum value in the similarity array, and determine the second maximum value of the similarities in the column; when the second maximum value is not greater than the first maximum value, add the row index of the row and the column index of the column to the index list; Determine a target row index and a target column index from the index list, and determine a matching piece of text group based on the target row index and the target column index; Remove the similarity indicated jointly by the target row index and the target column index from the similarity array to obtain an updated similarity array, use the updated similarity array as the similarity array, clear the index list, return to execute the step of traversing each row in the similarity array and continue to execute until a preset stop condition is reached; Update the original charter text based on the obtained matching piece of text group.
2. The method according to claim 1, characterized in that Before the step of determining the similarity between the current piece of node text and each piece of node text in the node text of the second chapter for each piece of node text in the node text of the first chapter, the method further includes: Obtain the original charter text and the updated charter text; For each chapter node text in the original charter text, determine the similarity between the current chapter node sub-text and each chapter node text in the updated charter text; Based on the similarities corresponding to all the chapter node texts of the original charter text, determine a target similarity that meets the preset similarity condition from the similarities corresponding to all the chapter node texts; Use the chapter node text in the updated charter text corresponding to the target similarity as the node text of the first chapter, use the chapter node text in the original charter text corresponding to the target similarity as the node text of the second chapter, and construct the matching chapter text group based on the node text of the first chapter and the node text of the second chapter.
3. The method according to claim 2, wherein After the step of returning to execute the step of traversing each row in the similarity array and continuing to execute until a preset stop condition is reached, and before the step of updating the original charter text based on the obtained matching piece of text group, the method further includes: Use the updated charter text that does not contain the text of the first chapter node as the updated charter text, and use the original charter text that does not contain the text of the second chapter node as the original charter text. Return and execute the step of determining the chapter similarity between the current chapter node sub-text and the chapter node texts in the updated charter text for each chapter node text in the original charter text, and continue to execute until the target chapter similarity is not greater than the chapter similarity threshold; Correspondingly, updating the original charter text based on the obtained matching bar text groups includes: Based on the matching bar text groups corresponding to the chapter node texts in the updated charter text respectively, determine the matching relationship between the bar node texts in the updated charter text and the bar node texts in the original charter text; Update the original charter text based on the matching relationship.
4. The method according to any one of claims 1 to 3, characterized in that, The method further includes: In the case where the second maximum value is greater than the first maximum value, add the row index and the blank column index to the index list; Correspondingly, determining the target row index and the target column index from the index list includes: In the case where the column indexes in the index list are not all blank column indexes, obtain the first column index from the index list; Judge whether the number of the first column indexes in the index list is not greater than the quantity threshold; If it is not greater than the quantity threshold, use the first column index as the target column index, and use the row index corresponding to the target column index as the target row index; If it is greater than the quantity threshold, determine the target column index from the first column indexes based on the bar similarity corresponding to the first column indexes, and use the row index corresponding to the target column index as the target row index.
5. The method according to claim 1, characterized in that, Updating the original charter text based on the obtained matching bar text groups includes: Based on the obtained matching bar text groups, determine the first bar node text that has no matching relationship with the updated charter text from the original charter text, and determine the second bar node text that has no matching relationship with the original charter text from the updated charter text; Determine the target bar similarity between the first bar node text and the second bar node text; In the case where the target bar similarity is greater than the corresponding similarity threshold, based on the node position of the second bar node text in the updated charter text, determine the moving node position corresponding to the node position in the original charter text, and move the first bar node text in the original charter text to the moving node position.
6. The method according to any one of claims 1 to 3, characterized in that, The preset stop condition includes: the similarity array is a blank array or all column indexes in the index list are blank column indexes.
7. The method according to any one of claims 1 to 3, characterized in that Updating the original charter text based on the obtained matching bar text groups includes: For each piece of node text in the node text of the first chapter, use the current piece of node text as the query text, input the query text into the deep paragraph retrieval model, and determine the similarity between the query text and each retrieval text in the retrieval library through the deep paragraph retrieval; the retrieval texts include the first node rule text in the modified rule text and the second node rule text corresponding to the first node rule text, and the second node rule text is included in the rule text before modification; Based on the similarity between the query text and each retrieval text in the retrieval library, determine the target retrieval text from the retrieval texts; Based on the target retrieval text, determine the revision basis information of the node rule text, and based on the revision basis information, determine the revision basis information of the current piece of node text; Based on the revision basis information corresponding to each piece of node text and the matching piece text group, update the original charter text.
8. A charter text update device, characterized in that, The device includes: A first construction module, configured to determine the similarity between each piece of node text in the node text of the first chapter and each piece of node text in the node text of the second chapter, and construct a similarity array based on the similarity corresponding to each piece of node text in the node text of the first chapter; wherein, the node text of the first chapter is included in the updated charter text, the node text of the second chapter is included in the original charter text, and the node text of the first chapter and the node text of the second chapter form a matching chapter text group; A traversal module, configured to traverse each row in the similarity array, determine the first maximum value of the similarity in each row, determine the column corresponding to the first maximum value in the similarity array, and determine the second maximum value of the similarity in the column; when the second maximum value is not greater than the first maximum value, add the row index of the row and the column index of the column to the index list; A first determination module, configured to determine the target row index and the target column index from the index list, and determine the matching piece text group based on the target row index and the target column index; A first loop module, configured to remove the similarity indicated jointly by the target row index and the target column index from the similarity array to obtain an updated similarity array, use the updated similarity array as the similarity array, clear the index list, return to execute the step of traversing each row in the similarity array and continue to execute until a preset stop condition is reached; An update module, configured to update the original charter text based on the obtained matching piece text group.
9. A computer device, comprising a memory and a processor, the memory storing a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the method according to any one of claims 1 to 7.