Emotional attribute acquisition method, device, equipment, and storage medium

Through vectorization processing and splicing of emotional attribute acquisition methods, combined with the tone information of characters, the limitations of emotional attribute acquisition in the prior art are solved, and efficiency and accuracy are improved.

CN112307200BActive Publication Date: 2025-02-07SF TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201910675582.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-07-25
Publication Date
2025-02-07
Estimated Expiration
2039-07-25

AI Technical Summary

Technical Problem

The prior art has limitations in acquiring emotional attributes, such as easy introduction of noisy words, difficulty in dealing with long-tail words, and dynamic expression methods, and requires relying on manual rules and complex models.

Method used

By obtaining the feature information of the text and its characters to be analyzed, vectorized processing and splicing the vector matrix, combining the tone of the characters and other information, the label score of the emotional attribute is calculated to obtain the emotional attribute.

Benefits of technology

It improves the efficiency and accuracy of emotional attribute acquisition, reduces the dependence on artificial and complex rules, and can better handle dynamic expressions and long-tail words.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112307200B_ABST
    Figure CN112307200B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a method, device, equipment and computer-readable storage medium for acquiring emotional attributes. The embodiment of the present application obtains a text to be analyzed, and obtains the feature information of each character in the text to be analyzed; vectorizes the text to be analyzed to obtain a vector matrix of the text to be analyzed; obtains the concatenated vector matrix information based on the feature information of each character in the text to be analyzed and the vector matrix; obtains the emotional attributes corresponding to the text to be analyzed based on the text to be analyzed, the feature information of each character and the concatenated vector matrix information. The accuracy and efficiency of acquiring emotional attributes are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of data processing technology, and specifically to a method, device, equipment and storage medium for acquiring emotional attributes. Background Art

[0002] With the rapid development of e-commerce and the Internet, browsing products, placing orders, paying, and posting personal experience and evaluation of products online have become people's daily habits. These review texts reflect consumers' likes and dislikes of this product in various dimensions, that is, users' evaluation attributes of the product. For example, a user's evaluation of a certain mobile phone is "OK, the appearance is gorgeous, the battery consumes too fast, and the camera function is average." Among them, the emotional tendency of the evaluation attribute "appearance" is positive, the emotional tendency of "battery consumption" is negative, and the emotional tendency of "camera function" is neutral. Positive, negative, and neutral are the emotions of the evaluation attributes.

[0003] There are three main methods for obtaining sentiment attributes: one is the frequency-based method, which first uses association rules to extract product attributes from the review text, and then uses the sentiment dictionary to judge the sentiment tendency. This method has great limitations, such as the easy introduction of noise words and difficulty in processing long-tail words. It is difficult to handle dynamic expressions relying solely on the sentiment dictionary. The second is the template rule-based method, which jointly extracts attributes and sentiment words by formulating part-of-speech and dependency syntactic templates. In addition to the sentiment discrimination problem in the first method, this method also relies on experts to formulate rules in a time-consuming and labor-intensive manner, and the template is difficult to adapt to the ever-changing spoken expressions. The third is the conditional random field-based method, which manually formulates feature templates and then feeds these features into a probability-based model for training. This method also requires manual formulation of feature rules, and the model is complex and requires more manual intervention. Summary of the invention

[0004] The embodiments of the present application provide a method, apparatus, device and storage medium for acquiring emotional attributes, which can achieve the efficiency of acquiring emotional attributes and improve the accuracy of acquiring emotional attributes.

[0005] In a first aspect, an embodiment of the present application provides a method for acquiring emotional attributes, including:

[0006] Acquire a text to be analyzed, and acquire feature information of each character in the text to be analyzed;

[0007] Performing vectorization processing on the text to be analyzed to obtain a vector matrix of the text to be analyzed;

[0008] According to the feature information of each character in the text to be analyzed and the vector matrix, obtaining the concatenated vector matrix information;

[0009] The sentiment attribute corresponding to the text to be analyzed is obtained according to the text to be analyzed, the feature information of each character and the concatenated vector matrix information.

[0010] In some implementations, the step of obtaining the concatenated vector matrix information based on the feature information of each character in the text to be analyzed and the vector matrix includes:

[0011] Acquire a first position of a character corresponding to the feature information in the text to be analyzed, and a second position of a character corresponding to the vector matrix in the text to be analyzed;

[0012] The feature information of each character in the text to be analyzed is spliced ​​with the vector matrix according to the first position and the second position to obtain the spliced ​​vector matrix information.

[0013] In some implementations, obtaining the sentiment attribute corresponding to the text to be analyzed according to the text to be analyzed and the concatenated vector matrix information includes:

[0014] Obtaining a vector of feature information of each character;

[0015] Calculate the label score of the text to be analyzed according to the text to be analyzed and the concatenated vector matrix information;

[0016] The sentiment attribute corresponding to the text to be analyzed is obtained according to the label score.

[0017] In some implementations, the vectorization processing of the text to be analyzed to obtain a vector matrix of the text to be analyzed includes:

[0018] Perform word segmentation on the input text to be analyzed through the trained vectorization model, generate words constituting the text to be analyzed, and obtain word vectors corresponding to the words;

[0019] The word vectors are connected according to the character arrangement order corresponding to the text to be analyzed to obtain a vector matrix of the text to be analyzed.

[0020] In some implementations, the step of performing word segmentation processing on the input text to be analyzed by using a vectorization model to generate words constituting the text to be analyzed includes:

[0021] Segment the text to be analyzed to obtain words that match a preset vocabulary to obtain initial words;

[0022] Obtaining the optimal path between the initial word and each word in the preset word library through the vectorization model;

[0023] The words constituting the text to be analyzed are determined according to the optimal path.

[0024] In some implementations, before performing word segmentation processing on the input text to be analyzed by using a vectorization model to generate words constituting the text to be analyzed and obtaining word vectors corresponding to the words, the method further includes:

[0025] Obtain words with the same radical and marked with real word categories to obtain training samples;

