Comment information synchronization method, apparatus, device, and medium
By determining the comment position and editing operation of the current document in a paperless office environment, and generating reverse editing operations, the problem of information synchronization in multi-document office work is solved, and the synchronization of comment information between different documents is realized, thereby improving office efficiency.
Patent Information
- Application Number
- CN202310960679.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-01
- Publication Date
- 2026-11-06
- Estimated Expiration
- 2043-08-01
AI Technical Summary
Existing paperless collaborative office functions only support information synchronization within the same document, which cannot meet the collaborative office needs in multi-document office scenarios and reduces office efficiency.
By determining the position of the current comment information in the current document and the editing operation of the target document, reverse editing operations are generated. These operations are used to edit the current document, and the target node and number of characters are determined based on the editing results, thereby synchronizing the comment information in the target document.
It enables the synchronization of comment information between different documents, expands the applicable scenarios for information synchronization, and improves the efficiency of multi-document office work.
Smart Images

Figure CN116956865B_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of computer technology, specifically to the fields of knowledge bases, document editing, intelligent office, collaborative office, information sharing and cloud computing, and particularly to a method, apparatus, device and medium for synchronizing comment information. Background Technology
[0002] With the development of computer technology, paperless office is becoming increasingly popular in all walks of life. Compared with traditional paper-based office, paperless office has many advantages such as being green and environmentally friendly, having high office efficiency, and low cost.
[0003] The most attractive feature of paperless office is undoubtedly its collaborative office function, which supports multiple people working together online in real time, thereby improving office efficiency. Summary of the Invention
[0004] This disclosure provides a method, apparatus, device, and medium for synchronizing comment information to improve office efficiency.
[0005] According to one aspect of this disclosure, a method for synchronizing comment information is provided, comprising:
[0006] Determine the current comment position of the current comment information in the current document, and determine at least one target editing operation to be performed to edit the target document into the current document;
[0007] Based on the first reverse editing operation corresponding to the target editing operation, at least one current editing operation is generated;
[0008] The current document is edited using the current editing operation, and the number of target nodes and the number of target characters are determined based on the editing results; wherein, the number of target nodes is the number of nodes in the target document that include target character nodes, and the number of target characters is the number of characters included in the target character nodes;
[0009] Based on the number of target nodes and the number of target characters, the target comment position corresponding to the current comment position in the target document is determined, and the current comment information is synchronized in the target document according to the target comment position.
[0010] According to another aspect of this disclosure, a device for synchronizing comment information is provided, comprising:
[0011] The information determination module is used to determine the current comment position of the current comment information in the current document, and to determine at least one target editing operation to be performed to edit the target document into the current document;
[0012] The current editing operation generation module is used to generate at least one current editing operation based on the first reverse editing operation corresponding to the target editing operation;
[0013] The quantity determination module is used to edit the current document using the current editing operation, and determine the number of target nodes and the number of target characters based on the editing result; wherein, the number of target nodes is the number of nodes in the target document including target character nodes, and the number of target characters is the number of characters included in the target character nodes;
[0014] The comment location determination module is used to determine the target comment location in the target document corresponding to the current comment location based on the number of target nodes and the number of target characters, and to synchronize the current comment information in the target document according to the target comment location.
[0015] According to another aspect of this disclosure, an electronic device is provided, comprising:
[0016] At least one processor; and
[0017] A memory that is communicatively connected to at least one processor; wherein,
[0018] The memory stores instructions that can be executed by at least one processor to enable the at least one processor to perform any of the methods of this disclosure.
[0019] According to another aspect of this disclosure, a non-transitory computer-readable storage medium is provided storing computer instructions, wherein the computer instructions are used to cause a computer to perform any of the methods of this disclosure.
[0020] According to another aspect of this disclosure, a computer program product is provided, including a computer program and a method for the computer program to be executed by a processor according to any of the methods disclosed herein.
[0021] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this disclosure, nor is it intended to limit the scope of this disclosure. Other features of this disclosure will become readily apparent from the following description. Attached Figure Description
[0022] The accompanying drawings are provided to better understand this solution and do not constitute a limitation of this disclosure. Wherein:
[0023] Figure 1 This is a flowchart of a method for synchronizing comment information according to embodiments of this disclosure;
[0024] Figure 2 This is a flowchart of another method for synchronizing comment information disclosed according to embodiments of this disclosure;
[0025] Figure 3 This is a schematic diagram of the structure of a device for synchronizing comment information according to embodiments of this disclosure;
[0026] Figure 4 This is a block diagram of an electronic device used to implement the method for synchronizing comment information disclosed in the embodiments of this disclosure. Detailed Implementation
[0027] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.
[0028] Currently, most paperless office collaborative functions only support multiple users working together on the same document. For example, one user can comment on the content of a document, and other users can view the comments and make adjustments to the document content based on them. Other users can also comment on the document content, thus achieving the effect of multi-user collaborative work.
[0029] However, the current collaborative work model only supports information synchronization within the same document, and does not support information synchronization across different documents. This undoubtedly limits the applicable scenarios for information synchronization, fails to meet the collaborative work needs in multi-document office scenarios, and reduces the work efficiency in such scenarios.
[0030] Figure 1 This is a flowchart illustrating a method for synchronizing comment information according to embodiments of this disclosure. This embodiment can be applied to situations where comment information is synchronized between different documents. The method of this embodiment can be executed by a comment information synchronization device disclosed in this disclosure. The device can be implemented in software and / or hardware and can be integrated into any electronic device with computing capabilities.
[0031] like Figure 1 As shown, the method for synchronizing comment information disclosed in this embodiment may include:
[0032] S101. Determine the current comment position of the current comment information in the current document, and determine at least one target editing operation to be performed to edit the target document into the current document.
[0033] The current comment information refers to the comment information generated when a user comments on the content of the document in the current document. The content being commented on can be text, images, videos, or hyperlinks, etc. For example, if a user selects a piece of text in the current document by controlling the cursor and calls the document comment function to comment on that piece of text, the current comment information for that piece of text will be "Please review this piece of text".
[0034] The current comment position indicates the location of the comment within the current document. For example, if a user comments on the document content "aabbcc", and the current comment information "112233" is generated based on the user's comment, then the current comment position of "112233" within the current document is the same as the position of the document content "aabbcc" within the current document. The current comment position can be represented by the current character node within the current document and the current character position within that character node. For instance, assuming the current comment position is located at the 4th-9th character position of the 10th character node in the current document, then the current character node is "the 10th character node", and the current character position is "the 4th-9th character position". Therefore, the current comment position can be represented as "the 4th-9th character position of the 10th character node".
[0035] The target document and the current document refer to different documents. For example, they can be different versions of the document, such as the target document being version V1 and the current document being version V2; or they can be documents in different read / write states, such as the target document being in edit mode and the current document being in view mode. The document types of the target document and the current document include, but are not limited to, text documents, spreadsheet documents, PowerPoint presentations, etc.
[0036] The current document can be obtained by performing at least one target editing operation on the target document using a document editor. For example, a user may issue a document editing command to the target document, such as bolding or underlining text. The document editor then responds to the document editing command by performing at least one target editing operation corresponding to the command, thereby editing the target document into the current document. Here, the document editor refers to the virtual software used to perform editing operations on the document, such as the Slate editor. Editing operations are the smallest granular atomic operations that transform the document within the document editor. Each editing operation describes a specific action of the document editor, and all actions that edit the document content are ultimately achieved by combining one or more editing operations. Editing operations include, but are not limited to, inserting nodes, removing nodes, merging nodes, splitting nodes, and moving nodes.
[0037] In one embodiment of S101, candidate character nodes included in the current document and the number of characters included in each candidate character node are determined based on the data structure of the current document. Then, based on the candidate character nodes and the number of characters, the current character node in which the current comment information is located in the current document, and the current character position in the current character node, are determined, and the current comment position is determined based on the current character node and the current character position.
[0038] Additionally, from the editing operation data stored on the server, obtain at least one target editing operation performed when editing the target document into the current document.
[0039] By determining the current comment position of the current comment information in the current document, and determining at least one target editing operation performed to edit the target document into the current document, the data preparation effect is achieved, laying a data foundation for subsequently determining the first reverse editing operation based on the target editing operation, and determining the target comment position based on the current comment position.
[0040] S102. Generate at least one current editing operation based on the first reverse editing operation corresponding to the target editing operation.
[0041] Within the set of editing operations provided by the document editor, based on the purpose of each operation, a positive-negative relationship can be established between them. That is, based on the purpose of a given editing operation, an editing operation with the opposite purpose can be established as a positive-negative relationship with that operation. It can be understood that the first negative editing operation represents an editing operation with the opposite purpose to the target editing operation, and there is a positive-negative relationship between the first negative editing operation and the target editing operation.
[0042] For example, if the target editing operation is "insert node", then the first reverse editing operation is "remove node"; as another example, if the target editing operation is "merge node", then the first reverse editing operation is "split node". Similarly, if the target editing operation is "remove node", then the first reverse editing operation is "insert node"; and if the target editing operation is "split node", then the first reverse editing operation is "merge node".
[0043] In one embodiment of S102, based on the pre-established positive and negative relationships between editing operations in the set of editing operations provided by the document editor, an editing operation with a positive and negative relationship to the target editing operation is determined as the first negative editing operation corresponding to the target editing operation. For example, assuming the target editing operation is "insert node", and there is a positive and negative relationship between the editing operation "insert node" and the editing operation "remove node", then the first negative editing operation corresponding to the target editing operation is determined to be "remove node".
[0044] Furthermore, based on the determined first reverse editing operation, at least one current editing operation is generated.
[0045] Optionally, determine whether the document editor has performed any editing operations on the current document before generating the current comment information. If not, directly use the first reverse editing operation as the current editing operation. If so, determine the historical editing operations performed by the document editor on the current document before generating the current comment information, and further determine the third reverse editing operation corresponding to the historical editing operation, and then use the first reverse editing operation and the third reverse editing operation as the current editing operation.
[0046] Optionally, the auxiliary editing operation performed on the current document during the process of generating the current comment information is determined, and the second reverse editing operation corresponding to the auxiliary editing operation is determined, and then the first reverse editing operation, the second reverse editing operation, and the third reverse editing operation are taken as the current editing operation.
[0047] By generating at least one current editing operation based on the first reverse editing operation corresponding to the target editing operation, the effect of determining the current editing operation to be executed is achieved, laying the data foundation for subsequent reverse editing of the current document based on the current editing operation.
[0048] S103. Use the current editing operation to edit the current document, and determine the number of target nodes and the number of target characters based on the editing results.
[0049] The target node count refers to the total number of nodes in the target document that include the target character nodes, and the target character count refers to the total number of characters included in each target character node. A character node represents a data node in the document's data structure, and each character node consists of at least one character. For example, assuming the target document includes "character node 1: aaa", "character node 2: bb", and "character node 3: c", then the target character nodes are "character node 1, character node 2, and character node 3", the total number of target nodes is "3", the number of target characters corresponding to character node 1 is "3", the number of target characters corresponding to character node 2 is "2", and the number of target characters corresponding to character node 3 is "1".
[0050] In one embodiment of S103, the current document is edited using the current editing operation in a second execution order that is the opposite of the first execution order of the target editing operation.
[0051] For example, suppose the target editing operations include "Editing Operation 1, Editing Operation 2, Editing Operation 3, and Editing Operation 4", the first reverse editing operation corresponding to "Editing Operation 1" is "Reverse Editing Operation 1", the first reverse editing operation corresponding to "Editing Operation 2" is "Reverse Editing Operation 2", the first reverse editing operation corresponding to "Editing Operation 3" is "Reverse Editing Operation 3", and the first reverse editing operation corresponding to "Editing Operation 4" is "Reverse Editing Operation 4". That is, the current editing operations include "Reverse Editing Operation 1, Reverse Editing Operation 2, Reverse Editing Operation 3, and Reverse Editing Operation 4". Suppose the first execution order of the target editing operations is "Editing Operation 1, Editing Operation 2, Editing Operation 3, and Editing Operation 4" in sequence, then the second execution order of the current editing operations is the reverse of the first execution order, which is "Reverse Editing Operation 4, Reverse Editing Operation 3, Reverse Editing Operation 2, and Reverse Editing Operation 1".
[0052] Since the current document is obtained by performing the target editing operation on the target document using a document editor, the document data structure of the current document will be the same as that of the target document after performing the reverse editing operation (the current editing operation). That is, both contain the same number of character nodes and the same number of characters in each character node. For example, if the current document is obtained by performing two "insert node" editing operations on the target document, then performing two "remove node" editing operations on the current document will result in the current document having the same number of character nodes as the target document. Similarly, if the current document is obtained by performing two "merge node" editing operations on the target document, then performing two "split node" editing operations on the current document will result in the current document having the same number of character nodes as the target document.
[0053] Based on the above description, in one embodiment of S103, after editing the current document using the current editing operation, the document data structure of the current document is determined, and the number of auxiliary nodes and the number of auxiliary characters included in the current document are determined according to the document data structure. Then, the number of auxiliary nodes is used as the target number of nodes, and the number of auxiliary characters is used as the target number of characters. Here, the number of auxiliary nodes is the number of nodes in the current document that include auxiliary character nodes, and the current number of characters is the number of characters included in the auxiliary character nodes. For example, assuming the current document includes "character node 1: dd", "character node 2: eee", and "character node 3: f", then the auxiliary character nodes are "character node 1, character node 2, and character node 3", the number of auxiliary nodes is "3", the number of auxiliary characters corresponding to character node 1 is "2", the number of auxiliary characters corresponding to character node 2 is "3", and the number of auxiliary characters corresponding to character node 3 is "1".
[0054] By using the current editing operation to edit the current document, the document data structure of the current document is reverse-engineered and reconstructed, making the document data structure of the current document identical to that of the target document. This allows for the direct determination of the number of target nodes and target characters in the target document, laying a data foundation for further determination of the target comment location.
[0055] S104. Based on the number of target nodes and the number of target characters, determine the target comment position in the target document corresponding to the current comment position, and synchronize the current comment information in the target document according to the target comment position.
[0056] In one implementation of S104, the current character count of the characters preceding the current comment position in the current document is determined based on the current comment position. Then, the target comment position is determined based on the current character count, the target node count, and the target character count.
[0057] For example, suppose the current document and the target document contain the document content "aaabbbccc". The current document includes three character nodes: [aaa], [bb], and [bccc], while the target document includes four character nodes: [aa], [ab], [bb], and [ccc]. The current comment refers to the comment content "ccc". It can be seen that the current comment position is within the third character node ([bccc]) of the current document. The third character node includes five character positions: the first character position before the character 'b', the second character position between the character 'b' and the first character 'c', the third character position between the first and second characters 'c', the fourth character position between the second and third characters 'c', and the fifth character position after the third character 'c'. Therefore, the current comment position is between the second and fifth character positions within the third character node. In other words, the current comment position is between the second and fifth character positions within the third character node of the current document.
[0058] The current document contains six characters preceding the current comment position. The target document contains two characters for each of the character nodes: [aa], [ab], and [bb]. Therefore, the target comment position corresponds to the fourth character node ([ccc]) in the target document. The fourth character node comprises four positions: the first character before the first character c, the second character between the first and second characters c, the third character between the second and third characters c, and the fourth character after the third character c. Thus, the target comment position is located between the first and fourth characters within the fourth character node of the target document.
[0059] In one implementation of S104, the current comment information is generated at the target comment location by a document editor, thereby achieving synchronization of the current comment information.
[0060] This disclosure achieves the effect of synchronizing comment information between different documents by determining the current comment position of the current comment information in the current document, and determining at least one target editing operation to be performed to edit the target document into the current document; generating at least one current editing operation based on the first reverse editing operation corresponding to the target editing operation; editing the current document using the current editing operation, and determining the number of target nodes and the number of target characters based on the editing result; determining the target comment position in the target document corresponding to the current comment position based on the number of target nodes and the number of target characters, and synchronizing the current comment information in the target document based on the target comment position. This expands the applicable scenarios for information synchronization and improves the efficiency of document office work.
[0061] Figure 2 This is a flowchart of another method for synchronizing comment information disclosed in the embodiments of this disclosure, which is further optimized and extended based on the above technical solutions, and can be combined with the above optional implementation methods.
[0062] like Figure 2 As shown, the method for synchronizing comment information disclosed in this embodiment may include:
[0063] S201. Determine the current comment position of the current comment information in the current document, and determine at least one target editing operation to be performed to edit the target document into the current document.
[0064] S202. Determine at least one auxiliary editing operation to be performed on the current document, and determine a second reverse editing operation based on the auxiliary editing operation.
[0065] The auxiliary editing operations are used to generate the current comment information in the current document. Since the document editor performs not only comment editing operations but also non-comment editing operations such as "insert node" and "merge node" when generating comment information, the auxiliary editing operations include both comment editing and non-comment editing operations.
[0066] Comment editing operations are key to generating comment information; that is, performing a comment editing operation at a specific location in the document will generate the corresponding comment information at that location. Since generating comment information at a document location essentially involves adding the `comment.Id` attribute to the node attribute of the character node belonging to that location, comment editing operations are essentially character node attribute setting operations; for example, the "Set_node" operation is a comment editing operation. Conversely, non-comment editing operations refer to any editing operations other than comment editing operations.
[0067] In one embodiment of S202, at least one auxiliary editing operation performed on the current document is determined, and a second reverse editing operation is determined based on the reverse editing operation corresponding to the non-comment editing operation in the auxiliary editing operation.
[0068] Optionally, S202 includes:
[0069] S2021. If an auxiliary editing operation performed before any non-comment editing operation is any comment editing operation, then an operation separator is added between the non-comment editing operation and the comment editing operation, and the auxiliary editing operation is divided into at least two sets of editing operations according to the operation separator.
[0070] The current comment can appear in one or more positions within the current document. Therefore, the number of comment editing operations included in the auxiliary editing operations can also be one or more, and the number of comment positions is the same as the number of comment editing operations. For example, if the current comment appears in three positions within the current document, then the auxiliary editing operations will include comment editing operations for each of those three positions.
[0071] Furthermore, since the execution times of each editing operation are different, there is a predetermined execution order for each editing operation. For example, if the execution times of editing operation 1 and editing operation 2 are adjacent, and editing operation 1 is executed earlier than editing operation 2, then it can be determined that the execution order of editing operation 1 is before editing operation 2.
[0072] For example, in S2021, assume the auxiliary editing operation consists of "non-comment editing operation 1, comment editing operation 1, non-comment editing operation 2, comment editing operation 2, and comment editing operation 3", and the execution order is non-comment editing operation 1, comment editing operation 1, non-comment editing operation 2, comment editing operation 2, and comment editing operation 3. It can be seen that the auxiliary editing operation executed before "non-comment editing operation 2" is "comment editing operation 1". Therefore, an operation separator is added between "non-comment editing operation 2" and "comment editing operation 1", and the auxiliary editing operation is divided into two sets of editing operations based on the operation separator: "non-comment editing operation 1 and comment editing operation 1" and "non-comment editing operation 2, comment editing operation 2, and comment editing operation 3".
[0073] S2022. The comment editing operation performed at the current comment position is taken as the target comment editing operation, and the set of editing operations to which the target comment editing operation belongs is taken as the target editing operation set.
[0074] Since the current comment information can be located in one or more positions within the current document, the comment editing operation performed at the current comment position will be taken as the target comment editing operation.
[0075] Continuing with the example above, let's explain S2022. Assume we consider "non-comment editing operation 1 and comment editing operation 1" as editing operation set 1, and "non-comment editing operation 2, comment editing operation 2, and comment editing operation 3" as editing operation set 2. If the comment editing operation performed at the current comment position is "comment editing operation 1," then editing operation set 1 will be the target editing operation set. If the comment editing operation performed at the current comment position is "comment editing operation 2," then editing operation set 2 will be the target editing operation set. If the comment editing operation performed at the current comment position is "comment editing operation 3," then editing operation set 3 will be the target editing operation set.
[0076] S2023. Take the non-comment editing operations included in the target editing operation set as the target non-comment editing operations, and determine the second reverse editing operation based on the fourth reverse editing operation corresponding to the target non-comment editing operation.
[0077] Continuing with the example above, let's explain S2023. Assuming the target set of editing operations is set 1, then "non-comment editing operation 1" will be considered the target non-comment editing operation. Assuming the target set of editing operations is set 2, then "non-comment editing operation 2" will be considered the target non-comment editing operation.
[0078] Accordingly, if the target non-comment editing operation is "Non-comment editing operation 1", then the reverse editing operation corresponding to "Non-comment editing operation 1" is taken as the fourth reverse editing operation, and the second reverse editing operation is determined based on the fourth reverse editing operation. If the target non-comment editing operation is "Non-comment editing operation 2", then the reverse editing operation corresponding to "Non-comment editing operation 2" is taken as the fourth reverse editing operation, and the second reverse editing operation is determined based on the fourth reverse editing operation.
[0079] Since non-comment editing operations affect the document's data structure (e.g., adding or removing character nodes), determining the second reverse editing operation based on the fourth reverse editing operation corresponding to the target non-comment editing operation ensures the accuracy and completeness of the reverse editing operations used when ultimately reversing the current document. This further guarantees the accuracy of the document data structure obtained after reversing the current document, as well as the accuracy of the target node and character counts. Furthermore, since the current comment information can have one or multiple comment positions in the current document, dividing the auxiliary editing operations into at least two sets of editing operations based on operation separators—using the set of editing operations to which the target comment editing operation belongs as the target editing operation set, and the non-comment editing operations included in the target editing operation set as the target non-comment editing operations—allows for the identification of target non-comment editing operations that only affect the current comment position. This accelerates the determination process and saves time.
[0080] Optionally, S2023 includes:
[0081] If the target editing operation set is first in the set order, the fourth reverse editing operation is treated as the second reverse editing operation.
[0082] Continuing with the example above, let's assume that the set of editing operations 1 is the target set of editing operations. Since the set of editing operations 1 is the first in terms of order, the fourth reverse editing operation corresponding to "non-comment editing operation 2" is taken as the second reverse editing operation.
[0083] Since if the target editing operation set is first in order, the non-comment editing operations in the subsequent editing operation set will not affect the document data structure when generating the current comment information at the current comment position. Only the non-comment editing operations in the target editing operation set will affect the document data structure when generating the current comment information at the current comment position. Therefore, by taking the fourth reverse editing operation as the second reverse editing operation when the target editing operation set is first in order, the accuracy of the determined second reverse editing operation can be improved.
[0084] Optionally, S2023 includes:
[0085] S20231. If the set order of the target editing operation set is not first, the set of editing operations that is in the order of the target editing operation set shall be used as the auxiliary editing operation set.
[0086] Continuing with the example above, let's explain S20231. Assume that the editing operation set 2 is taken as the target editing operation set. Since the order of the editing operation set 2 is the second, the editing operation set 1 is taken as the auxiliary editing operation set.
[0087] S20232. Take the non-comment editing operations included in the set of auxiliary editing operations as auxiliary non-comment editing operations, and determine the fifth reverse editing operation corresponding to the auxiliary non-comment editing operations.
[0088] Continuing with the above example to explain S20232, if the editing operation set 1 includes "non-comment editing operation 1", then "non-comment editing operation 1" will be used as an auxiliary non-comment editing operation, and the reverse editing operation corresponding to "non-comment editing operation 1" will be determined as the fifth reverse editing operation.
[0089] S20233, Combine the fourth and fifth reverse editing operations as the second reverse editing operation.
[0090] Continuing with the example above, let's explain S20233. Assuming the target editing operation set is editing operation set 2, then "non-comment editing operation 2" is taken as the target non-comment editing operation, and the reverse editing operation corresponding to "non-comment editing operation 2" is taken as the fourth reverse editing operation. Since editing operation set 2 is the second in order, editing operation set 1 is taken as the auxiliary editing operation set, and "non-comment editing operation 1" is taken as the auxiliary non-comment editing operation. The reverse editing operation corresponding to "non-comment editing operation 1" is then determined as the fifth reverse editing operation. Finally, the fourth and fifth reverse editing operations are combined as the second reverse editing operation.
[0091] Since if the target set of editing operations is not the first in order, the non-comment editing operations in the preceding set of editing operations will also affect the document data structure when generating the current comment information at the current comment position, the set of editing operations that precedes the target set of editing operations is used as the auxiliary set of editing operations when the target set of editing operations is not the first in order. The non-comment editing operations included in the auxiliary set of editing operations are used as auxiliary non-comment editing operations, and the fifth reverse editing operation corresponding to the auxiliary non-comment editing operation is determined. The fourth and fifth reverse editing operations are used together as the second reverse editing operation, thereby improving the accuracy and completeness of the determined second reverse editing operation.
[0092] S203. Determine at least one historical editing operation performed on the current document, and determine the third reverse editing operation corresponding to the historical editing operation.
[0093] In this context, historical editing operations refer to the editing operations performed on the current document before the current comment information was generated. For example, editing operations performed on the current document to generate other comment information before the current comment information was generated.
[0094] In one implementation, based on the pre-established positive and negative relationships between editing operations in the set of editing operations provided by the document editor, an editing operation that has a positive and negative relationship with the historical editing operation is determined as the third negative editing operation corresponding to the historical editing operation.
[0095] S204. Generate the current editing operation based on the first reverse editing operation, the second reverse editing operation, and the third reverse editing operation.
[0096] In one implementation, the first reverse editing operation, the second reverse editing operation, and the third reverse editing operation are collectively used as the current editing operation.
[0097] By identifying at least one auxiliary editing operation to be performed on the current document, determining a second reverse editing operation based on the auxiliary editing operation, identifying at least one historical editing operation to be performed on the current document, and determining a third reverse editing operation corresponding to the historical editing operation, and generating the current editing operation based on the first, second, and third reverse editing operations, the current editing operation is ensured to include all the reverse editing operations that should be performed, thereby improving the accuracy, completeness, and reliability of the current editing operation.
[0098] S205. Use the current editing operation to edit the current document, and determine the number of target nodes and the number of target characters based on the editing results.
[0099] In one implementation, the execution order of the target editing operation, historical editing operations, target non-comment editing operation, and auxiliary non-comment editing operation in the current editing operation is determined. Based on the reverse execution order corresponding to this execution order, a first reverse editing operation, a third reverse editing operation, a fourth reverse editing operation, and a fifth reverse editing operation are performed to edit the current document. The number of target nodes and the number of target characters are determined based on the editing results.
[0100] Optionally, S205 includes:
[0101] S2051. Determine the set of forward editing operations based on the target editing operation, historical editing operations, target non-comment editing operation, and auxiliary non-comment editing operation.
[0102] In one implementation, the set of editing operations consisting of the target editing operation, historical editing operations, target non-comment editing operations, and auxiliary non-comment editing operations is used as the positive editing operation set.
[0103] S2052. Based on the operation execution time, determine the first execution order of the target editing operation in the forward editing operation set, the second execution order of the historical editing operation in the forward editing operation set, the third execution order of the target non-comment editing operation in the forward editing operation set, and the fourth execution order of the auxiliary non-comment editing operation in the forward editing operation set.
[0104] For example, suppose that the execution order of each editing operation in the forward editing operation set is determined according to the operation execution time as "target editing operation 1, target editing operation 2, historical editing operation 1, historical editing operation 2, auxiliary non-comment editing operation 1, and target non-comment editing operation 1". It can be seen that the first execution order of target editing operation 1 is 1, the first execution order of target editing operation 2 is 2, the second execution order of historical editing operation 1 is 3, the second execution order of historical editing operation 2 is 4, the fourth execution order of auxiliary non-comment editing operation 1 is 5, and the third execution order of target non-comment editing operation 1 is 6.
[0105] S2053. Determine the fifth execution order of the first reverse editing operation in the current editing operation according to the first execution order, determine the sixth execution order of the third reverse editing operation in the current editing operation according to the second execution order, determine the seventh execution order of the fourth reverse editing operation in the current editing operation according to the third execution order, and determine the eighth execution order of the fifth reverse editing operation in the current editing operation according to the fourth execution order.
[0106] Among them, the sum of the values of the first and fifth execution orders, the sum of the values of the second and sixth execution orders, the sum of the values of the third and seventh execution orders, and the sum of the values of the fourth and eighth execution orders are all equal to the total number of editing operations; the total number of editing operations represents the total number of editing operations included in the current editing operation plus one.
[0107] Continuing with the above example to explain S2053, assume that the target editing operation 1, target editing operation 2, history editing operation 1, history editing operation 2, auxiliary non-comment editing operation 1, and target non-comment editing operation 1 have the following reverse editing operations respectively: first reverse editing operation 1, first reverse editing operation 2, third reverse editing operation 1, third reverse editing operation 2, fifth reverse editing operation 1, and fourth reverse editing operation 1.
[0108] Assume the first execution order of target editing operation 1 is 1, the first execution order of target editing operation 2 is 2, the second execution order of historical editing operation 1 is 3, the second execution order of historical editing operation 2 is 4, the fourth execution order of auxiliary non-comment editing operation 1 is 5, and the third execution order of target non-comment editing operation 1 is 6.
[0109] It can be determined that the current editing operations include "First Reverse Editing Operation 1, First Reverse Editing Operation 2, Third Reverse Editing Operation 1, Third Reverse Editing Operation 2, Fifth Reverse Editing Operation 1, and Fourth Reverse Editing Operation 1", with a total of 6 + 1 = 7 editing operations. Correspondingly, the fifth execution order of First Reverse Editing Operation 1 in the current editing operation is 7 - 1 = 6; the fifth execution order of First Reverse Editing Operation 2 in the current editing operation is 7 - 2 = 5; the sixth execution order of Third Reverse Editing Operation 1 in the current editing operation is 7 - 3 = 4; the sixth execution order of Third Reverse Editing Operation 2 in the current editing operation is 7 - 4 = 3; the eighth execution order of Fifth Reverse Editing Operation 1 in the current editing operation is 7 - 5 = 2; and the seventh execution order of Fourth Reverse Editing Operation 1 in the current editing operation is 7 - 6 = 1.
[0110] It is understandable that the earlier the first execution order of the target editing operation, the later the fifth execution order of the first reverse editing operation; the earlier the second execution order of the historical editing operation, the later the sixth execution order of the third reverse editing operation; the earlier the fourth execution order of the auxiliary non-comment editing operation, the later the eighth execution order of the fifth reverse editing operation; and the earlier the third execution order of the target non-comment editing operation, the later the seventh execution order of the fourth reverse editing operation.
[0111] S2054. Based on the fifth, sixth, seventh, and eighth execution orders, the current document is edited using the first, third, fourth, and fifth reverse editing operations.
[0112] Continuing with the above example to explain S2054, assume that the first execution order of the target editing operation 1 is 1, the first execution order of the target editing operation 2 is 2, the second execution order of the historical editing operation 1 is 3, the second execution order of the historical editing operation 2 is 4, the fourth execution order of the auxiliary non-comment editing operation 1 is 5, and the third execution order of the target non-comment editing operation 1 is 6.
[0113] The first reverse editing operation 1 is executed in the fifth order of the current editing operation at 6; the first reverse editing operation 2 is executed in the fifth order of the current editing operation at 5; the third reverse editing operation 1 is executed in the sixth order of the current editing operation at 4; the third reverse editing operation 2 is executed in the sixth order of the current editing operation at 3; the fifth reverse editing operation 1 is executed in the eighth order of the current editing operation at 2; and the fourth reverse editing operation 1 is executed in the seventh order of the current editing operation at 1.
[0114] The document will be edited sequentially according to the execution order of "Fourth Reverse Editing Operation 1, Fifth Reverse Editing Operation 1, Third Reverse Editing Operation 2, Third Reverse Editing Operation 1, First Reverse Editing Operation 2 and First Reverse Editing Operation 1".
[0115] A forward editing operation set is determined based on the target editing operation, historical editing operations, the target non-comment editing operation, and auxiliary non-comment editing operations. Based on the operation execution time, the first execution order of the target editing operation within the forward editing operation set is determined, followed by the second execution order of historical editing operations, the third execution order of the target non-comment editing operation, and the fourth execution order of the auxiliary non-comment editing operation. Based on the first execution order, the fifth execution order of the first reverse editing operation within the current editing operation is determined; based on the second execution order, the sixth execution order of the third reverse editing operation within the current editing operation is determined; and based on the third execution order, the sixth execution order of the fourth reverse editing operation within the current editing operation is determined. The seventh execution order in the previous editing operation determines the eighth execution order of the fifth reverse editing operation in the current editing operation based on the fourth execution order. Based on the fifth, sixth, seventh, and eighth execution orders, the first, third, fourth, and fifth reverse editing operations are used to edit the current document, ensuring that the execution order of the reverse editing operations to be performed on the current document is exactly the reverse of the execution order of the previously executed forward editing operations. This guarantees that the document data structure generated after performing the reverse editing operations on the current document is identical to the document data structure of the target document, further ensuring the accuracy and reliability of subsequently determining the number of target nodes and target characters.
[0116] S206. The character in the current document preceding the current comment position is taken as the current character, and the current character count is determined.
[0117] For example, suppose the current document and the target document contain the document content "aaabbbccc". The current document includes three character nodes: [aaa], [bb], and [bccc], while the target document includes four character nodes: [aa], [ab], [bb], and [ccc]. The current comment refers to the comment content "ccc". It can be seen that the current comment is located between the second and fifth characters of the third character node in the current document.
[0118] The current character preceding the current comment in the current document is "aaabbb", which means the current character count is 6.
[0119] S207. Based on the current number of characters, the number of target nodes, and the number of target characters, determine the auxiliary character node in the target document where the current comment is located, and the auxiliary character position within the auxiliary character node.
[0120] Continuing with the example above, if the character node [aa] in the target document contains two characters, the character node [ab] contains two characters, and the character node [bb] contains two characters, then the target comment position in the target document is determined to be the first character position - fourth character position in the fourth character node of the target document.
[0121] S208. Determine the target comment position based on the auxiliary character node and the auxiliary character position.
[0122] By using the character preceding the current comment position in the current document as the current character and determining the current character count, and based on the current character count, the number of target nodes, and the number of target characters, the auxiliary character node in the target document where the current comment position is located, and the auxiliary character position within the auxiliary character node, the target comment position is determined. This establishes the association between comment positions in different documents, laying an important data foundation for subsequent synchronization of comment information.
[0123] S209. Synchronize the current comment information in the target document according to the target comment location.
[0124] Optionally, S209 includes:
[0125] S2091. If the current comment information has been synchronized in other comment locations in the target document, determine the number of update nodes and the number of update characters.
[0126] Since the current comment information can be in one or more comment positions in the current document, if the current comment information has already been synchronized in other comment positions in the target document, it means that the document editor has already performed comment editing operations in other comment positions, which will affect the document data structure of the target document. Therefore, it is necessary to update the target comment position determined based on the current comment position.
[0127] The number of updated nodes indicates the number of nodes in the target document that include the updated character node at the current moment, and the number of updated characters is the number of characters included in the updated character node.
[0128] In one implementation, if the current comment information has already been synchronized at other comment locations in the target document, the number of updated nodes and the number of updated characters are re-determined based on the pre-determined number of target nodes and the number of target characters. For example, suppose the target document includes the document content "aaabbbccc", and suppose it initially includes three target character nodes: [aaa], [bb], and [ccc]. If the current comment information has been synchronized at "bc", then "bc" is re-designated as a new target character node. At this point, the target character nodes become four updated character nodes: [aaa], [bb], [bc], and [cc]. The updated character node [aaa] includes 3 updated characters, the updated character node [bb] includes 2 updated characters, the updated character node [bc] includes 2 updated characters, and the updated character node [cc] includes 2 updated characters.
[0129] S2092. Update the target comment position based on the number of update nodes and the number of update characters to determine the updated comment position.
[0130] In one implementation, the character in the target document preceding the target comment position is used as the target character, and the number of reference characters for the target character is determined. Based on the number of reference characters, the number of update nodes, and the number of update characters, the target comment position is updated to determine the updated comment position.
[0131] For example, suppose the target document contains the content "aaabbbccc", and suppose that in its initial state it includes three target character nodes: [aaa], [bbb], and [ccc]. Suppose the target comment position is the first character position minus the third character position of the third character node. The target character is "aaabbb", and the number of reference characters is 6.
[0132] If the current comment information has been synchronized at "bc", then "bc" will be used as a new target character node. At this time, the target character nodes will become four updated character nodes: [aaa], [bb], [bc], and [cc]. The updated character node [aaa] includes 3 updated characters, the updated character node [bb] includes 2 updated characters, the updated character node [bc] includes 2 updated characters, and the updated character node [cc] includes 2 updated characters.
[0133] Since the number of reference characters is 6, the updated comment position is in both the third character node [bc] and the fourth character node [cc], specifically represented as "the second character position of the third character node - the third character position" and "the first character position of the fourth character node - the second character position".
[0134] As can be seen, the target comment position was updated from "the first character position of the third character node to the third character position" to the updated comment position "the second character position of the third character node to the third character position" and "the first character position of the fourth character node to the second character position".
[0135] By determining the number of update nodes and characters when the current comment information has already been synchronized in other comment locations within the target document, and then updating the target comment location based on these numbers, the updated comment location is determined. The current comment information is then synchronized within the target document based on this updated comment location. This achieves timely updates to the corresponding target comment location within the target document, ensuring the accuracy and reliability of the updated comment location and further guaranteeing the accuracy of the synchronized comment information location.
[0136] S2093. Synchronize the current comment information in the target document according to the updated comment location.
[0137] Optionally, S2093 includes:
[0138] Perform the target comment editing operation at the updated comment location to generate the current comment information at the updated comment location.
[0139] In one implementation, a target comment editing operation is performed at the updated comment location using a document editor, thereby synchronizing the current comment information generated at the current comment location in the current document to the updated comment location in the target document. Here, the target comment editing operation is a comment editing operation performed at the current comment location.
[0140] By performing a target comment editing operation at the updated comment location, the current comment information is generated at the updated comment location, achieving the effect of synchronizing comment information between different documents. This expands the applicable scenarios for information synchronization and improves the efficiency of document processing.
[0141] Figure 3 This is a schematic diagram of a device for synchronizing comment information according to embodiments of the present disclosure, applicable to situations where comment information is synchronized between different documents. The device of this embodiment can be implemented in software and / or hardware and can be integrated into any electronic device with computing capabilities.
[0142] like Figure 3 As shown, the comment information synchronization device 30 disclosed in this embodiment may include an information determination module 31, a current editing operation generation module 32, a quantity determination module 33, and a comment position determination module 34, wherein:
[0143] The information determination module 31 is used to determine the current comment position of the current comment information in the current document, and to determine at least one target editing operation to be performed to edit the target document into the current document;
[0144] The current editing operation generation module 32 is used to generate at least one current editing operation based on the first reverse editing operation corresponding to the target editing operation;
[0145] The quantity determination module 33 is used to edit the current document using the current editing operation, and determine the number of target nodes and the number of target characters based on the editing result; wherein, the number of target nodes is the number of nodes in the target document including the target character nodes, and the number of target characters is the number of characters included in the target character nodes;
[0146] The comment location determination module 34 is used to determine the target comment location in the target document based on the number of target nodes and the number of target characters, and to synchronize the current comment information in the target document according to the target comment location.
[0147] Optionally, the current editing operation generates module 32, which is specifically used for:
[0148] Identify at least one auxiliary editing operation to be performed on the current document, and determine a second reverse editing operation based on the auxiliary editing operation; wherein the auxiliary editing operation is used to generate current comment information in the current document;
[0149] Identify at least one historical editing operation performed on the current document, and identify a third reverse editing operation corresponding to the historical editing operation; wherein, the historical editing operation represents the editing operation performed on the current document before the current comment information is generated in the current document;
[0150] The current editing operation is generated based on the first reverse editing operation, the second reverse editing operation, and the third reverse editing operation.
[0151] Optionally, auxiliary editing operations include comment editing operations and non-comment editing operations;
[0152] The current editing operation generates module 32, which is also used for:
[0153] If an auxiliary editing operation performed before any non-comment editing operation is a comment editing operation, then an operation separator is added between the non-comment editing operation and the comment editing operation, and the auxiliary editing operation is divided into at least two sets of editing operations according to the operation separator;
[0154] The comment editing operation performed at the current comment position is taken as the target comment editing operation, and the set of editing operations to which the target comment editing operation belongs is taken as the target editing operation set;
[0155] The non-comment editing operations included in the target editing operation set are taken as the target non-comment editing operations, and the second reverse editing operation is determined according to the fourth reverse editing operation corresponding to the target non-comment editing operation.
[0156] Optionally, the current editing operation generation module 32 is further used for:
[0157] If the target editing operation set is first in the set order, the fourth reverse editing operation is treated as the second reverse editing operation.
[0158] Optionally, the current editing operation generation module 32 is further used for:
[0159] If the set of editing operations is not the first in the target set of editing operations, the set of editing operations that precedes the target set of editing operations will be used as the auxiliary set of editing operations.
[0160] The non-comment editing operations included in the set of auxiliary editing operations are taken as auxiliary non-comment editing operations, and the fifth reverse editing operation corresponding to the auxiliary non-comment editing operation is determined;
[0161] The fourth and fifth reverse editing operations are combined as the second reverse editing operation.
[0162] Optional, quantity determination module 33, specifically used for:
[0163] Determine the set of positive editing operations based on the target editing operation, historical editing operations, target non-comment editing operation, and auxiliary non-comment editing operation;
[0164] Based on the operation execution time, determine the first execution order of the target editing operation in the positive editing operation set, the second execution order of the historical editing operation in the positive editing operation set, the third execution order of the target non-comment editing operation in the positive editing operation set, and the fourth execution order of the auxiliary non-comment editing operation in the positive editing operation set;
[0165] The fifth execution order of the first reverse editing operation in the current editing operation is determined according to the first execution order; the sixth execution order of the third reverse editing operation in the current editing operation is determined according to the second execution order; the seventh execution order of the fourth reverse editing operation in the current editing operation is determined according to the third execution order; and the eighth execution order of the fifth reverse editing operation in the current editing operation is determined according to the fourth execution order.
[0166] Based on the fifth, sixth, seventh, and eighth execution orders, the first, third, fourth, and fifth reverse editing operations are used to edit the current document.
[0167] Among them, the sum of the values of the first and fifth execution orders, the sum of the values of the second and sixth execution orders, the sum of the values of the third and seventh execution orders, and the sum of the values of the fourth and eighth execution orders are all equal to the total number of editing operations; the total number of editing operations represents the total number of editing operations included in the current editing operation plus one.
[0168] Optional, the comment location determination module 34 is specifically used for:
[0169] The character preceding the current comment position in the current document is taken as the current character, and the current character count is determined.
[0170] Based on the current number of characters, the number of target nodes, and the number of target characters, determine the auxiliary character node in the target document where the current comment is located, and the auxiliary character position within the auxiliary character node;
[0171] The target comment position is determined based on the auxiliary character node and the position of the auxiliary character.
[0172] Optionally, the comment location determination module 34 is also used for:
[0173] If the current comment information has been synchronized in other comment locations in the target document, then determine the number of update nodes and the number of update characters;
[0174] The target comment position is updated based on the number of updated nodes and the number of updated characters to determine the updated comment position;
[0175] Synchronize the current comment information in the target document based on the updated comment location;
[0176] The number of updated nodes represents the number of nodes in the target document that include the updated character node at the current moment, and the number of updated characters is the number of characters included in the updated character node.
[0177] Optionally, the comment location determination module 34 is also used for:
[0178] Perform the target comment editing operation at the updated comment location to generate the current comment information at the updated comment location.
[0179] The comment information synchronization device 30 disclosed in this embodiment can execute the comment information synchronization method disclosed in this embodiment, and has the corresponding functional modules and beneficial effects of the method execution. Content not described in detail in this embodiment can be referred to the description in the method embodiments of this disclosure.
[0180] The acquisition, storage, and application of user personal information involved in the technical solution disclosed herein comply with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0181] According to embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0182] Figure 4 A schematic block diagram of an example electronic device 400 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0183] like Figure 4 As shown, device 400 includes a computing unit 401, which can perform various appropriate actions and processes based on a computer program stored in read-only memory (ROM) 402 or a computer program loaded from storage unit 408 into random access memory (RAM) 403. RAM 403 may also store various programs and data required for the operation of device 400. The computing unit 401, ROM 402, and RAM 403 are interconnected via bus 404. Input / output (I / O) interface 405 is also connected to bus 404.
[0184] Multiple components in device 400 are connected to I / O interface 405, including: input unit 406, such as keyboard, mouse, etc.; output unit 407, such as various types of monitors, speakers, etc.; storage unit 408, such as disk, optical disk, etc.; and communication unit 409, such as network card, modem, wireless transceiver, etc. Communication unit 409 allows device 400 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0185] The computing unit 401 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 401 performs the various methods and processes described above, such as the method for synchronizing comment information. For example, in some embodiments, the method for synchronizing comment information may be implemented as a computer software program tangibly contained in a machine-readable medium, such as storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on device 400 via ROM 402 and / or communication unit 409. When the computer program is loaded into RAM 403 and executed by the computing unit 401, one or more steps of the method for synchronizing comment information described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform the method for synchronizing comment information by any other suitable means (e.g., by means of firmware).
[0186] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0187] The program code used to implement the methods of this disclosure may be written in any combination of one or more programming languages. This program code may be provided to a processor or controller of a general-purpose computer, special-purpose computer, or other programmable data processing apparatus, such that when executed by the processor or controller, the program code causes the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The program code may be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0188] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0189] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the computer. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0190] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as a data server), or computing systems that include middleware components (e.g., an application server), or computing systems that include frontend components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with embodiments of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., a communication network). Examples of communication networks include local area networks (LANs), wide area networks (WANs), and the Internet.
[0191] Computer systems can include clients and servers. Clients and servers are generally located far apart and typically interact via communication networks. Client-server relationships are created by computer programs running on the respective computers and having a client-server relationship with each other. Servers can be cloud servers, servers in distributed systems, or servers incorporating blockchain technology.
[0192] It should be understood that the various forms of processes shown above can be used to rearrange, add, or delete steps. For example, the steps described in this disclosure can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution disclosed in this disclosure can be achieved, and this is not limited herein.
[0193] The specific embodiments described above do not constitute a limitation on the scope of protection of this disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this disclosure should be included within the scope of protection of this disclosure.
Claims
1. A method for synchronizing comment information, comprising: The process involves determining the current comment's position within the current document and identifying at least one target editing operation to modify the target document into the current document. The target document and the current document represent different documents. The target editing operation is the smallest atomic operation performed in the document editor, including inserting, removing, merging, splitting, and moving nodes. The target editing operation is obtained from editing operation data stored on the server. Based on the first reverse editing operation corresponding to the target editing operation, at least one current editing operation is generated; wherein, the first reverse editing operation is an editing operation with the opposite operation purpose to the target editing operation; The current document is edited using the current editing operation in a second execution order, which is the reverse of the first execution order of the target editing operation. The number of target nodes and the number of target characters are determined based on the editing results. The number of target nodes is the number of nodes in the target document that include target character nodes, and the number of target characters is the number of characters included in each target character node. The current document is obtained by performing the target editing operation on the target document. After performing the current editing operation on the current document, the document data structure of the current document is the same as the document data structure of the target document. Based on the number of target nodes and the number of target characters, the target comment position corresponding to the current comment position in the target document is determined, and the current comment information is synchronized in the target document according to the target comment position.
2. The method according to claim 1, wherein, The step of generating at least one current editing operation based on the first reverse editing operation corresponding to the target editing operation includes: Determine at least one auxiliary editing operation to be performed on the current document, and determine a second reverse editing operation based on the auxiliary editing operation; wherein the auxiliary editing operation is used to generate the current comment information in the current document; Determine at least one historical editing operation performed on the current document, and determine a third reverse editing operation corresponding to the historical editing operation; wherein the historical editing operation represents an editing operation performed on the current document before the current comment information is generated in the current document; The current editing operation is generated based on the first reverse editing operation, the second reverse editing operation, and the third reverse editing operation.
3. The method according to claim 2, wherein, The auxiliary editing operations include comment editing operations and non-comment editing operations; The step of determining the second reverse editing operation based on the auxiliary editing operation includes: If an auxiliary editing operation performed before any of the non-comment editing operations is any of the comment editing operations, then an operation separator is added between the non-comment editing operation and the comment editing operation, and the auxiliary editing operation is divided into at least two sets of editing operations according to the operation separator; The comment editing operation performed at the current comment position is taken as the target comment editing operation, and the set of editing operations to which the target comment editing operation belongs is taken as the target editing operation set; The non-comment editing operations included in the target editing operation set are taken as target non-comment editing operations, and the second reverse editing operation is determined according to the fourth reverse editing operation corresponding to the target non-comment editing operation.
4. The method according to claim 3, wherein, The step of determining the second reverse editing operation based on the fourth reverse editing operation corresponding to the target non-comment editing operation includes: If the set of target editing operations is ordered as first, the fourth reverse editing operation is taken as the second reverse editing operation.
5. The method according to claim 3, wherein, The step of determining the second reverse editing operation based on the fourth reverse editing operation corresponding to the target non-comment editing operation includes: If the set order of the target editing operation set is not first, the set of editing operations that is in the order of the target editing operation set shall be used as the auxiliary editing operation set; The non-comment editing operations included in the set of auxiliary editing operations are taken as auxiliary non-comment editing operations, and the fifth reverse editing operation corresponding to the auxiliary non-comment editing operation is determined; The fourth reverse editing operation and the fifth reverse editing operation are combined as the second reverse editing operation.
6. The method according to claim 5, wherein, The step of editing the current document using the current editing operation includes: A set of positive editing operations is determined based on the target editing operation, the historical editing operations, the target non-comment editing operation, and the auxiliary non-comment editing operation; Based on the operation execution time, determine the first execution order of the target editing operation in the positive editing operation set, the second execution order of the historical editing operation in the positive editing operation set, the third execution order of the target non-comment editing operation in the positive editing operation set, and the fourth execution order of the auxiliary non-comment editing operation in the positive editing operation set; The fifth execution order of the first reverse editing operation in the current editing operation is determined according to the first execution order; the sixth execution order of the third reverse editing operation in the current editing operation is determined according to the second execution order; the seventh execution order of the fourth reverse editing operation in the current editing operation is determined according to the third execution order; and the eighth execution order of the fifth reverse editing operation in the current editing operation is determined according to the fourth execution order. According to the fifth execution order, the sixth execution order, the seventh execution order, and the eighth execution order, the first reverse editing operation, the third reverse editing operation, the fourth reverse editing operation, and the fifth reverse editing operation are used to edit the current document; Wherein, the sum of the values of the first execution order and the fifth execution order, the sum of the values of the second execution order and the sixth execution order, the sum of the values of the third execution order and the seventh execution order, and the sum of the values of the fourth execution order and the eighth execution order are all equal to the total number of editing operations; the total number of editing operations represents the total number of editing operations included in the current editing operation plus one.
7. The method according to claim 1, wherein, Determining the target comment position in the target document corresponding to the current comment position based on the number of target nodes and the number of target characters includes: The character preceding the current comment position in the current document is taken as the current character, and the number of current characters of the current character is determined; Based on the current number of characters, the number of target nodes, and the number of target characters, determine the auxiliary character node in the target document where the current comment position is located, and the auxiliary character position in the auxiliary character node; The target comment position is determined based on the auxiliary character node and the position of the auxiliary character.
8. The method according to claim 3, wherein, The step of synchronizing the current comment information in the target document according to the target comment position includes: If the current comment information has been synchronized in other comment locations of the target document, then determine the number of update nodes and the number of update characters; The target comment position is updated based on the number of updated nodes and the number of updated characters to determine the updated comment position; The current comment information is synchronized in the target document according to the updated comment location; Wherein, the number of updated nodes represents the number of nodes in the target document that include updated character nodes at the current moment, and the number of updated characters is the number of characters included in the updated character nodes.
9. The method according to claim 8, wherein, The step of synchronizing the current comment information in the target document according to the updated comment position includes: The target comment editing operation is performed at the updated comment location to generate the current comment information at the updated comment location.
10. A device for synchronizing comment information, comprising: The information determination module is used to determine the current comment position of the current comment information in the current document, and to determine at least one target editing operation to be performed to edit the target document into the current document; wherein, the target document and the current document represent different documents; the target editing operation is the smallest granular atomic operation in the document editor, and the target editing operation includes inserting nodes, removing nodes, merging nodes, splitting nodes, and moving nodes; the target editing operation is obtained from the editing operation data stored on the server. The current editing operation generation module is used to generate at least one current editing operation based on the first reverse editing operation corresponding to the target editing operation; wherein, the first reverse editing operation is an editing operation with the opposite operation purpose to the target editing operation; The quantity determination module is used to edit the current document using the current editing operation in a second execution order, which is the opposite of the first execution order of the target editing operation, and to determine the number of target nodes and the number of target characters based on the editing result; wherein, the number of target nodes is the number of nodes in the target document including target character nodes, and the number of target characters is the number of characters included in the target character nodes; wherein, the current document is obtained by performing the target editing operation on the target document; after performing the current editing operation on the current document, the document data structure of the current document is the same as the document data structure of the target document; The comment location determination module is used to determine the target comment location in the target document corresponding to the current comment location based on the number of target nodes and the number of target characters, and to synchronize the current comment information in the target document according to the target comment location.
11. The apparatus according to claim 10, wherein, The current editing operation generation module is specifically used for: Determine at least one auxiliary editing operation to be performed on the current document, and determine a second reverse editing operation based on the auxiliary editing operation; wherein the auxiliary editing operation is used to generate the current comment information in the current document; Determine at least one historical editing operation performed on the current document, and determine a third reverse editing operation corresponding to the historical editing operation; wherein the historical editing operation represents an editing operation performed on the current document before the current comment information is generated in the current document; The current editing operation is generated based on the first reverse editing operation, the second reverse editing operation, and the third reverse editing operation.
12. The apparatus according to claim 11, wherein, The auxiliary editing operations include comment editing operations and non-comment editing operations; The current editing operation generation module is further used for: If an auxiliary editing operation performed before any of the non-comment editing operations is any of the comment editing operations, then an operation separator is added between the non-comment editing operation and the comment editing operation, and the auxiliary editing operation is divided into at least two sets of editing operations according to the operation separator; The comment editing operation performed at the current comment position is taken as the target comment editing operation, and the set of editing operations to which the target comment editing operation belongs is taken as the target editing operation set; The non-comment editing operations included in the target editing operation set are taken as target non-comment editing operations, and the second reverse editing operation is determined according to the fourth reverse editing operation corresponding to the target non-comment editing operation.
13. The apparatus according to claim 12, wherein, The current editing operation generation module is further used for: If the set of target editing operations is ordered as first, the fourth reverse editing operation is taken as the second reverse editing operation.
14. The apparatus according to claim 12, wherein, The current editing operation generation module is further used for: If the set order of the target editing operation set is not first, the set of editing operations that is in the order of the target editing operation set shall be used as the auxiliary editing operation set; The non-comment editing operations included in the set of auxiliary editing operations are taken as auxiliary non-comment editing operations, and the fifth reverse editing operation corresponding to the auxiliary non-comment editing operation is determined; The fourth reverse editing operation and the fifth reverse editing operation are combined as the second reverse editing operation.
15. The apparatus according to claim 14, wherein, The quantity determination module is specifically used for: A set of positive editing operations is determined based on the target editing operation, the historical editing operations, the target non-comment editing operation, and the auxiliary non-comment editing operation; Based on the operation execution time, determine the first execution order of the target editing operation in the positive editing operation set, the second execution order of the historical editing operation in the positive editing operation set, the third execution order of the target non-comment editing operation in the positive editing operation set, and the fourth execution order of the auxiliary non-comment editing operation in the positive editing operation set; The fifth execution order of the first reverse editing operation in the current editing operation is determined according to the first execution order; the sixth execution order of the third reverse editing operation in the current editing operation is determined according to the second execution order; the seventh execution order of the fourth reverse editing operation in the current editing operation is determined according to the third execution order; and the eighth execution order of the fifth reverse editing operation in the current editing operation is determined according to the fourth execution order. According to the fifth execution order, the sixth execution order, the seventh execution order, and the eighth execution order, the first reverse editing operation, the third reverse editing operation, the fourth reverse editing operation, and the fifth reverse editing operation are used to edit the current document; Wherein, the sum of the values of the first execution order and the fifth execution order, the sum of the values of the second execution order and the sixth execution order, the sum of the values of the third execution order and the seventh execution order, and the sum of the values of the fourth execution order and the eighth execution order are all equal to the total number of editing operations; the total number of editing operations represents the total number of editing operations included in the current editing operation plus one.
16. The apparatus according to claim 10, wherein, The comment location determination module is specifically used for: The character preceding the current comment position in the current document is taken as the current character, and the number of current characters of the current character is determined; Based on the current number of characters, the number of target nodes, and the number of target characters, determine the auxiliary character node in the target document where the current comment position is located, and the auxiliary character position in the auxiliary character node; The target comment position is determined based on the auxiliary character node and the position of the auxiliary character.
17. The apparatus according to claim 12, wherein, The comment location determination module is further used for: If the current comment information has been synchronized in other comment locations of the target document, then determine the number of update nodes and the number of update characters; The target comment position is updated based on the number of updated nodes and the number of updated characters to determine the updated comment position; The current comment information is synchronized in the target document according to the updated comment location; Wherein, the number of updated nodes represents the number of nodes in the target document that include updated character nodes at the current moment, and the number of updated characters is the number of characters included in the updated character nodes.
18. The apparatus according to claim 17, wherein, The comment location determination module is further used for: The target comment editing operation is performed at the updated comment location to generate the current comment information at the updated comment location.
19. An electronic device comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-9.
20. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-9.
21. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-9.
Citation Information
Patent Citations
Document processing method and device, readable medium and electronic equipment
CN112328927A
Annotation mapping
US9275368B1
