Emotional text data annotation method, device, system and electronic device

Through hypersphere k-means clustering and classifier prediction uncertainty processing, representative and uncertain samples of emotional text data are screened out for labeling, which solves the problems of heavy manual workload and high cost in emotional text labeling technology, and improves Improve model performance and labeling efficiency.

CN114064897BActive Publication Date: 2024-09-03UNICOM WOYUEDU TECH CULTURE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111382797.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-11-22
Publication Date
2024-09-03
Estimated Expiration
2041-11-22

AI Technical Summary

Technical Problem

Existing emotional text annotation technology has the problems of heavy human workload, high cost of annotating data, and insufficient value in improving model performance, especially in scenarios where the scale of unlabeled data cannot meet the accuracy requirements of deep learning models.

Method used

The hypersphere-based k-means clustering algorithm is used to cluster the emotional text data to be labeled, obtain the ball cluster information and its neighbor relationships, filter out representative data for labeling, and predict the classification probability through the classifier to eliminate uncertainty Process and output representative and uncertain samples for labeling, reducing the amount and cost of manual labeling.

Benefits of technology

By selecting samples with the most labeling value, the workload and difficulty of manual labeling are reduced, the labeling efficiency and effectiveness of model performance are improved, and labeling costs are reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114064897B
    Figure CN114064897B
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence technology, and to a method, device, system and electronic device for labeling emotional text data; the method comprises obtaining emotional text data to be labeled, and processing the emotional text data; clustering the emotional text data using a hypersphere-based k-means clustering algorithm; obtaining the stable domain and ring domain of each ball cluster, and screening representative data from the ring domain from the outside to the inside according to the required labeling amount; selecting part of the data in the stable domain of each ball cluster for labeling processing, and training a classifier using the labeled data; inputting the representative data into the trained classifier to obtain the classification probability, performing uncertainty processing on the classification probability, and outputting data with uncertainty; labeling the data with uncertainty, and outputting the labeled emotional text data. The present invention solves the problem of blind labeling in the field of text labeling by using big data processing technology and active learning based on hyperspheres.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method, device, system and electronic equipment for labeling emotional text data. Background Art

[0002] Deep learning (DL) is a new research direction in the field of machine learning (ML). Deep learning has achieved many results in text recognition, image recognition, speech recognition and other application fields. However, these recognition models rely on a large amount of labeled data. However, the scale of labeled data in real life often cannot meet the accuracy requirements of deep learning models.

[0003] In the field of text recognition, especially in the field of text-based sentiment analysis, there is a large amount of unlabeled data. For labeled data, there is also a data skew problem. For example, most users' sentiment labels are "good", and only a small number of them are "bad". In this case, if you want to obtain a high-precision model, you must rely on human labor to label more samples that are valuable for improving model accuracy. However, the workload of manually labeling the entire data set is very large, and sometimes the labeling difficulty is also very high, because users may sometimes express emotions in a hidden way. Therefore, it is necessary to reduce the cost of human labeling through some technical means to avoid blind waste of resources.

[0004] At present, the existing labeling technology mainly focuses on whether the labeled data is correctly labeled. However, in real scenarios, not all labeled data can help improve the model. For example, patent CN 107067025 A proposes an automatic labeling inspection method, but it does not solve the problems faced by the labeling field, such as the large workload of manual work, the insufficient value of labeled data for improving model performance, and the high cost of labeled data. Summary of the invention

[0005] Based on the problems existing in the prior art, the purpose of the present invention is to provide a method, device, system and electronic device for labeling emotional text data, so as to solve the problems of blindness, large workload and high cost in the current field of emotional text labeling. The main idea of ​​active learning labeling adopted by the present invention is to select a part of the data from the entire unlabeled sample pool through a collector. Compared with blind selection by humans, the present invention can select text data samples that are more helpful for improving model performance. In addition, since the total amount of labeling is reduced, the manual workload is also greatly reduced.