[0026] Determining a word prediction category of the training sample;

[0027] Obtaining a preset loss function according to the real word category and the word prediction category;

[0028] The vectorized model is converged according to the loss function to obtain a trained vectorized model.

[0029] In some implementations, the feature information includes radicals, and obtaining the feature information of each character in the text to be analyzed includes:

[0030] Get the basic radical table;

[0031] Splitting each character in the text to be analyzed to obtain sub-characters of the text to be analyzed;

[0032] The radical of each character in the text to be analyzed is obtained according to the basic radical table and the sub-characters.

[0033] In a second aspect, the embodiment of the present application further provides a device for acquiring emotional attributes, including:

[0034] A first acquisition unit is used to acquire a text to be analyzed, and acquire feature information of each character in the text to be analyzed;

[0035] A vectorization unit, used for performing vectorization processing on the text to be analyzed to obtain a vector matrix of the text to be analyzed;

[0036] A second acquisition unit, configured to acquire the concatenated vector matrix information according to the feature information of each character in the text to be analyzed and the vector matrix;

[0037] The sentiment attribute obtaining unit is used to obtain the sentiment attribute corresponding to the text to be analyzed according to the text to be analyzed and the concatenated vector matrix information.

[0038] In some implementations, the second acquisition unit includes:

[0039] The first acquisition subunit is used to obtain the first position of the character corresponding to the feature information in the text to be analyzed, and the second position of the character corresponding to the vector matrix in the text to be analyzed; according to the first position and the second position, the feature information of each character in the text to be analyzed is spliced ​​with the vector matrix to obtain the spliced ​​vector matrix information.

[0040] In some implementations, the emotion attribute obtaining unit includes:

[0041] A second acquisition subunit, used to acquire a vector of feature information of each character;

[0042] A calculation subunit, used for calculating the label score of the text to be analyzed based on the text to be analyzed and the concatenated vector matrix information;

[0043] The third acquisition subunit is used to acquire the sentiment attribute corresponding to the text to be analyzed according to the label score.

[0044] In some implementations, the vectorization unit includes:

[0045] A generating subunit, used for performing word segmentation processing on the input text to be analyzed by using the trained vectorization model, generating words constituting the text to be analyzed, and obtaining word vectors corresponding to the words;

[0046] A connecting subunit is used to connect the word vectors according to the character arrangement order corresponding to the text to be analyzed, so as to obtain the vector matrix of the text to be analyzed.

[0047] In some embodiments, the generating subunit comprises:

[0048] A segmentation module, used to segment the text to be analyzed into words that match a preset vocabulary to obtain initial words;

[0049] The acquisition module is used to acquire the optimal path between the initial word and each word in the preset vocabulary through the vectorization model; and determine the words constituting the text to be analyzed according to the optimal path.

[0050] In some implementations, the vectorization unit includes:

[0051] The fourth acquisition subunit is used to acquire words with the same radical and marked with real word categories to obtain training samples;

[0052] A determination subunit, used to determine the word prediction category of the training sample;

[0053] A fifth acquisition subunit, used to acquire a preset loss function according to the real word category and the word prediction category;

[0054] A convergence subunit is used to converge the vectorized model according to the loss function to obtain a trained vectorized model.

[0055] In some implementations, the first acquisition unit includes:

[0056] The sixth acquisition subunit is used to acquire a basic radical table;

[0057] A splitting subunit, used for splitting each character in the text to be analyzed to obtain sub-characters of the text to be analyzed;

[0058] The seventh acquisition subunit is used to acquire the radical of each character in the text to be analyzed according to the basic radical table and the sub-characters.

[0059] In a third aspect, an embodiment of the present application further provides a device, comprising a processor and a memory, wherein the memory stores program code, and when the processor calls the program code in the memory, the method for acquiring emotional attributes as described above is executed.

[0060] In a fourth aspect, an embodiment of the present application further provides a storage medium, wherein the storage medium stores a computer program, which is loaded by a processor to execute the emotion attribute acquisition method as described above.

[0061] The embodiment of the present application obtains the text to be analyzed by vectorizing the text to be analyzed, and obtains the feature information of each character in the text to be analyzed; vectorizes the text to be analyzed to obtain the vector matrix of the text to be analyzed; obtains the spliced ​​vector matrix information according to the feature information of each character in the text to be analyzed and the vector matrix; obtains the emotional attribute corresponding to the text to be analyzed according to the text to be analyzed, the feature information of each character and the spliced ​​vector matrix information. This solution obtains the vector matrix of the text to be analyzed by vectorizing the text to be analyzed; obtains the spliced ​​vector matrix information according to the feature information of each character in the text to be analyzed and the vector matrix. Since the feature information of each character is combined, the spliced ​​vector matrix information integrates the information such as the tone of the character, and further increases the information contained in the vector matrix information; then, according to the text to be analyzed, the feature information of each character and the spliced ​​vector matrix information, the emotional attribute corresponding to the text to be analyzed can be obtained, so that the obtained emotional attribute is more accurate and does not need to rely on manual and template rules; thereby improving the efficiency of determining the emotional attribute. BRIEF DESCRIPTION OF THE DRAWINGS

[0062] 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 only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0063] Figure 1 It is a flowchart of the method for acquiring emotional attributes provided in an embodiment of the present application;

[0064] Figure 2 is another flow chart of the method for acquiring emotional attributes provided in an embodiment of the present application;

[0065] Figure 3 is a schematic diagram of the structure of the emotional attribute acquisition device provided in an embodiment of the present application;

[0066] Figure 4 It is a schematic diagram of the structure of the device provided in the embodiment of the present application. DETAILED DESCRIPTION

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

[0068] See also Figure 1 , Figure 1 : is a flowchart of an emotion attribute acquisition method provided by an embodiment of the present application. The execution subject of the emotion attribute acquisition method may be the emotion attribute acquisition device provided by the embodiment of the present application, or a device integrated with the emotion attribute acquisition device, such as a terminal or a server, etc. The device may be a smart phone, a tablet computer, a PDA, or a laptop computer, a fixed computer, and a server, etc. The emotion attribute acquisition method may include:

