Text processing method and device, equipment, medium and product

By simplifying and comparing the initial and modified content in the rich text editor, and generating difference prompts, the problem of not being able to track content deletion and formatted text comparison in existing technologies is solved, and the recording and display of modified content in the rich text editor is realized.

CN120893418APending Publication Date: 2025-11-04INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511001774.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-21
Publication Date
2025-11-04

AI Technical Summary

Technical Problem

Existing rich text editors cannot effectively track content deletions made by users during editing, nor can they perform difference comparisons in formatted text.

Method used

The initial and modified content in the rich text editor is simplified and converted into DOM objects. The node content is extracted and an initial array and a modified array are generated. The differences are compared and target difference prompts are generated and displayed in the rich text editor.

Benefits of technology

It enables the recording and display of changed content within a rich text editor, avoiding the problem that simple text comparison tools cannot perform comparisons on formatted text, ensuring that the system retains relevant records or traces for easy tracking or recovery later.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120893418A_ABST
    Figure CN120893418A_ABST
Patent Text Reader

Abstract

The invention discloses a text processing method, device and equipment, a medium and a product, relates to the technical field of computers, and can be applied to the field of financial science and technology. The method comprises the following steps: acquiring initial content of a rich textbox in a rich text editor, and acquiring changed content in response to an input operation of a user on the initial content; simplifying the initial content and the changed content to obtain an initial array and a changed array; comparing the initial array with the change array to obtain a target difference array; processing the target difference array to obtain target difference prompt content; and displaying the target difference prompt content in the rich text editor. By adopting the technical scheme, the problem that comparison cannot be carried out on the basis of formats by using a simple text comparison tool is avoided, and the display of the changed content on the existing rich text editor is realized.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of computers, and can be used in the field of financial technology, and particularly relates to a text processing method, device, equipment, medium and product. BACKGROUND

[0002] A rich text editor is a tool that allows users to input and edit text and provides rich formatting functions. Front-end development often involves writing reports or product introductions with formatted text online. When adjusting the text content, the writer or approver wants to see the deleted records to prevent necessary content from being deleted, such as a customer manager deleting some risk prompt content in a product introduction. If the approver does not discover this in time, this material will cause bad consequences later.

[0003] However, most of the existing rich text editors do not have the ability to track the content deleted by the user during editing or give a prompt. Moreover, the rich text editor is in HTML format, and tables or multimedia pictures and videos can be added or deleted during editing. Therefore, simple text comparison tools cannot compare differences on the basis of formatted text. SUMMARY

[0004] The present application provides a text processing method, device, equipment, medium and product. The initial content and the changed content in the rich text editor are simplified and compared to obtain a difference array, and then the display of the difference content is completed, thereby avoiding the problem that simple text comparison tools cannot compare differences on the basis of formatted text, and realizing the display of the changed content on the existing rich text editor.

[0005] According to an aspect of the present application, a text processing method is provided, comprising:

[0006] obtaining initial content of a rich text box in a rich text editor, and in response to a user input operation on the initial content, obtaining changed content;

[0007] simplifying and processing the initial content and the changed content to obtain an initial array and a changed array;

[0008] comparing the initial array and the changed array to obtain a target difference array;

[0009] processing the target difference array to obtain target difference prompt content;

[0010] displaying the target difference prompt content in the rich text editor.

[0011] According to another aspect of the present application, a text processing device is provided, comprising:

[0012] An acquisition module is configured to acquire initial content of a rich text box in a rich text editor, and in response to input operation of a user on the initial content, acquire changed content;

[0013] A simplification module is configured to perform simplification processing on the initial content and the changed content, and obtain an initial array and a changed array;

[0014] A comparison module is configured to compare the initial array and the changed array, and obtain a target difference array;

[0015] A difference prompt content determination module is configured to process the target difference array, and obtain target difference prompt content;

[0016] A display module is configured to display the target difference prompt content in the rich text editor.

[0017] According to another aspect of the present application, an electronic device is provided, which comprises:

[0018] at least one processor; and

[0019] a memory connected to the at least one processor in communication; wherein,

[0020] the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the text processing method according to any one of the embodiments of the present application.

[0021] According to another aspect of the present application, a computer readable storage medium is provided, which stores computer instructions for enabling a processor to perform the text processing method according to any one of the embodiments of the present application when executed by the processor.

