Online shopping food safety public opinion event extraction method based on entity semantic graph
Through a model based on entity semantic graphs and combined with deep learning technology, traditional methods cannot effectively deal with the complexity and diversity of online food safety public opinion events, efficient event extraction and monitoring are achieved, decision support is provided, and food is ensured. Security and stability of e-commerce platforms.
Patent Information
- Application Number
- CN202411122901.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-11-01
AI Technical Summary
The traditional method of online shopping food safety public opinion event extraction cannot effectively deal with complexity and diversity, resulting in insufficient efficiency and accuracy of event extraction, and the inability to timely discover and deal with potential risks.
The model based on entity semantic graph is adopted, and through entity recognition, semantic graph construction, event type recognition and argument extraction processes, combined with deep learning technology and natural language processing, efficient extraction and monitoring of online food safety public opinion events.
It significantly improves the accuracy and efficiency of event extraction, can promptly detect potential risks, optimize public opinion monitoring and management, provide decision-making support, and help maintain the stability of e-commerce platforms and national food safety.
Smart Images

Figure CN118885657A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of food safety and deep learning, and specifically refers to a method for extracting public opinion events on online food safety based on entity semantic graphs. Background Art
[0002] With the rapid development of the economy and society, the rise of e-commerce online shopping has provided food companies with broader sales channels and more convenient sales methods, but it has also brought more food safety issues. People's material living standards have significantly improved, and higher requirements have been put forward for food quality. Whether it is at the national level, economic level, or social level, food safety has attracted much attention. Coupled with the current booming development of the Internet, it has become the main way for people to obtain information. The openness, real-time and diversity of social platforms have made online public opinion an important source of information and a place for public opinion exchange. Public opinion is formed quickly and spreads quickly. New media has a large amount of information, and the dissemination and update are rapid and low-cost. The freedom and convenience of the public to express their opinions may trigger a wave of public opinion, resulting in frequent public opinion incidents on online food safety.
[0003] Extracting public opinion events on online food safety is an important part of food safety management. However, traditional event extraction methods often cannot effectively handle the complexity and diversity of public opinion data on online food safety. Summary of the invention
[0004] To solve the above technical problems, a model for extracting public opinion events about online food safety based on entity semantic graphs was developed. Extracting public opinion events about online food safety is an important part of food safety management. By extracting events from a large amount of text data, it can help governments and relevant agencies to promptly discover and respond to potential risks. This model can make full use of the characteristics of heterogeneous data, improve the accuracy and efficiency of event extraction, and provide strong support for the monitoring and management of public opinion events about online food safety.
[0005] A method for extracting public opinion events about food safety in online shopping based on entity semantic graph is provided, including entity recognition process, entity semantic graph construction process, event type recognition process, and argument extraction process, wherein: Entity recognition process: preprocess the collected raw data, manually annotate the preprocessed text to form a complete corpus, input the word vector of each sentence in the preprocessed text into the sentence-level encoder, obtain the embedded representation of the sentences and entities in the text, obtain the embedded representation of each word sequence, perform entity recognition through the conditional random field CRF layer, and complete the decoding of the entity label through the Viterbi algorithm; Entity semantic graph construction stage: The entity nodes are compressed using the average pooling strategy to obtain the embedded representation of the entity nodes. The tags in the sentence nodes are compressed using the maximum pooling strategy and the position code of the sentence is added to obtain the embedded representation of the sentence nodes. Five types of edges are constructed using different rules and connected to different node information through a graph convolutional network. The graph structure obtained by the graph convolutional network is used to obtain the representation features at the document level. Event type recognition stage: First, the input text is processed by the embedding layer and then sent to the multi-layer Transformer encoder for feature extraction to obtain the hidden state representation of all time steps. Then, the global pooling layer is used to convert these hidden state representations into a fixed-size feature vector. Finally, classification is performed through the fully connected layer. Argument extraction stage: extract argument roles, sort on the extracted argument roles, determine the argument roles using the feedback process, and store the event record information in the global memory.
[0006] The method of extracting public opinion events on online food safety based on entity semantic graph has the following beneficial effects: Using deep learning technology and related technologies in the field of natural language processing to conduct semantic analysis on a large number of news reports and comments on the Internet in the field of online food safety public opinion can help the public to grasp the relevant key information of online food safety incidents in a timely manner and understand the dynamics of online public opinion in a large number of rapidly changing online food safety public opinion news events. From the perspective of the application chain, it is possible to innovate the existing online food enterprise competitiveness evaluation system, rely on online public opinion information and enterprise market data, and analyze and quantify online food safety public opinion evaluation in multiple dimensions to grasp the development dynamics of the industry. Its results will help to consolidate the leadership advantages of the upstream industry of online food shopping, highlight the development direction of market consumption, and have important application value in the field of food safety public opinion.
[0007] Optimizing the performance of event extraction methods: The entity semantic graph model significantly optimizes the performance of event extraction tasks with its ability to integrate heterogeneous information. The model can deeply explore and utilize the diverse characteristics of data, thereby improving the accuracy and efficiency of the extraction process. In the field of online food safety public opinion analysis, the application of heterogeneous graph models provides solid technical support for real-time monitoring and effective management of events.
[0008] Timely discovery and control of public opinion events: Use deep learning methods to extract online food safety public opinion events. Through the analysis and modeling of large amounts of text data, it is possible to timely discover and respond to potential public opinion risks, understand and predict the direction of public opinion in advance, control the evolution of online public opinion, reduce economic losses, and provide decision-making support and practical guidance for the government and relevant departments. This will help maintain the stability and sustainability of e-commerce platforms, ensure national food safety and Internet security, and promote the healthy development of my country's e-commerce industry. BRIEF DESCRIPTION OF THE DRAWINGS
[0009] Figure 1 It is an overall framework diagram of a method for extracting public opinion events on online food safety based on entity semantic graph according to an embodiment of the present invention; Figure 2 The figure is a flow chart of interactive feedback argument extraction according to an embodiment of the present invention. DETAILED DESCRIPTION
[0010] The exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present disclosure are shown in the accompanying drawings, it should be understood that the present disclosure can be implemented in various forms, and the present disclosure should not be limited by the embodiments described herein. On the contrary, these embodiments are provided to enable a more thorough understanding of the present disclosure and to fully convey the scope of the present disclosure to those skilled in the art.
[0011] Figure 1 FIG. 1 is an overall framework diagram of a method for extracting public opinion events on online food safety based on entity semantic graphs according to an embodiment of the present invention. Figure 1 As shown in the figure, the entire process framework of the online food safety public opinion event extraction method based on entity semantic graph includes entity recognition process, entity semantic graph construction process, event type recognition process, and argument extraction process.
[0012] Reference below Figure 1 Describe the process of the online food safety public opinion event extraction method based on entity semantic graph.
[0013] 1. Entity recognition stage: Preprocess the collected raw data, manually annotate the preprocessed text to form a complete corpus, input the word vector of each sentence in the preprocessed text into the sentence-level encoder, obtain the embedded representation of the sentences and entities in the text D, obtain the embedded representation of each word sequence, perform entity recognition through the CRF layer, and complete the decoding of the entity label through the Viterbi algorithm.
[0014] Specifically, this phase includes: Step S11, using web crawler technology to systematically collect online public opinion data related to online food safety, pre-process the collected online public opinion text, and then convert the online public opinion text into a vector representation through word embedding technology, so as to construct an online public opinion corpus and an embedding resource library.
[0015] In one embodiment, the preprocessing process includes removing redundant information, purifying text, and format standardization, such as word segmentation, removing stop words, etc.
[0016] In one embodiment, the systematic collection covers multiple social media platforms including Baidu News, Weibo, etc., and the online public opinion data includes user comments and news reports. Preprocessing is used to ensure the quality and consistency of the data.
[0017] In one embodiment, step S11 also includes manual annotation of the preprocessed online public opinion text, and the manual annotation includes identifying the content, content source, time and other information of the preprocessed text, aiming to build a comprehensive and structured online food safety public opinion analysis corpus, laying a solid foundation for subsequent text analysis and event extraction research.
[0018] Step S12, the word vector of each sentence in the preprocessed text is sent as input to the sentence-level encoder to obtain the embedded representation of the sentence and the entity. In one embodiment, the sentence-level encoder is an encoder based on the Transformer model, which performs high-level semantic encoding operations. Through this process, the following embedded representation can be generated for each sentence and its entity (an entity refers to a content word in a sentence, such as "Beijing", "air", etc.): , in, is the input from the sentence, i.e. the word vector of each sentence, is a vector sequence obtained by document conversion.
[0019] The word vectors of each sentence in the preprocessed food safety public opinion text are input into the sentence-level encoder, which maps these word vectors into a low-dimensional continuous space and generates sentence-level representation features. These representation features are then passed to the conditional random field (CRF) layer for entity recognition, as described below.
[0020] Step S13, using the conditional random field (CRF) layer to perform entity recognition, the process includes: After obtaining the embedding representation of each word vector, the transfer score matrix is calculated through the CRF layer , the calculation formula is: , Then calculate the possible label sequence scores: , in, Is the first Tags The score, Indicates from the label Transition to score.
[0021] The CRF model has the advantages of both the discriminative model and the generative model, which takes into account the transition probability between context tags and performs global parameter optimization and decoding in a serialized form, thus solving the label bias problem that is difficult to avoid in other discriminative models.
[0022] Step S14, decoding the tag is implemented by using the Viterbi algorithm.
[0023] 2. Entity semantic graph construction stage: Use the average pooling strategy to compress the entity node to obtain the embedded representation of the entity node. Use the maximum pooling strategy to compress the token in the sentence node and add the position code of the sentence to obtain the embedded representation of the sentence node. Use different rules to form five types of edges, connect to different node information through the graph convolution network (GCN), and use the graph structure obtained by the graph convolution network to obtain the representation features at the document level. Among them, introducing the graph convolution network and constructing the entity semantic graph can help obtain richer semantic information. Among them, the entity is the content word in the sentence, and the entity node is the corresponding node converted into the entity in the semantic graph.
[0024] This phase includes: Step S21: For the word vector representation of the entity, the average pooling method is used to take the average value of all word vectors in the entity as the entity's embedding vector. For the vector representation of the sentence, the maximum pooling method is used to take the maximum value of the word vectors of all words in the sentence as the sentence's embedding vector. In addition, for sentence nodes, the positional relationship of the sentence in the text is represented by adding a positional embedding vector.
[0025] Specifically, for entity nodes, an average pooling strategy can be used to solve an entity The problem is that it may contain multiple tokens. The entity is represented as ,in, is the number of different entities, and the sentence represents ,in, is the number of sentences.
[0026] After compression using the average pooling strategy, the embedding representation of the entity node is obtained. For the sentence node, the maximum pooling strategy is used to compress the tokens in the sentence and add the position encoding of the sentence to obtain the embedding representation of the sentence node.
[0027] Step S22: Use different rules to construct five types of edges: sentence-sentence edge, sentence-entity edge, intra-sentence entity mention edge, cross-sentence entity mention edge, and document-document edge.
[0028] Among them, sentence-sentence edge: by constructing edges, all sentence nodes in the document are connected in series to form a direct connection between sentences.
[0029] Sentence-entity edge: Create an edge between each sentence node and its internal entity node to realize the association between sentences and entities.
[0030] Intra-sentence entity mention edges: connect all entity nodes to each other within a single sentence to reveal the potential relationships between different entities in the same sentence.
[0031] Cross-sentence entity mention edges: connect the same entity nodes that appear in different sentences, so that the continuous appearance of the entity in the document can be tracked and the contextual coherence can be enhanced.
[0032] Document-document edge: All other nodes are connected to the document node through document edges to ensure the structural integrity and information integration at the document level. All other nodes refer to all sentence nodes and entity nodes except the document node. Document edge refers to the edge connecting the document node to other nodes; document-document edge refers to the connection between the document node and the document edge, and then connects other nodes.
[0033] Given a graph convolutional network All nodes of the layer , perform graph convolution, the operation formula of graph convolution is: , in, are different types of edges, Indicated in Nodes connected in the class edge , including a document node, an entity node, or a sentence node. and is a trainable parameter, k is the type of edge, is the normalization constant, is the result of graph convolution operation, Indicates The word passes through The representation after the layer graph convolutional network (GCN) is shown in the formula: , in, is the number of layers of GCN, The node shown The initial representation of , the superscript 1 represents the representation after the first layer of GCN.
[0034] After this stage, the updated entity representation is obtained and sentence representation , is the number of different entities, is the number of sentences.
[0035] 3. Event type recognition stage: First, the constructed entity semantic graph and the preprocessed text are input together, processed by the embedding layer, and then sent to the multi-layer Transformer encoder for feature extraction to obtain the hidden state representation of all time steps. Then, the global pooling layer is used to convert these hidden state representations into a fixed-size feature vector. Finally, classification is performed through the fully connected layer.
[0036] As mentioned above, the Transformer encoder is fused to generate local and global features, and a fully connected layer is added at the end to implement the text classification task. After obtaining the semantics represented by different node information, the Transformer classifier is introduced to detect event types and perform multi-label classification. Among them, the method of fusion Transformer model to generate local and global features solves the problem that the global feature vector may not be able to fully capture the various granularities of semantics in the document, which can enhance the prediction accuracy of the classifier.
[0037] Specifically, first, the input text is processed through the embedding layer to convert the input text into a vector representation in a high-dimensional space. Then, these vectors are input into a multi-layer Transformer encoder to extract the hidden state representation of each time step. Using the global pooling layer, the serialized hidden state is converted into a feature vector of fixed dimension to capture global semantic information. Finally, these feature vectors are processed through the fully connected layer to achieve multi-label classification of the text. The classifier is designed to receive a single text file as input, and the classification head receives the output of the Transformer model and makes predictions to generate the corresponding category labels, thereby achieving multi-label classification of the text.
[0038] All the information contained in the document vector can be fused through multiple layers of Transformers, and the attention scores of different dimensions can be calculated in parallel through multiple attention heads, which enables the model to focus on multiple key information points in the document at the same time. Finally, the output of these multi-head attention scores is used for the task of classifying event types, where the model accurately identifies and classifies events based on the fused document vector.
[0039] Given the complexity of multiple events that may be contained in a single document, it is more appropriate to consider the event extraction task as a multi-label classification problem. The traditional global feature vector may not be sufficient to fully capture the semantic information at different levels within the document. Therefore, this paper adopts a comprehensive approach that combines local features generated by the Transformer model with global features and introduces a fully connected layer at the end of the model architecture to enhance the accuracy of text classification.
[0040] 4. Argument extraction stage: extract argument roles, sort the extracted argument roles, determine the argument roles using the feedback process, and store the event record information in the global memory. Such a feedback process allows information to be transmitted and interacted between argument roles, thereby further improving the decision-making and extraction accuracy of the arguments.
[0041] Figure 2 FIG. 4 is a flowchart of interactive feedback argument extraction according to an embodiment of the present invention. Figure 2 As shown in Figure 2, the argument extraction stage includes: S41, execute argument role extraction: sort the extracted argument roles in descending order, and extract an argument role in sequence.
[0042] S42, in each iteration, positive feedback is performed based on the knowledge of the extracted argument roles, and backward feedback is performed based on the newly obtained information. The feedback process is iterative. In each iteration, positive feedback provides guidance for the current iteration based on the existing knowledge of the extracted argument roles. The results of the previous iteration are adjusted using backward feedback. Such an iterative process enables information to be effectively transferred and interacted between argument roles, thereby further improving the decision-making and extraction accuracy of the arguments.
[0043] Among them, the argument role feedback expression formula is: , in, , For each hidden state, use a trainable vector express The characteristics of the character, is the attention score corresponding to the argument role list, , is a trainable matrix, i, j, n are real numbers.
[0044] Step S43: In each iteration, the updated argument roles are sorted in descending order according to their scores. The purpose of sorting is to ensure that the argument roles with high scores are processed first in the next iteration, aiming to optimize the identification and decision-making process of argument roles and improve the accuracy of extraction. When there are multiple argument roles, a new entity representation is obtained by adding the role name embedding dimension to each entity: , Among them, E is the entity representation of the updated fused document information, Refers to The embedding of the argument role, is the new entity feature matrix.
[0045] Step S44: Identify event arguments through argument role extraction and use an expansion tree to decode records, including: starting from the virtual root node, since a single argument role may be associated with multiple entities, this leads to the formation of multiple expansion tree branches, each branch is an event record formed by a corresponding event. , encoded by BiLSTM, and then embedded in the vector of event type and sentence feature vector , concatenate the semantic representations generated above and input them into the Transformer model to obtain the updated feature matrix , the formula is: , For each event type, the argument role domain , predefine a trainable fully connected layer , for all entities The candidate arguments of the composition determine whether to add to the argument role: , is the updated feature matrix, It is used to determine whether to add the argument role. FFN refers to the calculation of Feed Forward Networks (FFN).
[0046] The mutual relationship and interaction between multiple arguments are crucial for accurately determining the role of arguments, but existing technologies often fail to fully consider this. Traditional methods usually extract arguments synchronously or follow a preset order, without fully considering the impact of the extraction order on the results. To address this problem, this paper proposes a new strategy, Reciprocal Feedback Argument Extraction, which optimizes the argument role recognition process through the feedback mechanism of interaction between arguments.
[0047] The present invention designs a method for extracting public opinion events on online food safety based on entity semantic graphs. Specifically, it integrates deep learning methods and entity semantic graph models to automatically identify key information in a large amount of text and mine the relationship between events, thereby achieving high-precision information extraction and discovering potential patterns and trends, providing data support for risk prevention and control and decision-making in the e-commerce industry.
[0048] The parts not described in detail in the present invention belong to the well-known technology in the art.
[0049] In this specification, the present invention has been described with reference to specific embodiments thereof. However, it is apparent that various modifications and variations may be made without departing from the spirit and scope of the present invention. Therefore, the specification and drawings should be regarded as illustrative rather than restrictive.
Claims
1. A method for extracting public opinion events on online food safety based on entity semantic graph, characterized in that: It includes entity recognition process, entity semantic graph construction process, event type recognition process, and argument extraction process, among which: Entity recognition process: preprocess the collected raw data, manually annotate the preprocessed text to form a complete corpus, input the word vector of each sentence in the preprocessed text into the sentence-level encoder, obtain the embedded representation of the sentences and entities in the text, obtain the embedded representation of each word sequence, perform entity recognition through the conditional random field CRF layer, and complete the decoding of the entity label through the Viterbi algorithm; Entity semantic graph construction stage: The entity nodes are compressed using the average pooling strategy to obtain the embedded representation of the entity nodes. The tags in the sentence nodes are compressed using the maximum pooling strategy and the position code of the sentence is added to obtain the embedded representation of the sentence nodes. Five types of edges are constructed using different rules and connected to different node information through a graph convolutional network. The graph structure obtained by the graph convolutional network is used to obtain the representation features at the document level. Event type recognition stage: First, the input text is processed by the embedding layer and then sent to the multi-layer Transformer encoder for feature extraction to obtain the hidden state representation of all time steps. Then, the global pooling layer is used to convert these hidden state representations into a fixed-size feature vector. Finally, classification is performed through the fully connected layer. Argument extraction stage: extract argument roles, sort on the extracted argument roles, determine the argument roles using the feedback process, and store the event record information in the global memory.
2. The method for extracting public opinion events on online food safety based on entity semantic graph according to claim 1 is characterized in that: The entity recognition process includes: Step S11, using web crawler technology to systematically collect online public opinion data related to online food safety, pre-processing the collected online public opinion text, and then converting the online public opinion text into a vector representation through word embedding technology, thereby constructing an online public opinion corpus and an embedding resource library; Step S12, the word vector of each sentence in the preprocessed text is sent as input to a sentence-level encoder to obtain an embedded representation of the sentence and entity. The sentence-level encoder is an encoder based on the Transformer model; Step S13, using the conditional random field layer for entity recognition, the process includes: after obtaining the embedding representation of each word vector, calculating the transfer score matrix through the conditional random field layer, and then calculating the label sequence score: Step S14, decoding the tag is implemented by using the Viterbi algorithm.
3. The method for extracting public opinion events of online food safety based on entity semantic graph according to claim 2 is characterized in that: The preprocessing process includes removing redundant information, cleaning the text, and format standardization.
4. The method for extracting public opinion events of online food safety based on entity semantic graph according to claim 2 is characterized in that: The entity semantic graph construction phase includes: Step S21: For the word vector representation of the entity, the average pooling method is used to take the average value of all word vectors in the entity as the entity's embedding vector. For the vector representation of the sentence, the maximum pooling method is used to take the maximum value of the word vectors of all words in the sentence as the sentence's embedding vector. In addition, for the sentence node, the positional embedding vector is added to represent the positional relationship of the sentence in the text. Step S22: using different rules to construct five types of edges: sentence-sentence edge, sentence-entity edge, intra-sentence entity mention edge, cross-sentence entity mention edge, and document-document edge; Given a graph convolutional network All nodes a of the layer perform graph convolution, and the calculation formula of graph convolution is: , in, are different types of edges, Represents the node a connected in the k-th edge, including a document node, entity node, or sentence node. and is a trainable parameter, k is the type of edge, is the normalization constant, is the result of graph convolution operation, It represents the representation of the vth word after passing through the lth layer of graph convolutional network; After this stage, the entity representation of the updated fused document information is obtained and sentence representation , is the number of different entities, is the number of sentences.
5. The method for extracting public opinion events of online food safety based on entity semantic graph according to claim 1 is characterized in that: In the event type identification stage, the classifier is designed to receive a single text file as input, and the classification head receives the output of the Transformer model and makes predictions to generate the corresponding category labels, thereby achieving multi-label classification of the text.
6. The method for extracting public opinion events of online food safety based on entity semantic graph according to claim 1 is characterized in that: The argument extraction stage includes: S41, executing argument role extraction: sorting the extracted argument roles in descending order, and extracting an argument role in order; S42, in each iteration, positive feedback is performed based on the knowledge of the extracted argument roles, and backward feedback is performed based on the newly acquired information; Step S43: In each iteration, the updated argument roles are sorted in descending order according to their scores; Step S44: By extracting the argument role, identifying the event argument, and decoding the record using the expansion tree, including: starting from the virtual root node, forming multiple expansion tree branches, each branch is an event record formed by the corresponding event, and representing the entity record in the branch as , encoded by BiLSTM, then embedded in the event type vector and sentence feature vector, concatenated the semantic representations generated above, and input into the Transformer model to obtain the updated feature matrix, For each event type, the argument role domain , predefine a trainable fully connected layer , for all entities The candidate arguments of the composition are judged whether to be added to the argument role.