[0069] S101, obtaining a text to be analyzed, and obtaining feature information of each character in the text to be analyzed.

[0070] Specifically, in this embodiment, the text to be analyzed may include the user's personal usage feelings and evaluation texts of goods, or the user's personal book review texts of certain texts, etc., which are not limited herein. Specifically, the text to be analyzed can be obtained by data crawling. First, start the data collector added in the server or device. The data collector can also be a data collector installed in the browser. The data collector is an information tool used to batch collect the content of web pages, forums, etc., and directly save it to the data or publish it to the network. It can automatically collect the original web page according to the rules set by the user and obtain the content required in the formatted web page. Now it has also developed into a tool (system) that can process data. For example, the SQL Server 2008 Performance Data Collector allows users to create a central database to store performance data; it contains three built-in data collection groups to collect and store data; in order to help us identify and troubleshoot SQL Server performance-related problems, we can use its three built-in reports to view the collected and stored data. Then, according to the received crawling conditions of the text to be analyzed, select the text to be analyzed that needs to be crawled and perform collection, and the analyzed text can be obtained, improving the accuracy of obtaining the text to be analyzed.

[0071] Further, the feature information may include obtaining radicals. The process of obtaining radicals may include:

[0072] Obtain a basic radical table;

[0073] Split each character in the text to be analyzed to obtain the sub-characters of the text to be analyzed;

[0074] Obtain the radicals of each character in the text to be analyzed according to the basic radical table and the sub-characters.

[0075] Obtain a basic radical table, which is a table containing common radicals. Then split each character in the text to be analyzed to obtain the sub-characters of the text to be analyzed. For example, can be split into sub-characters "female" and "mouth", and then match the split sub-characters with the radicals in the basic radical table to obtain the radicals of each character in the text to be analyzed.

[0076] S102, perform vectorization processing on the text to be analyzed to obtain a vector matrix of the text to be analyzed.

[0077] After obtaining the text to be analyzed, the text to be analyzed can be vectorized to obtain the vector matrix of the text to be analyzed. Specifically, the text to be analyzed can be input into the trained vectorization model, and the trained vectorization model can be used to segment the input text to be analyzed, generate the words that make up the text to be analyzed, and obtain the word vectors corresponding to the words. In order to obtain more accurate word vectors, the vectorization model can be trained with words with the same radical before obtaining the word vectors; then the word vectors are connected according to the character arrangement order corresponding to the text to be analyzed to obtain the vector matrix of the text to be analyzed.

[0078] That is, step S102 may include:

[0079] Perform word segmentation on the input text to be analyzed through the trained vectorization model, generate words constituting the text to be analyzed, and obtain word vectors corresponding to the words;

[0080] The word vectors are connected according to the character arrangement order corresponding to the text to be analyzed to obtain a vector matrix of the text to be analyzed.

[0081] First, obtain the trained vectorization model, and use the trained vectorization model to perform word segmentation on the input text to be analyzed. Specifically, the text to be analyzed can be segmented into words that match the preset vocabulary; the optimal path can be obtained through the vectorization model; the optimal segmentation result among the segmented words can be obtained according to the optimal path, and the words that make up the text to be analyzed can be obtained. Further, the word vectors corresponding to the words established when the model was established are obtained, and the word vectors are connected according to the character arrangement order corresponding to the text to be analyzed to obtain the vector matrix of the text to be analyzed. For example, assuming that the text to be analyzed is "gorgeous appearance", the segmented words are appearance and gorgeous, and the word vector obtained is Z 1 , Z 2 , then according to the text to be analyzed is "gorgeous appearance", the word vectors are concatenated to obtain the vector matrix (Z 1 , Z 2 ).

[0082] Furthermore, the word segmentation process may include:

[0083] Segment the text to be analyzed to obtain words that match a preset vocabulary to obtain initial words;

[0084] Obtaining the optimal path between the initial word and each word in the preset word library through the vectorization model;

[0085] The words constituting the text to be analyzed are determined according to the optimal path.

[0086] Specifically, first, all possible words that match the preset word library are segmented from the text to be analyzed to obtain initial words, and then a statistical language model is used to determine the optimal segmentation result. First, a dictionary entry search is performed (usually stored in a Trie), and all matching dictionary entries are found and represented in the form of word lattices. Then, a path search is performed, and the optimal path is found based on a statistical language model (such as n-gram), and the optimal segmentation result can be calculated to obtain the word segmentation result, that is, the words that make up the text to be analyzed are obtained.

[0087] Furthermore, training the vectorization model through word pairs with the same radical can include:

[0088] Obtain words with the same radical marked with real word categories to get training samples;

[0089] Determine the predicted word categories of the training samples;

[0090] Obtain a preset loss function according to the real word category and the predicted word category;

[0091] Converge the vectorization model according to the loss function to obtain a trained vectorization model.

[0092] For example, obtaining words such as "tree", "forest", "willow", "orange", "cypress", "poplar", etc., which are all related to trees, as training samples, and the corresponding real word category is trees.

[0093] Determine the predicted word categories of the training samples. Specifically, a classification regression network can be used to classify the training samples to obtain the predicted word categories of the training samples. Among them, the predicted word category can include information such as type and type probability. Then, a preset loss function, such as a classification loss function, is obtained according to the real word category and the predicted word category, and the vectorization model is converged according to the loss function to obtain a trained vectorization model. Optionally, in order to accelerate the training speed, a warm start method can be used to train the model. For example, the initial learning rate of the detection model can be set to 0.001, and when the training reaches three-quarters, the learning rate is reduced to 0.0001, and so on.

[0094] S103. According to the feature information of each character in the text to be analyzed and the vector matrix, obtain the vector matrix information after splicing.