[0022] According to another aspect of the present application, a computer program product is provided, which comprises a computer program for enabling a processor to perform the text processing method according to any one of the embodiments of the present application when executed by the processor.

[0023] The technical solution of the embodiments of the present application compares the initial content and the changed content in the rich text editor through simplification processing, obtains a difference array, and then displays the difference content, thereby avoiding the problem that simple text comparison tools cannot compare content with format, and realizing recording and display of changed content on the existing rich text editor.

[0024] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present application, nor to limit the scope of the present application. Other features of the present application will become apparent through the following description. Attached Figure Description

[0025] To more clearly illustrate the technical solutions in the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0026] Figure 1 This is a flowchart of a text processing method provided according to an embodiment of the present invention;

[0027] Figure 2 This is a flowchart of a text processing method provided according to an embodiment of the present invention;

[0028] Figure 3 This is a flowchart of a method for obtaining an initial array and a modified array as used in an embodiment of the present invention;

[0029] Figure 4 This is a flowchart of a target difference array determination method used in an embodiment of the present invention;

[0030] Figure 5 This is a structural block diagram of a text processing device according to an embodiment of the present invention;

[0031] Figure 6 This is a structural block diagram of an electronic device that implements the text processing method of the present invention. Detailed Implementation

[0032] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.

[0033] It should be noted that the terms "first", "second" and the like in the description and in the claims of the present application and the above-described accompanying drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.

[0034] In addition, it should also be noted that in the technical solutions of the present application, the collected information is information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data are in accordance with relevant laws, regulations and standards of relevant countries and regions, necessary security measures are taken, public order and good customs are not violated, and appropriate operation portals are provided for users to choose authorization or refusal.

[0035] Figure 1 A flowchart of a text processing method according to an embodiment of the present application is provided. The present application can be applied to the case of leaving marks on changed content, especially to the case of leaving marks on changed content on the basis of a rich text editor. The method can be executed by a text processing device provided by an embodiment of the present application, which can be realized in the form of hardware and / or software and can be integrated into an electronic device carrying a text processing function, such as a server. As shown in FIG. 1, the method comprises: Figure 1

[0036] S110, obtaining the initial content of the rich text box in the rich text editor, and in response to the input operation of the user on the initial content, obtaining the changed content.

[0037] The initial content is the content input by the relevant personnel in the rich text box of the rich text editor, which can be the first input content or the last version of the input end. The present application does not make specific limitation on this. The input operation is the operation of re-editing the last input content in the rich text box, which can include deletion, change or addition of the initial content. The changed content is the content after the initial content is changed.

[0038] Specifically, the initial content of the rich text box in the rich text editor is obtained. The user can perform input operations such as deletion, change or addition on the initial content through the rich text box. In response to the input operation of the user, the content of the initial content changed by the user is obtained. ​

[0039] S120, simplifying the initial content and the changed content to obtain an initial array and a changed array.

[0040] The simplifying can be converting the content into an operable DOM (Document Object Model) document object model; the initial array is an array obtained by simplifying the initial content, and the initial array includes text content and multimedia files; and the changed array is an array obtained by simplifying the changed content, and the changed array includes changed text content and multimedia files.

[0041] Specifically, the string of the initial content is converted to obtain a corresponding DOM object, and the text, multimedia or table in each node is extracted to obtain a corresponding initial array; the string of the changed content is converted to obtain a corresponding DOM object, and the text, multimedia or table in each node is extracted to obtain a corresponding changed array.

[0042] It can be understood that the content input in the rich text box in the rich text editor has various styles, such as different fonts, colors and font sizes; and in simple text comparison, the change of the text style does not need to be concerned, so the rich text content is simplified to remove the font, color and other styles before the content difference comparison, to avoid the influence of the styles and further improve the efficiency of the subsequent difference content comparison.

[0043] S130, comparing the initial array and the changed array to obtain a target difference array.

[0044] The target difference array is the difference content of the initial array and the changed array; and includes deleted, newly added or unchanged text content or multimedia files.

[0045] Specifically, the simplified initial array and the changed array are compared to obtain a difference content object array.

[0046] S140, processing the target difference array to obtain target difference prompt content.

[0047] The target difference prompt content is content with a difference change prompt; and the difference change prompt can be content with a deleted content prompt.

