Key word processing method and device, electronic equipment and storage medium
Patent Information
- Application Number
- CN202111209695.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-18
- Publication Date
- 2026-02-17
- Estimated Expiration
- 2041-10-18
AI Technical Summary
[0005]本申请提供了一种关键词的处理方法和装置、存储介质和电子设备,以至少解决相关技术中存在查看标注信息时需要遍历整个文档的dom树,从中提取相关信息,耗时长性能差的问题
[0036] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the method steps of any of the above embodiments when it is run.
Smart Images

Figure CN113961682B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of data processing, and in particular to a keyword processing method and device, an electronic device, and a storage medium. BACKGROUND
[0002] In an industrial intelligent writing robot project, a user needs to perform keyword labeling on a document in the system, so that a backend AI platform can quickly and accurately understand the general content of an article according to the labeled keywords.
[0003] Currently, most of the original labeling schemes are based on user operations in a document editor, and after listening to the corresponding events, the dom elements are directly processed. The disadvantage of this method is that when a user wants to know the labeling information in the entire document, the dom tree of the entire document needs to be traversed to extract relevant information, which is time-consuming and has poor performance. Moreover, because other components cannot trigger the listening events of the text editor, it is difficult to interact with external components.
[0004] Therefore, in the related art, there is a problem that when viewing the labeling information, the dom tree of the entire document needs to be traversed to extract relevant information, which is time-consuming and has poor performance. SUMMARY
[0005] The present application provides a keyword processing method and device, a storage medium, and an electronic device to at least solve the problem in the related art that when viewing the labeling information, the dom tree of the entire document needs to be traversed to extract relevant information, which is time-consuming and has poor performance.
[0006] According to an aspect of an embodiment of the present application, a keyword processing method is provided, which includes:
[0007] In a case where a target document in a data layer constructed on a node tree is in a first state, a trigger operation performed by a target user on the target document is obtained, wherein the target document is set in a target web page and is displayed in the target web page, the first state is used to indicate that the target document is in a browsed state, and the node tree and the data layer are in bidirectional binding communication;
[0008] In a case where the trigger operation is a selection operation, a selected target keyword is determined according to the trigger operation;
[0009] The current state of the target keyword is changed to a second state and a third state, wherein the second state is used to indicate that the background color of the target keyword is changed, and the third state is used to indicate that the target keyword is in an uneditable state.
[0010] According to another aspect of an embodiment of the present application, a keyword processing device is also provided, which includes:
[0011] The first obtaining unit is configured to obtain a trigger operation performed by a target user on a target document in a data layer constructed on a node tree, in a case where the target document is in a first state, wherein the target document is arranged in a target webpage and displayed in the target webpage, the first state is used to indicate that the target document is in a browsed state, and the node tree and the data layer are in bidirectional binding communication;
[0012] The determining unit is configured to determine a target keyword selected according to the trigger operation, in a case where the trigger operation is a selection operation.
[0013] The changing unit is configured to change a current state of the target keyword into a second state and a third state, wherein the second state is used to indicate that a base color of the target keyword is changed, and the third state is used to indicate that the target keyword is in an uneditable state.
[0014] Optionally, the determining unit comprises:
[0015] The first determining module is configured to determine a target position selected in the target document according to the trigger operation, wherein the target position comprises a start position and an end position.
[0016] The second determining module is configured to determine a target keyword corresponding to the target position according to the start position and the end position.
[0017] Optionally, the apparatus further comprises:
[0018] The setting unit is configured to set label information for the target keyword before the current state of the target keyword is changed into the second state and the third state, wherein the label information comprises a unique identification code.
[0019] The first modifying unit is configured to modify the current state of the target keyword according to the label information.
[0020] Optionally, the first modifying unit comprises:
[0021] The first obtaining submodule is configured to obtain a historical keyword stored in a storage container, wherein the historical keyword is a text selected as a keyword.
[0022] The second obtaining submodule is configured to obtain a start position and an end position of the historical keyword, and obtain a start position and an end position of the target keyword.
[0023] The first comparison submodule is configured to compare the start point position of the historical keyword with the start point position of the target keyword to obtain a maximum value as first data.
[0024] The second comparison submodule is configured to compare the end point position of the historical keyword with the end point position of the target keyword to obtain a minimum value as second data.
[0025] The modification submodule is configured to modify the current state of the target keyword in a case where the first data is greater than the second data.
[0026] Optionally, the trigger operation includes a deletion operation, and the apparatus further includes:
[0027] The second modification unit is configured to, after changing the current state of the target keyword to a second state and a third state, cancel the third state of the target keyword and the label information and change the second state to a fourth state in a case where it is determined that the trigger operation is the deletion operation, wherein the fourth state is used to indicate that the background color of the target keyword is no color.
[0028] Optionally, the manner in which the second modification unit determines that the trigger operation is the deletion operation includes:
[0029] obtaining a click operation performed by the target user on a deletion button corresponding to the target keyword, wherein the deletion button is arranged in the target web page;
[0030] Alternatively,
[0031] listening to a deletion event performed by a control device on the target keyword.
[0032] Optionally, the apparatus further includes:
[0033] The second acquisition unit is configured to, after canceling the third state of the target keyword and the label information and changing the second state to the fourth state, acquire a previous node text and a next node text located at a current node of the target keyword.
[0034] The merging unit is configured to merge the previous node text, the target keyword, and the next node text to generate a merged text.
[0035] According to still another aspect of the embodiments of the present application, an electronic device is provided, which includes a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete communication with each other through the communication bus; the memory is configured to store a computer program; and the processor is configured to execute the method steps in any of the above embodiments by running the computer program stored in the memory.
[0036] According to another aspect of the embodiments of this application, a computer-readable storage medium is also provided, wherein a computer program is stored therein, wherein the computer program is configured to perform the method steps of any of the above embodiments when it is run.
[0037] This application can be applied to data acquisition in the field of data capabilities. In this embodiment, when the target document in the data layer built on the node tree is in a first state, the trigger operation performed by the target user on the target document is obtained. The target document is set in the target webpage and displayed on the target webpage. The first state is used to indicate that the target document is in a browsing state. There is bidirectional binding communication between the node tree and the data layer. When it is determined that the trigger operation is a selection operation, the selected target keyword is determined according to the trigger operation. The current state of the target keyword is changed to a second state and a third state. The second state is used to indicate that the background color of the target keyword is changed, and the third state is used to indicate that the target keyword is in an uneditable state. Because this application embodiment constructs its own data layer on the node tree (i.e., DOM tree), the target user's operation only affects the data layer. Furthermore, since the node tree and data layer communicate bidirectionally, modifications to data within the data layer will automatically modify the node tree. This allows information to be obtained directly through the data layer without traversing the node tree. Additionally, this application embodiment modifies the selected target keywords into second and third states, saving time and improving performance when obtaining target keyword annotation information. This solves the problem in related technologies where viewing annotation information requires traversing the entire document's DOM tree to extract relevant information, resulting in long processing times and poor performance. Attached Figure Description
[0038] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0039] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, those skilled in the art can obtain other drawings based on these drawings without creative effort.
[0040] Figure 1 This is a schematic diagram of the hardware environment for an optional keyword processing method according to an embodiment of the present invention;
[0041] Figure 2 This is a flowchart illustrating an optional keyword processing method according to an embodiment of this application;
[0042] Figure 3 This is a schematic diagram illustrating an optional bidirectional binding communication between a data layer and a DOM tree according to an embodiment of this application;
[0043] Figure 4 This is a schematic diagram of the overall process of optional keyword annotation according to an embodiment of this application;
[0044] Figure 5 This is a schematic diagram of an optional process for merging various nodes after keyword deletion, according to an embodiment of this application.
[0045] Figure 6 This is a schematic diagram of the overall process for deleting an optional keyword according to an embodiment of this application;
[0046] Figure 7 This is a structural block diagram of an optional keyword processing device according to an embodiment of this application;
[0047] Figure 8 This is a structural block diagram of an optional electronic device according to an embodiment of this application. Detailed Implementation
[0048] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.
[0049] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0050] According to one aspect of the embodiments of this application, a keyword processing method is provided. Optionally, in this embodiment, the above-described keyword processing method can be applied to, for example... Figure 1 In the hardware environment shown. For example... Figure 1As shown, terminal 102 may include memory 104, processor 106, and display 108 (optional component). Terminal 102 can communicate with server 112 via network 110. Server 112 can provide services (such as application services) to the terminal or clients installed on the terminal. Database 114 can be set up on or independently of server 112 to provide data storage services to server 112. In addition, server 112 may run a processing engine 116, which can be used to execute the steps performed by server 112.
[0051] Optionally, terminal 102 may be, but is not limited to, a terminal capable of computing data, such as a mobile terminal (e.g., mobile phone, tablet computer), laptop computer, PC (Personal Computer), etc. The aforementioned network may include, but is not limited to, a wireless network or a wired network. The wireless network includes Bluetooth, Wi-Fi (Wireless Fidelity), and other networks that enable wireless communication. The aforementioned wired network may include, but is not limited to, a wide area network (WAN), a metropolitan area network (MAN), and a local area network (LAN). The aforementioned server 112 may include, but is not limited to, any hardware device capable of computing.
[0052] Furthermore, in this embodiment, the keyword processing method described above can also be applied to, but is not limited to, a powerful independent processing device without data interaction. For example, the processing device can be, but is not limited to, a powerful terminal device; that is, the various operations in the keyword processing method described above can be integrated into a single independent processing device. The above is merely an example, and this embodiment does not impose any limitations on it.
[0053] Optionally, in this embodiment, the keyword processing method described above can be executed by server 112, by terminal 102, or jointly by server 112 and terminal 102. The keyword processing method of this embodiment can also be executed by a client installed on terminal 102.
[0054] Taking running on a server as an example, Figure 2 This is a flowchart illustrating an optional keyword processing method according to an embodiment of this application, such as... Figure 2 As shown, the process of this method may include the following steps:
[0055] Step S201: When the target document in the data layer built on the node tree is in the first state, obtain the trigger operation performed by the target user on the target document. The target document is set in the target webpage and displayed on the target webpage. The first state is used to indicate that the target document is in the browsing state. There is bidirectional binding communication between the node tree and the data layer.
[0056] Optionally, such as Figure 3 In this embodiment, a data layer is constructed on the document DOM layer corresponding to the node tree. All data operations of the target user are performed on this data layer. At the same time, the data layer and the DOM layer are bidirectionally bound and communicated. In this way, when data is changed in the data layer, it can directly affect the node tree (i.e., DOM tree) of the DOM layer, so that if one is modified, the other will be automatically modified. Since the data layer can be manipulated arbitrarily, the communication problem between the text editor and other components is solved.
[0057] Furthermore, the method for manipulating the displayed data within the document is as follows: While the target document in the data layer is being viewed, the triggering operations performed by the target user on the target document's display page are obtained. The target document is set and displayed on the target webpage. Based on these executed triggering operations, operations are performed on the data within the target document. Additionally, triggering operations include selection, clicking, and deletion operations, etc. This application embodiment does not specifically limit the operation methods.
[0058] Step S202: If the triggering operation is determined to be a selection operation, the target keyword to be selected is determined based on the triggering operation.
[0059] Optionally, when the server determines that the triggering operation performed by the target user on the target document is a selection operation, it uses the selected content as the target keyword. It can be understood that the target keyword is the annotation information that needs to be annotated.
[0060] Step S203: Change the current state of the target keyword to the second state and the third state, where the second state is used to indicate that the background color of the target keyword is changed, and the third state is used to indicate that the target keyword is in an uneditable state.
[0061] Optionally, in order to quickly obtain annotation information, this application embodiment uses a method of changing the current state of the target keyword to a second state and a third state. The second state indicates that the background color of the target keyword should be changed, for example, changing it to yellow to brighten the background and distinguish it from non-target keywords. The third state indicates that the target keyword is in an uneditable state, for example, by setting its contenteditable attribute to false in a JS (JavaScript, a lightweight language) file. This achieves the characteristics of distinguishing the background color of the target keyword and making it difficult to tamper with.
[0062] In this embodiment, when the target document in the data layer constructed on the node tree is in a first state, the trigger operation performed by the target user on the target document is obtained. The target document is set in the target webpage and displayed on the target webpage. The first state is used to indicate that the target document is in a browsing state. There is bidirectional binding communication between the node tree and the data layer. When it is determined that the trigger operation is a selection operation, the selected target keyword is determined according to the trigger operation. The current state of the target keyword is changed to a second state and a third state. The second state is used to indicate that the background color of the target keyword is changed, and the third state is used to indicate that the target keyword is in an uneditable state. Because this application embodiment constructs its own data layer on the node tree (i.e., DOM tree), the target user's operation only affects the data layer. Furthermore, since the node tree and data layer communicate bidirectionally, modifications to data within the data layer will automatically modify the node tree. This allows information to be obtained directly through the data layer without traversing the node tree. Additionally, this application embodiment modifies the selected target keywords into second and third states, saving time and improving performance when obtaining target keyword annotation information. This solves the problem in related technologies where viewing annotation information requires traversing the entire document's DOM tree to extract relevant information, resulting in long processing times and poor performance.
[0063] It should be noted that, in this embodiment of the application, the target keywords after the status has been modified are also stored, for example, in a storage container, for easy use in subsequent deletion and saving operations.
[0064] Based on the above embodiments, as an optional embodiment, determining the selected target keyword according to the triggering operation includes:
[0065] The selected target location within the target document is determined based on the triggering operation, where the target location includes a start position and an end position;
[0066] Based on the starting and ending positions, determine the target keywords corresponding to the target positions.
[0067] Optionally, in this embodiment, `window.getSelection()` is used to obtain information about the selected portion for subsequent processing. `window.getSelection()` represents the text range selected by the target user or the current cursor position, returning a selection object. After obtaining the selected target position within the target document, `getRangeAt()` is used to convert the selection object into a range object (representing a continuous range in the document). The start and end positions of the range object are then obtained. Based on these start and end positions, the target keyword corresponding to the target position can be determined.
[0068] Based on the content of the above embodiments, as an optional embodiment, before changing the current state of the target keyword to the second and third states, the method further includes:
[0069] Set tag information for target keywords, where the tag information includes a unique identifier;
[0070] Based on the tag information, modify the current status of the target keywords.
[0071] Optionally, in this embodiment of the application, the selected text content is wrapped with span tags (i.e., tag information) using the surroundContents() method. The span tag is an inline tag in Hypertext Markup Language (HTML) used to group inline elements in a document, and it is assigned a unique identifier. Based on this tag information, the current state of the target keyword can be modified. For example, when changing the background color of the target keyword, the span tag can be searched directly, and the target keyword wrapped within the span tag can be found and its background color changed.
[0072] This application embodiment can quickly locate the position of the target keyword whose current state needs to be changed by setting tag information, achieving a convenient and accurate effect.
[0073] Based on the content of the above embodiments, as an optional embodiment, modifying the current state of the target keyword according to the tag information includes:
[0074] Retrieve historical keywords stored in the storage container, where historical keywords are texts that have been selected as keywords;
[0075] Get the starting and ending positions of historical keywords, and get the starting and ending positions of the target keyword;
[0076] Compare the starting position of the historical keyword with the starting position of the target keyword, and take the maximum value as the first data.
[0077] Compare the ending positions of historical keywords with the ending positions of target keywords, and obtain the minimum value as the second data;
[0078] If the first data point is greater than the second data point, modify the current state of the target keyword.
[0079] Optionally, this application embodiment provides a storage container for storing various keywords. After each target keyword is selected, the nodes in the storage container are traversed to determine whether the currently selected target keyword has already been stored in the storage container, that is, to check whether it is a historical keyword. The specific operation is as follows:
[0080] The starting and ending positions of historical keywords are obtained from the storage container, and then the starting and ending positions of the target keyword are obtained. The starting positions of the historical keywords and the target keywords are compared, and the maximum value is taken as the first data. The ending positions of the historical keywords and the target keywords are compared, and the minimum value is taken as the second data.
[0081] If the first data is less than or equal to the second data, it means that the target keyword is already included in the historical keywords, so the target keyword cannot be marked; if the first data is greater than the second data, it means that the target keyword is not included in the historical keywords, and the current status of the target keyword should be modified.
[0082] Based on the content of the above embodiments, as an optional embodiment, see [link / reference]. Figure 4 , Figure 4 This is a schematic diagram of the overall process for optional keyword tagging according to an embodiment of this application. The specific process is as follows:
[0083] S1, Select the words;
[0084] S2, determine whether the selected words contain existing keywords; if yes, then execute S3: return no response; if no, then execute S4: obtain the selected part information through window.getSelection();
[0085] S5 adds a span tag to the selected area;
[0086] S6, change the label background color;
[0087] S7, set the contenteditable attribute of the tag;
[0088] S8 stores the selection data;
[0089] S9, End.
[0090] Based on the content of the above embodiments, as an optional embodiment, the triggering operation includes a deletion operation. After changing the current state of the target keyword to the second and third states, the method further includes:
[0091] If the triggered operation is determined to be a deletion operation, cancel the third state and tag information of the target keyword, and change the second state to the fourth state, where the fourth state is used to indicate that the background color of the target keyword is colorless.
[0092] Optionally, when it is determined that the triggered operation is not a deletion operation, it is necessary to cancel the third state of the target keyword, that is, to cancel the contenteditable attribute to false and make it editable. At the same time, the tag information is deleted, that is, the span tag is deleted, and the background color of the second state of the target keyword is changed to the fourth state of no color, so that the current target keyword is no longer indistinguishable from other non-labeled information.
[0093] It should be noted that the methods for determining that the triggered operation is a deletion operation in this application embodiment include: obtaining that the target user has clicked the delete button set in the target webpage corresponding to the target keyword; or, listening to the control device (such as a keyboard) performing a deletion event on the target keyword (such as pressing the delete key on the keyboard).
[0094] Then, in order to retrieve the deleted data, if the user clicks the button to delete the keyword, the relevant data for the deleted content is retrieved from the previous storage container; if the user deletes using the keyboard, the relevant information is retrieved from the event object triggered on the DOM tree.
[0095] Based on the content of the above embodiments, as an optional embodiment, after canceling the third state and tag information of the target keyword and changing the second state to the fourth state, the method further includes:
[0096] Retrieve the text of the node preceding and following the current node of the target keyword;
[0097] The text of the previous node, the target keyword, and the text of the next node are merged to generate the merged text.
[0098] Optionally, since the original overall text node structure will be destroyed after being wrapped by the span tag, if the text node merging operation is not performed after removing the span tag, the number of text nodes will increase and the position of the text content in the DOM tree will change. Therefore, in this embodiment, after modifying the background color of the deleted content and removing the span tag, the text of the node before and the text of the node after the target keyword is obtained, and the text of the node before, the target keyword and the text of the node after are merged by the normalize() method in the DOM tree to generate merged text.
[0099] A diagram illustrating the generation of merged text can be found here. Figure 5 ,exist Figure 5 In the text, the original node (i.e., the current node of the target keyword) is xxxxxx. After wrapping the selected portion with a span, we get xx. xx After deleting the span, we get xx xx xx; after merging the nodes, we get xxxxxx.
[0100] Based on the content of the above embodiments, as an optional embodiment, see [link / reference]. Figure 6 , Figure 6 This is a schematic diagram of an optional keyword deletion process according to an embodiment of this application. The specific process is as follows:
[0101] S11, Delete keywords;
[0102] S12, if the user clicks the button to delete;
[0103] S13, Locate the data stored in the storage container; Execute S17;
[0104] S14, if you use the delete key in a text editor to delete;
[0105] S15, listen for the delete event;
[0106] S16, retrieve the deleted data through the event object; execute S17;
[0107] S17, remove the background color and span tag;
[0108] S18, merge text nodes;
[0109] S19, End.
[0110] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0111] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods according to the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM (Read-Only Memory) / RAM (Random Access Memory), magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods of the various embodiments of this application.
[0112] According to another aspect of the embodiments of this application, a keyword processing apparatus for implementing the above-described keyword processing method is also provided. Figure 7 This is a structural block diagram of an optional keyword processing setting according to an embodiment of this application, such as... Figure 7 As shown, the device may include:
[0113] The first acquisition unit 701 is used to acquire the trigger operation performed by the target user on the target document when the target document in the data layer built on the node tree is in the first state. The target document is set in the target webpage and displayed on the target webpage. The first state is used to indicate that the target document is in the browsing state. There is bidirectional binding communication between the node tree and the data layer.
[0114] The determining unit 702 is used to determine the selected target keyword based on the triggering operation when the triggering operation is determined to be a selection operation.
[0115] The modification unit 703 is used to change the current state of the target keyword to a second state and a third state, wherein the second state is used to indicate that the background color of the target keyword is changed, and the third state is used to indicate that the target keyword is in an uneditable state.
[0116] It should be noted that the first acquisition unit 701 in this embodiment can be used to perform the above step S201, the determination unit 702 in this embodiment can be used to perform the above step S202, and the modification unit 703 in this embodiment can be used to perform the above step S203.
[0117] Through the above modules, this application embodiment modifies the selected target keywords into second and third states, which saves time and improves performance when obtaining target keyword annotation information. This solves the problem in related technologies that it is time-consuming and has poor performance when viewing annotation information, which requires traversing the entire document's DOM tree to extract relevant information.
[0118] Based on the content of the above embodiments, as an optional embodiment, the determining unit includes:
[0119] The first determining module is used to determine the selected target location within the target document based on the triggering operation, wherein the target location includes a start position and an end position;
[0120] The second determining module is used to determine the target keywords corresponding to the target location based on the starting point and ending point.
[0121] Based on the above embodiments, as an optional embodiment, the device further includes:
[0122] The setting unit is used to set tag information for the target keyword before changing the current state of the target keyword to the second and third states, wherein the tag information contains a unique identifier.
[0123] The first modification unit is used to modify the current status of the target keyword based on the tag information.
[0124] Based on the content of the above embodiments, as an optional embodiment, the first modification unit includes:
[0125] The first acquisition submodule is used to acquire historical keywords stored in the storage container, wherein the historical keywords are the text that has been selected as keywords;
[0126] The second acquisition submodule is used to acquire the start and end positions of historical keywords, and to acquire the start and end positions of target keywords.
[0127] The first comparison submodule is used to compare the starting position of the historical keyword with the starting position of the target keyword, and obtain the maximum value as the first data.
[0128] The second comparison submodule is used to compare the ending position of the historical keyword with the ending position of the target keyword, and obtain the minimum value as the second data.
[0129] The modification submodule is used to modify the current state of the target keyword when the first data is greater than the second data.
[0130] Based on the content of the above embodiments, as an optional embodiment, the triggering operation includes a deletion operation, and the device further includes:
[0131] The second modification unit is used to, after changing the current state of the target keyword to the second and third states, and if the triggering operation is determined to be a deletion operation, cancel the third state and tag information of the target keyword, and change the second state to the fourth state, wherein the fourth state is used to indicate that the background color of the target keyword is colorless.
[0132] Based on the content of the above embodiments, as an optional embodiment, the method for determining that the triggering operation is a deletion operation in the second modification unit includes:
[0133] The system obtains the click action performed by the target user on the delete button corresponding to the target keyword, where the delete button is set within the target webpage;
[0134] or,
[0135] The control device was detected to have performed a deletion event on the target keyword.
[0136] Based on the above embodiments, as an optional embodiment, the device further includes:
[0137] The second acquisition unit is used to cancel the third state and tag information of the target keyword, change the second state to the fourth state, and then acquire the text of the node before and after the current node of the target keyword.
[0138] The merge unit is used to merge the text of the previous node, the target keyword, and the text of the next node to generate merged text.
[0139] It should be noted that the examples and application scenarios implemented by the above modules and corresponding steps are the same, but are not limited to the content disclosed in the above embodiments. It should also be noted that the above modules, as part of a device, can operate in environments such as... Figure 1 The hardware environment shown can be implemented through software or hardware, and the hardware environment includes the network environment.
[0140] According to another aspect of the embodiments of this application, an electronic device for implementing the above-described keyword processing method is also provided. The electronic device may be a server, a terminal, or a combination thereof.
[0141] Figure 8This is a structural block diagram of an optional electronic device according to an embodiment of this application, such as... Figure 8 As shown, it includes a processor 801, a communication interface 802, a memory 803, and a communication bus 804. The processor 801, communication interface 802, and memory 803 communicate with each other via the communication bus 804.
[0142] Memory 803 is used to store computer programs;
[0143] When processor 801 executes a computer program stored in memory 803, it performs the following steps:
[0144] When the target document in the data layer built on the node tree is in the first state, the trigger operation performed by the target user on the target document is obtained. The target document is set in the target webpage and displayed on the target webpage. The first state is used to indicate that the target document is in the browsing state. There is bidirectional binding communication between the node tree and the data layer.
[0145] If the triggering operation is determined to be a selection operation, the target keyword to be selected is determined based on the triggering operation;
[0146] Change the current state of the target keyword to the second and third states. The second state indicates that the background color of the target keyword should be changed, and the third state indicates that the target keyword is in an uneditable state.
[0147] Optionally, in this embodiment, the communication bus can be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0148] The communication interface is used for communication between the aforementioned electronic devices and other devices.
[0149] The memory may include RAM, or non-volatile memory, such as at least one disk storage device. Optionally, the memory may also be at least one storage device located remotely from the aforementioned processor.
[0150] As an example, such as Figure 8As shown, the memory 803 may include, but is not limited to, the first acquisition unit 701, the determination unit 702, and the modification unit 703 in the processing device for the aforementioned keywords. Furthermore, it may include, but is not limited to, other module units in the keyword processing device, which will not be elaborated upon in this example.
[0151] The processors mentioned above can be general-purpose processors, including but not limited to: CPU (Central Processing Unit), NP (Network Processor), etc.; they can also be DSP (Digital Signal Processor), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.
[0152] In addition, the aforementioned electronic device also includes a display for showing the processing results of the keywords.
[0153] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated here.
[0154] Those skilled in the art will understand that Figure 8 The structure shown is for illustrative purposes only. The device implementing the above keyword processing method can be a terminal device, such as a smartphone (e.g., Android phone, iOS phone), tablet computer, PDA, mobile Internet Device (MID), PAD, etc. Figure 8 This does not limit the structure of the aforementioned electronic devices. For example, the terminal device may also include components that are more advanced than those described above. Figure 8 The more or fewer components shown (such as network interfaces, display devices, etc.), or having the same Figure 8 The different configurations shown.
[0155] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the terminal device. The program can be stored in a computer-readable storage medium, which may include: flash drive, ROM, RAM, disk or optical disk, etc.
[0156] According to another aspect of the embodiments of this application, a storage medium is also provided. Optionally, in this embodiment, the storage medium can be used to execute program code for a keyword processing method.
[0157] Optionally, in this embodiment, the storage medium may be located on at least one of the network devices in the network shown in the above embodiment.
[0158] Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps:
[0159] When the target document in the data layer built on the node tree is in the first state, the trigger operation performed by the target user on the target document is obtained. The target document is set in the target webpage and displayed on the target webpage. The first state is used to indicate that the target document is in the browsing state. There is bidirectional binding communication between the node tree and the data layer.
[0160] If the triggering operation is determined to be a selection operation, the target keyword to be selected is determined based on the triggering operation;
[0161] Change the current state of the target keyword to the second and third states. The second state indicates that the background color of the target keyword should be changed, and the third state indicates that the target keyword is in an uneditable state.
[0162] Optionally, specific examples in this embodiment can refer to the examples described in the above embodiments, and will not be repeated in this embodiment.
[0163] Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, ROMs, RAMs, portable hard drives, magnetic disks, or optical disks.
[0164] According to another aspect of the embodiments of this application, a computer program product or computer program is also provided, the computer program product or computer program including computer instructions stored in a computer-readable storage medium; a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the processing method steps of the keywords in any of the above embodiments.
[0165] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0166] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the processing methods of the keywords in the various embodiments of this application.
[0167] In the above embodiments of this application, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0168] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or the indirect coupling or communication connection of units or modules may be electrical or other forms.
[0169] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the solution provided in this embodiment, depending on actual needs.
[0170] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0171] The above description is only a preferred embodiment of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A keyword processing method, characterized by, The method comprises: In the case that the target document in the data layer constructed on the node tree is in a first state, obtaining a trigger operation performed by a target user on the target document, wherein the target document is arranged in a target webpage and displayed in the target webpage, the first state is used to indicate that the target document is in a browsed state, the node tree and the data layer are in bidirectional binding communication, the corresponding data layer is constructed on the node tree, and in the case that the data in the data layer is modified after the operation of the target user affects the data layer, the node tree is also modified; In the case that the trigger operation is a selection operation, determining a target keyword selected according to the trigger operation; Changing a current state of the target keyword into a second state and a third state, wherein the second state is used to indicate that a background color of the target keyword is changed, and the third state is used to indicate that the target keyword is in an uneditable state; Before the current state of the target keyword is changed into the second state and the third state, the method further comprises: Arranging label information on the target keyword, wherein the label information comprises a unique identification code; Modifying the current state of the target keyword according to the label information; The modification of the current state of the target keyword according to the label information comprises: Obtaining a historical keyword stored in a storage container, wherein the historical keyword is a text selected as a keyword; Obtaining a start point position and an end point position of the historical keyword, and obtaining a start point position and an end point position of the target keyword; Comparing the start point position of the historical keyword with the start point position of the target keyword to obtain a maximum value as first data; Comparing the end point position of the historical keyword with the end point position of the target keyword to obtain a minimum value as second data; In the case that the first data is greater than the second data, modifying the current state of the target keyword.
2. The method of claim 1, wherein, The determination of the target keyword selected according to the trigger operation comprises: Determining a target position selected in the target document according to the trigger operation, wherein the target position comprises a start point position and an end point position; Determining the target keyword corresponding to the target position according to the start point position and the end point position.
3. The method of claim 1, wherein, The trigger operation comprises a deletion operation, and after the current state of the target keyword is changed into the second state and the third state, the method further comprises: In the case that the trigger operation is the deletion operation, canceling the third state of the target keyword and the label information, and changing the second state into a fourth state, wherein the fourth state is used to indicate that the background color of the target keyword is colorless.
4. The method of claim 3, wherein, The manner of determining that the trigger operation is the deletion operation comprises: Obtaining a click operation performed by the target user on a deletion button corresponding to the target keyword, wherein the deletion button is arranged in the target webpage; Or The listening to the operation device performs a delete event on the target keyword.
5. The method of claim 4, wherein, After the third state of the target keyword and the label information are canceled and the second state is changed to a fourth state, the method further includes: Obtaining a previous node text and a next node text located at a current node of the target keyword; Merging the previous node text, the target keyword, and the next node text to generate a merged text.
6. A keyword processing apparatus characterized by comprising: The device includes: The first acquisition unit is configured to acquire a trigger operation performed by a target user on a target document in a first state in a data layer constructed on a node tree, wherein the target document is arranged in a target webpage and displayed in the target webpage, the first state is used to indicate that the target document is in a browsed state, the node tree is in bidirectional binding communication with the data layer, a corresponding data layer is constructed on the node tree, and the node tree is modified automatically in a case where data in the data layer is modified after the operation of the target user affects the data layer; The determination unit is configured to determine a selected target keyword according to the trigger operation in a case where the trigger operation is a selection operation; The changing unit is configured to change a current state of the target keyword to a second state and a third state, wherein the second state is used to indicate that a background color of the target keyword is changed, and the third state is used to indicate that the target keyword is in an uneditable state; The device is further configured to: Set label information for the target keyword, wherein the label information includes a unique identification code; Modify the current state of the target keyword according to the label information; The device is specifically configured to: Obtain a historical keyword stored in a storage container, wherein the historical keyword is a text that has been selected as a keyword; Obtain a start point position and an end point position of the historical keyword, and obtain a start point position and an end point position of the target keyword; Compare the start point position of the historical keyword with the start point position of the target keyword to obtain a maximum value as first data; Compare the end point position of the historical keyword with the end point position of the target keyword to obtain a minimum value as second data; In a case where the first data is greater than the second data, modify the current state of the target keyword.
7. An electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein, The processor, the communication interface, and the memory complete communication with each other through the communication bus, and the method steps of any one of claims 1 to 5 are executed by running the computer program stored in the memory. The storage medium stores a computer program, and the computer program is configured to execute the method steps in any one of claims 1 to 5 when running. The storage medium stores a computer program, and the computer program is configured to execute the method steps in any one of claims 1 to 5 when running.
8. A computer readable storage medium, characterized in that,