[0006] In a first aspect of the present invention, the present invention provides a method for labeling emotional text data, the method comprising:

[0007] Obtain the emotional text data to be annotated, and perform cleaning and deduplication processing on it;

[0008] The processed sentiment text data to be annotated are clustered using a hypersphere-based k-means clustering algorithm to obtain the ball cluster information and its nearest neighbor relationship corresponding to the sentiment text data to be annotated;

[0009] According to the information of each ball cluster and its neighbor relationship, the stable domain and ring domain of each ball cluster are obtained, and representative emotional text data to be annotated are screened from the outer to the inner ring domain according to the required labeling amount;

[0010] Select some of the emotional text data to be annotated in the stable domain of each ball cluster for annotation processing, and use the annotated emotional text data to initially train the classifier;

[0011] Input representative sentiment text data to be annotated into the trained classifier to obtain the corresponding classification probability, perform uncertainty processing on the predicted classification probability, and output the sentiment text data to be annotated with uncertainty;

[0012] The emotional text data to be annotated with uncertainty is annotated, and the annotated emotional text data is output.

[0013] In a second aspect of the present invention, the present invention further provides an emotional text data annotation device, the device comprising:

[0014] An acquisition unit, used for acquiring emotional text data to be annotated;

[0015] A processing unit, used for cleaning and deduplicating the acquired emotional text data to be annotated;

[0016] A clustering unit, used for clustering the processed sentiment text data to be annotated based on a hypersphere k-means clustering algorithm, to obtain the ball cluster information and its nearest neighbor relationship corresponding to the sentiment text data to be annotated;

[0017] The classification unit is used to obtain the stable domain and ring domain of each ball cluster according to the information of each ball cluster and its nearest neighbor relationship;

[0018] The first screening unit screens out representative emotional text data to be annotated from the annular domain from the outer to the inner according to the required marking amount;

[0019] The first labeling unit is used to select part of the emotional text data to be labeled from the stable domain of each ball cluster and perform labeling processing;

[0020] A training unit, used to train a classifier using the labeled sentiment text data;

[0021] The second screening unit is used to input representative emotional text data to be annotated into the trained classifier to obtain corresponding classification probabilities, perform uncertainty processing on the predicted classification probabilities, and output emotional text data to be annotated with uncertainty;

[0022] The second labeling unit is used to label the emotional text data to be labeled with uncertainty, and output the labeled emotional text data.

[0023] In the third aspect of the present invention, the present invention also provides an emotional text data annotation system, including an emotional text data annotation device as described in the second aspect of the present invention, and also including a Spark platform and a distributed database, wherein the Spark platform is equipped with the acquisition unit and the processing unit; the distributed database is used to store the emotional text data to be annotated after cleaning and deduplication processing, and is called by the clustering unit.

[0024] In a fourth aspect of the present invention, the present invention further provides an electronic device, comprising:

[0025] Processor and memory;

[0026] The memory is used to store program code and transmit the program code to the processor;

[0027] The processor is used to execute the emotional text data labeling method described in the first aspect of the present invention according to the instructions in the program code.

[0028] Beneficial effects of the present invention:

[0029] The present invention combines the geometric properties of the hypersphere with uncertainty and representativeness to select the samples with the most tagging value. Compared with the existing manual random tagging method in emotional text tagging, the present invention can reduce the workload of manual tagging, and more quickly select samples that are helpful for improving model performance, reducing the difficulty and cost of tagging. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1 A flow chart of a method for labeling emotional text data provided in an embodiment of the present application;

[0031] Figure 2 A flow chart for screening emotional text data provided in an embodiment of the present application;

[0032] Figure 3 A structural diagram of a device for labeling emotional text data provided in an embodiment of the present application;

[0033] Figure 4A structural diagram of the emotional text data annotation system provided in the embodiment of the present application;

[0034] Figure 5 It is a schematic diagram of the structure of an electronic device involved in an embodiment of the present application. DETAILED DESCRIPTION