[0048] Specifically, the target difference array is processed to obtain content with a deleted content prompt.

[0049] In an optional mode of the present application, the difference content in the target difference array can be deleted content or newly added content, and the deleted content can be prompted and displayed as the target difference prompt content.

[0050] It can be understood that after the content in the rich text box is deleted, the relevant record or trace is still retained, so as to be tracked or recovered subsequently.

[0051] S150, display the target difference prompt content in the rich text editor.

[0052] Specifically, after obtaining the target difference prompt content, the difference prompt content can be displayed in the rich text editor, so as to retain the change record or trace.

[0053] Optionally, the initial content and the change content of the rich text box are HTML files.

[0054] Specifically, the rich text in the rich text editor is with HTML format, and during editing, tables or multimedia pictures and videos can be added or deleted, so that the simple text comparison tool cannot compare on the basis of the format.

[0055] It can be understood that, since the existing text comparison tool cannot compare the HTML files in the rich text, the embodiment of the present application can quickly compare the differences between the content before and after the change of the rich text box by converting the initial content and the change content of the rich text box into an array form through string conversion.

[0056] The embodiment of the present application obtains the initial content of the rich text box in the rich text editor, and in response to the input operation of the user on the initial content, obtains the change content; simplifies the initial content and the change content to obtain an initial array and a change array; compares the initial array and the change array to obtain a target difference array; processes the target difference array to obtain target difference prompt content; and displays the target difference prompt content in the rich text editor. The above technical solution compares the initial content and the change content in the rich text editor through simplification processing, obtains a difference array, and then completes the display of the difference content, thereby avoiding the problem that the simple text comparison tool cannot compare on the basis of the format, and realizing that after editing the rich text in the existing rich text editor, the relevant record or trace is still retained, so as to facilitate subsequent tracking or recovery.

[0057] Figure 2 is a flowchart of a text processing method according to the embodiment of the present application. The embodiment of the present application supplements the initial array and the change array obtained by simplifying the initial content and the change content on the basis of the above embodiment. It should be noted that, for the parts not described in detail in the embodiment of the present application, reference can be made to the relevant descriptions of other embodiments, such as Figure 2 The method comprises the following steps:

[0058] S210, obtaining the initial content of the rich text box in the rich text editor, and in response to the input operation of the user on the initial content, obtaining the change content.

[0059] S220. Convert the initial content and the changed content into DoM objects respectively; the DoM object includes a first object and a second object.

[0060] The DOM object includes a first object and a second object; the first object is the DOM object transformed from the initial content; the second object is the DOM object transformed from the changed content.

[0061] Specifically, by using the API provided by the rich text box to obtain the initial content string and the changed content string, you can use the browser's built-in DOMParser to create a DOMParser instance, convert the initial content string into a first object, and the changed content string into a second object.

[0062] S230. Recursively extract the node content of all nodes in the DoM object; the nodes include the first node and the second node, and the node content includes the first content and the second content.

[0063] The node content may include text content, multimedia file content, or table content; the first node is the node in the first object corresponding to the initial content; the first content is the content corresponding to the first node; the second node is the node in the second object corresponding to the changed content; and the second content is the content corresponding to the second node.

[0064] Specifically, a function can be defined to recursively extract the node content from the DOM object; obtain the first content corresponding to the first node in the first object; and the second content corresponding to the second node in the second object.

[0065] S240. Obtain the initial array and the changed array based on the node's attribute values ​​and node content.

[0066] The attribute values ​​of a node describe its content type. For example, a text node has an attribute value of 3, while a multimedia node is an element node with an attribute value of 1. The node content can be text content or multimedia files.

[0067] Specifically, the content of each node is extracted based on its attribute values. Text content is extracted from text nodes, and multimedia files are extracted from multimedia nodes. The extracted text content and multimedia files are then assembled in sequence to obtain the corresponding initial array and change array.

[0068] Optional, such as Figure 3 The method shown obtains an initial array and a changed array based on the node's attribute values ​​and node content, including:

[0069] S241, judging whether the node is a text node based on the attribute value of the node, if yes, extracting the text of the node content as a target text; the target text includes a first target text and a second target text.

[0070] Wherein, the attribute value of the text node is 3; the first target text is the text content in the initial content; the second target text is the text content in the changed content.