[0095] According to the feature information of each character in the text to be analyzed and the vector matrix, obtain the vector matrix information after splicing. The feature information of each character in the text to be analyzed includes the radical of each character. First, splice the vectors corresponding to the radicals of each character with the vector matrix. Specifically, it can be done through the first position of the character corresponding to the feature information in the text to be analyzed and the second position of the character corresponding to the vector matrix in the text to be analyzed, and splice the vectors corresponding to the radicals of each character with the vector matrix.

[0096] That is, step S103 includes:

[0097] Obtain the vectors of the feature information of each character;

[0098] Obtain the first position of the character corresponding to the feature information in the text to be analyzed and the second position of the character corresponding to the vector matrix in the text to be analyzed;

[0099] Splice the feature information of each character in the text to be analyzed with the vector matrix according to the first position and the second position to obtain the vector matrix information after splicing.

[0100] In this embodiment, the feature information of each character includes the radicals of each character in the text to be analyzed. Then, obtain the vectors of the radicals of each character, which can be specifically obtained through a trained vectorization model; then obtain the first position of the character corresponding to the radical in the text to be analyzed. For example, assume the text to be analyzed is "The appearance is gorgeous", and the radicals are "Xi, You, Silk Radical, and One" respectively. Then the characters corresponding to "Xi, You" are "appearance", and the first position of "appearance" in the text to be analyzed is 1, and the vector matrix Z 1 The corresponding character is "appearance", and the first position of "appearance" in the text to be analyzed is 1. Then splice the vectors of the radicals "Xi, You" with Z in the vector matrix 1 to obtain the vector matrix information after splicing.

[0101] S104, obtain the emotional attribute corresponding to the text to be analyzed according to the text to be analyzed, the feature information of each character, and the vector matrix information after splicing.

[0102] In this embodiment, the feature information of each character includes the tone of each character. Specifically, by inputting the text to be analyzed, the tones of each character, and the spliced vector matrix information into the trained discrimination model, the emotional attribute corresponding to the text to be analyzed is obtained through the discrimination model. For Chinese, the radicals contain the categories and similar characteristics of words. For example, characters with the radical "扌" such as "捉 (zhuō), 打 (dǎ), 招 (zhāo), 捉 (zhuō), 挥 (huī)" etc. all share the similarity related to hand movements; another example is that characters with the radical "木" such as "树 (shù), 林 (lín), 柳 (liǔ), 橘 (jú), 柏 (bǎi), 杨 (yáng)" etc. are all related to trees. Incorporating this character formation method information into the vectorization model can further improve the quality of vector representation. Thereby, the accuracy of obtaining the emotional attribute is improved. After obtaining the emotional attribute of the text to be analyzed, the obtained emotional attribute of the text to be analyzed can be further statistically analyzed. For example, counting the text to be analyzed with a positive emotional attribute and the text to be analyzed with a negative emotional attribute, and the statistical results can be further displayed on the display page to analyze the quality of the product corresponding to the text to be analyzed according to the statistical results.

[0103] Specifically, S104 includes:

[0104] Calculating the label score of the text to be analyzed according to the text to be analyzed and the spliced vector matrix information;

[0105] Obtaining the emotional attribute corresponding to the text to be analyzed according to the label score.

[0106] Specifically, the label score of the text to be analyzed is calculated through the discrimination model, where the discrimination model consists of a bidirectional LSTM followed by a CRF. First, the tones of each character are encoded through the discrimination model. The encoding rule can be encoding the high level, rising tone, falling-rising tone, falling tone, and neutral tone in the four tones as 1, 2, 3, 4, 0 respectively. For example, for the words "耗电 [hào diàn]" in the sentence "电池耗电太快了 (The battery drains power too quickly)", the previous and subsequent words are "电池 [diàn chí]" and "太 [tài]" (here n is taken as 1), and the tone representation obtained according to the conversion rule is 42444. Then, through the score calculation formula in the discrimination model:

[0107]

[0108] Calculate the score of the text to be analyzed, where T is the score transfer matrix, H is the hidden layer output of the bidirectional LSTM, and then use the Softmax function to obtain the probability representation of the score of the text to be analyzed. During the training process, optimize the maximum likelihood estimation function of all given samples. During the prediction, use the Viterbi algorithm to obtain the label sequence corresponding to the optimal probability of the text to be analyzed, and then use the label sequence to obtain the sentiment attribute corresponding to the text to be analyzed. For example, assuming that the text to be analyzed is "The battery consumes too fast", the probability of the text to be analyzed calculated by the discriminant model is shown in the following table, where the label corresponding to the largest number in the table is the label output corresponding to the text to be analyzed. It can be seen that the sentiment attribute output for "The battery consumes too fast" is BN IN OOO, where N is the abbreviation of Negative and P is the abbreviation of Positive. BP and IP indicate that battery consumption is a negative attribute.

[0109] BN IN BP IP O 0.6 0.1 0.1 0.1 0.1 0.1 0.6 0.1 0.1 0.1 0.1 0.1 0.1 0.1 0.6 0.1 0.1 0.1 0.1 0.6 0.1 0.1 0.1 0.1 0.6

[0110] This embodiment obtains the text to be analyzed by vectorizing the text to be analyzed, and obtains the feature information of each character in the text to be analyzed; vectorizes the text to be analyzed to obtain the vector matrix of the text to be analyzed; obtains the spliced ​​vector matrix information according to the feature information of each character in the text to be analyzed and the vector matrix; obtains the emotional attribute corresponding to the text to be analyzed according to the text to be analyzed, the feature information of each character and the spliced ​​vector matrix information. This scheme obtains the vector matrix of the text to be analyzed by vectorizing the text to be analyzed; obtains the spliced ​​vector matrix information according to the feature information of each character in the text to be analyzed and the vector matrix. Due to the combination of the feature information of each character, the spliced ​​vector matrix information integrates the information such as the tone of the character, further increasing the information contained in the vector matrix information; then, according to the text to be analyzed, the feature information of each character and the spliced ​​vector matrix information, the emotional attribute corresponding to the text to be analyzed can be obtained, so that the obtained emotional attribute is more accurate and does not need to rely on manual and template rules; thereby improving the efficiency of determining the emotional attribute.

