Text annotation methods and related products
By automatically labeling text data sets with emoji expressions, generating training sample sets and training neural networks, the problem of low efficiency in text emotion classification and annotation in the existing technology is solved, and efficient and low-cost emotional classification applications are achieved.
Patent Information
- Application Number
- CN202010465811.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-28
- Publication Date
- 2024-11-01
- Estimated Expiration
- 2040-05-28
AI Technical Summary
In the prior art, training of neural networks requires a large number of high-quality text data sets for labeling, and manual labeling is inefficient and costly, which limits the application scenarios of text emotional classification.
By obtaining text data sets containing emoji expressions from third-party platforms, using emoji expressions to automatically annotate, generating training sample sets, and using neural networks for training, the labeling application scenarios are expanded and the need for manual annotation is reduced.
It improves the efficiency and accuracy of text labeling, reduces the investment in human and material resources, expands the scope of application of emotional classification, and avoids the limitations of semantic analysis of texts of different language types.
Smart Images

Figure CN111695357B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of emotion recognition in artificial intelligence, and specifically to a text annotation method and related products. Background Art
[0002] With the development of artificial intelligence, the application scope of neural networks is becoming more and more extensive. For example, in the field of video surveillance, neural networks can be used to identify people in surveillance videos or in the medical field, neural networks can be used to identify tumors in MRI images; furthermore, in the field of text recognition, neural networks can be used to classify the emotions of texts.
[0003] Although neural networks have good performance in image recognition, the initial training of neural networks requires a sufficient number of high-quality training data sets. The production of training data sets is a very costly project. First, it is necessary to obtain some high-quality original data sets from the database and annotate the original data sets. For example, when training a text sentiment classification network, it is necessary to obtain a large amount of semantically complete and sentimentally clear text, and then manually annotate the large amount of text. However, due to the extremely large amount of text, manual annotation requires a lot of time and labor costs, and the annotation efficiency is low. Summary of the invention
[0004] The embodiments of the present application provide a text annotation method and related products, which increase the application scenarios of text annotation and improve the efficiency of text annotation.
[0005] In a first aspect, an embodiment of the present application provides a text annotation method, which is applied to an electronic device, including:
[0006] The electronic device obtains a first text data set from a first third-party platform, where each first text data in the first text data set includes an emoji expression;
[0007] The electronic device annotates each piece of first text data according to the emoji expression of each piece of first text data in the first text data set to obtain a first annotation result for each piece of first text data, where the first annotation result includes a positive evaluation or a negative evaluation;
[0008] The electronic device obtains a first training sample set according to a first annotation result of each piece of first text data;
[0009] The electronic device trains the first neural network using the first training sample set;
[0010] The electronic device obtains a second text data set from a second third-party platform;
[0011] The electronic device uses the first neural network to annotate the second text data set to obtain a second annotation result for each second text data in the second text data set, wherein the second annotation result includes one of a positive evaluation, a negative evaluation, or a neutral evaluation.
[0012] In a second aspect, an embodiment of the present application provides an electronic device, including:
[0013] An acquisition unit, configured to acquire a first text data set from a first third-party platform, wherein each first text data in the first text data set includes an emoji expression;
[0014] a labeling unit, labeling each piece of first text data according to the emoji expression of each piece of first text data in the first text data set, to obtain a first labeling result for each piece of first text data, wherein the first labeling result includes a positive evaluation or a negative evaluation;
[0015] A training unit, configured to obtain a first training sample set according to a first annotation result of each first text data, and train a first neural network using the first training sample set;
[0016] The acquisition unit is further used to acquire a second text data set from a second third-party platform;
[0017] The labeling unit is further used to use the first neural network to label the second text data set to obtain a second labeling result for each second text data in the second text data set, wherein the second labeling result includes one of a positive evaluation, a negative evaluation or a neutral evaluation.
[0018] In a third aspect, an embodiment of the present application provides an electronic device, comprising a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the steps in the method described in the first aspect.
[0019] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program enables a computer to execute the method described in the first aspect.
[0020] In a fifth aspect, an embodiment of the present application provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer is operable to cause the computer to execute the method described in the first aspect.
[0021] Implementing the embodiments of the present application has the following beneficial effects:
[0022] It can be seen that in the embodiment of the present application, comment data is annotated by emoji expressions in the text data, and there is no need to perform semantic analysis on the comment data, so that the annotation is not restricted by the language type of the text data, thereby increasing the application scenarios of the text annotation; in addition, text data can be automatically annotated by emoji expressions, without the need for manual annotation, thus saving manpower and material resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0024] Figure 1 A flowchart of a marking method provided in an embodiment of the present application;
[0025] Figure 2 A schematic diagram of another marking method provided in an embodiment of the present application;
[0026] Figure 3 A schematic diagram of another marking method provided in an embodiment of the present application;
[0027] Figure 4 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;
[0028] Figure 5 A block diagram of the functional units of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0029] 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 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.
[0030] The terms "first", "second", "third" and "fourth" etc. in the specification and claims of the present application and the drawings are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices.
[0031] Reference to "embodiments" herein means that a particular feature, result, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0032] The electronic devices in this application may include smart phones (such as Android phones, iOS phones, Windows Phone phones, etc.), tablet computers, PDAs, laptop computers, mobile Internet devices MID (Mobile Internet Devices, referred to as: MID) or wearable devices, etc. The above electronic devices are only examples, not exhaustive, and include but are not limited to the above electronic devices. In practical applications, the above electronic devices may also include: smart vehicle terminals, computer equipment, etc.
[0033] See also Figure 1 , Figure 1 A flowchart of a text annotation method provided in an embodiment of the present application is provided. The method is applied to an electronic device and includes the following steps:
[0034] 101: The electronic device obtains a first text data set from a first third-party platform.
[0035] The first third-party platform may be a social application such as Weibo, Twitter, Facebook, or an e-commerce platform such as Amazon, Taobao, and JD.com. That is, the first third-party platform is a third-party platform that contains more text data of positive evaluations and text data of negative evaluations. The electronic device obtains a first text data set by randomly obtaining a plurality of first text data from the first platform through an application programming interface (Application Programming Interface, API) provided by the first third-party platform. That is, the electronic device complies with the Robot protocol of the first third-party platform and obtains the first text data set from the first third-party platform through the API of the first third-party platform.
[0036] In some possible implementations, since the first text data is obtained through the API of the first third-party platform and no manual review is performed, some of the first text data may not meet the requirements. For example, it does not contain emoji expressions or the text content is too short. Therefore, after obtaining multiple first text data, the first text data in the first text data set is first cleaned to clean out the first text data that does not contain emoji expressions or the text content is too short, and the cleaned first text data constitute the first text data set.
[0037] Therefore, each first text data set in the first text data set contains an emoji expression.
[0038] 102: The electronic device annotates each piece of first text data according to the emoji expression of each piece of first text data in the first text data to obtain a first annotation result for each piece of first text data.
[0039] The first annotation result includes a positive evaluation or a negative evaluation.
[0040] Exemplarily, the first text data is cleaned, and each first text data in the first text data set includes an emoji expression. Since the emoji expression itself carries an emotional evaluation. For example, the emoji expression The emotional evaluation expressed is positive, while the Emoji expression Indicates a negative evaluation. Therefore, the first emotional evaluation of each first text data can be determined according to the emoji expression of each first text data; then, each first text data is labeled according to the first emotional evaluation of each first text data, that is, an emotional label is added to each first text data. That is, if the emoji expression of any first text data belongs to the emoji expression set of positive evaluation, the first text data is labeled as a positive evaluation, and if the emoji expression belongs to the emoji expression set of negative evaluation, the first text data is labeled as a negative evaluation.
[0041] Among them, corresponding to the first text data, the first annotation result includes positive comments and negative comments, the emotions corresponding to the positive comments include happiness, approval, appreciation, and the like, and the emotions corresponding to the negative comments include anger, pessimism, disapproval, and the like.
[0042] It should be noted that some emoji expressions do not have the ability to determine the emotional evaluation corresponding to the emoji expression. It can express happiness, i.e. positive emotion, or it can express ridicule, i.e. negative emotion. The first text data containing these emoji expressions in the first text data set is not annotated, and only the first text data containing emoji expressions corresponding to positive evaluations or emoji expressions corresponding to negative evaluations are annotated.
[0043] Furthermore, in order to improve the accuracy of emoji expression annotation, the text content of each first text data can be extracted, and the text content of each first text data can be semantically analyzed to obtain the semantic information of each first text data; the first emotional evaluation of each first text data can be determined based on the semantic information of each first text data; the first text data in the first text data set with the same first emotional evaluation and the second emotional evaluation can be retained, and the first text data with inconsistent first emotional evaluation and the second emotional evaluation can be deleted. Through semantic analysis and emoji expression double annotation, the annotation error caused by unilateral emoji expression annotation can be reduced, and the accuracy of annotation of the first text data set can be improved.
[0044] 103: The electronic device obtains a first training sample set according to the first annotation result of each piece of first text data.
[0045] The annotated first text data is used as a training sample with a label to obtain the first training sample set.
[0046] 104: The electronic device trains the first neural network using the first training sample set.
[0047] Specifically, the initial parameters of the first neural network are first constructed, and the training samples in the first training sample set are input into the first neural network to obtain the prediction results of the training samples; then, the loss gradient is determined based on the prediction results and the annotation results of the training samples, and the loss function is constructed based on the loss gradient; finally, the parameter values of the initial parameters are reversely updated based on the loss function and the gradient descent method; until the first neural network converges, the training of the first neural network is completed.
[0048] 105: The electronic device obtains a second text data set from a second third-party platform.
[0049] The second third-party platform may be a news platform that publishes science and technology news or wiki or summary texts, that is, the second third-party platform is a third-party platform that contains a large amount of text data with neutral evaluations.
[0050] Similarly, the electronic device complies with the Robot protocol of the second third-party platform, obtains multiple second text data from the second third-party platform through the API of the second third-party platform, and obtains the second text data set.
[0051] Of course, after obtaining the plurality of second text data, the plurality of second text data may be cleaned to remove the second text data that is illegal or has too short text content.
[0052] 106: The electronic device uses the first neural network to annotate the second text data set to obtain an annotation result for each second text data in the second text data set.
[0053] The second annotation result includes one of a positive evaluation, a negative evaluation or a neutral evaluation.
[0054] Specifically, the electronic device uses the first neural network to classify each second text data in the second text data set to obtain a first probability that each second text data is a positive evaluation and a second probability that each second text data is a negative evaluation; then, the second text data whose first probability is greater than a first threshold (i.e., there is 100% certainty that the sentiment evaluation of the second text data is a positive evaluation) is marked as a positive evaluation; the second text data whose second probability is greater than the first threshold (i.e., there is 100% certainty that the sentiment evaluation of the second text data is a negative evaluation) is marked as a negative evaluation; and the second text data whose training sample rate of the first probability evaluation is less than the first threshold and greater than the second threshold (i.e., there is no 100% certainty that the sentiment evaluation of the second text data is a positive evaluation or a negative evaluation) is marked as a neutral evaluation.
[0055] The first threshold may be 0.7, 0.75, 0.8 or other values, and the second threshold may be 0.4, 0.45, 0.5 or other values.
[0056] It can be seen that in the embodiments of the present application, the text data is annotated by the emoji expressions in the text data, and there is no need to perform semantic analysis on the text data, so that the annotation is not restricted by the language type of the text data, thereby increasing the application scenarios of the annotation method; in addition, the text data can be automatically annotated by emoji expressions, and the text data can be annotated without manual annotation, thereby saving manpower and material resources.
[0057] In some possible implementations, the method further includes:
[0058] The electronic device obtains a second training sample set according to the second annotation result of each second text data in the second text data set, that is, according to the annotation result of each second text data in the second text data set, the second text data set is assembled into a second training sample set with a label; then, the second training sample set is used to train the second neural network; and any comment data to be published is obtained, and the comment data to be published is classified by using the second neural network to obtain a classification result of the comment data to be published; and whether to publish the comment data to be published is determined according to the classification result.
[0059] Wherein, in the case where the comment data to be published can be the comment data to be published under any news website, when the classification result is a positive evaluation or a neutral evaluation, the comment data to be published is made public, and when the classification result is a negative evaluation, the comment data to be published is not made public. Compared with the existing manual review of the comment data to be published, the present application can automatically review the comment data to be published through the second neural network, thereby saving human resources.
[0060] Among them, in the case where the comment data to be published can be comment data under any e-commerce platform, when the classification result is a positive evaluation or a negative evaluation, the comment data to be published is checked with the user's purchase record to determine the authenticity of the comment data to be published. In the case where the comment data to be published is determined to be a malicious review, the comment data to be published will not be made public. In this application, the comment data to be published can be automatically reviewed by the second neural network to determine the authenticity of the comment data to be published, thereby saving human resources.
[0061] In some possible implementations, since the second text data obtained from the second third-party platform is mostly neutral text data, and the first text data obtained from the first third-party platform is mostly positive evaluation text data and negative evaluation text data. Therefore, in order to increase the number of positive evaluation training samples and negative evaluation training samples in the second training sample set, the second training sample set can be merged with the first training sample set to obtain a new second training sample set with sufficient training samples, and the new second training sample set is used to train the second neural network, thereby making the trained second neural network more accurate.
[0062] In some possible implementations, after determining the first emotion evaluation of each piece of first text data according to the emoji expression of each piece of first text data in the first text data set, the method further includes:
[0063] Extract the text content of each first text data; convert the text content into a second emoji expression; determine the second emotional evaluation corresponding to each first text data according to the second emoji expression; determine whether the first emotional evaluation of each first text data is consistent with the second emotional evaluation, and if consistent, annotate each first text data according to the first emotional evaluation of each first text data. Through the text-to-emoji operation, verify the emotional evaluation corresponding to each first text data, thereby improving the accuracy of subsequent annotation of the first text data.
[0064] In some possible implementations, the method further includes:
[0065] Obtain comment data of any user, which is the comment data of the user on the target product, and the target product includes a financial product; use the second neural network to classify the comment data of the user to obtain a classification result of the comment data of the user; according to the classification result of the comment data of the user, screen the target user, that is, the user with a positive evaluation as the classification result is taken as the target user; recommend the target product to the target user.
[0066] It can be seen that in this embodiment, the second neural network is used to screen out users who are interested in the target product (financial product), thereby ensuring the accuracy of user screening and improving the success rate of recommendation.
[0067] See also Figure 2 , Figure 2 A flowchart of another text annotation method provided in an embodiment of the present application. Figure 1 The same contents as those in the embodiments shown are not described again here. The method is applied to an electronic device, and the method comprises the following steps:
[0068] 201: The electronic device obtains a first text data set from a first platform.
[0069] 202: The electronic device cleans each first text data in the first text data set, deletes the first text data that does not contain emoji expressions, obtains a new first text data set, and uses the new first text data set as the first text data set.
[0070] 203: The electronic device determines a first emotion evaluation of each first text data according to the emoji expression of each first text data in the first text data set, where the first emotion evaluation includes a positive evaluation or a negative evaluation.
[0071] 204: The electronic device extracts text content of each piece of first text data, performs semantic analysis on the text content of each piece of first text data, and obtains semantic information of each piece of first text data.
[0072] 205: The electronic device determines a second emotion evaluation of each piece of first text data according to the semantic information of each piece of first text data.
[0073] 206: The electronic device retains the first text data in the first text data set whose first emotion evaluation and the second emotion evaluation are consistent, and deletes the first text data in which the first emotion evaluation and the second emotion evaluation are inconsistent.
[0074] 207: The electronic device labels the remaining first text data according to the first emotion evaluation of the remaining first text data to obtain a first training sample set.
[0075] The remaining first text data is the first text data remaining after deleting the first comment data in which the first sentiment evaluation and the second sentiment evaluation are inconsistent from the first text data set.
[0076] 208: The electronic device trains the first neural network using the first training sample set.
[0077] 209: The electronic device obtains a second text data set from the second platform.
[0078] 210: The electronic device uses the first neural network to annotate the second text data set to obtain a second annotation result for each second text data in the second text data set, where the second annotation result includes one of a positive evaluation, a negative evaluation, or a neutral evaluation.
[0079] It can be seen that in the embodiment of the present application, the comment data is annotated by the emoji expressions in the comment data, and there is no need to perform semantic analysis on the comment data, so that the annotation will not be restricted by the language type of the comment data, thereby increasing the application scenarios of the annotation method; in addition, the comment data can be automatically annotated by emoji expressions, and a training sample set containing sentiment classification labels can be obtained without manual annotation, thereby saving human and material resources; and, before annotating the first text data set, the first text data set is first cleaned to retain high-quality first text data, thereby improving the accuracy of the annotation.
[0080] See also Figure 3 , Figure 3 A flowchart of another text annotation method provided in an embodiment of the present application. Figure 1 and Figure 2 The same contents as those in the embodiments shown are not described again here. The method is applied to an electronic device, and the method comprises the following steps:
[0081] 301: The electronic device obtains a first text data set from a first platform.
[0082] 302: The electronic device cleans each first text data in the first text data set, deletes the first text data that does not contain emoji expressions, obtains a new first text data set, and uses the new first text data set as the first text data set.
[0083] 303: The electronic device determines a first emotion evaluation of each first text data according to the emoji expression of each first text data in the first text data set, where the first emotion evaluation includes a positive evaluation or a negative evaluation.
[0084] 304: The electronic device extracts text content of each piece of first text data, performs semantic analysis on the text content of each piece of first text data, and obtains semantic information of each piece of first text data.
[0085] 305: The electronic device determines a second emotion evaluation of each piece of first text data according to the semantic information of each piece of first text data.
[0086] 306: The electronic device retains the first text data in the first text data set whose first emotion evaluation and the second emotion evaluation are consistent, and deletes the first text data whose first emotion evaluation and the second emotion evaluation are inconsistent.
[0087] 307: The electronic device labels the remaining first text data according to the first emotion evaluation of the remaining first text data to obtain a first training sample set.
[0088] The remaining first text data is the first text data remaining after deleting the first comment data in which the first sentiment evaluation and the second sentiment evaluation are inconsistent from the first text data set.
[0089] 308: The electronic device trains the first neural network using the first training sample set.
[0090] 309: The electronic device obtains a second text data set from the second platform.
[0091] 310: The electronic device uses the first neural network to annotate the second text data set to obtain a second annotation result for each second text data in the second text data set, where the second annotation result includes one of a positive evaluation, a negative evaluation, or a neutral evaluation.
[0092] 311: The electronic device uses the second annotation result according to each second text data to obtain a second training sample set, and uses the second training sample set to train the second neural network.
[0093] 312: The electronic device obtains any comment data, classifies the comment data using the second neural network to obtain a classification result of the comment data, and determines whether to disclose the comment data according to the classification result.
[0094] It can be seen that in the embodiment of the present application, the text data is annotated by the emoji expressions in the text data, and there is no need to perform semantic analysis on the text data, so that the annotation will not be restricted by the language type of the text data, thereby increasing the application scenarios of the annotation method; in addition, the text data can be automatically annotated by the emoji expressions, and a training sample set containing sentiment classification labels can be obtained without manual annotation, thereby saving manpower and material resources; moreover, before annotating the first text data set, the first text data set is first cleaned to retain high-quality first text data, thereby improving the accuracy of the annotation; in addition, the trained second neural network is used to classify the comment data to be published, and the comment data to be published that does not meet the requirements is automatically shielded, without the need for manual review, saving human resources.
[0095] See also Figure 4 , Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 4 As shown, the electronic device 400 includes a processor, a memory, a communication interface, and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the program includes instructions for executing the following steps:
[0096] Acquire a first text data set from a first third-party platform, wherein each first text data in the first text data set includes an emoji expression;
[0097] Annotate each piece of first text data according to the emoji expression of each piece of first text data in the first text data set to obtain a first annotation result for each piece of first text data, where the first annotation result includes a positive evaluation or a negative evaluation;
[0098] Obtain a first training sample set according to the first annotation result of each first text data;
[0099] Using the first training sample set to train the first neural network;
[0100] Acquire a second text dataset from a second third-party platform;
[0101] The second text data set is annotated using the first neural network to obtain a second annotation result for each second text data in the second text data set, wherein the second annotation result includes one of a positive evaluation, a negative evaluation, or a neutral evaluation.
[0102] In some possible implementations, in terms of labeling each piece of first text data according to the emoji expression of each piece of first text data in the first text data set, the above program is specifically used to execute instructions of the following steps:
[0103] Determine, according to the emoji expression of each first text data in the first text data set, a first emotional evaluation of each first text data, wherein the first emotional evaluation includes a positive evaluation or a negative evaluation;
[0104] Each piece of first text data is labeled according to the first sentiment evaluation of each piece of first text data.
[0105] In some possible implementations, after determining the first emotional evaluation of each piece of first text data according to the emoji expression of each piece of first text data in the first text data set, the above program is further used to execute instructions for the following steps:
[0106] Extracting the text content of each piece of first text data;
[0107] Performing semantic analysis on the text content of each piece of first text data to obtain semantic information of each piece of first text data;
[0108] Determining a second sentiment evaluation of each piece of first text data according to the semantic information of each piece of first text data;
[0109] The first text data in the first text data set whose first sentiment evaluation and second sentiment evaluation are consistent are retained, and the first text data whose first sentiment evaluation and second sentiment evaluation are inconsistent are deleted.
[0110] In some possible implementations, before annotating the first text data set, the program is further used to execute instructions for the following steps:
[0111] Clean each first text data in the first text data set, delete the first text data that does not contain emoji expressions, and obtain a new first text data set;
[0112] The new first text data set is used as the first text data set.
[0113] In some possible implementations, in terms of annotating the second text data set using the first neural network to obtain a second annotation result for each second text data in the second text data set, the above program is specifically used to execute instructions for the following steps:
[0114] Using the first neural network to classify each second text data in the second text data set, to obtain a first probability that each second text data is a positive evaluation and a second probability that each second text data is a negative evaluation;
[0115] Determine that a second annotation result of the second text data for which the first probability is greater than the first threshold is a positive evaluation;
[0116] Determine that a second annotation result of the second text data for which the second probability is greater than the first threshold is a negative evaluation;
[0117] The second labeling result of the second text data whose first probability is less than the first threshold and greater than the second threshold is regarded as a neutral evaluation.
[0118] In some possible implementations, the above program is also used to execute instructions for the following steps:
[0119] Obtaining a second training sample set according to a second annotation result of each second text data in the second text data set;
[0120] Training a second neural network using the second training sample set;
[0121] The electronic device obtains any piece of comment data to be published;
[0122] Using the second neural network to perform sentiment classification on the comment data to be published, to obtain a classification result of the comment data to be published;
[0123] According to the classification result, it is determined whether to make public the comment data to be published.
[0124] In some possible implementations, after obtaining the second training sample set according to the second annotation result of each second text data in the second text data set, the above program is further used to execute instructions for the following steps:
[0125] Merging the second training sample with the first training sample set to obtain a new second training sample set;
[0126] In terms of training the second neural network using the second training sample set, the above program is specifically used to execute instructions for the following steps:
[0127] The second neural network is trained using the new second training sample set.
[0128] See also Figure 5 , Figure 5 The electronic device 500 includes: an acquisition unit 510, a labeling unit 520 and a training unit 530; wherein:
[0129] An acquiring unit 510 is configured to acquire a first text data set from a first third-party platform, wherein each first text data in the first text data set includes an emoji expression;
[0130] A labeling unit 520 labels each piece of first text data according to the emoji expression of each piece of first text data in the first text data set to obtain a first labeling result for each piece of first text data, wherein the first labeling result includes a positive evaluation or a negative evaluation;
[0131] A training unit 530, configured to obtain a first training sample set according to a first annotation result of each first text data, and train a first neural network using the first training sample set;
[0132] The acquisition unit 510 is further configured to acquire a second text dataset from a second third-party platform;
[0133] The labeling unit 520 is further used to use the first neural network to label the second text data set to obtain a second labeling result for each second text data in the second text data set, wherein the second labeling result includes one of a positive evaluation, a negative evaluation or a neutral evaluation.
[0134] In some possible implementations, in terms of labeling each piece of first text data according to the emoji expression of each piece of first text data in the first text data set, the labeling unit 520 is specifically configured to:
[0135] Determine, according to the emoji expression of each first text data in the first text data set, a first emotional evaluation of each first text data, wherein the first emotional evaluation includes a positive evaluation or a negative evaluation;
[0136] Each piece of first text data is labeled according to the first sentiment evaluation of each piece of first text data.
[0137] In some possible implementations, the electronic device 500 further includes a cleaning unit 540, which is configured to:
[0138] Extracting the text content of each piece of first text data;
[0139] Performing semantic analysis on the text content of each piece of first text data to obtain semantic information of each piece of first text data;
[0140] Determining a second sentiment evaluation of each piece of first text data according to the semantic information of each piece of first text data;
[0141] The first text data in the first text data set whose first sentiment evaluation and second sentiment evaluation are consistent are retained, and the first text data whose first sentiment evaluation and second sentiment evaluation are inconsistent are deleted.
[0142] In some possible implementations, the electronic device 500 further includes a cleaning unit 540. Before annotating the first text data set, the cleaning unit 540 is configured to:
[0143] Clean each first text data in the first text data set, delete the first text data that does not contain emoji expressions, and obtain a new first text data set;
[0144] The new first text data set is used as the first text data set.
[0145] In some possible implementations, in terms of using the first neural network to annotate the second text data set to obtain a second annotation result for each second text data in the second text data set, the annotation unit 520 is specifically configured to:
[0146] Using the first neural network to classify each second text data in the second text data set, to obtain a first probability that each second text data is a positive evaluation and a second probability that each second text data is a negative evaluation;
[0147] Determine that a second annotation result of the second text data for which the first probability is greater than the first threshold is a positive evaluation;
[0148] Determine that a second annotation result of the second text data for which the second probability is greater than the first threshold is a negative evaluation;
[0149] The second labeling result of the second text data whose first probability is less than the first threshold and greater than the second threshold is regarded as a neutral evaluation.
[0150] In some possible implementations, a determination unit 550 is further included;
[0151] The training unit 530 is further configured to obtain a second training sample set according to a second annotation result of each second text data in the second text data set;
[0152] The training unit 530 is further configured to train the second neural network using the second training sample set;
[0153] The determination unit 550 is used to obtain any comment data to be published; use the second neural network to perform sentiment classification on the comment data to be published to obtain a classification result of the comment data to be published; and determine whether to publish the comment data to be published based on the classification result.
[0154] In some possible implementations, after obtaining the second training sample set according to the second annotation result of each second text data in the second text data set, the training unit 530 is further configured to:
[0155] Merging the second training sample with the first training sample set to obtain a new second training sample set;
[0156] In terms of using the second training sample set to train the second neural network, the training unit 530 is specifically configured to:
[0157] The second neural network is trained using the new second training sample set.
[0158] An embodiment of the present application also provides a computer storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement part or all of the steps of any text annotation method recorded in the above method embodiments.
[0159] An embodiment of the present application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute part or all of the steps of any text annotation method recorded in the above method embodiments.
[0160] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0161] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0162] In the several embodiments provided in the present application, it should be understood that the disclosed device can be implemented in other ways. For example, the device embodiments described above are only schematic, such as the division of the units, which is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, and the indirect coupling or communication connection of the device or unit can be electrical or other forms.
[0163] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0164] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above integrated unit may be implemented in the form of hardware or in the form of a software program module.
[0165] If the integrated unit is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or CD-ROM and other media that can store program codes.
[0166] A person skilled in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in a computer-readable memory, and the memory can include: a flash drive, a read-only memory (English: Read-Only Memory, abbreviated as: ROM), a random access memory (English: Random Access Memory, abbreviated as: RAM), a magnetic disk or an optical disk, etc.
[0167] The embodiments of the present application are introduced in detail above. Specific examples are used in this article to illustrate the principles and implementation methods of the present application. The description of the above embodiments is only used to help understand the method and core idea of the present application. At the same time, for general technical personnel in this field, according to the idea of the present application, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.
Claims
1. A text annotation method, characterized in that: Used in electronic equipment, including: The electronic device obtains a first text data set from a first third-party platform, where each first text data in the first text data set includes an emoji expression; The electronic device cleans each first text data in the first text data set, deletes the first text data that does not contain emoji expressions, and obtains a new first text data set; and uses the new first text data set as the first text data set; The electronic device annotates each piece of first text data according to the emoji expression of each piece of first text data in the first text data set to obtain a first annotation result of each piece of first text data, wherein the first annotation result includes a positive evaluation or a negative evaluation; including: Determine a first emotional evaluation of each piece of first text data according to the emoji expressions of each piece of first text data in the first text data set, wherein the first emotional evaluation includes a positive evaluation or a negative evaluation; extract the text content of each piece of first text data; perform semantic analysis on the text content of each piece of first text data to obtain the semantic information of each piece of first text data; determine a second emotional evaluation of each piece of first text data according to the semantic information of each piece of first text data; retain the first text data in the first text data set whose first emotional evaluation and the second emotional evaluation are consistent, and delete the first text data whose first emotional evaluation and the second emotional evaluation are inconsistent; mark each piece of first text data according to its first emotional evaluation; The electronic device obtains a first training sample set according to a first annotation result of each piece of first text data; The electronic device trains the first neural network using the first training sample set; The electronic device obtains a second text data set from a second third-party platform; The electronic device uses the first neural network to annotate the second text data set to obtain a second annotation result for each second text data in the second text data set, where the second annotation result includes one of a positive evaluation, a negative evaluation, or a neutral evaluation; The electronic device obtains a second training sample set based on the second annotation result of each second text data in the second text data set; the electronic device uses the second training sample set to train the second neural network; the electronic device obtains any comment data to be published; the electronic device uses the second neural network to perform sentiment classification on the comment data to be published to obtain a classification result of the comment data to be published; the electronic device determines whether to disclose the comment data to be published based on the classification result.
2. The method according to claim 1, characterized in that The step of using the first neural network to annotate the second text data set to obtain a second annotation result for each second text data in the second text data set includes: Using the first neural network to classify each second text data in the second text data set, to obtain a first probability that each second text data is a positive evaluation and a second probability that each second text data is a negative evaluation; Determine that a second annotation result of the second text data for which the first probability is greater than the first threshold is a positive evaluation; Determine that a second annotation result of the second text data for which the second probability is greater than the first threshold is a negative evaluation; It is determined that the second labeling result of the second text data whose first probability is less than the first threshold and greater than the second threshold is a neutral evaluation.
3. The method according to claim 1, characterized in that After the electronic device obtains the second training sample set according to the second annotation result of each second text data in the second text data set, the method further includes: Merging the second training sample with the first training sample set to obtain a new second training sample set; The electronic device trains a second neural network using the second training sample set, including: The electronic device trains the second neural network using the new second training sample set.
4. An electronic device, characterized in that: The electronic device is used to execute the method according to any one of claims 1 to 3, and the electronic device includes: An acquisition unit, configured to acquire a first text data set from a first third-party platform, wherein each first text data in the first text data set includes an emoji expression; a labeling unit, labeling each piece of first text data according to the emoji expression of each piece of first text data in the first text data set, to obtain a first labeling result for each piece of first text data, wherein the first labeling result includes a positive evaluation or a negative evaluation; A training unit, configured to obtain a first training sample set according to a first annotation result of each first text data, and train a first neural network using the first training sample set; The acquisition unit is further used to acquire a second text data set from a second third-party platform; The labeling unit is further used to use the first neural network to label the second text data set to obtain a second labeling result for each second text data in the second text data set, wherein the second labeling result includes one of a positive evaluation, a negative evaluation or a neutral evaluation.
5. An electronic device, characterized in that: The method comprises a processor, a memory, a communication interface and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the processor, and the programs include instructions for executing the steps in the method according to any one of claims 1 to 3.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method according to any one of claims 1 to 3.