[0071] Specifically, the node type in the first content is traversed, if the attribute of the node is 3, it indicates that it is a text node, and the text content in the node is extracted as the first target text; the node type in the second content is traversed, and the text node is judged based on the attribute value of the node, if it indicates that it is a text node, the text content in the node is extracted as the second target text.

[0072] S242, if the node is not a text node, judging whether the node is a multimedia file based on the attribute value of the node, if yes, encoding the multimedia corresponding to the node to obtain a multimedia array; the multimedia array includes a first multimedia array and a second multimedia array.

[0073] Wherein, the attribute value of the multimedia node is 1; the first multimedia array is the multimedia file in the initial content; the second multimedia array is the multimedia file in the changed content.

[0074] Specifically, if the first content is not a text node based on the attribute value of the node, it is further judged whether the node is a multimedia file node, if yes, the file is encoded and stored in an array format to obtain the first multimedia array; if the second content is not a text node based on the attribute value of the node, it is further judged whether the node is a multimedia file node, if yes, the file is encoded and stored in an array format to obtain the second multimedia array.

[0075] In an optional mode of the present application, the multimedia file can be converted into base64 encoding and stored in an array format, and replaced with N is an array index.

[0076] It can be understood that, by encoding conversion of multimedia files with array storage, and replacing nodes with N is an array subscript, ensuring the order of each multimedia file in the multimedia array, and improving the efficiency of subsequent multimedia difference comparison.

[0077] S243, if the node is not a multimedia file, replacing the node type of the node with a specific mark type based on a preset node type replacement strategy; the specific mark type includes a first specific mark type and a second specific mark type.

[0078] The node type replacement strategy is a preset node type replacement strategy; for example, DIV and P tags are replaced with <l>< / l> , TABLE is replaced with <t>< / t> , TR is replaced with <r>< / r> , TD is replaced with <d>< / d> , and TBODY is replaced with The first specific mark type is the specific mark type of each node in the initial content; and the second specific mark type is the specific mark type of each node in the changed content.

[0079] Specifically, if the node in the first content is also not a multimedia file node, the node type mark of the node is replaced with the first specific mark type based on the preset node type replacement strategy; and if the node in the second content is also not a multimedia file node, the node type mark of the node is replaced with the second specific mark type based on the preset node type replacement strategy.

[0080] In an optional mode of the present application, after the node type of the node is replaced with the specific mark type based on the preset node type replacement strategy, the method further includes: traversing all the child nodes in the DOM object again, and judging the node content of the node attribute of each node in the specific mark type until all the child nodes are judged.

[0081] It can be understood that by replacing the node type mark, the efficiency of node traversal is improved, and the array corresponding to the node content is quickly obtained; and the subsequent comparison efficiency is further improved.

[0082] S244, the target text, the multimedia array and the target mark type are assembled in order respectively to obtain an initial array and a changed array.

[0083] Specifically, the first target text, the first multimedia array and the first target mark type are assembled in order to obtain a text string and a multimedia file array as an initial array; and the second target text, the second multimedia array and the second target mark type are assembled in order to obtain a text string and a multimedia file array as a changed array.

[0084] It can be understood that the initial content and the change content are converted into DOM objects respectively, and the initial array and the change array are obtained by traversing each node to extract the node content, which simplifies the rich text content, removes the font, color and other styles, and retains the paragraph, table, picture and other contrast content; and the subsequent comparison efficiency is improved.

[0085] S250, comparing the initial array and the change array to obtain a target difference array.

[0086] Optionally, as shown in a target difference array determination method, the initial array and the change array are compared to obtain a target difference array, including: Figure 4

[0087] S251, comparing the node types of the initial array and the change array based on the initial array and the change array to obtain an initial difference array.

[0088] The node types include text nodes and multimedia nodes; and the initial difference array is a difference content object array in the initial array and the change array.

[0089] Specifically, the initial array and the change array are compared based on the node types; for example, the text nodes are compared using diff_match_patch to obtain difference text content; the multimedia array is compared in sequence to obtain a difference multimedia array; and the difference text content and the difference multimedia array are assembled in sequence to obtain the initial difference array.

[0090] S252, recording the node state of the node based on the change attribute of each node in the initial difference array to obtain a target difference array; the node state includes an unchanged state, a deletion state or an addition state.