[0035] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0036] Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without making any creative work shall fall within the scope of protection of this application.

[0037] The terms "first", "second", "third", etc. (if any) in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "corresponding to" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0038] Flowcharts are used in the present application to illustrate the operations performed according to the embodiments of the present application. It should be understood that the preceding or following operations are not necessarily performed accurately in order. On the contrary, various steps may be processed in reverse order or simultaneously as required. At the same time, other operations may also be added to these processes, or a certain step or several steps of operations may be removed from these processes.

[0039] In some embodiments, the environment diagram of the exemplary emotional text data annotation system of the emotional text data annotation method and device provided in the embodiments of the present application may include a user terminal, a network, and a server. The network is used to provide a medium for a communication link between the user terminal and the server, and the network may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0040] The user terminal may be any other type of electronic device capable of performing data processing, which may include but is not limited to desktop computers, laptops, tablet computers, smart phones, smart home devices, wearable devices, etc.

[0041] The network may be a single network, or a combination of at least two different networks. For example, the network may include, but is not limited to, a local area network, a wide area network, a public network, a private network, etc., or a combination of several of them.

[0042] A server can be a single server or a server group, where the servers are connected via a wired or wireless network. A server group can be centralized, such as a data center, or distributed. Servers can be local or remote.

[0043] See also Figure 1 , Figure 1 A flow chart of the emotional text data annotation method provided by the embodiment of the present application is shown as follows: Figure 1 As shown, the text annotation method provided by this application includes:

[0044] 101. Obtain the emotional text data to be annotated, and perform cleaning and deduplication processing on it;

[0045] In the embodiment of the present invention, the emotional text data to be annotated may include but are not limited to words, sentences, paragraphs and articles, and the actual language of the emotional text data to be annotated includes but is not limited to English, Japanese, Korean and Chinese.

[0046] In one embodiment, the method for obtaining the emotion text data to be annotated may be obtained through a terminal device, may be crawled from a network, or may be obtained from an acquisition unit, and the method for obtaining the emotion text data to be annotated is not limited herein. For example, the terminal device may obtain the emotion text data to be annotated through an input device connected thereto (such as a keyboard, a mouse, a handwriting tablet, a touch screen, etc.). For another example, the terminal device may also receive audio data corresponding to the emotion text data to be annotated, and perform speech recognition on the audio data to obtain the emotion text data to be annotated.

[0047] In some embodiments, the emotional text data to be annotated is unlabeled or annotated emotional text data, wherein the emotional text data may include network-wide news data (SogouCA), customer shopping reviews, Weibo comments, etc. For example, "I like watching movies", the "like" that appears here is an emotional tendency, and we can mark out its emotional label in the subsequent annotation process.

[0048] In an embodiment of the present invention, the acquired emotional text data to be annotated needs to be preprocessed. In this embodiment, cleaning processing and deduplication processing are mainly performed. The cleaning processing and deduplication processing here can adopt a common big data processing platform, such as using Spark to clean missing data and duplicate data; of course, the specific processing method and processing conditions of the cleaning processing and duplicate processing are not limited in this embodiment.

[0049] In some preferred embodiments of the present invention, the pre-processed emotional text data to be annotated may also be stored in a distributed database for subsequent use.

[0050] 102. Clustering the processed sentiment text data to be labeled using a hypersphere-based k-means clustering algorithm to obtain ball cluster information and neighbor relationships corresponding to the sentiment text data to be labeled;

[0051] In an embodiment of the present invention, an improved ball k-means algorithm (S.Xia et al., "A Fast Adaptive k-means with No Bounds," in IEEE Transactions on Pattern Analysis and Machine Intelligence, doi: 10.1109 / TPAMI.2020.3008694.) is used to quickly cluster the unlabeled sentiment text data to be annotated, and the ball cluster's own information and neighbor information are collected during the clustering process; wherein, the structural information of the ball cluster includes the centroid centroid, the distance dis from each point to the centroid of the ball cluster to which it belongs, the ball cluster label cluster_labels of each point, the centroid neighbors of the neighboring ball cluster, and so on.