[0111] The method for acquiring the sentiment attribute described in the above embodiment will be further described in detail below. In this embodiment, the text to be analyzed is a method for acquiring the sentiment attribute by describing the user's comment text on the product.

[0112] See also Figure 2 , Figure 2 Another flow chart of the method for acquiring emotional attributes provided in an embodiment of the present application.

[0113] S201, obtaining the user's comment text on the product.

[0114] Specifically, in this embodiment, the review text of the product by the user refers to the text of the user's personal usage experience and evaluation of the product. Specifically, the review text of the product by the user can be obtained by scraping data on the product website. First, start the data collector added in the server or device. The data collector can also be a data collector installed in the browser, which can automatically collect the original web page according to the rules set by the user and obtain the content required in the formatted web page. Now it has also evolved into a tool that can process data. Then, according to the crawling conditions of the review text of the product by the user received, such as the publication time of the crawled review text, the review of the mobile phone or the review of the home furnishings, etc., select the review text of the product by the user that needs to be crawled and collect it, so as to obtain the review text of the product by the user and improve the accuracy of obtaining the review text of the product by the user.

[0115] S202, split each character in the review text of the product by the user to obtain the sub-characters of the review text of the product by the user.

[0116] S203, obtain the radicals of each character in the review text of the product by the user according to the basic radical table and the sub-characters.

[0117] Obtain the basic radical table, which is a table containing common radicals. Then split each character in the review text of the product by the user to obtain the sub-characters of the review text of the product by the user. For example, can be split into sub-characters "female" and "mouth", and then match the split sub-characters with the radicals in the basic radical table to obtain the radicals of each character in the review text of the product by the user.

[0118] S204, perform word segmentation on the input review text of the product by the user through the trained vectorization model, generate the words that make up the review text of the product by the user, and obtain the word vectors corresponding to the words.

[0119] S205, connect the word vectors in the order of the characters corresponding to the review text of the product by the user to obtain the vector matrix of the review text of the product by the user.

[0120] After obtaining the user's evaluation text on the product, the user's evaluation text on the product can be vectorized to obtain a vector matrix of the user's evaluation text on the product. Specifically, the user's evaluation text on the product can be input into the trained vectorization model, and the trained vectorization model can be used to perform word segmentation on the input user's evaluation text on the product to generate words that constitute the user's evaluation text on the product, and obtain word vectors corresponding to the words. In order to obtain more accurate word vectors, before obtaining word vectors, the word pair vectorization model can be trained with the same radical; then the word vectors are connected according to the character arrangement order corresponding to the user's evaluation text on the product to obtain a vector matrix of the user's evaluation text on the product.

[0121] First, obtain the trained vectorization model, and use the trained vectorization model to perform word segmentation on the input user's evaluation text of the product. Specifically, the user's evaluation text of the product can be segmented into words that match the preset vocabulary; the optimal path is obtained through the vectorization model; the optimal segmentation result among the segmented words is obtained according to the optimal path, and the words that make up the user's evaluation text of the product can be obtained. Further obtain the word vectors corresponding to the words established when the model is established, and connect the word vectors according to the character arrangement order corresponding to the user's evaluation text of the product to obtain the vector matrix of the user's evaluation text of the product. For example, assuming that the user's evaluation text of the product is "gorgeous appearance", the segmented words are appearance and gorgeous, and the word vector obtained is Z 1 , Z 2 , then according to the user's evaluation text of the product as "gorgeous appearance", the word vectors are spliced ​​to obtain the vector matrix (Z 1 , Z 2 ).

[0122] S206, obtaining a vector of feature information of each character.

[0123] S207, obtaining a first position of a character corresponding to the feature information in the user's comment text on the product, and a second position of a character corresponding to the vector matrix in the user's comment text on the product.

[0124] S208, concatenating the feature information of each character in the user's comment text on the product with the vector matrix according to the first position and the second position to obtain concatenated vector matrix information.

[0125] In this embodiment, the feature information of each character includes the radical of each character in the user's evaluation text of the commodity. Then, the vector of the radical of each character is obtained, which can be specifically obtained through a trained vectorization model. Then, the first position of the character corresponding to the radical in the user's evaluation text of the commodity is obtained. For example, assume that the user's evaluation text of the commodity is "The appearance is gorgeous", and the radicals are "Xi, You, Silk, and One" respectively. Then, the characters corresponding to "Xi, You" are "appearance", and the first position of "appearance" in the user's evaluation text of the commodity is 1, and the vector matrix Z 1 The corresponding character is "appearance", and the first position of "appearance" in the user's evaluation text of the commodity is 1. Then, the vectors of the radicals "Xi, You" are concatenated with Z in the vector matrix 1 to obtain the concatenated vector matrix information. Among them, the first position is the position of the character corresponding to the feature information in the user's evaluation text of the commodity, and the second position is the position of the character corresponding to the vector matrix in the user's evaluation text of the commodity. The first and second are only named to distinguish positions and have no substantive meaning. In the specific implementation process, the position of the character corresponding to the feature information in the user's evaluation text of the commodity can also be named the second position, and the position of the character corresponding to the vector matrix in the user's evaluation text of the commodity can also be named the first position.

[0126] S209. Calculate the label score of the user's evaluation text of the commodity according to the user's evaluation text of the commodity and the concatenated vector matrix information.

[0127] S210. Obtain the emotional attribute corresponding to the user's evaluation text of the commodity according to the label score.

[0128] In this embodiment, the feature information of each character includes the tone of each character. Specifically, the user's evaluation text of the commodity, the tone of each character, and the concatenated vector matrix information are input into the trained discriminant model, and the emotional attribute corresponding to the user's evaluation text of the commodity is obtained through the discriminant model.

