A method, device, electronic device and storage medium for generating opinion labels
By calculating and sorting the comments relevance and generating the opinion label sequence, the problem of inefficient opinion label generation in the existing technology is solved, and more efficient and accurate opinion label generation is achieved.
Patent Information
- Application Number
- CN202011371489.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-11-30
- Publication Date
- 2025-02-07
- Estimated Expiration
- 2040-11-30
AI Technical Summary
The methods used in the prior art to generate viewpoint labels rely on manual labels or heuristic methods, are time-consuming and inefficient, and are difficult to automatically generate reasonable and accurate viewpoint labels.
By obtaining a set of comments for the target resource, the correlation between each comment and the target resource is calculated, and the comments are sorted based on the correlation and semantic characteristics to generate a sequence of target view tags.
It improves the efficiency and accuracy of opinion tag generation, helps users quickly understand products, reduces the time to browse a large number of comments, and the order of generated opinion tags is convenient for users to obtain favorable information.
Smart Images

Figure CN112528136B_ABST
Abstract
Description
Background Art
[0002] User comments are users' evaluations of products. They are a form of communication between users and product providers, and reflect users' preferences and needs for products. The product here refers to a broad concept of products, which can be intangible software and services in addition to tangible products. Product opinion tags can not only save users' time reading comments and help users quickly understand a product, but also allow product providers to get user feedback more quickly. Therefore, extracting users' opinions from product user comments and generating product opinion tags have important practical value.
[0003] However, in related technologies, the techniques used to generate opinion labels often rely on manual labeling or heuristic methods, which are time-consuming and inefficient. Therefore, how to automatically generate more reasonable and accurate commodity opinion labels is an urgent problem to be solved. Summary of the invention
[0004] The embodiments of the present application provide a method, device, electronic device and storage medium for generating opinion labels, so as to improve the generation efficiency and accuracy of opinion labels.
[0005] An embodiment of the present application provides a method for generating a viewpoint label, including:
[0006] Obtain a review set for a target resource, where the review set includes at least two reviews;
[0007] Obtaining the relevance between each comment in the comment set and the target resource;
[0008] Sort the comments according to the relevance of the comments and the semantic features of the comments to obtain a corresponding comment sequence;
[0009] A target opinion label sequence for the target resource is generated based on the comment sequence, wherein the target opinion label sequence includes at least two target opinion label words.
[0010] An embodiment of the present application provides a device for generating a viewpoint label, including:
[0011] A comment acquisition unit, configured to acquire a comment set for a target resource, wherein the comment set includes at least two comments;
[0012] An analysis unit, used to obtain the relevance between each comment in the comment set and the target resource;
[0013] A sorting unit, used to sort the comments according to the relevance corresponding to the comments and the semantic features of the comments, to obtain a corresponding comment sequence;
[0014] A label generation unit is used to generate a target opinion label sequence for the target resource based on the comment sequence, wherein the target opinion sequence includes at least two target opinion label words.
[0015] Optionally, the sorting unit is specifically used to:
[0016] According to the relevance of each comment, the semantic features of each comment are weighted to obtain the significant semantic features of each comment;
[0017] The comments are clustered according to the significant semantic features of the comments to obtain at least two comment subsets.
[0018] Optionally, the sorting unit is specifically used to:
[0019] sorting each comment subset according to the number of comments contained in the comment subset; and,
[0020] For each of the comment subsets, the following operations are performed respectively: sorting the comments in the comment subset according to the degree of association between the semantic features of each comment in the comment subset and the comment subset;
[0021] The comment sequence is generated based on the ranking results between the comment subsets and the ranking results of each comment in the comment subsets.
[0022] Optionally, the analysis unit is specifically used for:
[0023] Inputting each of the comments into a trained opinion label generation model respectively, extracting features of each of the comments based on a sentence-level significance scoring component in the trained opinion label generation model, and obtaining a relevance corresponding to each of the comments output by the significance scoring component;
[0024] The sorting unit is specifically used for:
[0025] Inputting the comments and the relevances corresponding to the comments into the comment clustering and sorting component in the trained opinion label generation model respectively, clustering and sorting the comments based on the comment clustering and sorting component, obtaining a first concatenated representation vector at the word level output by the comment clustering and sorting component, wherein the comment words in the first concatenated representation vector are combined to form the comment sequence;
[0026] The label generating unit is specifically used for:
[0027] Inputting the concatenated representation vector into the opinion label component in the trained opinion label generation model, performing attention feature extraction based on the opinion label component, and obtaining the target opinion label sequence output by the opinion label component;
[0028] The trained opinion label generation model is trained based on a training sample data set, wherein the training samples in the training sample data set include sample comments annotated with relevance labels, and the relevance labels indicate whether the sample comments are relevant to the sample resources.
[0029] Optionally, the analysis unit is specifically used for:
[0030] Inputting each of the comments into the significance scoring component respectively, mapping each of the comments to a continuous space based on a sentence representation module in the significance scoring component, and obtaining a representation vector of each of the comments;
[0031] Convert the representation vectors of each comment into corresponding semantic vectors through context encoding;
[0032] Based on the saliency scoring component, extracting attention features between the semantic vectors of each comment and the semantic vectors of other comments except itself;
[0033] The relevance between each comment and the target resource is obtained based on the attention features corresponding to each comment.
[0034] Optionally, the sorting unit is specifically used to:
[0035] Based on the review clustering and ranking component in the trained opinion label generation model, mapping each review to a continuous space to obtain a word vector sequence corresponding to each review;
[0036] Extracting spatial information from the word vector sequences corresponding to the comments through a hierarchical pooling operation to obtain semantic representation vectors of the comments;
[0037] According to the relevance of each comment, the semantic representation vector of each comment is weighted to obtain the significant semantic representation vector of each comment;
[0038] Clustering is performed based on the significant semantic representation vectors of the comments to obtain at least two comment subsets;
[0039] After all comment subsets are sorted and each comment in each comment subset is sorted, the significant semantic representation vectors of each comment are concatenated and word-level converted to obtain the first concatenated representation vector.
[0040] Optionally, the sorting unit is specifically used to:
[0041] Based on the review clustering and ranking component in the trained opinion label generation model, mapping each review to a continuous space to obtain a word vector sequence corresponding to each review;
[0042] Extracting spatial information from the word vector sequences corresponding to the comments through a hierarchical pooling operation to obtain semantic representation vectors of the comments;
[0043] According to the relevance of each comment, the semantic representation vector of each comment is weighted to obtain the significant semantic representation vector of each comment;
[0044] Clustering is performed based on the significant semantic representation vectors of the comments to obtain at least two comment subsets;
[0045] After all comment subsets are sorted and each comment in each comment subset is sorted, the significant semantic representation vectors of each comment are concatenated and word-level converted to obtain the first concatenated representation vector.
[0046] Optionally, the label generating unit is specifically used for:
[0047] In a loop iteration manner, each opinion label word in the target opinion label sequence is generated in sequence, and one opinion label in the target opinion sequence includes at least one opinion label word; wherein, in one loop iteration process, the following operations are performed:
[0048] Inputting the target opinion label word outputted last time into the opinion label component, wherein the first input into the opinion label component is a preset starting marker word;
[0049] Analyzing the alignment probability of the target opinion label word output last time and each comment word in the comment sequence through an attention mechanism, wherein the alignment probability represents the attention value between the comment word and the opinion label word output last time;
[0050] The alignment probability and the semantic vector sequence of the comment words in the comment sequence are weighted and input into a forward neural network to obtain a target semantic representation vector of the comment sequence output this time;
[0051] Based on the target opinion label word output last time and the target semantic representation vector, a target opinion label word output this time is generated.
[0052] Optionally, the label generating unit is further used for:
[0053] Before analyzing the alignment probability of the target opinion label word output last time and each comment word in the comment sequence through the attention mechanism, the target comment subset selected this time and the neighbors of the target comment subset are used as the focused comment subsets, and other comment subsets are used as external comment subsets, wherein the target comment subset selected each time is determined based on the order between the comment subsets;
[0054] Adding a first alignment feature to the comment words in the focused comment subset in the comment sequence, and adding a second alignment feature to the comment words in the external comment subset in the comment sequence, to obtain a first alignment semantic vector corresponding to each comment word in the comment sequence; and
[0055] Adding the first alignment feature to the target opinion label word outputted last time to obtain a corresponding second alignment semantic vector;
[0056] The analyzing the alignment probability of the target opinion label word output last time and each comment word in the comment sequence by the attention mechanism specifically includes:
[0057] Combined with the first alignment vector corresponding to each comment word in the comment sequence and the second alignment semantic vector corresponding to the target opinion label word output last time, the alignment probability of the target opinion label word output last time and each comment word in the comment sequence is analyzed based on the attention mechanism.
[0058] Optionally, the device further comprises:
[0059] A training unit is used to generate the opinion labeling model obtained by training through the following process:
[0060] Acquire the training sample data set for at least one sample resource;
[0061] According to the training samples in the training sample data set, a loop iterative training is performed on the untrained opinion label generation model to obtain the trained opinion label generation model; wherein each loop iterative training process includes the following operations:
[0062] A group of training samples for the same sample resource is selected from the training sample data set, and sample comments contained in each of the selected training samples are respectively input into a sentence-level significance scoring component in the untrained opinion label generation model to obtain the relevance corresponding to each sample comment output by the significance scoring component;
[0063] Constructing a first loss function based on the error between the relevance corresponding to each sample comment and the corresponding relevance label; and
[0064] Inputting the sample comments in each selected training sample and the relevance corresponding to each sample comment into the comment clustering and sorting component in the untrained opinion label generation model, clustering each sample comment based on the comment clustering and sorting component to obtain at least two comment subsets; sorting each comment subset based on the comment clustering and sorting component to obtain a word-level second concatenated representation vector output by the comment clustering and sorting component;
[0065] Inputting the second concatenated representation vector into the opinion label component in the untrained opinion label generation model, performing attention feature extraction based on the opinion label component, and obtaining a set of predicted opinion label sequences output by the opinion label component, wherein the predicted opinion label sequence includes at least two predicted opinion label words;
[0066] Based on the distribution error between the predicted opinion label words in the predicted opinion label sequence and the real opinion label words in the real opinion label sequence, a second loss function is constructed; and based on the attention value of the comment words in each comment subset, a third loss function is constructed;
[0067] According to the first loss function, the second loss function and the third loss function, parameters of the untrained opinion label generation model are adjusted.
[0068] Optionally, the training unit is specifically used for:
[0069] For any predicted opinion label word, based on the distribution probability of the predicted opinion label word in the preset opinion label word set and the distribution probability of the predicted opinion label word in the comment set, determine the distribution error between the predicted opinion label word in the predicted opinion label sequence and the real opinion label word in the real opinion label sequence;
[0070] The second loss function is constructed based on the determined distribution error.
[0071] An electronic device provided in an embodiment of the present application includes a processor and a memory, wherein the memory stores program code, and when the program code is executed by the processor, the processor executes the steps of the above-mentioned method for generating an opinion label.
[0072] The embodiment of the present application provides a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device performs the steps of any of the above-mentioned methods for generating opinion labels.
[0073] An embodiment of the present application provides a computer-readable storage medium, which includes a program code. When the program product is run on an electronic device, the program code is used to enable the electronic device to execute the steps of the above-mentioned method for generating an opinion label.
[0074] The beneficial effects of this application are as follows:
[0075] The embodiments of the present application provide a method, device, electronic device and storage medium for generating opinion labels. Since the embodiments of the present application provide a method for generating an opinion label sequence based on a group of user comments, the group of user comments can be sorted based on the relevance between each comment and the target resource, as well as the semantic features of each comment, and then a group of ordered opinion labels for the target resource can be automatically generated based on the ordered comment sequence. Based on the method in the embodiments of the present application, a more reasonable and accurate list of commodity opinion labels can be automatically generated, which can help users quickly understand a commodity, reduce the time of browsing a large number of comments, and effectively improve the efficiency and accuracy of generating opinion labels; in addition, the generated opinion labels are in order, which can help users quickly and easily obtain useful information.
[0076] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0077] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0078] Figure 1 An optional schematic diagram of an application scenario in an embodiment of the present application;
[0079] Figure 2 An optional schematic diagram of a method for generating a viewpoint label in an embodiment of the present application;
[0080] Figure 3 A schematic diagram of a natural language generation framework in an embodiment of the present application;
[0081] Figure 4 A schematic diagram of the structure of a viewpoint label generation model in an embodiment of the present application;
[0082] Figure 5 A schematic diagram of a generation process of generating words for a point of view label in an embodiment of the present application;
[0083] Figure 6 A semantic vector representation diagram of a viewpoint label and a viewpoint cluster in an embodiment of the present application;
[0084] Figure 7 A flowchart of a complete training method for a viewpoint label generation model in an embodiment of the present application;
[0085] Figure 8 A schematic diagram of the composition structure of a device for generating a viewpoint label in an embodiment of the present application;
[0086] Fig. 9 A schematic diagram of the hardware structure of an electronic device to which an embodiment of the present application is applied. DETAILED DESCRIPTION
[0087] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the technical solution of the present application, rather than all of the embodiments. Based on the embodiments recorded in the application documents, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the technical solution of the present application.
[0088] The following is an introduction to some concepts involved in the embodiments of the present application.
[0089] Opinion tags: refers to an ordered list of tags that characterize the user's overall opinion. An object (product, merchant, song, movie) is often accompanied by thousands of user reviews. Opinion tags refer to extracting the essential information that can describe the object from these redundant review information. Based on the method for generating opinion tags in the embodiment of the present application, a sequence of opinion tags for the target resource, that is, a set of ordered opinion tags, can be generated quickly and accurately.
[0090] AOT (Abstractive Opinion Tagging) is a concept proposed in this application, which refers to the system automatically generating an ordered list of opinion tags based on a set of user reviews about a product. The generated opinion tags highly summarize the intention of the user's comments. They may not be the original words that appear in the comments, but may also refer to words in the opinion tag vocabulary, etc. In the embodiments of the present application, in addition to being applied to e-commerce systems, the abstract opinion tag generation technology can also be further expanded to other application scenarios, such as hot topic analysis in the field of social media.
[0091] Opinion label generation model: a machine learning model for generating a set of ordered opinion labels proposed in the embodiments of the present application, which is an abstract opinion label generation framework (AOT-Net). AOT-Net mainly includes three components: (1) a sentence-level saliency evaluation component, which is used to evaluate the saliency score of each comment; (2) a comment clustering and sorting component, which first groups the vector representations of the comments using a clustering algorithm, and then sorts the comments according to the size of the cluster and the distance from the center of the cluster to which they belong; (3) a sequentially enhanced opinion label component, which proposes alignment features and alignment loss functions to generate an ordered list of opinion labels.
[0092] Clustering: The process of dividing a collection of physical or abstract objects into multiple classes consisting of similar objects is called clustering. The clusters generated by clustering are a collection of data objects that are similar to objects in the same cluster and different from objects in other clusters. Cluster analysis, also known as group analysis, is a statistical analysis method for studying (sample or indicator) classification problems. Cluster analysis originated from taxonomy, but clustering is not equal to classification. The difference between clustering and classification is that the classes required for clustering are unknown. Cluster analysis is very rich in content, including systematic clustering, ordered sample clustering, dynamic clustering, fuzzy clustering, graph clustering, cluster prediction, etc. Clustering is also a very important concept in data mining.
[0093] In an embodiment of the present application, user comments can be divided into multiple comment subsets, also called opinion clusters, by clustering, which represent a set of semantic vectors of comments expressing similar opinions. Specifically, opinion clusters can be divided into two categories: FOCs (Focused Opinion Clusters, also called focused comment subsets) and OOCs (Outer Opinion Clusters, also called external comment subsets). Among them, FOC refers to the most relevant opinion cluster set for each opinion label; OOC refers to the irrelevant opinion cluster set for each opinion label.
[0094] MLP (Multilayer Perceptron): also called Artificial Neural Network (ANN), in addition to the input and output layers, it can have multiple hidden layers in the middle. The simplest MLP contains only one hidden layer, that is, a three-layer structure. The layers of the multilayer perceptron are fully connected (fully connected means that any neuron in the previous layer is connected to all neurons in the next layer). The bottom layer of the multilayer perceptron is the input layer, the middle layer is the hidden layer, and the last layer is the output layer.
[0095] Attention mechanism and multi-head attention: The attention mechanism originated from the study of human vision. In cognitive science, due to the bottleneck of information processing, humans selectively pay attention to part of all information while ignoring other visible information. The above mechanism is usually called the attention mechanism. There are two main aspects of the attention mechanism: deciding which part of the input needs to be paid attention to; allocating limited information processing resources to the important part. The neural attention mechanism enables the neural network to have the ability to focus on a subset of its input (or features): select specific inputs. Multi-head attention uses multiple queries to calculate multiple information from the input information in parallel. Each attention focuses on a different part of the input information.
[0096] The embodiments of the present application relate to artificial intelligence (AI) and machine learning technology, and are designed based on computer vision technology and machine learning (ML) in artificial intelligence.
[0097] Artificial intelligence is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. In other words, artificial intelligence is a comprehensive technology of computer science that attempts to understand the essence of intelligence and produce a new intelligent machine that can respond in a similar way to human intelligence.
[0098] Artificial intelligence is the study of the design principles and implementation methods of various intelligent machines, so that the machines have the functions of perception, reasoning and decision-making. Artificial intelligence technology mainly includes computer vision technology, natural language processing technology, and machine learning / deep learning. With the research and progress of artificial intelligence technology, artificial intelligence has been studied and applied in many fields, such as common smart homes, smart customer service, virtual assistants, smart speakers, smart marketing, unmanned driving, automatic driving, robots, smart medical care, etc. It is believed that with the development of technology, artificial intelligence will be applied in more fields and play an increasingly important role.
[0099] Machine learning is a multi-disciplinary subject that involves probability theory, statistics, approximation theory, convex analysis, algorithm complexity theory and other disciplines. It specializes in studying how computers simulate or implement human learning behavior to acquire new knowledge or skills and reorganize existing knowledge structures to continuously improve their performance. Compared with data mining, which seeks mutual characteristics between big data, machine learning focuses more on algorithm design, allowing computers to automatically "learn" rules from data and use the rules to predict unknown data.
[0100] Machine learning is the core of artificial intelligence and the fundamental way to make computers intelligent. Its applications are spread across all areas of artificial intelligence. Machine learning and deep learning generally include artificial neural networks, belief networks, reinforcement learning, transfer learning, inductive learning and other technologies. When generating a sequence of opinion labels, the embodiment of the present application adopts an opinion label generation model based on machine learning or deep learning, and based on the model, features are extracted from a group of comments on the target resource to generate a group of ordered opinion labels. The opinion labels generated based on the method in the embodiment of the present application are more accurate.
[0101] The method for training an opinion label generation model proposed in the embodiment of the present application can be divided into two parts, including a training part and an application part; wherein, the training part involves the technical field of machine learning. In the training part, the opinion label generation model is trained by the technology of machine learning, so that the training sample containing sample comments given in the embodiment of the present application is used to train the opinion label generation model. After the training sample passes through the opinion label generation model, the output result of the opinion label generation model is obtained, and based on the error between the output result and the label marked on the training sample, the model parameters are continuously adjusted through the optimization algorithm to obtain the trained opinion label generation model; the application part is used to use the opinion label generation model trained in the training part to perform feature extraction on a group of user comments on the target resource, generate a group of ordered opinion labels, and then display the group of opinion labels to the user to facilitate user search, etc.
[0102] The following is a brief introduction to the design concept of the embodiment of the present application:
[0103] In the e-commerce field, opinion tags are ordered lists of tags that describe consumers' overall opinions on a product. They can help consumers quickly understand a product and reduce the time spent browsing a large number of reviews. Current techniques for generating opinion tags often rely on manual labeling or heuristic methods, which are time-consuming and inefficient.
[0104] In the related art, technologies related to abstract opinion label generation technology include keyphrase generation technology and opinion summarization technology. Keyphrase generation technology refers to generating a set of diverse unordered keyword phrases based on a given document, but keyword generation technology often generates keywords based on a single document; opinion summarization technology refers to generating coherent sentences to express the core meaning of the document based on a set of user-generated documents. However, the generation goal of the opinion summary task in the related art is to generate a document consisting of coherent sentences. In summary, there is currently no method that can automatically generate opinion label sequences.
[0105] In view of this, an embodiment of the present application proposes an abstract opinion tag generation (AOT) technology, which automatically generates a set of ordered opinion tag lists based on a set of user comments, involving multi-document opinion aggregation. Specifically, the embodiment of the present application can sort this group of user comments based on the relevance between each comment and the target resource, and the semantic features of each comment, and then automatically generate a set of ordered opinion tags for the target resource based on the ordered comment sequence, which can help users quickly understand a product, reduce the time of browsing a large number of comments, and effectively improve the efficiency and accuracy of opinion tag generation. In addition, the opinion tags are in order, which can help users quickly and easily obtain useful information, and can easily distinguish different products with similar product attributes.
[0106] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.
[0107] like Figure 1 As shown, it is a schematic diagram of an application scenario of an embodiment of the present application. The application scenario diagram includes two terminal devices 110 and a server 120. The terminal devices 110 and the server 120 can communicate with each other through a communication network.
[0108] In an optional implementation, the communication network is a wired network or a wireless network. The terminal device 110 and the server 120 may be directly or indirectly connected via wired or wireless communication, which is not limited in the present application.
[0109] In the embodiment of the present application, the terminal device 110 is an electronic device used by the user, which can be a personal computer, mobile phone, tablet computer, notebook, e-book reader, smart home, etc., which has certain computing power and runs instant messaging software and websites or social software and websites. Each terminal device 110 is connected to the server 120 through a wireless network. The server 120 can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN (Content Delivery Network), and big data and artificial intelligence platforms.
[0110] Among them, the opinion label generation model can be deployed on the server 120 for training. The server 120 can store a large number of training samples obtained from the e-commerce platform, including sample comments marked with relevance labels, etc., wherein the relevance label indicates whether the sample comment is related to the sample resource. These training samples are used to train the opinion label generation model. Optionally, after the opinion label generation model is trained based on the training method in the embodiment of the present application, the trained opinion label generation model can be directly deployed on the terminal device 110 or on the server 120. In the embodiment of the present application, the opinion label generation model is used to generate opinion labels based on user comments. For a target resource, an ordered opinion label for the target resource is generated based on a group of user comments, and then prompted to the user to facilitate user search.
[0111] In an embodiment of the present application, when the opinion label generation model is deployed on the terminal device 110, the terminal device 110 can perform feature extraction, cluster sorting, and calculation of attention features from a group of comments on the target resource, and finally generate a group of target opinion label sequences. When the opinion label generation model is deployed on the server 120, the terminal device 110 can obtain a group of comments on the target resource and upload them to the server 120, and the server 120 can perform feature extraction, cluster sorting, and calculation of attention features on the group of comments, and finally generate a group of target opinion label sequences. Afterwards, the server 120 can return the predicted target opinion label sequence to the terminal device 110, and the terminal device 110 can display it to the user. However, in general, the opinion label generation model is directly deployed on the server 120, and no specific limitation is made here.
[0112] It should be noted that the training samples used in different scenarios are different. This application can be applied to an intelligent opinion tagging system. The application scenario is a large number of reviews of any product in the e-commerce field. The system generates a set of ordered opinion tags to represent consumers' evaluations of different aspects of the product, helping potential consumers to quickly understand the user evaluation of the product without browsing a large number of reviews.
[0113] At the same time, the method for generating opinion labels listed in the embodiments of the present application is not limited to the e-commerce application scenarios described above, but can also be used in all application scenarios that require modeling of multiple documents and concise summarization of the core opinions therein, such as social media platforms, news reporting websites, etc. This article mainly uses e-commerce application scenarios as examples for illustration.
[0114] See also Figure 2As shown, it is an implementation flow chart of a method for generating a viewpoint label provided in an embodiment of the present application. The specific implementation process of the method is as follows:
[0115] S21: Obtain a comment set for a target resource, where the comment set includes at least two comments;
[0116] The comment set contains multiple comments, which are from different users but are all comments on the same target resource.
[0117] The target resources in the embodiments of the present application mainly refer to commodities, which can refer to tangible products, such as clothing, home furnishings, electrical appliances, etc. that can be traded on an e-commerce platform, or intangible software or services, such as music, movies, articles, etc. In this article, tangible products are mainly used as examples for illustration.
[0118] S22: Obtain the relevance between each comment in the comment set and the target resource;
[0119] S23: sorting the comments according to the corresponding relevance of the comments and the semantic features of the comments to obtain a corresponding comment sequence;
[0120] S24: Generate a set of target opinion label sequences for the target resource based on the comment sequence, where the target opinion sequence includes at least two target opinion label words.
[0121] Among them, the relevance is also called the significance score, which indicates the degree of correlation between the comments and the target resources. Generally, the generated comments will also contain a lot of noise. The greater the noise, the smaller the correlation between the comments and the target resources.
[0122] In an optional implementation, the comments can be divided into multiple comment subsets (hereinafter referred to as opinion clusters) based on the relevance between each comment and the target resource, and the semantic features of each comment, so that the comments in the same subset are semantically similar, and the relevance between these comments and the target resource is also similar. Therefore, after the comment subsets are divided, the comment subsets are sorted, and the comments in each comment subset are sorted to obtain a comment sequence, and an ordered target opinion label is generated based on the ordered comment sequence.
[0123] In an embodiment of the present application, if a review set is divided into multiple review subsets, when generating a target opinion label word based on a review sequence, one target opinion label may be generated for one review subset, one target opinion label may be generated for multiple review subsets, or multiple target opinion labels may be generated for one review subset. In practical applications, if there may be many reviews in a review set, but the target opinion label sequence generated in fact generally contains several target opinion labels, so generally one target opinion label is generated for multiple review subsets.
[0124] In an optional implementation, clustering is mainly used to divide the comments. The specific process is as follows: weighting the semantic features of each comment according to the corresponding relevance of each comment to obtain the significant semantic features of each comment; clustering each comment according to the significant semantic features of each comment to obtain at least two comment subsets.
[0125] Since relevance is also called significance score, by weighting the semantic features of comments based on relevance, the significance information of comments and target resources can be calculated, thereby achieving the goal of noise reduction for a large number of comments, helping to select significant comments and weaken irrelevant comments.
[0126] In addition, when clustering comments according to their significant semantic features, there are many clustering methods. In this article, the K-Means clustering algorithm is used as an example. K-Means is an iterative unsupervised clustering algorithm. The K-Means clustering algorithm is applied to the significant semantic features of all comments, and all comments are grouped into k comment subsets.
[0127] It should be noted that the clustering method listed in the embodiments of the present application is only an example, and other clustering algorithms may be used instead, such as a clustering algorithm based on deep learning (deep clustering), which is not specifically limited here.
[0128] In the embodiment of the present application, after the review set is divided into a plurality of review sub-sets based on a clustering algorithm, the review sub-sets and the reviews within the review sub-sets may be sorted to form a review sequence.
[0129] In an optional implementation, each comment subset is sorted, and each comment in each comment subset is sorted to obtain a set of comment sequences, specifically including:
[0130] According to the number of comments contained in each comment subset, each comment subset is sorted; and for each comment subset, the following operations are performed respectively: according to the degree of association between the semantic features of each comment in the comment subset and the central comment of the comment subset, each comment in the comment subset is sorted. Finally, after sorting the comment subsets and sorting the comments within the comment subsets, a comment sequence is generated based on the sorting results between the comment subsets and the sorting results of each comment in each comment subset.
[0131] For example, a total of 4 comment subsets are obtained, k=4, and these 4 comment subsets are marked as C1, C2, C3 and C4 respectively. Among them, there are 3 comments in C1, 5 comments in C2, 7 comments in C3, and 3 comments in C4. At this time, according to the number of comments in each comment subset, the comment subsets are sorted. Assuming that the number of comments is in descending order, the more comments, the higher the front, the sorting results are: C3, C2, C1 and C4 (or C3, C2, C4 and C1). Among them, the number of comments contained in C1 and C4 is the same, because these two comment subsets can be randomly sorted, or further combined with other indicators to sort, such as the total number of words in the comments, etc., which are not specifically limited here.
[0132] In the embodiment of the present application, after sorting the comment subsets, the comments in the comment subsets can be further sorted, or before sorting the comment subsets, the comments in the comment subsets can be sorted, or they can be sorted at the same time, etc., which is not specifically limited here. Specifically, for each comment subset, when sorting the comments in the comment subset, it is mainly based on the degree of association between the semantic features of each comment in the comment subset and the comment subset. For example, the higher the degree of association, the higher the ranking, and the lower the degree of association, the lower the ranking.
[0133] Assume that the final comment sequence is: [X C3,1 , …, X C3,7 , X C2,1 , …, X C2,5 , X C1,1 , …, X C1,3 , X C4,1 , …, X C4,3 ].
[0134] Among them, X C3,1 represents the top-ranked comment in the comment subset C3, X C3,7 This means that the comment ranked last in the comment subset C3 has the highest relevance to C3. C3,1 Highest, X C3,7The lowest, and so on. Finally, a set of ordered opinion labels can be generated based on the comment sequence.
[0135] The method for generating opinion labels in the embodiment of the present application can also be implemented in combination with artificial intelligence technology. It is a new technical science for studying and developing theories, methods, technologies and application systems for simulating, extending and expanding human intelligence. The specific steps are: input each comment into the trained opinion label generation model, extract features of each comment based on the sentence-level significance scoring component in the trained opinion label generation model, and obtain the relevance of each comment output by the significance scoring component. After that, input each comment and the relevance corresponding to each comment into the comment clustering and sorting component in the trained opinion label generation model, cluster and sort each comment based on the comment clustering and sorting component, obtain the first concatenated representation vector at the word level output by the comment clustering and sorting component, and combine each comment word in the first concatenated representation vector to form a comment sequence; finally, input the first concatenated representation vector into the opinion label component in the trained opinion label generation model, extract attention features based on the opinion label component, and obtain the target opinion label sequence output by the opinion label component.
[0136] The opinion label generation model proposed in the embodiment of the present application mainly includes a sentence-level significance scoring component, a comment clustering and sorting component, and an opinion label component. Among them, the sentence level is mainly to distinguish it from the word level behind. In the significance scoring component, what is obtained are sentence representations of comments, while the first concatenated representation vector finally obtained in the comment clustering and sorting component is at the word level, which mainly refers to the vector representation obtained by sequentially concatenating the vector representations of each comment in the comment sequence and then converting it to the word level.
[0137] Among them, the opinion labeling model is trained based on the training sample data set, and the training samples in the training sample data set include sample comments that have been labeled with relevance labels, wherein the relevance label indicates whether the sample comment is related to the sample resource, and can be a binary classification label. It should be noted that the sample comments in the training samples contained in the training sample data set in the embodiment of the present application can be for the same sample resource or for multiple sample resources. Generally, there are multiple sample comments corresponding to the same sample resource. Furthermore, the opinion label generation model in the embodiment of the present application is obtained by using machine learning training using multiple groups of training samples.
[0138] See also Figure 3As shown in FIG. 1 , it is one of the most commonly used natural language generation frameworks listed in the embodiments of this application, namely the S2S (Sequence-to-Sequence) framework, which is the basic modeling framework for natural language generation and machine translation. The core components of the S2S framework include an encoder and a decoder. Currently, common encoders and decoders are usually implemented using Transformers, such as Figure 3 As shown in the figure, first the encoder converts a text representation into a continuous spatial representation (word embedding) and a semantic context vector. The decoder reads the semantic context vector, generates the target word and outputs it. The target word generated here is unordered.
[0139] On this basis, the opinion label generation model proposed in the embodiment of the present application is also implemented based on the S2S framework. Considering that the abstract opinion label generation task faces the following three challenges: (1) user-generated comments contain a lot of noise; (2) there is a big difference between the formal style of the target opinion label text and the verbal style of user comments; (3) opinion labels need to distinguish different products with similar characteristics. In order to solve the above challenges, the embodiment of the present application proposes an abstract opinion label generation framework AOT-Net, which is used to generate ordered opinion labels based on a set of user comments. Among them, AOT-Net adopts the natural language generation framework S2S as the basic framework.
[0140] Combine the following Figure 4 The opinion label generation model AOT-Net is listed to illustrate the method for generating opinion labels in the embodiments of the present application.
[0141] See also Figure 4 As shown, it is a schematic diagram of the structure of an opinion tag generation model in an embodiment of the present application. The model includes three parts: sentence-level salience estimation component, review clustering and ranking component, and rank-aware opinion tagging component.
[0142] First, input a set of reviews for a product (X1, X2, ..., X M ), M represents the total number of reviews. After the sentence-level saliency evaluation component, a saliency score can be predicted for each review to evaluate the amount of information related to the product in each review, that is, the relevance of the review.
[0143] In this embodiment of the present application, the purpose of the sentence-level saliency assessment component is to evaluate the significance of each comment X. i Calculate a saliency score. This component proposes a sentence-level self-attention mechanism to significantly emphasize comments related to the characteristics of the target resource and weaken noise. Each comment can be regarded as a word sequence. First, a bidirectional gated recurrent neural network is used to map each comment to a continuous space to obtain the representation vector of each comment, and then the representation vector is converted into a semantic vector through context encoding. The present application embodiment introduces a sentence-level self-attention mechanism to model the complex interactions between all comment semantic vectors. Specifically, the sentence-level self-attention mechanism is used to extract the attention features between the semantic vectors of each comment and the semantic vectors of other comments except itself, and the relevance between each comment and the target resource is obtained based on the attention features corresponding to each comment, and a significance score z is calculated for each comment. i .
[0144] It should be noted that Figure 4 The bidirectional recurrent neural network used in the listed saliency evaluation component is used as a sentence representation module. Of course, it can also be replaced by other sentence representation models, such as Transformer with pooling operation, etc., which is not specifically limited here.
[0145] Below is the i-th comment (the corresponding semantic vector is ) as an example, this paper introduces the sentence-level self-attention mechanism, models the complex interaction between the semantic vectors of the comment and other comments, and then calculates the relevant formulas involved in the process of obtaining the significance score of the i-th comment:
[0146] First of all Perform linear conversion, which is implemented based on formula 1:
[0147]
[0148] Among them, q i represents the query vector, k i represents the key vector, v i Represents the value vector. These three vectors are The linear transformation is obtained, W q , W k , W v is a preconfigured linear transformation matrix.
[0149] Furthermore, after calculating the above three types of linear vectors, attention features can be extracted based on the query vector, key vector and value vector to model the complex interaction between comment semantic vectors. The calculation formula is as follows:
[0150]
[0151] Among them, c i represents the contextual interaction vector obtained by the interaction between the ith comment and other M-1 comments, and M represents the total number of comments in the comment set. o and i' are not equal to i, which means other comments except the ith comment, and the value range is 1 to M (except i). o k represents the key vector of the oth comment. i′ represents the key vector of the i'th comment; v i′ represents the value vector represented by the i'th comment; q i represents the query vector represented by the i-th comment, and T represents the transpose.
[0152] After calculating the context interaction vector obtained by the interaction between the ith comment and the remaining M-1 comments, the relevance corresponding to the ith comment is calculated based on the context interaction vector, specifically involving the following two calculation formulas:
[0153]
[0154] Among them, W s , W s1 , W s2 , b s , σ are pre-configured model parameters or hyperparameters, It represents the semantic vector obtained by accumulating the semantic vector of the i-th comment and the corresponding context interaction vector, and then processing it through two layers of linear transformation and one layer of activation. Based on this semantic vector, the significance score z corresponding to the i-th comment can be analyzed. i .
[0155] Based on the saliency evaluation component, the z corresponding to each comment is calculated. i After that, the comments can be clustered and sorted based on the comment clustering and sorting component in the trained opinion label generation model. The comment clustering and sorting component proposed in this application learns the importance order of comments by organizing them into ordered opinion clusters, which is the prerequisite for accurately generating ordered opinion labels. The specific process is as follows:
[0156] First, we need to use the Transformer encoder to map each comment to a continuous space to obtain the word vector sequence corresponding to each comment, that is, the vector sequence composed of the vectors of all the words in a sentence, and then extract the spatial information of the word vector sequence corresponding to each comment through hierarchical pooling to obtain the semantic representation vector of each comment. like Figure 4 As shown in This vector refers to extracting and retaining spatial information from the vector sequence of words in a sentence, and finally obtaining a vector representing the sentence; then, the semantic representation vector of each comment is weighted according to the relevance corresponding to each comment, and the significant semantic representation vector X of each comment is obtained. i ′.
[0157] Then, the K-Means clustering algorithm can be applied to the significant semantic representation vectors of all comments to cluster them, and all comments can be grouped into k opinion clusters; all opinion clusters are sorted from large to small according to the number of comments they contain, and each opinion cluster is sorted from small to large according to the distance from the comment to the cluster center, and finally an ordered comment sequence is obtained, which can be expressed as: Where L i is the number of comments in the i-th opinion cluster. After the comments are sequentially concatenated to obtain a vector representation, the embodiment of the present application performs word-level conversion and flattens it into the first concatenated representation vector at the word level, corresponding to Figure 4 shown
[0158] Finally, in the sequentially enhanced opinion label component, two alignment constraints, namely alignment features and alignment losses, are adopted to enable the opinion label generation model to generate ordered opinion labels based on the semantic representation vectors of the comments. The specific process is as follows:
[0159] The target opinion label sequence is generated in turn by adopting a cyclic iteration method. A view label in the target opinion sequence includes at least one view label. For example, a view label is "service enthusiasm", which is composed of two view label words, namely "service" and "enthusiasm"; another view label is "size suitable", which is also composed of two view label words, namely "size" and "suitable", and so on.
[0160] Each time a tag word is generated, it is considered as a loop iteration, which can also be called a time step. Figure 5 As shown, during one loop iteration, the following operations are performed:
[0161] S51: Input the target opinion label word outputted last time into the opinion label component, wherein the first time the opinion label component is inputted is a pre-set starting marker word.
[0162] See also Figure 4 As shown, the starting marker word is BOS, y 1,1 Indicates the first word in the first opinion tag, inputs BOS in the first loop iteration process, and outputs y 1,1 ; Input y in the second loop iteration 1,1 , output y 1,2 . Assume that the first opinion tag contains two opinion tag words y 1,1 and 1,2 , then in the third loop iteration process, input y 1,2 , and also input BOS, output y 2,1 , which is the first word in the second opinion tag. Similarly, BOS can also be regarded as a separator between opinion tags, which needs to be input every time a new opinion tag is generated. 2,2 hour, Figure 4 The input shown includes BOS, y 1,1 ,y 1,2 , BOS,y 2,1 The serial numbers of the opinion labels corresponding to these words are 1, 1, 1, 2, 2 respectively.
[0163] It is very challenging to accurately generate ordered opinion tags. In the embodiment of the present application, a sequentially enhanced opinion tag component is proposed to generate ordered opinion tags. According to real data analysis, the order of opinion tags and the order of opinion clusters are strongly correlated, that is, the jth opinion tag is often strongly correlated with the jth opinion cluster and its neighbors. Therefore, in the embodiment of the present application, the jth opinion cluster and its neighbors are represented as focused opinion clusters, and other opinion clusters are represented as outer opinion clusters. In order to add sequential constraints between opinion tags and opinion clusters at each generation time step, the present application involves two alignment mechanisms:
[0164] Alignment Mechanism 1-Alignment Features. Intuitively, opinion labels and FOCs are semantically similar in vector space. This embodiment of the application introduces alignment features Aln() into the semantic vector representation of opinion labels and opinion clusters, such as Figure 6 For the specific alignment process, please refer to the following steps:
[0165] S52: taking the target opinion cluster and the neighbors of the target opinion cluster selected this time as focused opinion clusters, and taking other opinion clusters as external opinion clusters, wherein the target opinion cluster selected each time is determined based on the order between the opinion clusters.
[0166] S53: Add a first alignment feature to the comment words in the focused opinion cluster in the comment sequence, and add a second alignment feature to the comment words in the external opinion cluster in the comment sequence, to obtain a first alignment semantic vector corresponding to each comment word in the comment sequence; and, add a first alignment feature to the target opinion label word output last time, to obtain a corresponding second alignment semantic vector.
[0167] Among them, step S52 can be implemented by using a sliding window, and the target viewpoint cluster and the neighbors of the target viewpoint cluster are selected based on the sliding window. Assuming that the window size is 3, it means that 3 adjacent viewpoint clusters are selected as the focused viewpoint cluster FOC each time, and the remaining viewpoint clusters are selected as the external viewpoint clusters OOC, for example Figure 6 As shown, assuming there are 4 opinion clusters in total, there are 3 FOCs and one OOC.
[0168] In step S53, assume that the target opinion label word output last time is y j,q-1 , then corresponding to y j,q-1 In terms of , the semantic vector of the opinion label integrating the first alignment feature, namely the second alignment semantic vector, is expressed as:
[0169] y j,q-1 =W rt A ln(1)+Embed(y j,q-1 )+Pos(y j,q-1 ); (Formula 5)
[0170] Among them, W rt is the pre-set model parameter, and Aln(1) is the feature vector of the first alignment feature. For the pth comment word x in the i-th opinion cluster i,p , considering that the comment words in the focused opinion cluster FOC and the comment words in the external opinion cluster OOC have different corresponding added alignment features, see formula 6 for details:
[0171]
[0172] Among them, when the pth comment word x in the i-th opinion cluster i,p When it belongs to FOCs, it is the first alignment feature added corresponding to the comment word. When x i,p When it belongs to OOCs (i.e. x i,p When it does not belong to FOCs), it is the second alignment feature added corresponding to the comment word. Among them, Aln(0) and Aln(1) are two pre-set embedding feature vectors. That is, Aln(1) is added to the word vector of each comment word in FOC, and Aln(0) is added to the word vector of each comment word in OOC.
[0173] For the comment word x i,p , the corresponding first alignment semantic vector is shown in Formula 7:
[0174]
[0175] Among them, r i,p Indicates adding alignment features to the comment word x i,p The first aligned semantic vector W is obtained rt are the preset model parameters.
[0176] In order to capture semantic and alignment information from ordered opinion clusters, the multi-head cross-attention mechanism (MHAtt) is used in the embodiment of the present application to calculate the attention distribution of each time step Where k represents the kth cluster, Lk represents the total number of comment words in the kth cluster, That is, the Lth in the kth cluster k The alignment probability of a comment word and a target opinion label word output once is also called the attention value between the comment word and the opinion label word output last time. The specific implementation process is as follows:
[0177] S54: Combine the first alignment vector corresponding to each comment word in the comment sequence with the second alignment semantic vector corresponding to the target opinion label word output last time, and analyze the alignment probability of the target opinion label word output last time and each comment word in the comment sequence based on the attention mechanism, wherein the alignment probability represents the attention value between the comment word and the opinion label word output last time.
[0178] S55: Weight the alignment probability and the semantic vector sequence of the comment words in the comment sequence, and input them into the forward neural network to obtain the target semantic representation vector of the comment sequence output this time.
[0179] S56: Generate the target opinion label word output this time based on the target opinion label word output last time and the target semantic representation vector.
[0180] Specifically, when calculating the alignment probability in S54, the calculation formula is as follows:
[0181]
[0182] in, Represents the q-1th opinion label word y in the jth opinion label j,q-1 The second aligned semantic vector is linearly transformed into a vector representation, represents the vector representation of the linear transformation of the first aligned semantic vector of the p-th comment word in the i-th opinion cluster, z represents the z-th head in the multi-head attention mechanism, assuming there are n h Head, W a and W b are the preset model parameters.
[0183] In the calculation and After that, we can combine formula 10 to calculate the attention value corresponding to each comment word:
[0184]
[0185] in, Represents the p-th comment word in the ith cluster for the opinion label word y j,q-1 The attention value of i' ranges from 1 to M, in order to distinguish The i in the above sentence has the same physical meaning as i. Similarly, p' is used to distinguish The actual physical meaning of p is the same as p.
[0186] Finally, n h The attention values corresponding to the heads are put together, as shown in formula 11:
[0187]
[0188] Among them, c j,q Represents the context vector of the qth opinion label word in the jth opinion label, that is, the opinion label word y to be generated this time j,q There are k clusters in total, and the i-th cluster has c i Comment word.
[0189] After calculating the context vector, combined with Figure 4 The forward feedback (feedforward neural network) and regularization layer shown are processed to obtain the final output y j,q , specifically involving formula 12 to formula 13:
[0190]
[0191] Among them, LayerNorm refers to Figure 4 The Add&Norm layer in the sequential enhancement view label component is the regularization layer, FNN refers to the fully connected layer, and n refers to the number of transformer layers in the decoder. j,qThat is, opinion label word y j,q The vector representation of .
[0192] It should be noted that the sequentially enhanced opinion label component in the embodiment of the present application is illustrated by taking the decoder model as an example. In fact, the opinion label component is not limited to a specific decoder model, and opinion labels can also be generated based on a pre-trained language model, etc., which is not specifically limited here.
[0193] Furthermore, the opinion label generation model in the embodiment of the present application is obtained by using multiple sets of training samples and machine learning training. The specific training process is as follows:
[0194] A training sample data set for at least one sample resource is obtained, and a loop iterative training is performed on an untrained opinion label generation model according to training samples in the training sample data set to obtain a trained opinion label generation model; wherein each loop iterative training process includes the following operations:
[0195] First, a group of training samples for the same sample resource is selected from the training sample data set, and this group of training samples is used as a comment set. Similar to the application process listed above, the sample comments contained in each selected training sample are respectively input into the sentence-level significance scoring component in the untrained opinion label generation model to obtain the relevance corresponding to each sample comment output by the significance scoring component; then, based on the error between the relevance corresponding to each sample comment and the corresponding relevance label, a first loss function is constructed.
[0196] Specifically, the sentence-level saliency evaluation component uses the interaction between the semantic vectors of comments to determine the relevance of each comment to other comments and calculates the saliency information of each comment related to the product, thereby achieving the goal of noise reduction for a large number of comments, selecting salient comments, and weakening irrelevant comments. The optimization goals of this component are as follows:
[0197]
[0198] Among them, Lcla is the first loss function, z i refers to the significance score of the ith comment predicted by the opinion label generation model, z i * is the true significance score of the ith comment.
[0199] In the embodiment of this application, i * The value of is 0 or 1, which is a binary label, that is, the correlation label in the training sample listed in the embodiment of the present application, which is used to indicate whether the sample comment is related to the sample resource. For example, if a comment is a comment on product A, but the sample resource is product B, then zi * The value of is 0; if a comment is a comment on product B, and the sample resource is product B, then z i * The value of is 1.
[0200] Next, the sample comments in each selected training sample and the relevance of each sample comment are respectively input into the comment clustering and sorting component in the untrained opinion label generation model, and each sample comment is clustered based on the comment clustering and sorting component. After obtaining at least two opinion clusters, each opinion cluster is sorted to obtain the word-level second concatenated representation vector output by the comment clustering and sorting component. After that, the second concatenated representation vector can be input into the opinion label component in the untrained opinion label generation model, and the attention feature is extracted based on the opinion label component to obtain a set of predicted opinion label sequences output by the opinion label component, wherein the predicted opinion label sequence includes at least two predicted opinion label words.
[0201] For the comment clustering ranking component and the sequential enhanced opinion labeling component, the second loss function is mainly constructed based on the distribution error between the predicted opinion label words in the predicted opinion label sequence and the real opinion label words in the real opinion label sequence; the third loss function is constructed based on the attention value of the comment words in each opinion cluster.
[0202] Optionally, when constructing the second loss function, it can be based on the alignment loss.
[0203] For any predicted opinion label word, based on the distribution probability of the predicted opinion label word in the preset opinion label word set and the distribution probability of the predicted opinion label word in the comment set, determine the distribution error between the predicted opinion label word in the predicted opinion label sequence and the real opinion label word in the real opinion label sequence; construct a second loss function based on the determined distribution error.
[0204] Specifically, for any predicted opinion label word, the predicted opinion label word is used as the target opinion label word, the vector representation of the target opinion label word is updated through the Transformer decoder, and the probability distribution of the opinion label word related to FOCs is calculated:
[0205] P v (y j,q |[y 1,0 ,…,y j,q-1 ],X)=softmax(W v y j,q +b v ); (Formula 15)
[0206] As shown in Formula 15, X represents the semantic vector representation of the opinion cluster, which is obtained by concatenating the first aligned semantic vectors of each comment word obtained based on Formula 7, and P v represents the probability distribution over the opinion label vocabulary, W v and b v Represents pre-configured model parameters.
[0207] In particular, since the opinion label to be generated in this application is strongly correlated with the opinion cluster, the embodiment of this application adopts a copy mechanism to directly copy words from the opinion cluster as the target opinion label word, and the final opinion label word y j,q The probability distribution of is:
[0208]
[0209] p gen =σ(W g y j,q +b g ); (Formula 17)
[0210] Among them, p gen Indicates that y is obtained from the opinion label vocabulary p,q The probability of W can be obtained by analyzing the semantic vector representation X of the opinion cluster at the decoder end at the current moment and the vector semantic similarity of each word in the pre-configured opinion label vocabulary v. g and b g represents the pre-configured model parameters, α i,* Represents y j,q The attention value of the position is calculated by referring to Formula 10. When training the model, y j,q The probability of P(y j,q ) as large as possible.
[0211] The embodiment of the present application optimizes the loss function of the following formula during training so that the predicted opinion label word distribution is as close as possible to the actual opinion label word distribution:
[0212]
[0213] Wherein, the second loss function listed in Formula 18 is the negative log-likelihood loss function in the embodiment of the present application. Wherein, N indicates that a total of N predicted opinion labels are output, Represents the number of opinion label words in the jth opinion label.
[0214] Alignment mechanism 2-alignment loss: In the process of generating the jth opinion label, the embodiment of the present application proposes an alignment loss to help the sequentially enhanced opinion label component accurately locate FOCs. Through the alignment loss, the attention distribution in the multi-head attention mechanism can be optimized, so that the sequentially enhanced opinion label component explicitly pays attention to FOCs and ignores OOCs. The alignment loss function formula is as follows:
[0215]
[0216] Among them, α i,p represents the pth comment word pair y in the i-th opinion cluster j,q-1 By calculating the attention value of each comment word pair y in the opinion cluster j,q-1 The third loss function is constructed based on the attention value of the comment words in FOC, with the aim of making the attention value corresponding to the comment words in OOC higher and the attention value corresponding to the comment words in FOC lower.
[0217] Considering that the opinion label generation model listed in the embodiment of the present application contains the above three components, it is necessary to combine these three components for joint training during the model training process. By combining the sentence-level saliency evaluation component, the comment clustering and sorting component, and the sequentially enhanced opinion label component, the overall optimization goal of the embodiment of the present application is as follows (λ1, λ2, λ3 empirical values are 1):
[0218] L=λ1L cla +λ2L cln +λ3L gen ; (Formula 20)
[0219] In summary, L is determined based on the first loss function, the second loss function and the third loss function. Based on the loss function L listed above, the parameters of the opinion label generation model are continuously adjusted until the model converges or the iteration number reaches the upper limit to obtain the trained opinion label generation model.
[0220] After the opinion label generation model is trained, an opinion label sequence can be generated based on the trained opinion generation model. Specifically, a group of users' multiple comments on the target resource are input into the trained opinion label generation model, a group of opinion label sequences are generated based on the opinion label generation model, and finally the generated opinion label sequence is returned to the user. Based on the opinion label generation model in the embodiment of the present application, a set of ordered opinion labels can be generated to represent consumers' evaluations of different aspects of the product, helping potential consumers to quickly understand the user evaluations of the product without browsing a large number of comments. In addition, it can also be used in other application scenarios that require modeling of multiple documents and concise summarization of the core ideas therein, such as social media platforms, news reporting websites, etc., to help potential users quickly and easily obtain useful information from them.
[0221] See also Figure 7 As shown, it is a flow chart of a complete training method for a viewpoint label generation model in an embodiment of the present application. The specific implementation process of the method is as follows:
[0222] Step S700: Acquire a training sample data set for at least one sample resource;
[0223] Step S701: selecting a group of training samples for the same sample resource from the training sample data set;
[0224] Step S702: inputting the sample comments included in each selected training sample into the sentence-level significance scoring component in the untrained opinion label generation model, and obtaining the relevance corresponding to each sample comment output by the significance scoring component;
[0225] Step S703: constructing a first loss function based on the difference between the relevance corresponding to each sample comment and the corresponding relevance label;
[0226] Step S704: inputting the sample comments in each selected training sample and the relevance corresponding to each sample comment into the comment clustering ranking component in the untrained opinion label generation model, clustering each sample comment based on the comment clustering ranking component, and obtaining at least two opinion clusters;
[0227] Step S705: sorting each opinion cluster based on the comment cluster sorting component to obtain a second concatenated representation vector at the word level output by the comment cluster sorting component;
[0228] Step S706: inputting the second concatenated representation vector into the sequentially enhanced opinion label component in the untrained opinion label generation model, performing attention feature extraction based on the opinion label component, and obtaining a set of predicted opinion label sequences output by the opinion label component;
[0229] Step S707: constructing a second loss function based on the distribution difference between the predicted opinion label words in the predicted opinion label sequence and the real opinion label words in the real opinion label sequence;
[0230] Step S708: constructing a third loss function based on the attention value of the comment words in each opinion cluster;
[0231] Step S709: adjusting the network parameters of the untrained opinion label generation model according to the first loss function, the second loss function and the third loss function;
[0232] Step S710: Determine whether the opinion label generation model has converged. If so, end this process; otherwise, return to step S701.
[0233] Based on the same inventive concept, the present application also provides a device for generating opinion labels. Figure 8 As shown, it is a schematic diagram of the structure of a device 800 for generating opinion labels, which may include:
[0234] A comment acquisition unit 801 is used to acquire a comment set for a target resource, where the comment set includes at least two comments;
[0235] An analysis unit 802 is used to obtain the relevance between each comment in the comment set and the target resource;
[0236] The sorting unit 803 is used to sort the comments according to the relevance of each comment and the semantic features of each comment to obtain a corresponding comment sequence;
[0237] The label generation unit 804 is used to generate a target opinion label sequence for the target resource based on the comment sequence, and the target opinion sequence includes at least two target opinion label words.
[0238] Optionally, the sorting unit 803 is specifically configured to:
[0239] According to the relevance of each comment and the semantic features of each comment, each comment is divided to obtain at least two comment subsets;
[0240] Each comment subset is sorted, and each comment in each comment subset is sorted respectively to obtain a comment sequence.
[0241] Optionally, the sorting unit 803 is specifically configured to:
[0242] According to the corresponding relevance of each comment, the semantic features of each comment are weighted to obtain the significant semantic features of each comment;
[0243] Each comment is clustered according to its significant semantic features to obtain at least two comment subsets.
[0244] Optionally, the sorting unit 803 is specifically configured to:
[0245] sorting each comment subset according to the number of comments contained in each comment subset; and,
[0246] For each comment subset, the following operations are performed respectively: the comments in the comment subset are sorted according to the degree of association between the semantic features of each comment in the comment subset and the comment subset;
[0247] Based on the ranking results between each comment subset and the ranking results of each comment in each comment subset, a comment sequence is generated.
[0248] Optionally, the analyzing unit 802 is specifically configured to:
[0249] Input each comment into the trained opinion label generation model respectively, extract features of each comment based on the sentence-level significance scoring component in the trained opinion label generation model, and obtain the relevance of each comment output by the significance scoring component;
[0250] The sorting unit 803 is specifically used for:
[0251] Input each comment and the relevance corresponding to each comment into the comment clustering and sorting component in the trained opinion label generation model, cluster and sort each comment based on the comment clustering and sorting component, obtain the first concatenated representation vector at the word level output by the comment clustering and sorting component, and combine each comment word in the first concatenated representation vector to form a comment sequence;
[0252] The label generating unit 804 is specifically used for:
[0253] Input the concatenated representation vector into the opinion label component in the trained opinion label generation model, perform attention feature extraction based on the opinion label component, and obtain the target opinion label sequence output by the opinion label component;
[0254] The trained opinion label generation model is trained based on a training sample data set. The training samples in the training sample data set include sample comments annotated with relevance labels. The relevance labels indicate whether the sample comments are relevant to the sample resources.
[0255] Optionally, the analyzing unit 802 is specifically configured to:
[0256] Input each comment into the saliency scoring component, map each comment to a continuous space based on the sentence representation module in the saliency scoring component, and obtain the representation vector of each comment;
[0257] The representation vector of each comment is converted into a corresponding semantic vector through context encoding;
[0258] Based on the saliency scoring component, the attention features between the semantic vector of each comment and the semantic vectors of other comments except itself are extracted;
[0259] The relevance between each comment and the target resource is obtained based on the attention features corresponding to each comment.
[0260] Optionally, the sorting unit 803 is specifically configured to:
[0261] Based on the review clustering and ranking component in the trained opinion label generation model, each review is mapped to a continuous space to obtain the word vector sequence corresponding to each review;
[0262] The spatial information of the word vector sequence corresponding to each comment is extracted through hierarchical pooling operation to obtain the semantic representation vector of each comment;
[0263] According to the relevance of each comment, the semantic representation vector of each comment is weighted to obtain the significant semantic representation vector of each comment;
[0264] Clustering is performed based on the significant semantic representation vector of each comment to obtain at least two comment subsets;
[0265] After all comment subsets are sorted and each comment in each comment subset is sorted, the significant semantic representation vectors of each comment are concatenated and word-level transformed to obtain a first concatenated representation vector.
[0266] Optionally, the sorting unit 803 is specifically configured to:
[0267] Based on the review clustering and ranking component in the trained opinion label generation model, each review is mapped to a continuous space to obtain the word vector sequence corresponding to each review;
[0268] The spatial information of the word vector sequence corresponding to each comment is extracted through hierarchical pooling operation to obtain the semantic representation vector of each comment;
[0269] According to the relevance of each comment, the semantic representation vector of each comment is weighted to obtain the significant semantic representation vector of each comment;
[0270] Clustering is performed based on the significant semantic representation vector of each comment to obtain at least two comment subsets;
[0271] After all comment subsets are sorted and each comment in each comment subset is sorted, the significant semantic representation vectors of each comment are concatenated and word-level transformed to obtain a first concatenated representation vector.
[0272] Optionally, the label generating unit 804 is specifically configured to:
[0273] In a loop iteration method, each opinion label word in the target opinion label sequence is generated in turn, and one opinion label in the target opinion sequence includes at least one opinion label word; wherein, in one loop iteration process, the following operations are performed:
[0274] Input the target opinion label word outputted last time into the opinion label component, wherein the first input into the opinion label component is a pre-set starting marker word;
[0275] The attention mechanism is used to analyze the alignment probability between the target opinion label word output last time and each comment word in the comment sequence, where the alignment probability represents the attention value between the comment word and the opinion label word output last time.
[0276] The alignment probability and the semantic vector sequence of the comment words in the comment sequence are weighted and input into the forward neural network to obtain the target semantic representation vector of the comment sequence output this time;
[0277] Based on the target opinion label word output last time and the target semantic representation vector, the target opinion label word output this time is generated.
[0278] Optionally, the label generating unit 804 is further configured to:
[0279] Before analyzing the alignment probability of the target opinion label word output last time and each comment word in the comment sequence through the attention mechanism, the target comment subset selected this time and the neighbors of the target comment subset are used as the focused comment subsets, and the other comment subsets are used as the external comment subsets, where the target comment subset selected each time is determined based on the order between the comment subsets;
[0280] Adding a first alignment feature to the comment words in the focused comment subset in the comment sequence, and adding a second alignment feature to the comment words in the external comment subset in the comment sequence, to obtain a first alignment semantic vector corresponding to each comment word in the comment sequence; and
[0281] Add the first alignment feature to the target opinion label word output last time to obtain the corresponding second alignment semantic vector;
[0282] The attention mechanism is used to analyze the alignment probability of the target opinion label word output last time and each comment word in the comment sequence, including:
[0283] Combining the first alignment vector corresponding to each comment word in the comment sequence with the second alignment semantic vector corresponding to the target opinion label word output last time, the alignment probability between the target opinion label word output last time and each comment word in the comment sequence is analyzed based on the attention mechanism.
[0284] Optionally, the device further comprises:
[0285] The training unit 805 is used to generate a model for opinion labels obtained through training in the following process:
[0286] Obtaining a training sample data set for at least one sample resource;
[0287] According to the training samples in the training sample data set, the untrained opinion label generation model is subjected to cyclic iterative training to obtain a trained opinion label generation model; wherein each cyclic iterative training process includes the following operations:
[0288] A group of training samples for the same sample resource are selected from the training sample data set, and sample comments contained in each of the selected training samples are respectively input into a sentence-level significance scoring component in an untrained opinion label generation model to obtain the relevance corresponding to each sample comment output by the significance scoring component;
[0289] Constructing a first loss function based on the error between the relevance corresponding to each sample comment and the corresponding relevance label; and
[0290] Inputting the sample comments in each selected training sample and the relevance corresponding to each sample comment into the comment clustering and sorting component in the untrained opinion label generation model, clustering each sample comment based on the comment clustering and sorting component to obtain at least two comment subsets; sorting each comment subset based on the comment clustering and sorting component to obtain a second concatenated representation vector at the word level output by the comment clustering and sorting component;
[0291] Inputting the second concatenated representation vector into an opinion label component in an untrained opinion label generation model, performing attention feature extraction based on the opinion label component, and obtaining a set of predicted opinion label sequences output by the opinion label component, wherein the predicted opinion label sequence includes at least two predicted opinion label words;
[0292] A second loss function is constructed based on the distribution error between the predicted opinion label words in the predicted opinion label sequence and the real opinion label words in the real opinion label sequence; and a third loss function is constructed based on the attention value of the comment words in each comment subset;
[0293] According to the first loss function, the second loss function and the third loss function, parameters of the untrained opinion label generation model are adjusted.
[0294] Optionally, the training unit 805 is specifically used for:
[0295] For any predicted opinion label word, based on the distribution probability of the predicted opinion label word in the preset opinion label word set and the distribution probability of the predicted opinion label word in the comment set, determine the distribution error between the predicted opinion label word in the predicted opinion label sequence and the real opinion label word in the real opinion label sequence;
[0296] A second loss function is constructed based on the determined distribution error.
[0297] For the convenience of description, the above parts are divided into modules (or units) according to their functions and described separately. Of course, when implementing this application, the functions of each module (or unit) can be implemented in the same or multiple software or hardware.
[0298] After introducing the method and device for generating opinion tags according to an exemplary embodiment of the present application, next, an electronic device according to another exemplary embodiment of the present application is introduced.
[0299] Those skilled in the art will appreciate that various aspects of the present application may be implemented as a system, method or program product. Therefore, various aspects of the present application may be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or a combination of hardware and software, which may be collectively referred to as "circuit", "module" or "system" herein.
[0300] Based on the same inventive concept as the above method embodiment, an electronic device is also provided in the embodiment of the present application. The electronic device can be used to generate a viewpoint tag sequence. In one embodiment, the electronic device can be a server, such as Figure 1 In this embodiment, the structure of the electronic device can be as follows: Fig. 9 As shown, it includes a memory 901 , a communication module 903 and one or more processors 902 .
[0301] The memory 901 is used to store computer programs executed by the processor 902. The memory 901 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system and programs required for running the instant messaging function, etc.; the data storage area may store various instant messaging information and operation instruction sets, etc.
[0302] The memory 901 may be a volatile memory, such as a random-access memory (RAM); the memory 901 may also be a non-volatile memory, such as a read-only memory, a flash memory, a hard disk drive (HDD) or a solid-state drive (SSD); or the memory 901 may be any other medium that can be used to carry or store the desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory 901 may be a combination of the above memories.
[0303] The processor 902 may include one or more central processing units (CPU) or a digital processing unit, etc. The processor 902 is configured to implement the above-mentioned method for generating opinion labels when calling the computer program stored in the memory 901 .
[0304] The communication module 903 is used to communicate with terminal devices and other servers.
[0305] The specific connection medium between the memory 901, the communication module 903 and the processor 902 is not limited in the embodiment of the present application. Fig. 9 In the embodiment, the memory 901 and the processor 902 are connected via a bus 904. The bus 904 is connected to the processor 902 via a bus 904. Fig. 9 The connections between other components are shown in bold lines, and are not intended to be limiting. Bus 904 can be divided into address bus, data bus, control bus, etc. For ease of representation, Fig. 9 Only one thick line is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0306] The memory 901 stores a computer storage medium, and the computer storage medium stores computer executable instructions, and the computer executable instructions are used to implement the method for generating opinion labels in the embodiment of the present application. The processor 902 is used to execute the above-mentioned method for generating opinion labels, such as Figure 2 shown.
[0307] In some possible implementations, various aspects of the method for generating opinion labels provided in the present application may also be implemented in the form of a program product, which includes program code. When the program product is run on a computer device, the program code is used to enable the computer device to execute the steps of the method for generating opinion labels according to various exemplary embodiments of the present application described above in this specification. For example, the computer device may execute the following steps: Figure 2 Follow the steps shown in .
[0308] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of readable storage media (a non-exhaustive list) include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0309] The program product of the embodiment of the present application can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a computing device. However, the program product of the present application is not limited to this. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with a command execution system, device or device.
[0310] The readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, wherein the readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. The readable signal medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with a command execution system, apparatus, or device.
[0311] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.
[0312] A person skilled in the art can understand that: all or part of the steps of implementing the above method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above method embodiment; and the aforementioned storage medium includes: mobile storage devices, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), disks or optical disks, etc. Various media that can store program codes.
[0313] Alternatively, if the above-mentioned integrated unit of the embodiment of the present application is implemented in the form of a software function module and sold or used as an independent product, it can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the methods described in each embodiment of the embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as mobile storage devices, ROM, RAM, magnetic disks or optical disks.
[0314] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present application.
[0315] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these changes and modifications of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these changes and modifications.
Claims
1. A method for generating opinion labels, characterized in that: The method includes: Obtain a review set for a target resource, where the review set includes at least two reviews; Obtaining the relevance between each comment in the comment set and the target resource; According to the relevance corresponding to each comment and the semantic features of each comment, the comments are sorted to obtain a corresponding comment sequence, including: inputting each comment and the relevance corresponding to each comment into a comment clustering and sorting component in a trained opinion label generation model; extracting the significant semantic representation vector corresponding to each comment based on the comment clustering and sorting component, and clustering and sorting the comments based on the extracted significant semantic representation vectors to obtain a comment sequence output by the comment clustering and sorting component; the semantic feature is a semantic representation vector; the significant semantic representation vector of each comment is obtained by weighting the semantic representation vector of the comment according to the relevance corresponding to the comment; A target opinion label sequence for the target resource is generated based on the comment sequence, wherein the target opinion label sequence includes at least two target opinion label words.
2. The method according to claim 1, characterized in that The step of sorting the comments according to the relevance of the comments and the semantic features of the comments to obtain a corresponding comment sequence further includes: Dividing the comments according to the relevance corresponding to the comments and the semantic features of the comments to obtain at least two comment subsets; Each comment subset is sorted, and each comment in each comment subset is sorted respectively to obtain the comment sequence.
3. The method according to claim 2, characterized in that The step of dividing the comments according to the relevance of the comments and the semantic features of the comments to obtain at least two comment subsets specifically includes: According to the relevance of each comment, the semantic features of each comment are weighted to obtain the significant semantic features of each comment; The comments are clustered according to the significant semantic features of the comments to obtain at least two comment subsets.
4. The method according to claim 2, characterized in that The step of sorting each comment subset and sorting each comment in each comment subset to obtain the comment sequence specifically includes: sorting each comment subset according to the number of comments contained in the comment subset; and, For each of the comment subsets, the following operations are performed respectively: sorting the comments in the comment subset according to the degree of association between the semantic features of each comment in the comment subset and the comment subset; The comment sequence is generated based on the ranking results between the comment subsets and the ranking results of the individual comments in the comment subsets.
5. The method according to claim 1, characterized in that The obtaining of the relevance between each comment in the comment set and the target resource specifically includes: Inputting each of the comments into the trained opinion label generation model respectively, extracting features of each of the comments based on a sentence-level significance scoring component in the trained opinion label generation model, and obtaining the relevance corresponding to each of the comments output by the significance scoring component; The obtaining of the comment sequence output by the comment clustering and sorting component specifically includes: Obtaining a first concatenated representation vector at a word level output by the review clustering and sorting component, wherein each review word in the first concatenated representation vector is combined to form the review sequence; The step of generating a target opinion label sequence for the target resource based on the comment sequence specifically includes: Inputting the first concatenated representation vector into the opinion label component in the trained opinion label generation model, performing attention feature extraction based on the opinion label component, and obtaining the target opinion label sequence output by the opinion label component; The trained opinion label generation model is trained based on a training sample data set, wherein the training samples in the training sample data set include sample comments annotated with relevance labels, and the relevance labels indicate whether the sample comments are relevant to the sample resources.
6. The method according to claim 5, characterized in that The step of inputting each comment in the comment set into a trained opinion label generation model, extracting features of each comment based on a sentence-level significance scoring component in the trained opinion label generation model, and obtaining the relevance between each comment and the target resource output by the significance scoring component specifically includes: Inputting each of the comments into the significance scoring component respectively, mapping each of the comments to a continuous space based on a sentence representation module in the significance scoring component, and obtaining a representation vector of each of the comments; Convert the representation vectors of each comment into corresponding semantic vectors through context encoding; Based on the saliency scoring component, extracting attention features between the semantic vectors of each comment and the semantic vectors of other comments except itself; The relevance between each comment and the target resource is obtained based on the attention features corresponding to each comment.
7. The method according to claim 5, characterized in that Extracting the significant semantic representation vectors corresponding to the comments based on the comment clustering and sorting component, and clustering and sorting the comments based on the extracted significant semantic representation vectors to obtain the first concatenated representation vector at the word level output by the comment clustering and sorting component, specifically includes: Based on the comment clustering and sorting component, each comment is mapped to a continuous space to obtain a word vector sequence corresponding to each comment; Extracting spatial information from the word vector sequences corresponding to the comments through a hierarchical pooling operation to obtain semantic representation vectors of the comments; According to the relevance of each comment, the semantic representation vector of each comment is weighted to obtain the significant semantic representation vector of each comment; Clustering is performed based on the significant semantic representation vectors of the comments to obtain at least two comment subsets; After all comment subsets are sorted and each comment in each comment subset is sorted, the significant semantic representation vectors of each comment are concatenated and word-level converted to obtain the first concatenated representation vector.
8. The method according to claim 5, characterized in that The step of inputting the first concatenated representation vector into the opinion label component in the trained opinion label generation model, performing attention feature extraction based on the opinion label component, and obtaining the target opinion label sequence output by the opinion label component specifically includes: In a loop iteration manner, each opinion label word in the target opinion label sequence is generated in sequence, and one opinion label in the target opinion sequence includes at least one opinion label word; wherein, in one loop iteration process, the following operations are performed: Inputting the target opinion label word outputted last time into the opinion label component, wherein the first input into the opinion label component is a preset starting marker word; Analyzing the alignment probability of the target opinion label word output last time and each comment word in the comment sequence through an attention mechanism, wherein the alignment probability represents the attention value between the comment word and the target opinion label word output last time; The alignment probability and the semantic vector sequence of the comment words in the comment sequence are weighted and input into a forward neural network to obtain a target semantic representation vector of the comment sequence output this time; Based on the target opinion label word output last time and the target semantic representation vector, a target opinion label word output this time is generated.
9. The method according to claim 8, characterized in that Before analyzing the alignment probability of the target opinion label word output last time and each comment word in the comment sequence through the attention mechanism, the method further includes: The target comment subset selected this time and the neighbors of the target comment subset are used as the focused comment subset, and the other comment subsets are used as the external comment subsets, wherein the target comment subset selected each time is determined based on the order between the comment subsets; Adding a first alignment feature to the comment words in the focused comment subset in the comment sequence, and adding a second alignment feature to the comment words in the external comment subset in the comment sequence, to obtain a first alignment semantic vector corresponding to each comment word in the comment sequence; and Adding the first alignment feature to the target opinion label word outputted last time to obtain a corresponding second alignment semantic vector; The analyzing the alignment probability of the target opinion label word output last time and each comment word in the comment sequence by the attention mechanism specifically includes: Combined with the first alignment vector corresponding to each comment word in the comment sequence and the second alignment semantic vector corresponding to the target opinion label word output last time, the alignment probability of the target opinion label word output last time and each comment word in the comment sequence is analyzed based on the attention mechanism.
10. The method according to any one of claims 5 to 9, characterized in that: The opinion label generation model is trained through the following process: Acquire the training sample data set for at least one sample resource; According to the training samples in the training sample data set, a loop iterative training is performed on the untrained opinion label generation model to obtain the trained opinion label generation model; wherein each loop iterative training process includes the following operations: A group of training samples for the same sample resource is selected from the training sample data set, and sample comments contained in each of the selected training samples are respectively input into a sentence-level significance scoring component in the untrained opinion label generation model to obtain the relevance corresponding to each sample comment output by the significance scoring component; Constructing a first loss function based on the error between the relevance corresponding to each sample comment and the corresponding relevance label; and Inputting the sample comments in each selected training sample and the relevance corresponding to each sample comment into the comment clustering and sorting component in the untrained opinion label generation model, clustering each sample comment based on the comment clustering and sorting component to obtain at least two comment subsets; sorting each comment subset based on the comment clustering and sorting component to obtain a word-level second concatenated representation vector output by the comment clustering and sorting component; Inputting the second concatenated representation vector into the opinion label component in the untrained opinion label generation model, performing attention feature extraction based on the opinion label component, and obtaining a set of predicted opinion label sequences output by the opinion label component, wherein the predicted opinion label sequence includes at least two predicted opinion label words; Based on the distribution error between the predicted opinion label words in the predicted opinion label sequence and the real opinion label words in the real opinion label sequence, a second loss function is constructed; and based on the attention value of the comment words in each comment subset, a third loss function is constructed; According to the first loss function, the second loss function and the third loss function, parameters of the untrained opinion label generation model are adjusted.
11. The method according to claim 10, characterized in that The constructing of a second loss function based on the distribution error between the predicted opinion label words in the predicted opinion label sequence and the real opinion label words in the real opinion label sequence specifically includes: For any predicted opinion label word, based on the distribution probability of the predicted opinion label word in the preset opinion label word set and the distribution probability of the predicted opinion label word in the comment set, determine the distribution error between the predicted opinion label word in the predicted opinion label sequence and the real opinion label word in the real opinion label sequence; The second loss function is constructed based on the determined distribution error.
12. A device for generating opinion labels, characterized in that: include: A comment acquisition unit, configured to acquire a comment set for a target resource, wherein the comment set includes at least two comments; An analysis unit, used to obtain the relevance between each comment in the comment set and the target resource; A sorting unit, used to sort the comments according to the relevance corresponding to the comments and the semantic features of the comments to obtain a corresponding comment sequence, including: inputting the comments and the relevance corresponding to the comments into a comment clustering sorting component in a trained opinion label generation model respectively; Extracting the significant semantic representation vectors corresponding to the comments based on the comment clustering and sorting component, and clustering and sorting the comments based on the extracted significant semantic representation vectors, to obtain a comment sequence output by the comment clustering and sorting component; the semantic feature is a semantic representation vector; the significant semantic representation vector of each comment is obtained by weighting the semantic representation vector of the comment according to the relevance corresponding to the comment; A label generation unit is used to generate a target opinion label sequence for the target resource based on the comment sequence, wherein the target opinion sequence includes at least two target opinion label words.
13. The device according to claim 12, characterized in that The sorting unit is specifically used for: Dividing the comments according to the relevance corresponding to the comments and the semantic features of the comments to obtain at least two comment subsets; Each comment subset is sorted, and each comment in each comment subset is sorted respectively to obtain the comment sequence.
14. An electronic device, characterized in that: It includes a processor and a memory, wherein the memory stores program code, and when the program code is executed by the processor, the processor executes the steps of any one of the methods described in claims 1 to 11.
15. A computer-readable storage medium, characterized in that: It includes program code, and when the program code is run on an electronic device, the program code is used to enable the electronic device to execute the steps of any method described in claims 1 to 11.
Citation Information
Patent Citations
Video tag extraction method based on semantic association of barrages
CN106407484A