[0052] In an embodiment of the present invention, before clustering, the processed emotional text data to be labeled needs to be z-score standardized. At the beginning of clustering, the Euclidean distance between different data sample points needs to be calculated, and the centroid initialization strategy of k-means++ is used to select k cluster centroids. During the clustering process, the distance from each data sample point to the cluster centroid and the distance between the clusters need to be determined. A hypersphere is used to characterize each cluster, and the emotional text data to be labeled is classified into different clusters according to the distance relationship.

[0053] In some embodiments of the present invention, the present invention can also use other clustering algorithms to cluster the sentiment text data to be labeled, such as a hierarchical clustering algorithm, a K-means clustering algorithm, etc. These clustering algorithms can be used to obtain the ball cluster information and its neighbor relationship corresponding to the sentiment text data to be labeled, and a part of representative sentiment text data to be labeled can be selected therefrom.

[0054] Based on the above method, the cluster classification results of the emotional text data to be labeled can be obtained. Assuming that there are 1,000 emotional text data to be labeled, then according to these cluster information, we can divide them into 10 clusters, and the classification result of each cluster is the classification result represented by the centroid of the cluster.

[0055] 103. According to the information of each ball cluster and its nearest neighbor relationship, the stable domain and the ring domain of each ball cluster are obtained, and representative emotional text data to be annotated are screened from the outer to the inner ring domain according to the required labeling amount;

[0056] In an embodiment of the present invention, according to the neighbor relationship of each cluster, we can divide the annular region of each cluster, that is, according to the set of the centroids of all neighboring clusters of the current cluster, if the number of centroids of the neighboring clusters of the current cluster is 0, then all spherical regions of the current cluster are used as stable domains; if the number of centroids of the neighboring clusters of the current cluster is not 0, then the annular region is calculated from all spherical regions of the current cluster according to the centroids of the neighboring clusters, and the remaining spherical regions of the current cluster are used as stable domains.

[0057] Specifically, assume that C is a spherical cluster (center of mass is c, radius is r), N C represents the set of centroids of all neighboring clusters of cluster C. Let k' = |N C |, if k'=0, it means that cluster C has no neighboring clusters. At this time, the core area of ​​the cluster is the entire cluster, that is, there is only a stable domain and no ring domain. If k'≠0, then for i∈[1,2,...,k], k represents the number of neighboring clusters of cluster C, let the centroid c i and the centroid c i+1 represents the centroid of the ith neighboring cluster and the i+1th neighboring cluster of cluster C. The ith annulus of cluster C is defined as The points in the ith ring domain satisfy that, for any x∈C, the ith ring domain is:

[0058]

[0059] in, represents the emotional text data to be annotated contained in the i-th ring domain of cluster C, c represents the centroid of cluster C, c i and c i+1 They represent the centroids of the i-th neighboring cluster and the i+1-th neighboring cluster of cluster C respectively, k′ represents the number of neighboring clusters of cluster C, r represents the radius of cluster C, and x represents the sentiment text data to be annotated in cluster C.

[0060] Among them, the parameters that need to be set in the ring domain calculation are shown in Table 1:

[0061] Table 1 Ring domain partition parameter settings

[0062]

[0063]

[0064] i indicates which ring domain needs to be calculated currently, which can be used for traversal and is initially set to 0; m indicates how many outer ring domains to select samples from; R_ratio indicates the ring domain ratio, that is, if the current cluster has no neighboring clusters, then the part outside the spherical domain with the radius of the cluster × R_ratio as the radius in the current cluster needs to be recorded as the ring domain according to the ring domain ratio; Neighbor_num indicates the number of neighboring clusters. If 3 is selected, it means that 3 neighboring clusters need to be considered when calculating the ring domain.