[0091] The change attribute is addition, deletion or unchanged; and the target difference array is a difference array containing each node state.

[0092] Specifically, the node state of the node is recorded based on the change attribute of each node in the initial difference array, and each node state includes an unchanged state, a deletion state or an addition state; and the target difference array is obtained.

[0093] It can be understood that the difference array is recorded based on the node type and the change attribute of the node to obtain a changed array, so that the system still retains relevant records or traces after the change operation, facilitating subsequent tracking or recovery.

[0094] S260, processing the target difference array to obtain target difference prompt content.

[0095] Optionally, the target difference array is processed to obtain target difference prompt content, including:

[0096] ​Traverse the node state of each node in the target difference array, and take the node with a deletion state as an initial node;

[0097] Obtain a specific flag type of other nodes in the target difference array except text and multimedia nodes;

[0098] Split the initial node according to the specific flag type to obtain each subtext;

[0099] Splice each subtext with a deletion line to obtain a target node;

[0100] Splice the target node into the target difference array to obtain an initial difference prompt array;

[0101] Restore each target flag type in the initial difference prompt array based on a preset node type replacement strategy to obtain a target difference prompt content.

[0102] Among them, the initial node is a node with deleted content; the initial difference prompt array is an array with difference prompt content; and the target difference prompt content is content with deletion prompt.

[0103] Specifically, traverse the difference content array, judge whether it is a deletion state node based on the node state, if yes, take the node with a deletion state as an initial node; split the content of the deletion node according to the flag defined by the specific flag type to obtain each subtext, such as <t b r l d>, will each segment of subtext using added strikethrough target node, will the target node splicing to the target difference array array to get the initial difference prompt, and after splicing processing results, the results of the text in a specific simple <t b r l d>The label mark is further reduced to a specific label, and the multimedia file is further reduced, so that the target difference prompt content with the deleted content prompt is obtained.

[0104] In an optional mode of the present application, each subtext is added with a deletion line, which can be wrapping each subtext with <delstyle="color:red">he to obtain a target node, and obtaining an initial difference prompt array by splicing back the target difference array, and the content obtained by reducing the initial difference prompt array is the deleted content with the deletion line.

[0105] It can be understood that by adding a deletion line to the difference text node, it is possible to support recording and identifying whether the rich text content is deleted, so that the system still retains relevant records or traces after the deletion operation, and supports subsequent tracking or recovery of relevant users.

[0106] S270, displaying the target difference prompt content in the rich text editor.

[0107] The embodiment of the present application converts the initial content and the changed content to obtain a DOM document object type, obtains a difference array based on the change state of each node, and further adds a deletion line to the difference node in the deletion state, so that the system still retains relevant records or traces, and relevant technical personnel can see the deleted records, so as to prevent necessary content from being deleted, for example, a customer manager deletes some risk prompt content in a product introduction, and if the approver does not discover it in time, this material will cause bad consequences in the future, and the trace of the deleted content in the rich text editor is realized.

[0108] Figure 5 It is a structure schematic diagram of a text processing device provided by the embodiment of the present application. The present application can be applied to the case of leaving traces of changed content, especially to the case of leaving traces of changed content based on a rich text editor. The text processing device can be realized in the form of hardware and / or software, and can be integrated in an electronic device carrying a text processing function, such as a server. As shown in the figure, Figure 5 The text processing device 300 includes an acquisition module 310, a simplification processing module 320, a comparison module 330, a difference prompt content determination module 340 and a display module 350.

[0109] The acquisition module 310 is used to acquire the initial content of the rich text box in the rich text editor, and acquire the changed content in response to the input operation of the user on the initial content.

[0110] The simplification processing module 320 is used to simplify the initial content and the changed content to obtain an initial array and a changed array.

[0111] The comparison module 330 is used to compare the initial array and the changed array to obtain a target difference array.

[0112] The difference prompt content determination module 340 is configured to process the target difference array to obtain target difference prompt content.

[0113] The display module 350 is configured to display the target difference prompt content in the rich text editor.