[0129] Specifically, the label score of the user's evaluation text of the commodity is calculated through the discriminant model, where the discriminant model consists of a bidirectional LSTM followed by a CRF. First, the discriminant model encodes the tone of each character. The encoding rule can be to encode the high level, rising tone, falling-rising tone, falling tone, and neutral tone in the four tones of the tone as 1, 2, 3, 4, and 0 respectively. For example, for the words "power consumption [hào diàn]" in the sentence "The battery drains too fast", the preceding and following words are "battery [diàn chí]" and "too [tài]" (here n is taken as 1). The tone represented according to the conversion rule is 42444. Then, through the score calculation formula in the discriminant model:

[0130]

[0131] Calculate the score of the user's evaluation text on the product, where T is the score transfer matrix, H is the hidden layer output of the bidirectional LSTM, and then use the Softmax function to obtain the probability representation of the score of the user's evaluation text on the product. During the training process, optimize the maximum likelihood estimation function of all given samples, and use the Viterbi algorithm to obtain the label sequence corresponding to the optimal probability of the user's evaluation text on the product during prediction. Then, the emotional attributes corresponding to the user's evaluation text on the product can be obtained through the label sequence, and it can be known whether the user's evaluation of the product is positive or negative.

[0132] This embodiment obtains a vector matrix of the text to be analyzed by vectorizing the text to be analyzed; obtains the spliced ​​vector matrix information based on the feature information of each character in the text to be analyzed and the vector matrix. Since the feature information of each character is combined, the spliced ​​vector matrix information incorporates information such as the tone of the character, further increasing the information contained in the vector matrix information; then, based on the text to be analyzed, the feature information of each character and the spliced ​​vector matrix information, the emotional attributes corresponding to the text to be analyzed can be obtained, so that the obtained emotional attributes are more accurate and do not need to rely on manual and template rules; thereby improving the efficiency of determining the emotional attributes.

[0133] In order to better implement the emotion attribute acquisition method provided in the embodiment of the present application, the embodiment of the present application also provides an emotion attribute acquisition device based on the above. The meaning of the nouns is the same as in the above emotion attribute acquisition method, and the specific implementation details can refer to the description in the method embodiment.

[0134] See also Figure 3 , Figure 3 A structural schematic diagram of an emotional attribute acquisition device provided in an embodiment of the present application, wherein the emotional attribute acquisition device may include a first acquisition unit 301, a quantization unit 302, a second acquisition unit 303, and an emotional attribute acquisition 304, etc.

[0135] Specifically, the emotion attribute acquisition device includes:

[0136] A first acquisition unit is used to acquire a text to be analyzed, and acquire feature information of each character in the text to be analyzed;

[0137] A vectorization unit, used for performing vectorization processing on the text to be analyzed to obtain a vector matrix of the text to be analyzed;

[0138] A second acquisition unit, configured to acquire the concatenated vector matrix information according to the feature information of each character in the text to be analyzed and the vector matrix;

[0139] The sentiment attribute obtaining unit is used to obtain the sentiment attribute corresponding to the text to be analyzed according to the text to be analyzed and the concatenated vector matrix information.

[0140] In some implementations, the second acquisition unit includes:

[0141] The first acquisition subunit is used to obtain the first position of the character corresponding to the feature information in the text to be analyzed, and the second position of the character corresponding to the vector matrix in the text to be analyzed; according to the first position and the second position, the feature information of each character in the text to be analyzed is spliced ​​with the vector matrix to obtain the spliced ​​vector matrix information.

[0142] In some implementations, the emotion attribute obtaining unit includes:

[0143] A second acquisition subunit, used to acquire a vector of feature information of each character;

[0144] A calculation subunit, used for calculating the label score of the text to be analyzed based on the text to be analyzed and the concatenated vector matrix information;

[0145] The third acquisition subunit is used to acquire the sentiment attribute corresponding to the text to be analyzed according to the label score.

[0146] In some implementations, the vectorization unit includes:

[0147] A generating subunit, used for performing word segmentation processing on the input text to be analyzed by using the trained vectorization model, generating words constituting the text to be analyzed, and obtaining word vectors corresponding to the words;

[0148] A connecting subunit is used to connect the word vectors according to the character arrangement order corresponding to the text to be analyzed, so as to obtain the vector matrix of the text to be analyzed.

[0149] In some embodiments, the generating subunit comprises:

[0150] A segmentation module, used to segment the text to be analyzed into words that match a preset vocabulary to obtain initial words;

[0151] The acquisition module is used to acquire the optimal path between the initial word and each word in the preset vocabulary through the vectorization model; and determine the words constituting the text to be analyzed according to the optimal path.

[0152] In some implementations, the vectorization unit includes:

[0153] The fourth acquisition subunit is used to acquire words with the same radical and marked with real word categories to obtain training samples;

[0154] A determination subunit, used to determine the word prediction category of the training sample;

[0155] A fifth acquisition subunit, used to acquire a preset loss function according to the real word category and the word prediction category;

[0156] A convergence subunit is used to converge the vectorized model according to the loss function to obtain a trained vectorized model.

[0157] In some implementations, the first acquisition unit includes:

[0158] The sixth acquisition subunit is used to acquire a basic radical table;

[0159] A splitting subunit, used for splitting each character in the text to be analyzed to obtain sub-characters of the text to be analyzed;

[0160] The seventh acquisition subunit is used to acquire the radical of each character in the text to be analyzed according to the basic radical table and the sub-characters.

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

[0162] Figure 4 The specific structural block diagram of the device provided in the embodiment of the present invention is shown, and the device can be used to implement the emotional attribute acquisition method provided in the above embodiment. The device 400 can be a smart phone or a tablet computer.

[0163] like Figure 4 As shown, the device 400 may include an RF (Radio Frequency) circuit 110, a memory 120 including one or more (only one is shown in the figure) computer-readable storage media, an input unit 130, a display unit 140, a transmission module 170, a processor 180 including one or more (only one is shown in the figure) processing cores, and a power supply 190. Those skilled in the art will understand that Figure 4 The structure of the device 400 shown in the figure does not constitute a limitation on the device 400, and may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently.