[0065] According to the above method, the representative emotional text data to be annotated in this embodiment is the text data in the ring domain. From the perspective of clustering, the text data in this ring domain is located in the boundary area of ​​the cluster, and the data set composed of cluster boundary points describes the contour structure of the data set, so it is representative.

[0066] 104. Select a portion of the emotion text data to be annotated from the stable domain of each ball cluster for annotating, and use the annotated emotion text data to train a classifier;

[0067] In an embodiment of the present invention, by utilizing the cluster's own information and neighbor information, x samples closest to the cluster's centroid in the stable domain can be selected from each cluster for labeling (x can be freely set according to user requirements, but must be greater than 0, and the default value is 1). These labeled data are used as labeled sets, and the labeled sets are used as training data sets. These training data sets are used to train classifiers, and the type of classifiers here can be any common classic classifiers, such as logistic regression, SVM, etc. The trained classifier can be used to calculate the predicted probability of the emotional text data to be labeled, and this predicted probability can indicate the classification probability of the data, that is, the probability of belonging to category A, category B, or other categories.

[0068] 105. Inputting representative sentiment text data to be annotated into the trained classifier to obtain corresponding classification probabilities, performing uncertainty processing on the predicted classification probabilities, and outputting sentiment text data to be annotated with uncertainty;

[0069] In the embodiment of the present invention, the representative emotional text data to be annotated is further screened for a second time. This screening process needs to perform uncertainty processing with the help of classification probability, so that the screened emotional text data to be annotated is representative while also having strong uncertainty.

[0070] In an embodiment of the present invention, by inputting representative sentiment text data to be annotated into a trained classifier, the classification probability corresponding to the data can be obtained, and the uncertainty of the predicted probability corresponding to the sentiment text data to be annotated is calculated based on the predicted classification probability. When the uncertainty exceeds a preset adaptive threshold, the corresponding sentiment text data to be annotated has uncertainty.

[0071] Among them, the formula used to calculate the uncertainty of the prediction probability corresponding to the emotional text data to be annotated is expressed as:

[0072]

[0073] Among them, G(p) represents the Gini index of the emotional text data p to be labeled, which is the first-order Taylor expansion of information entropy; K represents the number of categories of the emotional text data to be labeled, where the number of categories is the number of categories in the emotional text data set, which can correspond to the total number of categories in the classifier; p k represents the probability of belonging to category k.

[0074] The calculation formula used for the selected labeled samples is expressed as:

[0075]

[0076] Among them, Selected instances represents the sentiment text data to be labeled, and G(x) represents the Gini index of the sentiment text data x to be labeled; It represents the sentiment text data to be annotated contained in the i-th ring domain of the ball cluster C; topN represents the sampling function based on the adaptive threshold, which can calculate the adaptive threshold according to the ring domain radius and select N samples whose uncertainty exceeds the adaptive threshold. The value of N is determined by the ring domain.

[0077] 106. Perform labeling processing on the emotion text data to be labeled with uncertainty, and output the labeled emotion text data.

[0078] In an embodiment of the present invention, Figure 2 A flowchart of the screening process is given, such as Figure 2 As shown in the figure, during the screening process, an unlabeled data set is selected from the labeled state pool, and the i-th outer ring domain sample is iteratively screened out using the active learning process to form a representative sample set. The uncertainty of this representative sample set is calculated and sorted. The samples in the representative sample set with the highest sorting are output, which are important samples with both representativeness and uncertainty. Such samples are labeled by experts, and after the labeling is completed, these samples are marked as labeled data sets in the labeled state pool.

[0079] Among them, the labeled state pool: {unlabeled data set, labeled data set}, the labeled data set in the initial labeled state pool is the output of the previous process, the unlabeled data set = complete data set - labeled data set.