[0114] The embodiment of the present application obtains the initial content of the rich text box in the rich text editor, and obtains the changed content in response to the input operation of the user on the initial content. The initial array and the changed array are obtained by simplifying the initial content and the changed content. The target difference array is obtained by comparing the initial array and the changed array. The target difference prompt content is obtained by processing the target difference array. The target difference prompt content is displayed in the rich text editor. The above technical solution obtains the difference array by comparing the initial content and the changed content in the rich text editor, and then displays the difference content, thereby avoiding the problem that the simple text comparison tool cannot compare the content with format, and realizing that the relevant record or trace is still retained after the editing operation on the rich text in the existing rich text editor, so as to facilitate subsequent tracking or recovery.

[0115] Optionally, the simplification processing module 320 includes a conversion unit, an extraction unit and an array determination unit.

[0116] The conversion unit is configured to convert the initial content and the changed content into DoM objects respectively; the DoM objects include first objects and second objects.

[0117] The extraction unit is configured to recursively extract node content of all nodes in the DoM objects; the nodes include first nodes and second nodes, and the node content includes first content and second content.

[0118] The array determination unit is configured to obtain the initial array and the changed array based on the attribute value of the node and the node content.

[0119] Optionally, the array determination unit is specifically configured to determine whether the node is a text node based on the attribute value of the node, and if so, extract the text of the node content as target text; the target text includes first target text and second target text; if the node is not a text node, determine whether the node is a multimedia file based on the attribute value of the node, and if so, encode the multimedia corresponding to the node to obtain a multimedia array; the multimedia array includes first multimedia array and second multimedia array; if the node is not a multimedia file, replace the node type of the node with a specific mark type based on a preset node type replacement strategy; the specific mark type includes first specific mark type and second specific mark type; and the target text, the multimedia array and the target mark type are assembled in sequence to obtain the initial array and the changed array.

[0120] Optionally, the comparison module 330 is specifically configured to compare the text types of the initial array and the change array to obtain an initial difference array; and record the node state of the node based on the change attribute of each node in the initial difference array to obtain a target difference array; the node state includes an unchanged state, a deletion state or an addition state.

[0121] Optionally, the difference prompt content determination module 340 is configured to traverse the node state of each node in the target difference array, and take the node with the deletion state as an initial node; obtain a specific mark type of other nodes in the target difference array except for text and multimedia nodes; split the initial node according to the specific mark type to obtain each subtext; splice each subtext with a deletion line to obtain a target node; splice the target node into the target difference array to obtain an initial difference prompt array; and restore each target mark type in the initial difference prompt array based on a preset node type replacement strategy to obtain target difference prompt content.

[0122] Optionally, the initial content and the change content of the rich text box are HTML files.

[0123] The text processing device provided in the embodiments of the present application can execute the text processing method provided in any of the embodiments of the present application, and has the corresponding function modules and beneficial effects of the execution method.

[0124] According to the embodiments of the present application, the present application further provides an electronic device, a readable storage medium and a computer program product.

[0125] Figure 6 A structural schematic diagram of an electronic device 10 that can be used to implement embodiments of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptops, desktops, tablets, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular telephones, smart phones, wearable devices (such as headsets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be examples only, and are not intended to limit the implementations of the present application described and / or claimed in this document.

[0126] As Figure 6 As shown, the electronic device 10 includes at least one processor 11, and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., communicatively connected to the at least one processor 11, where the memory stores a computer program executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0127] Various components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc., an output unit 17, such as various types of displays, a speaker, etc., a storage unit 18, such as a magnetic disk, an optical disk, etc., and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network, such as the Internet, and / or various telecommunication networks.

[0128] The processor 11 can be various general and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 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 processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 performs various methods and processes described above, such as the text processing method.

[0129] In some embodiments, the text processing method can be implemented as a computer program tangibly embodied in a computer readable storage medium, such as the storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded onto the RAM 13 and executed by the processor 11, one or more steps of the text processing method described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to perform the text processing method by any other appropriate means, such as by means of firmware.

[0130] The various embodiments of the systems and techniques described above can be implemented in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a load programmable logic device (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.

[0131] Computer programs used to implement the processes of the application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer program, when executed, can cause instructions defined in the flow charts and / or block diagrams to be implemented. The computer program can be executed entirely on a machine, partially on a machine, partially on a machine as a standalone software package and partially on a remote machine or entirely on a remote machine or server.

[0132] In the context of the present application, a computer-readable storage medium can be a tangible medium that can contain or store computer programs for use by or in connection with an instruction execution system, apparatus, or device. Computer-readable storage media can include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0133] To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can be used to provide for interaction with a user as well; 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 acoustic, speech, or tactile input.