[0164] The RF circuit 110 is used to receive and send electromagnetic waves, realize the mutual conversion between electromagnetic waves and electrical signals, and thus communicate with a communication network or other devices. The RF circuit 110 may include various existing circuit elements for performing these functions, such as antennas, radio frequency transceivers, digital signal processors, encryption / decryption chips, user identity module (SIM) cards, memories, etc. The RF circuit 110 can communicate with various networks such as the Internet, corporate intranets, wireless networks, or communicate with other devices through wireless networks. The above-mentioned wireless networks may include cellular telephone networks, wireless local area networks, or metropolitan area networks. The above-mentioned wireless networks can use various communication standards, protocols and technologies, including but not limited to Global System for Mobile Communication (GSM), Enhanced Data GSM Environment (EDGE), Wideband Code Division Multiple Access (WCDMA), Code Division Multiple Access (CDMA), Time Division Multiple Access (TDMA), Wireless Fidelity (Wi-Fi) (such as Institute of Electrical and Electronics Engineers standards IEEE 802.11a, IEEE 802.11b, IEEE802.11g and / or IEEE802.11n), Voice over Internet Protocol (VoIP), Worldwide Interoperability for Microwave Access (Wi-Max), other protocols for email, instant messaging and short messages, and any other suitable communication protocols, even those that have not yet been developed.

[0165] The memory 120 can be used to store software programs and modules, such as the program instructions / modules of the emotional attribute acquisition method in the above-mentioned embodiment. The processor 180 executes various functional applications and data processing by running the software programs and modules stored in the memory 120, that is, realizes the function of acquiring emotional attributes. The memory 120 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 120 may further include a memory remotely arranged relative to the processor 180, and these remote memories may be connected to the device 400 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0166] The input unit 130 can 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. Specifically, the input unit 130 may include a touch-sensitive surface 131 and other input devices 132. The touch-sensitive surface 131, also known as a touch display screen or a touch pad, can collect user touch operations on or near it (such as operations performed by users using fingers, styluses, or any other suitable objects or accessories on or near the touch-sensitive surface 131), and drive corresponding connection devices according to a pre-set program. Optionally, the touch-sensitive surface 131 may include a touch detection device and a touch controller. Among them, the touch detection device detects the user's touch orientation, detects the signal brought by the touch operation, and transmits the signal to the touch controller; the touch controller receives the touch information from the touch detection device, converts it into touch point coordinates, and then sends it to the processor 180, and can receive and execute commands sent by the processor 180. In addition, the touch-sensitive surface 131 can be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. In addition to the touch-sensitive surface 131, the input unit 130 may further include other input devices 132. Specifically, other input devices 132 may include but are not limited to one or more of a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, a joystick, etc.

[0167] The display unit 140 can be used to display information input by the user or information provided to the user and various graphical user interfaces of the device 400, which can be composed of graphics, text, icons, videos and any combination thereof. The display unit 140 may include a display panel 141. Optionally, the display panel 141 may be configured in the form of LCD (Liquid Crystal Display), OLED (Organic Light-Emitting Diode), etc. Further, the touch-sensitive surface 131 may cover the display panel 141. When the touch-sensitive surface 131 detects a touch operation on or near it, it is transmitted to the processor 180 to determine the type of touch event. Subsequently, the processor 180 provides a corresponding visual output on the display panel 141 according to the type of touch event. Although in Figure 4 In the embodiment, the touch-sensitive surface 131 and the display panel 141 are implemented as two independent components to realize the input and output functions. However, in some embodiments, the touch-sensitive surface 131 and the display panel 141 can be integrated to realize the input and output functions.

[0168] The device 400 can help users send and receive emails, browse web pages, and access streaming media through the transmission module 170 (such as a Wi-Fi module), and it provides users with wireless broadband Internet access. Figure 4 The transmission module 170 is shown, but it is understandable that it is not a necessary component of the device 400 and can be omitted as needed without changing the essence of the invention.

[0169] The processor 180 is the control center of the device 400. It uses various interfaces and lines to connect various parts of the entire mobile phone. By running or executing software programs and / or modules stored in the memory 120, and calling data stored in the memory 120, it executes various functions of the device 400 and processes data, thereby monitoring the mobile phone as a whole. Optionally, the processor 180 may include one or more processing cores; in some embodiments, the processor 180 may integrate an application processor and a modem processor, wherein the application processor mainly processes the operating system, user interface, and application programs, etc., and the modem processor mainly processes wireless communications. It is understandable that the above-mentioned modem processor may not be integrated into the processor 180.

[0170] The device 400 also includes a power supply 190 (such as a battery) for supplying power to various components. In some embodiments, the power supply can be logically connected to the processor 180 through a power management system, so that the power management system can manage charging, discharging, and power consumption management. The power supply 190 can also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, and power status indicators.

[0171] Specifically in this embodiment, the display unit 140 of the device 400 is a touch screen display, and the device 400 further includes a memory 120 and one or more programs, wherein the one or more programs are stored in the memory 120 and are configured to be executed by one or more processors 180. The one or more programs include instructions for performing the following operations:

[0172] Acquire a text to be analyzed, and acquire feature information of each character in the text to be analyzed;

[0173] Performing vectorization processing on the text to be analyzed to obtain a vector matrix of the text to be analyzed;

[0174] According to the feature information of each character in the text to be analyzed and the vector matrix, obtaining the concatenated vector matrix information;

[0175] The sentiment attribute corresponding to the text to be analyzed is obtained according to the text to be analyzed, the feature information of each character and the concatenated vector matrix information.

[0176] In the above embodiments, the description of each embodiment has its own focus. For the part that is not described in detail in a certain embodiment, please refer to the detailed description of the method for obtaining emotional attributes above, and will not be repeated here.

[0177] 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.

[0178] To this end, an embodiment of the present application provides a storage medium, wherein the storage medium stores a computer program, which is loaded by a processor to execute the steps in any of the emotion attribute acquisition methods provided in the embodiments of the present application. For example, the computer program may execute the following steps:

[0179] Acquire a text to be analyzed, and acquire feature information of each character in the text to be analyzed;