[0080] In an embodiment of the present invention, through two screenings, representative emotion text data to be labeled are screened out from a massive amount of emotion text data to be labeled, and then the emotion text data to be labeled with uncertainty are screened out from the representative emotion text data to be labeled; the emotion text data to be labeled finally screened out are both representative and uncertain; this method has the most marking value, and labeling these data with the most marking value can reduce the workload of manual labeling, and reduce the difficulty and cost of labeling work.

[0081] See also Figure 3 , Figure 3 A structural diagram of the emotional text data annotation device provided in an embodiment of the present application is shown. Figure 3 As shown, the emotional text data labeling device 200 provided by the present application includes:

[0082] An acquisition unit 201 is used to acquire emotional text data to be annotated;

[0083] The processing unit 202 is used to clean and remove duplicates of the acquired emotional text data to be annotated;

[0084] The clustering unit 203 is used to cluster the processed sentiment text data to be annotated based on the hypersphere k-means clustering algorithm to obtain the ball cluster information and its nearest neighbor relationship corresponding to the sentiment text data to be annotated;

[0085] The classification unit 204 is used to obtain the stable domain and the ring domain of each ball cluster according to the information of each ball cluster and its neighbor relationship;

[0086] The first screening unit 205 screens out representative emotional text data to be marked from the annular domain from the outer to the inner according to the required marking amount;

[0087] A first labeling unit 206 is used to select a portion of the emotional text data to be labeled from the stable domain of each ball cluster and perform labeling processing;

[0088] A training unit 207, used for training a classifier using the annotated sentiment text data;

[0089] The second screening unit 208 is used to input representative emotional text data to be annotated into the trained classifier to obtain corresponding classification probabilities, perform uncertainty processing on the predicted classification probabilities, and output emotional text data to be annotated with uncertainty;

[0090] The second labeling unit 209 is used to label the emotional text data to be labeled with uncertainty, and output the labeled emotional text data.

[0091] See also Figure 4 , Figure 4 A structural diagram of the emotional text data annotation system provided in the embodiment of the present application is shown. Figure 4 As shown, the emotional text data annotation system 300 provided by the present application includes:

[0092] A sentiment text data labeling device also includes a Spark platform 301 and a distributed database 302, wherein the Spark platform is equipped with the acquisition unit and the processing unit; the distributed database is used to store the sentiment text data to be labeled after cleaning and deduplication processing, and is called by the clustering unit.

[0093] In a preferred embodiment of the present invention, the emotional text data annotation system 300 may also include a visualization front end, which may be used to display the annotation status for easy review.

[0094] In addition, the present application also provides an electronic device, see Figure 4 , Figure 4 A schematic structural diagram of an electronic device involved in an embodiment of the present application is shown.

[0095] like Figure 5 As shown, the electronic device may include components such as a processor 401 of one or more processing cores, a memory 402 of one or more computer-readable storage media, a power supply 403, and an input unit 404.

[0096] Those skilled in the art will understand that Figure 5 The electronic device structure shown in the figure does not constitute a limitation of the electronic device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0097] In one embodiment, the processor 401 is the control center of the electronic device, which uses various interfaces and lines to connect various parts of the entire electronic device, and executes various functions of the electronic device and processes data by running or executing software programs and / or modules stored in the memory 402, and calling data stored in the memory 402, thereby monitoring the electronic device as a whole.

[0098] In one embodiment, processor 401 may include one or more processing cores.

[0099] In one embodiment, the processor 401 may integrate an application processor and a modem processor, wherein the application processor mainly processes an operating system, a user interface, and application programs, and the modem processor mainly processes wireless communications. It is understandable that the modem processor may not be integrated into the processor 401.

[0100] In one embodiment, the memory 402 may be used to store software programs and modules, and the processor 401 executes various functional applications and data processing by running the software programs and modules stored in the memory 402 .

[0101] In one embodiment, the memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 402 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 with access to the memory 402.

[0102] In one embodiment, the power supply 403 may be logically connected to the processor 401 through a power management system, so that functions such as charging, discharging, and power consumption management can be implemented through the power management system.