[0134] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0135] The computing system can include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. A server can be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system, to solve the defects of large management difficulty and weak business scalability in traditional physical host and VPS service.

[0136] It should be understood that the various forms of flow shown above can be re-ordered, added to, or deleted from without departing from the scope of the present disclosure. For example, the steps recited in the present disclosure can be executed in parallel, executed in sequence, or executed in a different order, as long as the desired results of the present disclosure are achieved, and the present disclosure is not limited herein.

[0137] The above detailed description does not limit the scope of the present disclosure. It is understood that various modifications, combinations, sub-combinations, and alternatives can be made to the detailed disclosure without departing from the spirit and principles of the present disclosure. Any modifications, equivalent substitutions, improvements, and the like that are made within the spirit and principles of the present disclosure are included in the scope of the present disclosure.< / t> < / t>

Claims

1. A text processing method, characterized in that, include: Get the initial content of the rich text box in the rich text editor, and in response to the user's input operation on the initial content, get the changed content; The initial content and the changed content are simplified to obtain an initial array and a changed array; By comparing the initial array and the changed array, a target difference array is obtained; The target difference array is processed to obtain the target difference prompt content; The target difference prompt is displayed in the rich text editor.

2. The method according to claim 1, characterized in that, The simplification process of the initial content and the changed content to obtain the initial array and the changed array includes: The initial content and the modified content are respectively converted into DoM objects; the DoM objects include a first object and a second object; Recursively extract the node content of all nodes in the DoM object; the nodes include a first node and a second node, and the node content includes first content and second content; An initial array and a change array are obtained based on the attribute values ​​and content of the nodes.

3. The method according to claim 2, characterized in that, Based on the attribute values ​​and content of the nodes, an initial array and a changed array are obtained, including: Based on the attribute values ​​of the node, it is determined whether the node is a text node. If it is, the text of the node content is extracted as the target text. The target text includes a first target text and a second target text. If the node is not a text node, then it is determined whether the node is a multimedia file based on the attribute value of the node. If it is, the multimedia file corresponding to the node is encoded to obtain a multimedia array; the multimedia array includes a first multimedia array and a second multimedia array. If the node is not a multimedia file, the node type is replaced with a specific flag type based on a preset node type replacement strategy; the specific flag type includes a first specific flag type and a second specific flag type. The target text, the multimedia array, and the target flag type are assembled in sequence to obtain an initial array and a modified array.

4. The method according to claim 1, characterized in that, The step of comparing the initial array and the changed array to obtain the target difference array includes: An initial difference array is obtained by comparing the text types of the initial array and the changed array; The node state of each node is recorded based on the change attributes of each node in the initial difference array to obtain the target difference array; the node state includes unchanged state, deleted state, or added state.

5. The method according to claim 4, characterized in that, The target difference array is processed to obtain the target difference prompt content, including: Iterate through the node states of each node in the target difference array, and take the node with the deletion state as the initial node; Retrieve the specific flag type of nodes other than text and multimedia nodes in the target difference array; The initial node is split into sub-texts according to the specific flag type; The target node is obtained by adding strikethrough to each of the sub-texts and concatenating them. The target nodes are concatenated into the target difference array to obtain the initial difference prompt array; Based on the preset node type replacement strategy, the target flag types in the initial difference prompt array are restored to obtain the target difference prompt content.

6. The method according to any one of claims 1-5, characterized in that, Also includes: The initial and modified content of the rich text box is an HTML file.

7. A text processing device, characterized in that, include: The acquisition module is used to acquire the initial content of the rich text box in the rich text editor, and in response to the user's input operation on the initial content, acquire the changed content. A simplification processing module is used to simplify the initial content and the changed content to obtain an initial array and a changed array; The comparison module is used to compare the initial array and the changed array to obtain the target difference array; The difference prompt content determination module is used to process the target difference array to obtain the target difference prompt content; The display module is used to display the target difference prompt content in the rich text editor.

8. An electronic device, characterized in that, The electronic device includes: At least one processor; and A memory communicatively connected to the at least one processor; wherein, The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the text processing method according to any one of claims 1-6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that cause a processor to execute the text processing method according to any one of claims 1-6.

10. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the text processing method according to any one of claims 1-6.