[0180] Performing vectorization processing on the text to be analyzed to obtain a vector matrix of the text to be analyzed;

[0181] According to the feature information of each character in the text to be analyzed and the vector matrix, obtaining the concatenated vector matrix information;

[0182] The sentiment attribute corresponding to the text to be analyzed is obtained according to the text to be analyzed, the feature information of each character and the concatenated vector matrix information.

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

[0184] The storage medium may include: a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0185] Since the computer program stored in the storage medium can execute the steps in any one of the emotion attribute acquisition methods provided in the embodiments of the present application, the beneficial effects that can be achieved by any one of the emotion attribute acquisition methods provided in the embodiments of the present application can be achieved. Please refer to the previous embodiments for details and will not be repeated here.

[0186] The above is a detailed introduction to the emotional attribute acquisition method, device, equipment and storage medium provided in the embodiments of the present application. This article uses specific examples 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 of the present application and its core idea; at the same time, for technical personnel in this field, according to the ideas of the present application, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present application.

Claims

1. A method for acquiring emotional attributes, characterized in that: include: Acquire a text to be analyzed, and acquire feature information of each character in the text to be analyzed, wherein the feature information of each character includes the tone of each character; Perform word segmentation on the input text to be analyzed through the trained vectorization model, generate words constituting the text to be analyzed, and obtain word vectors corresponding to the words; Connecting the word vectors according to the character arrangement order corresponding to the text to be analyzed to obtain a vector matrix of the text to be analyzed; Acquire a first position of a character corresponding to the feature information in the text to be analyzed, and a second position of a character corresponding to the vector matrix in the text to be analyzed; splicing the feature information of each character in the text to be analyzed with the vector matrix according to the first position and the second position to obtain spliced ​​vector matrix information; Obtaining the sentiment attribute corresponding to the text to be analyzed according to the text to be analyzed, the feature information of each character and the concatenated vector matrix information, including: Input the text to be analyzed, the tones of each character, and the concatenated vector matrix information into the trained discriminant model, wherein the discriminant model is composed of a bidirectional LSTM followed by a CRF; Encoding the tone of each character by using the discriminant model, calculating the score of the text to be analyzed by using the score calculation formula in the discriminant model, and obtaining a score probability representation of the text to be analyzed; The Viterbi algorithm is used to obtain the label sequence corresponding to the optimal score probability of the text to be analyzed, and the sentiment attribute corresponding to the text to be analyzed is obtained through the label sequence.

2. The method for acquiring emotional attributes according to claim 1, characterized in that: The step of obtaining the sentiment attribute corresponding to the text to be analyzed according to the text to be analyzed and the concatenated vector matrix information includes: Obtaining a vector of feature information of each character; Calculate the label score of the text to be analyzed according to the text to be analyzed and the concatenated vector matrix information; The sentiment attribute corresponding to the text to be analyzed is obtained according to the label score.

3. The method for acquiring emotional attributes according to claim 1, characterized in that: The step of performing word segmentation processing on the input text to be analyzed by using the vectorization model to generate words constituting the text to be analyzed includes: Segment the text to be analyzed to obtain words that match a preset vocabulary to obtain initial words; Obtaining the optimal path between the initial word and each word in the preset word library through the vectorization model; The words constituting the text to be analyzed are determined according to the optimal path.

4. The method for acquiring emotional attributes according to claim 1, characterized in that: Before performing word segmentation processing on the input text to be analyzed by the vectorization model to generate words constituting the text to be analyzed and obtaining word vectors corresponding to the words, the method further includes: Obtain words with the same radical and marked with real word categories to obtain training samples; Determining a word prediction category of the training sample; Obtaining a preset loss function according to the real word category and the word prediction category; The vectorized model is converged according to the loss function to obtain a trained vectorized model.

5. The method for acquiring emotional attributes according to claim 1, characterized in that: The feature information includes tones and radicals, and the step of obtaining the feature information of each character in the text to be analyzed includes: Get the basic radical table; Splitting each character in the text to be analyzed to obtain sub-characters of the text to be analyzed; The radical of each character in the text to be analyzed is obtained according to the basic radical table and the sub-characters.

6. A device for acquiring emotional attributes, characterized in that: include: A first acquisition unit is used to acquire a text to be analyzed, and acquire feature information of each character in the text to be analyzed, wherein the feature information of each character includes the tone of each character; A vectorization unit, used to perform word segmentation processing on the input text to be analyzed through the trained vectorization model, generate words constituting the text to be analyzed, and obtain word vectors corresponding to the words; Connecting the word vectors according to the character arrangement order corresponding to the text to be analyzed to obtain a vector matrix of the text to be analyzed; A second acquisition unit, used for acquiring a first position of a character corresponding to the feature information in the text to be analyzed, and a second position of a character corresponding to the vector matrix in the text to be analyzed; splicing the feature information of each character in the text to be analyzed with the vector matrix according to the first position and the second position to obtain spliced ​​vector matrix information; The emotional attribute obtaining unit is used to obtain the emotional attribute corresponding to the text to be analyzed according to the text to be analyzed and the concatenated vector matrix information, including: inputting the text to be analyzed, the tone of each character and the concatenated vector matrix information into a trained discriminant model, wherein the discriminant model is composed of a bidirectional LSTM followed by a CRF; encoding the tone of each character through the discriminant model, calculating the score of the text to be analyzed through the score calculation formula in the discriminant model, and obtaining the score probability representation of the text to be analyzed; obtaining the label sequence corresponding to the optimal score probability of the text to be analyzed through the Viterbi algorithm, and obtaining the emotional attribute corresponding to the text to be analyzed through the label sequence.

7. A device, characterized in that: It comprises a processor and a memory, wherein the memory stores program code, and when the processor calls the program code in the memory, the method for acquiring emotional attributes as described in any one of claims 1 to 5 is executed.

8. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, which is loaded by a processor to execute the emotion attribute acquisition method as described in any one of claims 1 to 5.