[0103] In one embodiment, the power supply 403 may also include one or more DC or AC power supplies, a recharging system, a power failure detection circuit, a power converter or inverter, a power status indicator, and other arbitrary components.

[0104] In one embodiment, the electronic device may further include an input unit 404, which may be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal input related to user settings and function control.

[0105] Although not shown, the electronic device may further include a display unit, etc., which will not be described in detail here.

[0106] In one embodiment, the processor 401 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 runs the application stored in the memory 402, thereby realizing the emotional text data annotation function:

[0107] Obtain the emotional text data to be annotated, and perform cleaning and deduplication processing on it;

[0108] The processed sentiment text data to be annotated are clustered using a hypersphere-based k-means clustering algorithm to obtain the ball cluster information and its nearest neighbor relationship corresponding to the sentiment text data to be annotated;

[0109] According to the information of each ball cluster and its neighbor relationship, the stable domain and ring domain of each ball cluster are obtained, and representative emotional text data to be annotated are screened from the outer to the inner ring domain according to the required labeling amount;

[0110] Select some emotional text data to be annotated from the stable domain of each ball cluster for annotation processing, and use the annotated emotional text data to train the classifier;

[0111] Input representative sentiment text data to be annotated into the trained classifier to obtain the corresponding classification probability, perform uncertainty processing on the predicted classification probability, and output the sentiment text data to be annotated with uncertainty;

[0112] The emotional text data to be annotated with uncertainty is annotated, and the annotated emotional text data is output.

[0113] The specific implementation of the above operations can be found in the previous embodiments, which will not be described in detail here.

[0114] A person of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be completed by instructions, or by controlling related hardware through instructions. The instructions may be stored in a computer-readable storage medium and loaded and executed by a processor.

[0115] In the description of the present invention, it is necessary to understand that the terms "coaxial", "bottom", "one end", "top", "middle", "the other end", "upper", "one side", "top", "inside", "outside", "front", "center", "both ends" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation on the present invention.

[0116] In the present invention, unless otherwise clearly stipulated and limited, the terms such as "installation", "setting", "connection", "fixation" and "rotation" should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or an integral one; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium; it can be the internal connection of two elements or the interaction relationship between two elements. Unless otherwise clearly defined, ordinary technicians in this field can understand the specific meanings of the above terms in the present invention according to the specific circumstances.

[0117] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for labeling emotional text data, characterized in that: The method comprises: Obtain the emotional text data to be annotated, and perform cleaning and deduplication processing on it; The processed sentiment text data to be annotated are clustered using a hypersphere-based k-means clustering algorithm to obtain the ball cluster information and its nearest neighbor relationship corresponding to the sentiment text data to be annotated; According to the information of each ball cluster and its neighbor relationship, the stable domain and ring domain of each ball cluster are obtained, and representative emotional text data to be annotated are screened from the outer to the inner ring domain according to the required labeling amount; Select some of the emotional text data to be annotated in the stable domain of each ball cluster for annotation processing, and use the annotated emotional text data to initially train the classifier; Input representative sentiment text data to be annotated into the trained classifier to obtain the corresponding classification probability, perform uncertainty processing on the predicted classification probability, and output the sentiment text data to be annotated with uncertainty; The uncertainty processing of the predicted classification probability specifically includes calculating the uncertainty of the predicted probability corresponding to the emotional text data to be annotated, and when the uncertainty exceeds a preset adaptive threshold, the corresponding emotional text data to be annotated has uncertainty; The formula used to calculate the uncertainty of the prediction probability corresponding to the emotional text data to be annotated is expressed as: Among them, G(p) represents the Gini index of the emotional text data p to be labeled, which is the first-order Taylor expansion of information entropy; K represents the number of categories of the emotional text data to be labeled, p k represents the probability of belonging to category k; The calculation formula used to select the emotional text data to be annotated with uncertainty is expressed as: Among them, Selected instances represents the sentiment text data to be labeled, and G(x) represents the Gini index of the sentiment text data x to be labeled; represents the emotional text data to be annotated contained in the i-th ring domain of the ball cluster C; topN represents the sampling function based on the adaptive threshold, which can calculate the adaptive threshold according to the ring domain radius and select N samples whose uncertainty exceeds the adaptive threshold; The emotional text data to be annotated with uncertainty is annotated, and the annotated emotional text data is output.

