Text marking method, device and equipment, readable storage medium and program product
By obtaining the target characters selected by the user and their related word segmentation sets, and marking matching target segments in the text, the problem of only single characters in the prior art is solved, and more efficient text tagging is achieved and user experience is improved.
Patent Information
- Application Number
- CN202510095050.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-21
- Publication Date
- 2025-05-13
AI Technical Summary
The existing text marking method can only singlely mark a single character selected by the user, and cannot meet application needs and affect the user's user experience.
By obtaining the pending text, in response to the user's selection operation, the selected target characters and their related target word segmentation sets are obtained, and matching target word segmentation is marked in the text.
It realizes word segmentation marking of the text selected by the user, meets application needs, improves the user's user experience, and improves the accuracy and universality of word segmentation collections.
Smart Images

Figure CN119990064A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a text marking method, apparatus, device, readable storage medium and program product. Background Art
[0002] With the development of computer technology, electronic devices (e.g., mobile terminal devices) can display content (e.g., text) through various interactive interfaces. Electronic devices can also mark the text selected by the user in response to the user's selection operation on the text. However, the existing methods can only mark the single character selected by the user in a relatively simple manner, which cannot meet the application requirements and affects the user's experience. Summary of the invention
[0003] The embodiments of the present application provide a text marking method, apparatus, device, readable storage medium and program product, which can mark word segments from the text in response to a selection operation on the text, so that the marked word segments meet application requirements and improve the user experience.
[0004] On the one hand, an embodiment of the present application provides a text marking method, the text marking method comprising:
[0005] Obtaining a text to be processed, wherein the text includes a plurality of characters;
[0006] In response to a selection operation on the text, a target character selected in the text is obtained, and a target segmentation set related to the target character is obtained; the target segmentation set is obtained by performing semantic segmentation processing on text content related to the target character in the text;
[0007] Acquire a target word segmentation matching the target character from the target word segmentation set;
[0008] The target word segment is marked in the text.
[0009] Accordingly, an embodiment of the present application provides a text marking device, which includes:
[0010] An acquisition unit, used for acquiring a text to be processed, wherein the text includes a plurality of characters;
[0011] The acquisition unit is further configured to, in response to a selection operation on the text, acquire a selected target character in the text and acquire a target segmentation set related to the target character; the target segmentation set is obtained by performing semantic segmentation processing on text content related to the target character in the text;
[0012] The acquisition unit is further configured to acquire a target word segmentation matching the target character from the target word segmentation set;
[0013] A marking unit is used to mark the target word in the text.
[0014] Accordingly, an embodiment of the present application provides a computer device, the computer device comprising:
[0015] a processor suitable for implementing a computer program;
[0016] A computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the above-mentioned text marking method.
[0017] Correspondingly, an embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is read and executed by a processor of a computer device, the computer device executes the above-mentioned text marking method.
[0018] Accordingly, an embodiment of the present application further provides a computer program product, which includes a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium, and the processor executes the computer program, so that the computer device executes the above-mentioned text marking method.
[0019] When a user selects text content in a text, he usually wants to select a certain word in the text. In the present application, the text to be processed (the text includes multiple characters) can be obtained, and in response to the user's selection operation on the text, the selected target character in the text can be obtained; a target segmentation set related to the target character is obtained, and a target segmentation matching the target character is obtained from the target segmentation set, thereby marking the target segmentation in the text, which effectively meets the application requirements of the "selected word" and improves the user's experience. In addition, the target segmentation set in the present application is obtained by semantically segmenting the text content related to the target character in the text. Therefore, the accuracy of the target segmentation determined according to the target segmentation set is relatively high, and it can also be applied to different application scenarios, with universality. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0021] Figure 1 is a schematic diagram of the system architecture of a text marking system provided in an embodiment of the present application;
[0022] Figure 2 It is a flowchart of a text marking method provided in an embodiment of the present application;
[0023] Figure 3 is a schematic diagram of a target character determination method provided in an embodiment of the present application;
[0024] Figure 4 is a schematic diagram of a method for determining a target word segmentation set provided in an embodiment of the present application;
[0025] Figure 5 is a schematic diagram of a text marking method provided in an embodiment of the present application;
[0026] Figure 6 is a schematic diagram of an interface of an automatic scrolling method provided in an embodiment of the present application;
[0027] Figure 7 is a schematic diagram of an automatic scrolling method provided in an embodiment of the present application;
[0028] Figure 8 It is a flowchart of another text marking method provided in an embodiment of the present application;
[0029] Fig. 9 is a schematic diagram of another text marking method provided in an embodiment of the present application;
[0030] Fig.10 is a structural block diagram of a text marking device provided in an embodiment of the present application;
[0031] Fig.11 It is a structural block diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0032] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0033] It should be noted that the descriptions of "first", "second", etc. involved in the embodiments of the present application are only for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features. Therefore, the technical features defined as "first" or "second" may explicitly or implicitly include at least one of the features.
[0034] It should be noted that the collection and processing of relevant data in this application (for example, data related to text selection operations) should be strictly in accordance with the requirements of relevant laws and regulations when applied in examples, and the informed consent or separate consent of the personal information subject should be obtained. Subsequent data use and processing should be carried out within the scope of authorization of laws and regulations and the personal information subject.
[0035] The text marking method in the embodiment of the present application is applied to a text marking device, which is arranged on a client, and the client can run in a first terminal. The first terminal is provided with one or more processors, a memory, and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the text marking method; wherein the first terminal can be a smart terminal, such as a mobile phone, a wearable device, a vehicle-mounted device, a tablet computer, a network device, and a smart computer.
[0036] An embodiment of the present application provides a text marking system. The architecture of the text marking system provided by the embodiment of the present application will be introduced below in conjunction with the accompanying drawings.
[0037] See also Figure 1 , which is a schematic diagram of the system architecture of a text tagging system provided in an embodiment of the present application, the text tagging system, the text tagging system can be run on a content publishing platform, and the text tagging system can include at least one client 100 (any client 100 is integrated with a text tagging device) and a server 200. A computer-readable storage medium corresponding to the text tagging method is run in the client 100 to execute the text tagging method. The server 200 communicates and interacts with at least one client 100, and the server 200 is also used to send a word segmentation set, text, etc. to any client 100.
[0038] Any client 100 refers to a client for displaying content (the content may include text), that is, a client corresponding to a user. Figure 1 Objects in the ) can interact with their corresponding client 100.
[0039] In this embodiment, any client 100 can obtain a text to be processed, which contains multiple characters. The text to be processed can be sent to any client 100 by the server 200. Any client 100 can obtain the selected target character in the text in response to the object's selection operation on the text, and obtain a target segmentation set related to the target character. The target segmentation set can be obtained by semantically segmenting the text content related to the target character in the text. Any client 100 can obtain the target segmentation that matches the target character from the target segmentation set, and mark the target segmentation in the text, so as to meet the application requirements of the object and improve the user experience.
[0040] Optionally, the target word segmentation set obtained by any client 100 may be implemented as follows: any client 100 may obtain the text content to be segmented from the text according to the position information of the target character in the text, and the text content to be segmented includes the target character, multiple characters located before the target character in the text, and multiple characters located after the target character in the text. Any client 100 may perform semantic segmentation processing on the text content to be segmented using a local dictionary or a word segmentation model to obtain a target word segmentation set. Any client 100 may also send the text content to be segmented to the server 200, and the server 200 may perform semantic segmentation processing on the text content to be segmented to obtain a target word segmentation set, and send the target word segmentation set to any client 100.
[0041] The server 200 in the text tagging system can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers. It can also be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (CDN), as well as big data and artificial intelligence platforms.
[0042] Any client 100 and server 200 may be directly or indirectly connected to each other via wired or wireless communication, and this application does not impose any limitation on this.
[0043] Understandably, Figure 1 The server or at least one client in the text marking system shown does not constitute a limitation on the embodiments of the present invention, that is, the number of servers, the type of servers, the number of at least one client, the type of at least one client, or the number and type of devices contained in each server or client do not affect the overall implementation of the technical solution in the embodiments of the present invention, and can all be regarded as equivalent replacements or derivatives of the technical solution claimed to be protected in the embodiments of the present invention.
[0044] See also Figure 2 , Figure 2 A flowchart of a text marking method provided in an embodiment of the present application is provided. The text marking method can be implemented by the above-mentioned client 100, or by other devices that can implement the text marking method. The text marking method is implemented by the above-mentioned client 100 as an example for explanation. The flowchart of the text marking method provided in the embodiment of the present application includes but is not limited to:
[0045] S201. Obtain a text to be processed, where the text contains a plurality of characters.
[0046] In the embodiment of the present application, the client can obtain the text to be processed, which can contain multiple characters. In some cases, the client can obtain the text to be processed from the server and display the obtained text to be processed in the content interface so that the client can subsequently receive the user's selection operation on the text and implement the response logic of the selection operation.
[0047] S202. In response to a selection operation on the text, a target character selected in the text is obtained, and a target word segmentation set related to the target character is obtained; the target word segmentation set is obtained by performing semantic segmentation processing on text content related to the target character in the text.
[0048] In the embodiment of the present application, the client can interact with the user, and can obtain the target character selected in the text in response to the selection operation of the text. The client can display the text. Usually the user wants to mark a word in the text. At this time, the user can perform a selection operation on the text (for example: long press, drag, etc. on the text), and the selection operation is usually directly for the target character in the text. For example: the text displayed by the client includes the word "conversion rate". When the user wants to mark the word "conversion rate" in the text, it is usually directly to select a character in "conversion rate" (for example, "turn") (for example: long press operation). At this time, the target character selected in the text is the "turn" character. The method provided in the embodiment of the present application can obtain the target character selected in the text in response to the selection operation of the text, which is conducive to the subsequent marking of the target segmentation matching the target character in the text; compared with the existing method of only marking the selected target character in the text, the method provided in the embodiment of the present application can effectively meet the application needs of the user and improve the user experience.
[0049] In one embodiment, in response to a selection operation on a text, a specific implementation method for obtaining a target character selected in the text may be: in response to a selection operation on the text, obtaining operation position information of the selection operation and obtaining text position information of the text; determining relative position information between the operation position of the selection operation and the text based on the operation position information and the text position information, wherein the relative position information includes relative horizontal coordinate information and relative vertical coordinate information; determining the number of selected lines in the text based on the relative vertical coordinate information; and determining the target character selected in the text based on the relative horizontal coordinate and the number of lines.
[0050] Specifically, the client can obtain the operation position information of the selection operation in response to the selection operation of the text, and the operation position information is used to indicate the operation position of the selection operation in the display interface of the client, and the operation position information is based on the display interface of the client. The text position information of the text can be obtained, and the text position information is used to indicate the display starting position of the text in the display interface of the client, and the text position information is also based on the display interface of the client. Both the operation position information and the text position information include horizontal coordinate information and vertical coordinate information.
[0051] According to the operation position information and the text position information, the relative position information between the operation position of the selection operation and the text is determined. The relative position information is used to indicate the relative position of the selection operation in the text. The relative position information is based on the text position information of the text. The relative position information includes relative horizontal coordinate information and relative vertical coordinate information. For example, if the operation position information is (3,2) and the text position information is (1,0), the relative position information can be determined to be (2,2) according to the operation position information and the text position information.
[0052] According to the relative ordinate information, the number of lines selected in the text can be determined. For example, if the relative position information is (2,2) and each line in the text occupies 1 unit of space, the number of lines selected in the text can be determined to be line 2. According to the relative abscissa and the number of lines, the target character selected in the text can be determined. For example, if the relative position information is (2,2) and the number of lines selected in the text is line 2, the target character selected in the text can be determined to be the second character in line 2 of the text.
[0053] It should be noted that, in some cases, the display interface of the client includes one or more text controls, which are used to display text, and each text control can display different text content. At this time, in response to the user's selection operation, the client can obtain the operation position information of the selection operation, and determine the target text control targeted by the selection operation according to the selection operation (for example: the target text control can be determined according to the operation position information and the display range occupied by each text control in the display interface of the client); obtain the text position information of the text displayed by the target text control, and determine the relative position information between the operation position of the selection operation and the text according to the operation position information and the text position information, and determine the target character selected in the target text control according to the relative position information. Through the method provided in the embodiment of the present application, the target character selected by the selection operation can be accurately determined, which is conducive to the subsequent determination of accurate target segmentation according to the target character, and meets the application requirements; the method provided in the present application can also be applied to the scene where the text control displays text, and has good universality.
[0054] See also Figure 3, this figure is a schematic diagram of a target character determination method provided by an embodiment of the present application. Figure 3 3a in it shows the method for determining the target character when the display interface of the client includes multiple text controls; Figure 3 3b in it shows the target character selected by the selection operation in the display interface of the client. As Figure 3 shown in 3a in it, in response to the selection operation on the text, the client obtains the operation position information of the selection operation, and determines the target text control targeted by the selection operation according to the operation position information; obtains the text position information of the text displayed by the target text control, and determines the relative position information between the operation position of the selection operation and the text according to the operation position information and the text position information (this relative position information includes relative abscissa information and relative ordinate information). The client determines the number of selected lines in the target text control according to the relative ordinate information, and determines the target character selected in the target text control according to the relative abscissa and the number of lines.
[0055] As Figure 3 shown in 3b in it, the display interface of the client includes 3 text controls (i.e., text control 1, text control 2, and text control 3), and the texts displayed in each text control are different. The client obtains the operation position information of the selection operation as (4, 3), and the client can determine that the target text control is text control 2 according to the display ranges occupied by the 3 text controls. Obtain the text position information of the text displayed in text control 2 (the text position information is (2, 0)), and determine the relative position information between the operation position of the selection operation and the text according to the operation position information and the text position information (the relative position information is 2, 3). According to the relative ordinate information in the relative position information, determine that the number of selected lines in the target text control is the second line, and according to the relative abscissa information and the number of lines in the relative position information, determine that the target character selected in the target text control is "thing".
[0056] In one embodiment, the specific implementation manner of obtaining the target word segmentation set related to the target character may be: according to the position information of the target character, obtain the text content to be segmented from the text, and the text content includes the target character, multiple characters before the target character in the text, and multiple characters after the target character in the text; perform semantic segmentation processing on the text content to obtain the target word segmentation set related to the target character.
[0057] Specifically, after the client determines the target character, it can also determine the position information of the target character, which is used to indicate the position of the target character in the text. For example, the position information of the target character can indicate that the target character is located in the 3rd row and the 2nd column of the text, or it can indicate that the target character is the 21st character in the text. In order to determine the target word segmentation corresponding to the target character, the sentence where the target character is located can be obtained, and the sentence can be semantically segmented, that is, the client can obtain the text content to be segmented from the text according to the position information of the target character, and the text content includes the target character, multiple characters before the target character in the text (which can be called prefix characters), and multiple characters after the target character in the text (which can be called suffix characters). For example, the text to be processed is "Liquid food is a kind of easily digestible and nutritious food, which is very helpful for postoperative recovery, indigestion, oral diseases and other situations that require soft food. The seven-day liquid food recipe for a week needs to provide comprehensive and balanced nutrition, while meeting the needs of different tastes." If the target character is "ying", the client can determine that the prefix character of the target character is "food is a kind of easily digestible, "and the suffix character is "nutritious food, right". The number of prefix characters and suffix characters may be the same or different, and the number of prefix characters and suffix characters may be adaptively adjusted according to application requirements and texts.
[0058] After determining the text content, the text content can be semantically segmented to obtain a target word segmentation set related to the target character. The client can use a local dictionary or a local word segmentation model to perform semantic segmentation on the text content to obtain a target word segmentation set. Compared with the method for semantically segmenting text, the method provided in the present application only performs real-time semantic segmentation on the text content associated with the target content, thereby improving processing efficiency. Through the method provided in the embodiment of the present application, the text content can be determined according to the target character, and then the text content can be semantically segmented to obtain a target word segmentation set, so that the text content can be semantically segmented in a targeted manner, reducing the amount of data processing, and also improving the efficiency of determining the target word segmentation set, and enhancing the user experience.
[0059] It should be noted that, in some cases, the client can be deployed on a text tagging device, and the text tagging device also includes a server that interacts with the client, and the process of semantic segmentation of the text content can also be performed by the server. Specifically, the client can send the determined text content to the server, and the server performs semantic segmentation on the text content to obtain a target word set related to the target character; the server sends the target word set to the client.
[0060] In one embodiment, a specific implementation method for obtaining a target word segmentation set related to a target character may be: obtaining a text word segmentation set, the text word segmentation set including a plurality of word segmentation sets corresponding to text contents, the word segmentation set corresponding to the text contents being obtained by semantically segmenting the corresponding text contents; extracting the text word segmentation set according to the text contents related to the target characters in the text to obtain a target word segmentation set related to the target characters.
[0061] Specifically, the client can obtain a text segmentation set, which may contain a plurality of segmentation sets corresponding to text contents, and the segmentation set corresponding to the text contents is obtained by semantic segmentation processing of the corresponding text contents. The text content in the embodiment of the present application may refer to the sentences contained in the text to be processed. For example: the text to be processed is "liquid food is a kind of easily digestible and nutritious food, which is very helpful for postoperative recovery, indigestion and other situations that require soft food. The seven-day liquid food recipe of the week needs to provide comprehensive and balanced nutrition, while meeting the needs of different tastes", then the text content may be "liquid food is a kind of easily digestible and nutritious food, which is very helpful for postoperative recovery, indigestion and other situations that require soft food" and "the seven-day liquid food recipe of the week needs to provide comprehensive and balanced nutrition, while meeting the needs of different tastes". The client can extract and process the text segmentation set according to the text content related to the target character in the text, and obtain the target segmentation set related to the target character. For example: the client can determine the sentence where the target character is located in the text (i.e., the text content related to the target character) according to the position information of the target character, and then extract the target segmentation set from the text segmentation set.
[0062] It should be noted that the text segmentation set can be obtained by the client performing semantic segmentation processing on the text content, or by the server that interacts with the client performing semantic segmentation processing on the text content. Specifically, when sending a text to the client, the server can perform semantic segmentation processing on the text content (for example, a sentence) contained in the text to obtain a text segmentation set; the server can send the text and the text segmentation set to the client, and the client can determine the target segmentation set from the text segmentation set in response to the selection operation.
[0063] In some cases, the client can display a content interface, which includes multiple text controls. The texts displayed in each text control are different. Then the client obtains a text word segmentation set, which contains the word segmentation sets corresponding to multiple text contents, and the text contents are the texts displayed in each text control. The client can determine the target text control corresponding to the target character according to the position information of the target character, and determine the word segmentation set corresponding to the text content in the target text control as the target word segmentation set. At this time, the text word segmentation set can be generated by the client or by the server that interacts with the client.
[0064] Please refer to Figure 4 , which is a schematic diagram of a method for determining a target word segmentation set provided by an embodiment of the present application. Figure 4 Two different methods for determining the target word segmentation set are shown. The first method is: the client obtains the text content to be segmented from the text according to the position information of the target character. The text content to be segmented includes the target character, multiple characters before the target character in the text, and multiple characters after the target character in the text; the client uses a local dictionary or a word segmentation model to perform semantic segmentation processing on the text content to be segmented to obtain the target word segmentation set, or the client sends the text content to be segmented to the server, and the server performs semantic segmentation processing on the text content and sends the obtained target word segmentation set to the client.
[0065] The second method is: the client performs semantic segmentation processing on multiple text contents to obtain a text word segmentation set, or the client receives the text word segmentation set sent by the server. The text word segmentation set includes the word segmentation sets corresponding to multiple text contents; the client extracts the target word segmentation set related to the target character from the text word segmentation set according to the text content related to the target character in the text. After determining the target word segmentation set, the client obtains the target word that matches the target character from the target word segmentation set.
[0066] S203. Obtain the target word that matches the target character from the target word segmentation set.
[0067] In the embodiment of the present application, the client can obtain the target word that matches the target character from the target word segmentation set. For example: the target character is "need", and the target word that matches the target character can be "requirement". Through the method provided by the embodiment of the present application, the target word can be determined, which is beneficial to subsequently marking the target word in the text, thereby meeting the user's text marking requirement and improving the usage experience.
[0068] In one embodiment, the target word segmentation set includes multiple word segmentation groups, and the word segmentation group includes semantic word segmentation and range information, and the range information is used to indicate the position of each character included in the semantic word segmentation in the text; then the specific implementation method of obtaining the target word segmentation matching the target character from the target word segmentation set can be: obtaining the position information of the target character, and the position information is used to indicate the position of the target character in the text; matching the position information of the target character with the range information included in each word segmentation group to obtain a matching result, and the matching result is used to indicate whether there is a matching word segmentation group in the target word segmentation set, and the matching word segmentation group includes range information that matches the position information of the target character; if the matching result indicates that there is a matching word segmentation group in the target word segmentation set, the semantic word included in the matching word segmentation group is determined as the target word segmentation matching the target character.
[0069] Specifically, the target word segmentation set may include multiple word segmentation groups, each word segmentation group includes semantic word segmentation and range information, and the range information is used for the position of each character contained in the semantic word segmentation in the text. For example: the semantic word contained in a word segmentation group is "recipe", and the range information is "row 1 column 1 to row 1 column 2", where "row 1 column 1" and "row 1 column 2" both indicate the position of the characters contained in the semantic word segmentation in the text. In some cases, the word segmentation groups in the word segmentation set can also be stored in the form of a list, that is, word segmentation group (semantic word segmentation, position information of the first character in the semantic word segmentation, position information of the last character in the semantic word segmentation), for example: word segmentation group 1 (recipe, 1, 3), where "recipe" is a semantic word segmentation, the position information of the first character in the semantic word segmentation is "the first character in the text", and the position information of the last character in the semantic word segmentation is "the second character in the text", so the range information can be determined to be (1,2+1). Adding 1 to the data indicated by the position information of the last character in the semantic segmentation is to make the range information form an interval, because in some cases, the semantic segmentation contains only one character.
[0070] When determining the target word segmentation, the client can obtain the position information of the target character, which can be used to indicate the position of the target character in the text. For example, the position information of the target character can be "row 2, column 3" or "character 20 in the text". The client can match the position information of the target character with the range information contained in each word segmentation group in the target word segmentation set to obtain a matching result. The matching result can indicate whether there is a matching word segmentation group in the target word segmentation set, and the matching word segmentation group contains range information that matches the position information of the target character.
[0071] If the matching result indicates that there is a matching word group in the target word set, the semantic word contained in the matching word group can be determined as the target word that matches the target character. For example: the position information of the target character is "the 20th character in the text", the range information contained in the matching word group is (19,21), and the semantic word contained in the matching word group is "video", then the target word that matches the target character can be determined to be "video". Through the method provided in the embodiment of the present application, matching can be performed through position information, thereby accurately determining the target word that matches the target character.
[0072] In one embodiment, the specific implementation method of obtaining the target word segmentation matching the target character from the target word segmentation set may also include the following steps: if the matching result indicates that there is no matching word segmentation group in the target word segmentation set, the target character is determined as the target word segmentation matching the target character.
[0073] Specifically, the client can match the position information of the target character with the range information contained in each word segmentation group in the target word segmentation set to obtain a matching result. If the matching result indicates that there is no matching word segmentation group in the target word segmentation set, the client can determine that the target character is a target word segmentation that matches the target character, that is, the target character cannot be divided into any word segmentation, and therefore needs to be marked separately.
[0074] In one embodiment, each word segmentation group included in the target word segmentation set has its own arrangement order; then the position information of the target character is matched with the range information included in each word segmentation group to obtain the matching result. The specific implementation method can be: determine the word segmentation group with the tth arrangement position in the target word segmentation set as the to-be-selected word segmentation group, where t is a positive integer; match the range information included in the to-be-selected word segmentation group with the position information of the target character; if the range information included in the to-be-selected word segmentation group includes the position information of the target character, determine a first matching result based on the to-be-selected word segmentation group, and the first matching result indicates that there is a matching word segmentation group in the target word segmentation set; if the range information included in the to-be-selected word segmentation group does not include the position information of the target character, determine the word segmentation group with the t+1th arrangement position in the target word segmentation set as the to-be-selected word segmentation group, and determine the matching result based on the to-be-selected word segmentation group.
[0075] Specifically, the target word segmentation set contains multiple word segmentation groups, and the client can traverse and match multiple word segmentation groups in the target word segmentation set according to the position information of the target character. That is, the client can determine the word segmentation group with the tth (t is a positive integer) position in the target word segmentation set as the word segmentation group to be selected, and match the range information contained in the word segmentation group to be selected with the position information of the target character. If the range information contained in the word segmentation group to be selected contains the position information of the target character (for example: the range information is (1,3), and the position information of the target character is "2"), then the word segmentation group to be selected is determined as the matching word segmentation group, and the first matching result is determined. If the range information contained in the word segmentation group to be selected does not contain the position information of the target character (for example: the range information is (1,3), and the position information of the target character is "6"), then the word segmentation group with the t+1th position in the target word segmentation set is determined as the word segmentation group to be selected, and the newly determined word segmentation group to be selected is matched with the position information of the target character to determine the matching result. It should be noted that when t+1 is greater than the number of word segments included in the target word segmentation set, a second matching result is directly determined, and the second matching result indicates that there is no matching word segmentation group in the target word segmentation set. Through the method provided in the embodiment of the present application, the word segmentation groups included in the target word segmentation set can be traversed and matched according to the position information of the target character, so that the target word segmentation can be accurately determined.
[0076] S204: Mark the target word segment in the text.
[0077] In an embodiment of the present application, after determining the target word segmentation, the client can mark the target word segmentation in the text. The method of marking the target word segmentation can be a method such as shading, highlighting, underlining, bold font, italic font, etc. to make the target word segmentation different from other text contents in the text. It should be noted that the target word segmentation includes the target character selected by the selection operation. Through the method provided in the embodiment of the present application, in response to the user's trigger operation for a certain character, the word segmentation containing the character can be marked, thereby meeting the user's word segmentation marking needs and helping to improve the user experience.
[0078] See also Figure 5 , which is a schematic diagram of a text marking method provided in an embodiment of the present application. Figure 5 As shown in 5a in FIG. 1 , the client displays a content interface including text, and the user can interact with the client. The user can select the text. Figure 5As can be seen from 5a, the character targeted by the selection operation is the character "thing" in the text. In response to the user's selection operation on the text, the client can obtain the selected target character (i.e., "thing") in the text, and obtain the target word segmentation set related to the target character. This target word segmentation set is obtained by performing semantic segmentation processing on the text content related to the target character in the text. The client can obtain the target word segmentation that matches the target character from the target word segmentation set. The target word segmentation is "food", and the client can mark the target word segmentation in the text, such as Figure 5 As shown in 5b, the marking method of the target word segmentation "food" is a shaded background.
[0079] In one embodiment, the text content included in the text exceeds the display interface of the text, and the target character is located outside the display interface. The text marking method provided by the present application may further include the following steps: scrolling and displaying the target character in the display interface at a scrolling display rate so that the target character is located within the display interface, where the scrolling display rate is determined according to the screen refresh rate corresponding to the display interface.
[0080] Specifically, the animation effect utilizes the persistence of vision effect. When a set of static pictures are continuously switched and displayed and the number of pictures in this set is greater than 10 - 12, a dynamic effect will be presented, and the number of pictures displayed per second is called the frame rate. And the display device (such as a monitor, mobile phone, etc.) also has a corresponding concept of frame rate, that is, the screen refresh rate. The screen refresh rate refers to the number of new image frames drawn by the display device per second. Currently, the screen refresh rates of most mobile phones are 60hz, 90hz, or 120hz. When the client displays a display interface containing text and the target character is not located within the display interface (for example, the target character is located outside the display interface) or the target character is not completely located within the display interface (for example, the target character includes a first character and a second character, and the first character is located within the display interface while the second character is located outside the display interface), the client can activate the automatic scrolling function. At this time, the client can automatically scroll and display the target character in the display interface at the scrolling display rate so that the target character is completely located within the display interface.
[0081] In some cases, when the system corresponding to the client is the Android system, the client can participate in the drawing of image frames according to the Choreographer interface provided by the Android system, and perform a small - base displacement of the drawn image frames according to the scrolling display rate until the target character is completely displayed. After the target character is completely displayed, the client can stop participating in the drawing of image frames, thereby stopping the automatic scrolling.
[0082] The scrolling display rate is determined according to the screen refresh rate corresponding to the display interface of the client. For example, if the screen refresh rate is 60 hz, the scrolling display rate can be determined to be 2, that is, every 1 / 60 second, the client can displace the image frames displayed in the display interface by 2 pixels (usually moving down or up), so that after 1 second, the image frames displayed in the display interface scroll a distance of (2 * 60) pixels, achieving a smooth automatic scrolling effect. It should be noted that the scrolling display rate can also be determined according to the screen refresh rate and the scrolling effect data. For example, if the scrolling effect data is 180 and the screen refresh rate is 60 hz, the scrolling display rate can be determined to be 3; if the screen refresh rate is 90 hz, the scrolling display rate can be determined to be 2. Through the method provided by the embodiments of the present application, automatic scrolling can be achieved, ensuring that the target characters can be fully displayed, guaranteeing the user experience, and the scrolling display rate can also be determined according to the screen refresh rate of the device, so as to scroll at a smaller rate, achieving a smooth scrolling effect while making the method have better universality.
[0083] It should be noted that when the target characters are not fully displayed, it is a feasible implementation for the client to perform automatic scrolling. In the actual application process, the client can also perform automatic scrolling when the target word segmentation is not fully displayed, so that the target word segmentation can be fully displayed.
[0084] Please refer to Figure 6 , which is a schematic diagram of the interface of an automatic scrolling method provided by the embodiments of the present application. As Figure 6 shown in 6a, the text content contained in the text exceeds the display interface of the text, and the target characters are not fully located within the display interface (that is, the target characters include the first character (the first character is "sand") and the second character (the second character is "sugar"), the first character is within the display interface, and the second character is outside the display interface). The client can scroll and display the target characters in the display interface at the scrolling display rate, so that the first character and the second character are within the display interface. As Figure 6 shown in 6b, the scrolling display rate is determined according to the screen refresh rate corresponding to the display interface.
[0085] Please refer to Figure 7 , which is a schematic diagram of an automatic scrolling method provided by the embodiments of the present application. As Figure 7 shown, when the client detects a user's selection operation on the text, it obtains the target characters selected by the selection operation; according to whether the target characters are fully displayed and whether the text content contained in the text exceeds the display interface of the text, it determines whether to activate the automatic scrolling function. If the target characters are not fully displayed and the text content contained in the text exceeds the display interface of the text (that is Figure 7The client can participate in the drawing of the image frame according to the interface, and perform a small cardinality screen shift on the drawn image frame according to the scrolling display rate until the target character is fully displayed. When the target character is fully displayed, the client can detect the user's selection operation on the text again. If the target character is fully displayed, or the text content contained in the text does not exceed the text display interface (i.e. Figure 7 If the "No" branch is not found in the above example, the client does not activate the automatic scrolling function and continues to detect the user's selection operation on the text.
[0086] The text marking method provided by the present application can determine the target character selected by the selection operation in response to the selection operation on the text, so that the target word segmentation containing the target character can be determined and marked, which effectively meets the user's word segmentation marking needs and improves the user experience; in the process of determining the word segmentation, the text content can be determined according to the position information of the target word segmentation, and then the target word segmentation set can be determined, which effectively improves the efficiency of determining the word segmentation set, and then the efficiency of marking the target word segmentation can be improved, and the user experience is further improved; the method provided by the present application can also realize automatic scrolling, ensuring that the characters selected by the selection operation can be fully displayed, ensuring the user experience, and can also determine the scrolling display rate according to the screen refresh rate of the device, so as to scroll at a smaller rate, while achieving a smooth scrolling effect, the method also has good universality.
[0087] See also Figure 8 , Figure 8 A flowchart of another text marking method provided in an embodiment of the present application is shown below. Figure 1 The client 100 and server 200 in the text marking system shown are implemented. The process of the text marking method provided in the embodiment of the present application includes but is not limited to:
[0088] S801. The server sends the text to be processed to the client.
[0089] In the embodiment of the present application, the server can send the text to be processed to the client, and the text to be processed can be the text contained in the published content, and the text contains multiple characters. In some cases, the server can also perform semantic segmentation on the text to be processed to obtain a text segmentation set, and send the text segmentation set and the text to be processed to the client, so that the client can subsequently determine the target segmentation according to the text segmentation set.
[0090] S802: The client displays the text to be processed, and in response to a selection operation on the text, obtains a target character selected in the text.
[0091] In an embodiment of the present application, the client can display the text to be processed on the display interface. The display interface can include multiple text controls, each of which is used to display text. The client can interact with the user, and the user can select the text displayed in the display interface. The client can respond to the selection operation on the text and obtain the target character selected in the text. The implementation method of determining the target character can be as shown in the above step S202.
[0092] S803: The client obtains a target word segmentation set related to the target character, where the target word segmentation set is obtained by performing semantic segmentation processing on text content related to the target character in the text.
[0093] In an embodiment of the present application, the client can obtain a target word segmentation set related to the target character, which is obtained by semantically segmenting the text content related to the target character in the text. The target word segmentation set can be obtained by extracting the text word segmentation set, or by semantically segmenting the text content related to the target character.
[0094] S804: The client obtains a target word segmentation that matches the target character from the target word segmentation set, and marks the target word segmentation in the text.
[0095] In an embodiment of the present application, the client can obtain a target word segmentation that matches the target character from the target word segmentation set. Specifically, the client can match the target character with the word segmentation group contained in the target word segmentation set. If there is a matching word segmentation group in the target word segmentation set, the client can determine the semantic word segmentation contained in the matching word segmentation group as the target word segmentation. If there is no matching word segmentation group in the target word segmentation set, the client can determine the target character as the target word segmentation. The client can mark the target word segmentation in the text to indicate that the target word segmentation is the text content selected by the selection operation. Through the method provided in the embodiment of the present application, word segmentation processing can be performed, so that the client directly marks the target word segmentation in response to the selection operation for the text, which meets the user's word segmentation selection needs and improves the user experience.
[0096] In one embodiment, the marking method is shadow, and the specific implementation method of marking the target word segmentation in the text can be: determining the shadow starting position according to the position information of the first character in the target word segmentation, and determining the shadow ending position according to the position information of the last character in the target word segmentation; drawing the shadow according to the shadow starting position, the shadow ending position and the line height of the text; drawing the starting mark according to the shadow starting position and the line height of the text, and drawing the ending mark according to the shadow ending position and the line height of the text.
[0097] Specifically, the client can determine the position of the upper left corner of the character according to the position information of the first character in the target word segmentation, and determine the position of the upper left corner of the character as the starting position of the shadow; determine the position of the lower right corner of the character according to the position information of the last character in the target word segmentation, and determine the position of the lower right corner of the character as the ending position of the shadow. The client can draw a shadow according to the starting position of the shadow and the line height of the line where the first character in the target word segmentation is located, draw a shadow according to the ending position of the shadow and the line height of the line where the last character in the target word segmentation is located, and draw a shadow background for the characters between the first character and the last character in the target word segmentation. In order to clearly indicate the starting position and ending position of the target word segmentation, and to facilitate subsequent users to further adjust the selected text content, the client can draw a starting mark at the starting position of the shadow according to the line height of the line where the first character in the target word segmentation is located, and draw an ending mark at the ending position of the shadow according to the line height of the line where the last character in the target word segmentation is located.
[0098] In one embodiment, after the client displays the marked target word segmentation (i.e., the text content selected by the selection operation), the text content selected by the selection operation can also be adjusted. In one case, when the client displays the marked target word segmentation, it can also display the start mark and the end mark, and the characters between the start mark and the end mark are the text content selected by the selection operation. The user can adjust the selected text content by adjusting the position of the start mark or the end mark (for example, dragging the start mark or the end mark). In another case, the client can respond to the user's secondary selection operation (for example, a long press operation on the text), obtain the characters selected by the secondary selection operation, and determine the target word segmentation, the characters selected by the secondary selection operation, and the characters between the characters selected by the secondary selection operation and the target word segmentation as the text content selected by the selection operation. The client can mark the text content selected by the selection operation, and the marking method can be as shown in the above embodiment.
[0099] It should be noted that the text content selected by the selection operation may include text displayed in different text controls, that is, the text selected in the text marking method provided by the present application may be across text controls. And in some cases, the display interface displayed by the client includes not only text (usually plain text) and the marked target word segmentation, but also rich text. Rich text refers to text that contains multimedia elements or format information such as font style (bold, italic, etc.), color, hyperlinks, images, tables, etc. The method provided by the present application can select text content across text controls, and can also display rich text while selecting text content, without affecting the relevant functions of rich text, and can be applied to a variety of application scenarios, with good universality.
[0100] In one embodiment, in response to a trigger operation on a text, the client can display a magnifying glass effect image. Specifically, the client can obtain the trigger position information of the trigger operation in response to the trigger operation on the text (such as a long press operation), and the trigger position information is used to indicate the position corresponding to the trigger operation in the display interface of the client; obtain the operation surrounding image of the position corresponding to the trigger operation according to the trigger position information; enlarge the operation surrounding image to obtain an enlarged image; the client displays the enlarged image on the upper layer of the text and above the position corresponding to the trigger operation, thereby realizing the magnifying glass effect. The method provided in the embodiment of the present application can realize the magnifying glass effect, which is conducive to improving the user experience.
[0101] See also Fig. 9 , which is a schematic diagram of another text marking method provided in an embodiment of the present application. Fig. 9 The display interface displayed by the client is shown, and the display interface includes multiple text controls (respectively, text control a, text control b, text control c, and text control d), and the text controls display plain text and rich text. The client can respond to the text selection operation and mark the target word segmentation (i.e. Fig. 9 The client can also respond to the secondary selection operation on the text, obtain the characters selected by the secondary selection operation, and determine the target word segmentation, the characters selected by the secondary selection operation, and the characters between the characters selected by the secondary selection operation and the target word segmentation as the text content selected by the selection operation (i.e. Fig. 9 "White sugar is enough. Vegetable tofu soup"), such as Fig. 9 As shown, the text content selected by the selection operation is across text controls (across text control c and text control d). The client can draw a shadow background for the text content selected by the selection operation, and draw a start mark and an end mark. In response to the triggering operation on the text, the client can display a magnifying glass effect to display the text content more clearly, assist the user in selecting the text content, and enhance the user's experience. There is no version restriction and it can be implemented in any Android system version.
[0102] The text marking method provided by the present application can determine the target character selected by the selection operation in response to the selection operation on the text, so that the target word segmentation containing the target character can be determined and marked, which effectively meets the user's word segmentation marking needs and improves the user experience; in the process of determining the word segmentation, the text content can be determined according to the position information of the target word segmentation, and then the target word segmentation set can be determined, which effectively improves the efficiency of determining the word segmentation set, and then the efficiency of marking the target word segmentation can be improved, and the user experience is further improved; the method provided by the present application can also realize automatic scrolling, ensuring that the characters selected by the selection operation can be fully displayed, ensuring the user experience, and can also determine the scrolling display rate according to the screen refresh rate of the device, so as to scroll at a smaller rate, while achieving a smooth scrolling effect, the method also has good universality.
[0103] See also Fig.10 , Fig.10 This is a structural block diagram of a text marking device provided in an embodiment of the present application. The text marking device can be set in the computer device provided in an embodiment of the present application, and the computer device can be the above-mentioned Figure 1 A client 100 in the text marking system is shown. Fig.10 The text marking device shown can be a computer program running in a computer device, and the text marking device can be used to execute Figure 2 or Figure 8 Part or all of the steps in the text marking method embodiment shown. Fig.10 , the text marking device may include the following units:
[0104] An acquisition unit 1001 is used to acquire a text to be processed, wherein the text includes a plurality of characters;
[0105] The acquisition unit 1001 is further configured to, in response to a selection operation on the text, acquire a target character selected in the text and acquire a target segmentation set related to the target character; the target segmentation set is obtained by performing semantic segmentation processing on text content related to the target character in the text;
[0106] The acquisition unit 1001 is further configured to acquire a target word segmentation matching the target character from the target word segmentation set;
[0107] The marking unit 1002 is used to mark the target word in the text.
[0108] In one embodiment, the target word segmentation set includes multiple word segmentation groups, the word segmentation groups include semantic word segmentations and range information, and the range information is used to indicate the position of each character included in the semantic word segmentation in the text; the acquisition unit 1001 is used to acquire a target word segmentation matching the target character from the target word segmentation set, specifically to perform the following steps:
[0109] Acquire position information of the target character, where the position information is used to indicate the position of the target character in the text;
[0110] Matching the position information of the target character with the range information contained in each of the word segments to obtain a matching result, wherein the matching result is used to indicate whether there is a matching word segmentation group in the target word segmentation set, and the matching word segmentation group contains range information that matches the position information of the target character;
[0111] If the matching result indicates that the matching word group exists in the target word set, the semantic word included in the matching word group is determined as the target word that matches the target character.
[0112] In one embodiment, the acquisition unit 1001 is used to acquire the target segmentation matching the target character from the target segmentation set, and is also used to perform the following steps:
[0113] If the matching result indicates that the matching word segment group does not exist in the target word segment set, the target character is determined as a target word segment that matches the target character.
[0114] In one embodiment, the acquisition unit 1001 is used to acquire a target word segmentation set related to the target character, and is specifically used to perform the following steps:
[0115] According to the position information of the target character, obtaining text content to be segmented from the text, the text content including the target character, a plurality of characters located before the target character in the text, and a plurality of characters located after the target character in the text;
[0116] The text content is subjected to semantic segmentation processing to obtain a target word set related to the target character.
[0117] In one embodiment, the acquisition unit 1001 is used to acquire a target word segmentation set related to the target character, and is specifically used to perform the following steps:
[0118] Obtain a text segmentation set, wherein the text segmentation set includes a plurality of segmentation sets corresponding to text contents, and the segmentation sets corresponding to the text contents are obtained by performing semantic segmentation processing on the corresponding text contents;
[0119] The text segmentation set is extracted based on the text content related to the target character in the text to obtain a target segmentation set related to the target character.
[0120] In one embodiment, each word segmentation group included in the target word segmentation set has its own arrangement order; the acquisition unit 1001 is used to match the position information of the target character with the range information included in each word segmentation group, and when the matching result is obtained, it is specifically used to perform the following steps:
[0121] Determine the word group with the tth position in the target word set as the word group to be selected, where t is a positive integer;
[0122] Matching the range information included in the to-be-selected word group with the position information of the target character;
[0123] If the range information included in the to-be-selected word segmentation group includes the position information of the target character, determining a first matching result according to the to-be-selected word segmentation group, the first matching result indicating that there is a matching word segmentation group in the target word segmentation set;
[0124] If the range information contained in the to-be-selected word group does not contain the position information of the target character, the word group arranged at the t+1th position in the target word set is determined as the to-be-selected word group, and a matching result is determined based on the to-be-selected word group.
[0125] In one embodiment, the acquisition unit 1001 is used to obtain the selected target character in the text in response to the selection operation on the text, and is specifically used to perform the following steps:
[0126] In response to a selection operation on the text, obtaining operation position information of the selection operation and obtaining text position information of the text;
[0127] Determine relative position information between the operation position of the selection operation and the text according to the operation position information and the text position information, wherein the relative position information includes relative horizontal coordinate information and relative vertical coordinate information;
[0128] Determine the number of selected lines in the text according to the relative ordinate information;
[0129] The selected target character in the text is determined according to the relative horizontal coordinate and the number of lines.
[0130] In one embodiment, the text marking device further includes a display unit 1003, the text content included in the text exceeds the display interface of the text, and the target character is located outside the display interface, and the display unit 1003 is further used to perform the following steps:
[0131] The target character is scrolled and displayed in the display interface at a scrolling display rate so that the target character is located within the display interface, wherein the scrolling display rate is determined according to a screen refresh rate corresponding to the display interface.
[0132] The text marking device provided by the present application can determine the target character selected by the selection operation in response to the selection operation on the text, so that the target word segmentation containing the target character can be determined and marked, which effectively meets the user's word segmentation marking needs and improves the user experience; in the process of determining the word segmentation, the text content can be determined according to the position information of the target word segmentation, and then the target word segmentation set can be determined, which effectively improves the efficiency of determining the word segmentation set, and then the efficiency of marking the target word segmentation can be improved, and the user experience is further improved; the method provided by the present application can also realize automatic scrolling, ensuring that the characters selected by the selection operation can be fully displayed, ensuring the user experience, and can also determine the scrolling display rate according to the screen refresh rate of the device, so as to scroll at a smaller rate, while achieving a smooth scrolling effect, the method also has good universality.
[0133] Based on the above method and device embodiments, the present application embodiment provides a computer device. Fig.11 , Fig.11 A structural block diagram of a computer device provided in an embodiment of the present application. Fig.11 The computer device shown can be the above Figure 1 The client 100 in. Fig.11 The computer device shown includes at least a processor 1101, an input interface 1102, an output interface 1103, and a computer-readable storage medium 1104. The processor 1101, the input interface 1102, the output interface 1103, and the computer-readable storage medium 1104 may be connected via a bus or other means.
[0134] The computer-readable storage medium 1104 may be stored in a memory of a computer device. The computer-readable storage medium 1104 is used to store a computer program. The computer program includes program instructions (such as Fig.11The processor 1101 is used to execute the computer program stored in the computer-readable storage medium 1104. The processor 1101 (or CPU (Central Processing Unit)) is the computing core and control core of the computer device, which is suitable for implementing the computer program, and is specifically suitable for loading and executing the computer program to implement the corresponding method flow or corresponding function.
[0135] The embodiment of the present application also provides a computer-readable storage medium (Memory), which is a memory device in a computer device for storing programs and data. It is understandable that the computer-readable storage medium here can include both built-in storage media in the computer device and, of course, extended storage media supported by the computer device. The computer-readable storage medium provides a storage space that stores the operating system of the computer device. In addition, a computer program suitable for being loaded and executed by a processor is also stored in the storage space. It should be noted that the computer-readable storage medium here can be a high-speed RAM memory or a non-volatile memory (Non-Volatile Memory), such as at least one disk storage; optionally, it can also be at least one computer-readable storage medium located away from the aforementioned processor.
[0136] In a specific implementation, the processor 1101 may load and execute a computer program stored in the computer-readable storage medium 1104 to implement the above-mentioned Figure 2 or Figure 8 In a specific implementation, the computer program in the computer-readable storage medium 1104 is loaded by the processor 1101 and executes the following steps:
[0137] Obtaining a text to be processed, wherein the text includes a plurality of characters;
[0138] In response to a selection operation on the text, a target character selected in the text is obtained, and a target segmentation set related to the target character is obtained; the target segmentation set is obtained by performing semantic segmentation processing on text content related to the target character in the text;
[0139] Acquire a target word segmentation matching the target character from the target word segmentation set;
[0140] The target word segment is marked in the text.
[0141] In one embodiment, the target word segmentation set includes multiple word segmentation groups, the word segmentation groups include semantic word segmentations and range information, and the range information is used to indicate the position of each character included in the semantic word segmentation in the text; when the computer program in the computer-readable storage medium 1104 is loaded and executed by the processor 1101 to obtain a target word segmentation matching the target character from the target word segmentation set, it is specifically used to perform the following steps:
[0142] Acquire position information of the target character, where the position information is used to indicate the position of the target character in the text;
[0143] Matching the position information of the target character with the range information contained in each of the word segments to obtain a matching result, wherein the matching result is used to indicate whether there is a matching word segmentation group in the target word segmentation set, and the matching word segmentation group contains range information that matches the position information of the target character;
[0144] If the matching result indicates that the matching word group exists in the target word set, the semantic word included in the matching word group is determined as the target word that matches the target character.
[0145] In one embodiment, when the computer program in the computer-readable storage medium 1104 is loaded and executed by the processor 1101 to obtain a target word segmentation matching the target character from the target word segmentation set, the computer program is further configured to perform the following steps:
[0146] If the matching result indicates that the matching word segment group does not exist in the target word segment set, the target character is determined as a target word segment that matches the target character.
[0147] In one embodiment, when the computer program in the computer-readable storage medium 1104 is loaded and executed by the processor 1101 to obtain a target word segmentation set related to the target character, it is specifically used to perform the following steps:
[0148] According to the position information of the target character, obtaining text content to be segmented from the text, the text content including the target character, a plurality of characters located before the target character in the text, and a plurality of characters located after the target character in the text;
[0149] The text content is subjected to semantic segmentation processing to obtain a target word set related to the target character.
[0150] In one embodiment, when the computer program in the computer-readable storage medium 1104 is loaded and executed by the processor 1101 to obtain a target word segmentation set related to the target character, it is specifically used to perform the following steps:
[0151] Obtain a text segmentation set, wherein the text segmentation set includes a plurality of segmentation sets corresponding to text contents, and the segmentation sets corresponding to the text contents are obtained by performing semantic segmentation processing on the corresponding text contents;
[0152] The text segmentation set is extracted based on the text content related to the target character in the text to obtain a target segmentation set related to the target character.
[0153] In one embodiment, each word segmentation group included in the target word segmentation set has its own arrangement order; the computer program in the computer-readable storage medium 1104 is loaded and executed by the processor 1101 to match the position information of the target character with the range information included in each word segmentation group, and when a matching result is obtained, it is specifically used to perform the following steps:
[0154] Determine the word group with the tth position in the target word set as the word group to be selected, where t is a positive integer;
[0155] Matching the range information included in the to-be-selected word group with the position information of the target character;
[0156] If the range information included in the to-be-selected word segmentation group includes the position information of the target character, determining a first matching result according to the to-be-selected word segmentation group, the first matching result indicating that there is a matching word segmentation group in the target word segmentation set;
[0157] If the range information contained in the to-be-selected word group does not contain the position information of the target character, the word group arranged at the t+1th position in the target word set is determined as the to-be-selected word group, and a matching result is determined based on the to-be-selected word group.
[0158] In one embodiment, the computer program in the computer-readable storage medium 1104 is loaded and executed by the processor 1101 in response to the selection operation on the text, and when obtaining the selected target character in the text, is specifically used to perform the following steps:
[0159] In response to a selection operation on the text, obtaining operation position information of the selection operation and obtaining text position information of the text;
[0160] Determine relative position information between the operation position of the selection operation and the text according to the operation position information and the text position information, wherein the relative position information includes relative horizontal coordinate information and relative vertical coordinate information;
[0161] Determine the number of selected lines in the text according to the relative ordinate information;
[0162] The selected target character in the text is determined according to the relative horizontal coordinate and the number of lines.
[0163] In one embodiment, the text content included in the text exceeds the display interface of the text, and the target character is located outside the display interface. When the computer program in the computer-readable storage medium 1104 is loaded and executed by the processor 1101, it is also used to perform the following steps:
[0164] The target character is scrolled and displayed in the display interface at a scrolling display rate so that the target character is located within the display interface, wherein the scrolling display rate is determined according to a screen refresh rate corresponding to the display interface.
[0165] The computer device provided by the present application can determine the target character selected by the selection operation in response to the selection operation on the text, so that the target word segmentation containing the target character can be determined and marked, which effectively meets the user's word segmentation marking needs and improves the user experience; in the process of determining the word segmentation, the text content can be determined according to the position information of the target word segmentation, and then the target word segmentation set can be determined, which effectively improves the efficiency of determining the word segmentation set, and then the efficiency of marking the target word segmentation can be improved, and the user experience is further improved; the method provided by the present application can also realize automatic scrolling, ensuring that the characters selected by the selection operation can be fully displayed, ensuring the user experience, and can also determine the scrolling display rate according to the screen refresh rate of the device, so as to scroll at a smaller rate, while achieving a smooth scrolling effect, the method also has good universality.
[0166] The present application also provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer instructions, and when the computer instructions are executed on a computer device, the computer device executes the steps in the method embodiments of the present application to implement the text marking method provided by the present application. The specific implementation method can be referred to the above description, and will not be repeated here.
[0167] The embodiment of the present application also provides a computer program product, which includes a computer program or a computer instruction, and the computer program or the computer instruction is stored in a computer-readable storage medium. The processor of the computer device reads the computer program or the computer instruction from the computer-readable storage medium, and the processor executes the computer program or the computer instruction, so that the computer device executes the steps in the embodiments of the present application to implement the text marking method provided in the embodiment of the present application. The specific implementation method can be referred to the above description, which will not be repeated here.
[0168] It is appreciated by those skilled in the art that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in this application can be implemented in electronic hardware or in combination with computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional technical objects can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application. In the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program with a predetermined function, and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories) or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be a part of an overall module or unit containing the function of the module or unit.
[0169] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loading and executing computer program instructions on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted by a computer-readable storage medium. The computer instructions can be transmitted from a website site, a computer, a server or a data center to another website site, a computer, a server or a data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server, a data center, etc. that contains one or more available media integrated. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)), etc.
[0170] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technical object familiar with the technical field within the technical scope disclosed in the present application can be easily thought of for changes or replacements, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A text marking method, characterized in that: The method comprises: Obtaining a text to be processed, wherein the text includes a plurality of characters; In response to a selection operation on the text, a target character selected in the text is obtained, and a target segmentation set related to the target character is obtained; the target segmentation set is obtained by performing semantic segmentation processing on text content related to the target character in the text; Acquire a target word segmentation matching the target character from the target word segmentation set; The target word segment is marked in the text.
2. The method according to claim 1, characterized in that The target word segmentation set includes a plurality of word segmentation groups, each word segmentation group includes a semantic word segmentation and range information, and the range information is used to indicate the position of each character included in the semantic word segmentation in the text; The step of acquiring a target word segmentation that matches the target character from the target word segmentation set includes: Acquire position information of the target character, where the position information is used to indicate the position of the target character in the text; Matching the position information of the target character with the range information contained in each of the word segments to obtain a matching result, wherein the matching result is used to indicate whether there is a matching word segmentation group in the target word segmentation set, and the matching word segmentation group contains range information that matches the position information of the target character; If the matching result indicates that the matching word group exists in the target word set, the semantic word included in the matching word group is determined as the target word that matches the target character.
3. The method according to claim 2, characterized in that The step of acquiring a target word segmentation that matches the target character from the target word segmentation set further includes: If the matching result indicates that the matching word segment group does not exist in the target word segment set, the target character is determined as a target word segment that matches the target character.
4. The method according to claim 1, characterized in that The step of acquiring a target word segmentation set related to the target character includes: According to the position information of the target character, obtaining text content to be segmented from the text, the text content including the target character, a plurality of characters located before the target character in the text, and a plurality of characters located after the target character in the text; The text content is subjected to semantic segmentation processing to obtain a target word set related to the target character.
5. The method according to claim 1, characterized in that The step of acquiring a target word segmentation set related to the target character includes: Obtain a text segmentation set, wherein the text segmentation set includes a plurality of segmentation sets corresponding to text contents, and the segmentation sets corresponding to the text contents are obtained by performing semantic segmentation processing on the corresponding text contents; The text segmentation set is extracted based on the text content related to the target character in the text to obtain a target segmentation set related to the target character.
6. The method according to claim 2, characterized in that Each word segmentation group included in the target word segmentation set has its own arrangement order; the position information of the target character is matched with the range information included in each word segmentation group to obtain a matching result, including: Determine the word group with the tth position in the target word set as the word group to be selected, where t is a positive integer; Matching the range information included in the to-be-selected word group with the position information of the target character; If the range information included in the to-be-selected word segmentation group includes the position information of the target character, determining a first matching result according to the to-be-selected word segmentation group, the first matching result indicating that there is a matching word segmentation group in the target word segmentation set; If the range information contained in the to-be-selected word group does not contain the position information of the target character, the word group arranged at the t+1th position in the target word set is determined as the to-be-selected word group, and a matching result is determined based on the to-be-selected word group.
7. The method according to any one of claims 1 to 6, characterized in that: The step of obtaining a target character selected from the text in response to a selection operation on the text includes: In response to a selection operation on the text, obtaining operation position information of the selection operation and obtaining text position information of the text; Determine relative position information between the operation position of the selection operation and the text according to the operation position information and the text position information, wherein the relative position information includes relative horizontal coordinate information and relative vertical coordinate information; Determine the number of selected lines in the text according to the relative ordinate information; The selected target character in the text is determined according to the relative horizontal coordinate and the number of lines.
8. The method according to any one of claims 1 to 6, characterized in that: The text content included in the text exceeds the display interface of the text, and the target character is located outside the display interface, and the method further includes: The target character is scrolled and displayed in the display interface at a scrolling display rate so that the target character is located within the display interface, wherein the scrolling display rate is determined according to a screen refresh rate corresponding to the display interface.
9. A text marking device, characterized in that: include: An acquisition unit, used for acquiring a text to be processed, wherein the text includes a plurality of characters; The acquisition unit is further configured to, in response to a selection operation on the text, acquire a selected target character in the text and acquire a target segmentation set related to the target character; the target segmentation set is obtained by performing semantic segmentation processing on text content related to the target character in the text; The acquisition unit is further configured to acquire a target word segmentation matching the target character from the target word segmentation set; A marking unit is used to mark the target word in the text.
10. A computer device, characterized in that: The computer device comprises: a processor suitable for implementing a computer program; A computer-readable storage medium storing a computer program, wherein the computer program is suitable for being loaded by the processor and implementing the text marking method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and implementing the text marking method according to any one of claims 1 to 8.
12. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the text marking method according to any one of claims 1 to 8 is implemented.