2. The emotional text data labeling method according to claim 1, characterized in that: The method of clustering the processed emotional text data to be labeled by using a hypersphere-based k-means clustering algorithm includes performing z-score standardization on the processed emotional text data to be labeled, calculating the Euclidean distance between different data sample points, and selecting k ball cluster centroids by using a k-means++ centroid initialization strategy; Determine the distance from each data sample point to the centroid of the cluster, as well as the distance between clusters; use a hypersphere to characterize each cluster, and classify the emotional text data to be labeled into different clusters according to the distance relationship.

3. The emotional text data labeling method according to claim 1, characterized in that: The method of obtaining the stable domain and annular domain of each cluster based on the information of each cluster and its neighbor relationship includes obtaining the set of the centroids of all neighboring clusters of the current cluster. If the number of centroids of the neighboring clusters of the current cluster is 0, the internal spherical area of ​​the current cluster is used as the stable domain, and the rest is used as the annular domain; if the number of centroids of the neighboring clusters of the current cluster is not 0, the annular domain is calculated from all spherical areas of the current cluster based on the centroids of the neighboring clusters, and the remaining spherical area of ​​the current cluster is used as the stable domain.

4. The emotional text data labeling method according to claim 3 is characterized in that: The step of calculating the annulus from all spherical regions of the current cluster according to the centroid of the neighboring clusters specifically includes: Where c represents the center of mass of the cluster C, c i and c i+1 They represent the centroids of the i-th neighboring cluster and the i+1-th neighboring cluster of cluster C respectively, k′ represents the number of neighboring clusters of cluster C, and r represents the radius of cluster C.

5. An emotional text data labeling device, which is used to implement the emotional text data labeling method according to any one of claims 1 to 4, characterized in that: The device comprises: An acquisition unit, used for acquiring emotional text data to be annotated; A processing unit, used for cleaning and deduplicating the acquired emotional text data to be annotated; A clustering unit, used for clustering the processed sentiment text data to be annotated based on a hypersphere k-means clustering algorithm, to obtain the ball cluster information and its nearest neighbor relationship corresponding to the sentiment text data to be annotated; The classification unit is used to obtain the stable domain and ring domain of each ball cluster according to the information of each ball cluster and its nearest neighbor relationship; The first screening unit screens out representative emotional text data to be annotated from the annular domain from the outer to the inner according to the required marking amount; The first labeling unit is used to select part of the emotional text data to be labeled from the stable domain of each ball cluster and perform labeling processing; A training unit, used to train a classifier using the labeled sentiment text data; The second screening unit is used to input representative emotional text data to be annotated into the trained classifier to obtain corresponding classification probabilities, perform uncertainty processing on the predicted classification probabilities, and output emotional text data to be annotated with uncertainty; The second labeling unit is used to label the emotional text data to be labeled with uncertainty, and output the labeled emotional text data.

6. A sentiment text data annotation system, characterized in that: It includes a sentiment text data labeling device as described in claim 5, and also includes a Spark platform and a distributed database, wherein the Spark platform is equipped with the acquisition unit and the processing unit; the distributed database is used to store the sentiment text data to be labeled after cleaning and deduplication processing, and is called by the clustering unit.

7. An electronic device, characterized in that: include: Processor and memory; The memory is used to store program code and transmit the program code to the processor; The processor is used to execute the emotional text data labeling method according to any one of claims 1 to 4 according to the instructions in the program code.