Malicious semantic alignment method and system based on global semantic graph and electronic equipment
Through the combination of global semantic graphs and graph convolutional neural networks, the problem of malicious text recognition in Chinese social media is solved, and deep semantic understanding and efficient recognition are achieved, especially in the Chinese environment, which significantly improves the accuracy and speed of identifying malicious texts.
Patent Information
- Application Number
- CN202510555366.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-29
- Publication Date
- 2025-08-08
AI Technical Summary
The prior art is difficult to effectively identify malicious texts of complex structures in Chinese social media environments, especially due to the uniqueness and diversity of languages, traditional methods are difficult to capture deep semantic information, and deep learning models ignore global semantic impacts.
Using a global semantic graph-based method, the global semantic structure of sentences is captured through AMR analysis and graph convolution neural network, combined with word-level and sentence-level feature interaction, and the pre-trained language model Roberta is used for text encoding to achieve deep semantic understanding.
It improves the recognition ability and accuracy of malicious texts in complex structures, especially in the Chinese environment, which can better handle the ambiguity and contextual dependence of language expressions, and improves the recognition speed and accuracy.
Smart Images

Figure CN120449859A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing, and in particular to a malicious semantic alignment method, system and electronic device based on a global semantic graph. Background Art
[0002] With the increasing popularity of social media platforms, the spread of malicious text (such as harassment and fraudulent messages) on social networks has become a serious social problem. Traditional text filtering methods primarily rely on keyword matching or simple grammatical analysis, but these methods struggle to cope with the ever-changing nature of language expressions and complex semantic structures. Existing technologies are particularly deficient in identifying malicious text in the Chinese context, due to the uniqueness and diversity of the language. Traditional methods typically focus on surface-level text representation, failing to capture deeper semantic information and effectively leveraging context to understand the true meaning of short text. Furthermore, existing methods inadequately address word-level ambiguity. While some deep learning models attempt to address word-level ambiguity through architectures such as LSTM, they overlook the impact of broader global semantic information. Furthermore, while most current research focuses on English and other Western languages, relatively little research has been conducted on malicious text detection in Chinese, resulting in poor recognition performance in this context. Summary of the Invention
[0003] In response to the technical problems existing in the prior art, the present invention proposes a malicious semantic alignment method, system, and electronic device based on a global semantic graph. This method aims to enhance the recognition of complex malicious text through in-depth learning of global semantic knowledge. In particular, the model is optimized to better understand and process diverse language expressions based on the characteristics of short text in the Chinese environment. Compared with the prior art, this framework not only focuses on word-level features but also captures the global semantic structure of sentences through AMR parsing and graph convolutional neural networks, achieving a deeper level of semantic understanding. It also enhances semantic consistency assessment through word-level feature interaction and sentence-level feature interaction, improving recognition accuracy and reliability.
[0004] The technical solution adopted by the present invention is as follows: In a first aspect, a malicious semantic alignment method based on a global semantic graph is provided, comprising the following steps: Step 1: Obtain the original data and receive the sentence pairs to be analyzed in the original data as input; Step 2: Perform natural language preprocessing on the input data; Step 3: Convert each input text sentence into a global semantic graph through the AMR parser; Step 4: extract the semantic features of the text and perform text encoding on the input text; Step 5: Encode the global semantic graph through graph convolutional neural network; Step 6: Perform word-level feature interaction and sentence-level feature interaction to obtain word-level and sentence-level embedding vectors; In step 7, the word-level and sentence-level embedding vectors are connected as the final feature representation. The similarity score is obtained through the output layer to determine whether the text contains malicious semantics and whether it is malicious content.
[0005] Based on the implementation of the above method, the natural language preprocessing of the input text includes: Perform text cleaning to remove unnecessary information from the input text, including removing HTML tags, special characters, and extra spaces; Segment the sentence into words or subword units.
[0006] Based on the implementation of the above method, the process of capturing the global semantic information of a sentence through an AMR parser and converting each input text sentence into a global semantic graph includes: Identify the main components of a sentence through the AMR parser, including analyzing the grammatical structure of the sentence to identify the main actions or states, participants, and other relevant elements; Based on the analysis results, concept nodes are constructed and a set of semantic roles are assigned to each predicate to describe the relationship between different participants and predicates; All identified concept nodes and the relationships between them are organized into a directed acyclic graph, namely the global semantic graph, in which nodes represent various concepts or entities, and edges represent the semantic relationships between them.
[0007] Finally, after the AMR graph is constructed, the nodes in the AMR graph are initialized according to the semantic labels, and the processed AMR structure is output.
[0008] Based on the implementation of the above method, encoding the input text includes: The input text enters the text encoder, and the pre-trained language model Roberta is used to encode the question text to obtain the global semantic information of the text and generate initial semantic labels; the initial semantic labels are used to initialize the global semantic graph nodes obtained from the AMR parser.
[0009] Based on the implementation of the above method, the graph encoding of the global semantic graph by the graph convolutional neural network includes: The global semantic graph parsed by the AMR parser is encoded through a two-layer graph convolutional neural network R-GCN to capture the abstract semantic structure.
[0010] On the basis of the implementation content of the above method, in the word-level feature interaction and sentence-level feature interaction, the word-level feature interaction learns the word-level embedding vector by calculating the cross-sentence attention coefficient and the multi-view matching function, and enhances the node interaction feature through the multi-view matching function to obtain the embedding vector of the word-level feature interaction; The sentence-level feature interaction is performed by using a bidirectional long short-term memory network aggregation to learn an embedding vector of the sentence-level feature interaction.
[0011] Based on the implementation of the above method, the word-level and sentence-level embedding vectors are connected as the final feature representation, and the similarity score is obtained through the output layer to determine whether the text contains malicious semantics and whether it is malicious content. The word-level and sentence-level embedding vectors are concatenated as the final feature representation and input into a multi-layer perceptron to generate the final similarity score. The Sigmoid activation function is used to limit the score to the range of (0, 1). Finally, it is determined whether the text contains malicious semantics and whether it is malicious content.
[0012] In a second aspect, the present invention provides a malicious semantic alignment system based on a global semantic graph, comprising: A data receiving module, configured to receive text data to be analyzed as input; The preprocessing module is used to perform natural language preprocessing operations on the input data; The semantic data extraction module is used to capture the global semantic information of sentences through the AMR parser and convert each input text sentence into a global semantic graph; The text encoding module is used to extract the semantic features of the text and perform text encoding on the input text; Graph encoding module, used to encode the global semantic graph through graph convolutional neural network; Feature interaction module, used to perform word-level feature interaction and sentence-level feature interaction to obtain word-level and sentence-level embedding vectors; The malicious semantic alignment module is used to connect the word-level and sentence-level embedding vectors as the final feature representation, obtain the similarity score through the output layer, and determine whether the text contains malicious semantics and whether it is malicious content.
[0013] On the basis of the implementation content of the above method, in the word-level feature interaction and sentence-level feature interaction, the word-level feature interaction learns the word-level embedding vector by calculating the cross-sentence attention coefficient and the multi-view matching function, and enhances the node interaction feature through the multi-view matching function to obtain the embedding vector of the word-level feature interaction; The sentence-level feature interaction is performed by using a bidirectional long short-term memory network aggregation to learn an embedding vector of the sentence-level feature interaction.
[0014] In a third aspect, an embodiment of the present invention provides an electronic device, including: The device has at least one processor, at least one memory and a communication interface; wherein the processor, memory and communication interface communicate with each other; the memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the malicious semantic alignment method based on the global semantic graph provided by any one of the various implementation methods of the first aspect.
[0015] Compared with the prior art, the advantages and beneficial technical effects of the present invention are as follows: The present invention proposes a malicious semantic alignment method, system and electronic device based on a global semantic graph. The malicious semantic alignment method based on a global semantic graph not only focuses on word-level features, but also captures the global semantic structure of sentences through AMR parsing and graph convolutional neural networks. This method can more comprehensively understand the deep meaning of the text and improve the ability to recognize malicious text with complex structures. Compared with traditional models that only rely on word-level features, this framework can better handle ambiguity and context dependence in language expression.
[0016] Secondly, through word-level and sentence-level feature interactions, the framework can effectively evaluate the semantic consistency between sentence pairs. This not only improves recognition accuracy and reliability, but also enables the model to find semantic similarities in different expressions, thereby more accurately identifying malicious content. This capability is particularly critical in the Chinese environment because Chinese language expression is more flexible and diverse.
[0017] Furthermore, the present invention integrates deep learning technologies such as pre-trained language models and AMR parsers to form an efficient end-to-end system. This framework can complete the analysis, classification and recognition of large amounts of text in a short period of time, greatly improving the speed and accuracy of malicious text recognition. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, a brief introduction will be given below to the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0019] Figure 1 A flowchart of a malicious semantic alignment method based on a global semantic graph provided by an embodiment of the present invention; Figure 2 A diagram illustrating the architecture of a malicious semantic alignment method based on a global semantic graph provided by an embodiment of the present invention; Figure 3 A flowchart of extracting a global semantic graph by an AMR parser provided in an embodiment of the present invention; Figure 4 A schematic diagram of an example of extracting a global semantic graph by an AMR parser provided in an embodiment of the present invention; Figure 5 A flowchart of text encoding provided by an embodiment of the present invention; Figure 6 A flowchart of graph coding provided by an embodiment of the present invention; Figure 7 A flowchart of word-level feature interaction provided by an embodiment of the present invention; Figure 8 A flowchart of sentence-level feature interaction provided by an embodiment of the present invention; Figure 9 A schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0020] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention. In addition, the technical features in the various embodiments or single embodiments provided by the present invention can be arbitrarily combined with each other to form a feasible technical solution. This combination is not restricted by the sequence of steps and / or structural composition mode, but must be based on the ability of ordinary technicians in this field to implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such a combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0021] The embodiment of the present invention provides a malicious semantic alignment method based on a global semantic graph, see Figure 1 , the method comprising: Step 1: receiving the text data to be analyzed as input; The text data includes sentence pairs, represented as ,in Each is represented as a sentence; Step 2: Perform natural language preprocessing on the input text; Based on the content of the above method embodiment, specifically as follows Figure 2As shown in Figure 1, natural language preprocessing of input text specifically includes: Perform the following steps on the input text: Text cleaning: remove or standardize unnecessary information in the input text, including removing HTML tags, special characters, and extra spaces; Word segmentation: Segmenting a sentence into words or subword units, which involves identifying word boundaries and taking into account the combination of words.
[0022] Step 3: Capture the global semantic information of the sentence through the AMR parser and convert each input text sentence into a global semantic graph; Based on the content of the above method embodiment, as Figure 3 As shown, the AMR parser is used to capture the global semantic information of the sentence and convert each input text sentence into a global semantic graph, which specifically includes: When processing a sentence, the AMR parser follows a series of steps to construct its semantic representation. First, it identifies the main components of the sentence. This involves analyzing the sentence's grammatical structure to identify the primary action or state (predicate), participants (arguments), and other relevant elements. For example, in the sentence "I am developing my own application," the AMR parser identifies "development" as the predicate, "I" as the performer of the action (agent), and "application" as the object of the action (patient).
[0023] Next, the AMR parser constructs concept nodes based on the analysis results. These nodes represent specific entities or abstract concepts within a sentence and serve as the fundamental units of the AMR graph. In the previous example, "I," "development," and "application" would all be created as independent nodes, resulting in the node set V = {I, development, application}.
[0024] The AMR parser then assigns a set of semantic roles to each predicate to describe the relationship between different actors and the predicate. Figure 4 As shown, these semantic roles include ARG0 (agent) and ARG1 (patient). For the sentence "I am developing my own application," the AMR parser sets "development" as the predicate, "I" as ARG0 (agent), and "application" as ARG1 (patient). This can be described as the edge set E = {(u, v, r)|(development, me, ARG0), (development, application, ARG1)}.
[0025] In addition to basic semantic roles, the AMR parser can also express more complex modifier relationships, such as time, place, and manner. If a sentence contains this information, it will also be incorporated into the AMR graph as additional edges or attributes. For example, in the sentence "Yesterday I wrote an article at home," "yesterday" will be connected to the node of "write" as a time modifier, and "at home" will be connected to the node of "I" as a location modifier.
[0026] Finally, the AMR parser organizes all the identified concept nodes and their relationships into a directed acyclic graph (DAG), namely In this graph, nodes represent various concepts or entities, while edges represent the semantic relationships between them. The DAG format enables AMR to clearly display the complex semantic structure within a sentence while maintaining logical coherence.
[0027] After constructing the AMR graph, the AMR parser initializes the nodes in the AMR graph based on semantic labels. This process preserves the semantic features of the original text and provides a foundation for subsequent encoding steps. Specifically, the corresponding AMR nodes are initialized based on the semantic labels mentioned above (such as predicates and arguments), ensuring that their meaning is fully preserved.
[0028] Finally, the AMR parser outputs the processed AMR structure. This structure not only contains rich semantic information but also has good structure and interpretability. It can serve as input for deep learning models, helping them better understand the true intent and background knowledge of the sentence.
[0029] Step 4: extract the semantic features of the text and perform text encoding on the input text; Based on the content of the above method embodiment, extracting the semantic features of the text and encoding the input text specifically includes: The question text is encoded through the pre-trained language model Roberta to obtain the global semantic information of the text and generate initial semantic labels. These labels are used to initialize the global semantic graph nodes obtained from the AMR parser.
[0030] like Figure 5 As shown, encoding the input text specifically includes: First, we need to convert the original input text into a form suitable for model processing. This conversion process is quite critical, and it usually covers the word segmentation of the text to ensure that the model can correctly understand and analyze each vocabulary unit in the text. At the same time, we will also insert some special tags into the text, such as [CLS] and [SEP]. These tags play an important role in the model processing process, helping the model to better understand and distinguish different parts of the text. In addition, some other preprocessing operations may be performed, such as text cleaning, truncation, and padding, to ensure that the text data meets the input requirements of the model.
[0031] Each token in the input sequence is then mapped into a high-dimensional vector space through Roberta’s embedding layer. Roberta uses the WordPiece embedding method, which means it can handle out-of-vocabulary words (words that do not appear in the training corpus) and can capture information about the internal structure of the vocabulary.
[0032] Next, these token vectors are fed into a network consisting of multiple layers of Transformer encoders. Each Transformer layer incorporates a self-attention mechanism and a feed-forward neural network. The self-attention mechanism allows the model to focus on the relationships between different positions in the sentence, not just between adjacent words. The feed-forward neural network is used to further transform the feature representations.
[0033] After deep processing by the multi-layer Transformer encoder, the final result is a vector sequence rich in contextual information. For each token in the sequence, the corresponding vector not only reflects the semantic information of the token itself but also incorporates the complex interactions between it and other tokens in the sentence. This vector representation, which incorporates global contextual information, provides strong support for subsequent text processing tasks.
[0034] Step 5: Encode the global semantic graph through graph convolutional neural network; Based on the content of the above method embodiment, as Figure 6 As shown in Figure 2, graph encoding of the global semantic graph through a graph convolutional neural network specifically includes: The context-aware vectors obtained from text encoding can be used to initialize semantic labels for nodes in the global semantic graph. These labels not only retain the rich semantic information in the original text, but also lay a solid foundation for the subsequent graph encoding stage.
[0035] In the graph encoding process, the R-GCN (Relational Graph Convolutional Network) model is used, which updates the feature representation of nodes through an efficient message passing mechanism. Specifically, for each node in the graph , its new state It is the weighted sum of the states of adjacent nodes and then the activation function The result obtained. Specifically, the formula is:
[0036] in, Represents the set of all relationship types in the graph, is a node In relationship The neighbor set below, is a problem-specific normalization constant, usually set to the number of neighbors ,and and are the edge weight matrix and the node self-connection weight matrix respectively.
[0037] In particular, this step introduces a two-layer R-GCN, which means that the above message passing and aggregation process is repeated twice, allowing node features to propagate information more deeply throughout the entire graph. Ultimately, the node features encoded by these two layers of R-GCN not only contain detailed local information, but also incorporate extensive contextual information from distant nodes in the graph, greatly promoting the accurate capture of the global semantic structure of the text.
[0038] In order to further enhance the generalization ability of the model, prevent overfitting of rare relation types, and allow effective parameter sharing between different relation types, the basis decomposition technique is adopted. The parameter matrix of each relation type is Defined as a set of basis transformations and coefficients A linear combination of:
[0039] in, is the number of bases, It is Layers and relationships Hedi The coefficients between bases.
[0040] Step 6: Perform word-level feature interaction and sentence-level feature interaction to obtain word-level and sentence-level embedding vectors; Based on the content of the above method embodiment, feature interaction is divided into: Word-level feature interactions: The word-level feature interaction is as follows Figure 7 As shown, first, for the given two graphs G1 and G2, we need to calculate the cross-sentence attention coefficient between each pair of nodes. Specifically, for each node in G1 , calculate its difference with all nodes in G2 Attention coefficient ; Similarly, for each node in G2 , and also calculate its relationship with all nodes in G1 Attention coefficient .
[0041]
[0042]
[0043] here, and Represents the first The hidden state vector of the layer, Is the function used to calculate similarity, here we use cosine similarity.
[0044] Next, using the attention coefficients calculated above, we can calculate the corresponding word-level embedding vector for each node and This step involves taking a weighted sum of all node embedding vectors and their corresponding attention coefficients in the other graph.
[0045]
[0046]
[0047] in Represents the nodes in G1 from the perspective of G2 The word-level embedding vector of It is the nodes in G2 from the perspective of G1 The word-level embedding vectors of .
[0048] After obtaining the word-level embedding vector, we can use the multi-view matching function To update the original node vector, the newly generated node interaction features are considered as the new feature matrix.
[0049]
[0050]
[0051]
[0052] In this process, and Represent the updated node vectors, is a weight matrix used by the multi-view matching function, Represents element-wise multiplication operation, Indicates the number of views.
[0053] Finally, to better understand the information at the word-sentence matching layer, a bidirectional LSTM (BiLSTM) aggregator is used for information aggregation. This aggregator receives randomly permuted word embeddings as input and represents each sentence by concatenating the forward and backward final hidden layer outputs. The formula is as follows:
[0054] in, and represent the number of nodes in G1 and G2 respectively.
[0055] Through this process, the model not only captures word-level semantic information but also learns global structural consistency across different texts, which is critical for identifying malicious text and complex semantic alignment tasks. This approach ensures that even in the case of short texts, deep semantic features can be effectively extracted and utilized. The embedding vector of word-level feature interactions obtained through this method forms the basis for the final feature representation vector at the output layer.
[0056] Sentence-level feature interactions: Sentence-level feature interactions are as follows: Figure 8 As shown, first, in order to better understand the interaction at the sentence level, the results of direct aggregation calculation are used as the original node embedding. In the graph encoding stage, the hidden state of each node has been obtained from the encoding process of R-GCN , these states represent the node features after multi-layer graph convolution.
[0057] For graphs G1 and G2, obtain their node embedding matrices respectively and :
[0058]
[0059] in, and represent the number of nodes in G1 and G2 respectively. is the dimension of node embedding.
[0060] Similarly, to capture sentence-level information, a bidirectional LSTM (BiLSTM) is used as an aggregator. This aggregator receives all node embeddings from each graph and represents the entire sentence by concatenating the forward and backward final hidden layer outputs.
[0061]
[0062] in, Indicates the The sentence-level embedding vector of a graph (i.e., G1 or G2), and represent the number of nodes in G1 and G2 respectively.
[0063] Through this sentence-level feature interaction process, the model effectively captures the overall semantic information of the sentence and uses this information for accurate semantic alignment and similarity assessment. This approach ensures good performance even when faced with complex sentence structures. The embedding vector of sentence-level feature interactions obtained through this method forms the basis for the final feature representation vector of the output layer.
[0064] In step 7, the word-level and sentence-level embedding vectors are connected as the final feature representation. The similarity score is obtained through the output layer to determine whether the text contains malicious semantics and whether it is malicious content.
[0065] Based on the content of the above method embodiment, step 7 specifically includes: After completing word-level feature interaction and sentence-level feature interaction, two sets of feature representations are obtained: word-level embedding vectors and , and sentence-level embedding vectors and In order to comprehensively consider the information of these two levels, they are connected and the final feature representation vector is extracted through MLP learning:
[0066]
[0067] in, and It represents the final feature representation vector that combines word-level and sentence-level features; MLP stands for Multi-Layer Perceptron, which is used to perform nonlinear transformation on input features to capture more complex patterns.
[0068] Next, these two final feature representation vectors are concatenated and fed into another MLP layer for further final prediction to generate the final similarity score:
[0069]
[0070] in, is the final similarity score, indicating that the two sentences and The degree of semantic consistency; the sigmoid function maps the output of MLP to a probability range of (0, 1); MLP stands for multi-layer perceptron.
[0071] The implementation basis of the embodiments of the present invention is achieved through programmed processing by a device with processor functionality. Therefore, in engineering practice, the technical solutions and functions of the various embodiments of the present invention can be encapsulated into various modules. Based on this reality, the embodiments of the present invention provide a semantic alignment system based on a global semantic graph, which is used to execute the semantic alignment method based on a global semantic graph in the above method embodiment. The system includes: A data receiving module, configured to receive text data to be analyzed as input; The preprocessing module is used to perform natural language preprocessing operations on the input data; The semantic data extraction module is used to capture the global semantic information of sentences through the AMR parser and convert each input text sentence into a global semantic graph; The text encoding module is used to extract the semantic features of the text and perform text encoding on the input text; Graph encoding module, used to encode the global semantic graph through graph convolutional neural network; Feature interaction module, used to perform word-level feature interaction and sentence-level feature interaction to obtain word-level and sentence-level embedding vectors; The malicious semantic alignment module is used to connect the word-level and sentence-level embedding vectors as the final feature representation, obtain the similarity score through the output layer, and determine whether the text contains malicious semantics and whether it is malicious content.
[0072] The semantic alignment system based on the global semantic graph provided by the embodiment of the present invention adopts the modules described above and focuses on the in-depth mining of global semantic information, rather than being limited to the use of surface text features. It significantly enhances the consistency alignment between global structure and semantic information by constructing a global semantic graph of the input text and incorporating a contrast graph learning method in the pre-training stage. Furthermore, the device realizes effective interaction of features at the word and sentence levels, ensuring that the model can not only accurately capture local word-level information, but also deeply understand the global sentence structure, thereby achieving a significant improvement in accuracy in the semantic alignment task.
[0073] The method described in the embodiment of the present invention relies on electronic devices to be executed, so the introduction of related electronic devices is particularly necessary. The embodiment of the present invention provides an electronic device, the specific structure of which is as follows Figure 9 As shown, the device includes: at least one processor, a communication interface, at least one memory, and a communication bus. These components communicate with each other via the communication bus. The processor can call logic instructions in the memory to execute all or part of the processes of the various method embodiments described above.
[0074] Furthermore, if the logic instructions in the aforementioned memory are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention or its innovative portion can be presented in the form of a software product, which is stored in a storage medium and contains a number of instructions designed to cause a computer device (such as a personal computer, server, or network device, etc.) to execute all or part of the processes described in the various method embodiments of the present invention. The aforementioned storage medium includes various media that can store program code, such as USB flash drives, mobile hard drives, read-only memories (ROMs), random access memories (RAMs), magnetic disks, and optical disks.
[0075] It should be emphasized that the equipment in the apparatus embodiment provided by the present invention can not only realize the functions in the aforementioned method embodiment, but also has the potential to realize other method embodiments of the present invention. The core difference is only that the corresponding functional modules need to be configured, and the working principles of these modules are consistent with the basic principles of the aforementioned apparatus embodiment of the present invention. Therefore, as long as the technical personnel in this field master the aforementioned apparatus embodiment, combined with the specific technical details in other method embodiments, create corresponding technical means by reasonably combining technical features, and construct a feasible technical solution, while ensuring that the solution is practical, the equipment in the aforementioned apparatus embodiment can be improved to be suitable for realizing the functions in other method embodiments. For example: Through the description of the embodiments, those skilled in the art will clearly recognize that each embodiment can be implemented through software combined with a general hardware platform, or can also be achieved through hardware. Based on this understanding, the above technical solutions or their innovative parts can exist in the form of software products. Such software products are stored in computer-readable storage media such as ROM / RAM, magnetic disks, optical disks, etc., and contain a number of instructions that prompt a computer device to execute the processes described in each embodiment or parts of the embodiments.
[0076] Finally, it should be noted that the above embodiments are intended only to illustrate the technical solutions of the present invention and are not intended to be limiting. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art will appreciate that they may modify the technical solutions or substitute equivalent features for some of the technical features, without departing from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A malicious semantic alignment method based on a global semantic graph, characterized by: The following steps are involved: Step 1: receiving the text data to be analyzed as input; Step 2: Perform natural language preprocessing on the input text; Step 3: Capture the global semantic information of the sentence through the AMR parser and convert each input text sentence into a global semantic graph; Step 4: extract the semantic features of the text and perform text encoding on the input text; Step 5: Encode the global semantic graph through graph convolutional neural network; Step 6: Perform word-level feature interaction and sentence-level feature interaction to obtain word-level and sentence-level embedding vectors; In step 7, the word-level and sentence-level embedding vectors are connected as the final feature representation. The similarity score is obtained through the output layer to determine whether the text contains malicious semantics and whether it is malicious content.
2. The malicious semantic alignment method based on the global semantic graph according to claim 1 is characterized in that: The natural language preprocessing of the input text includes: Perform text cleaning to remove unnecessary information from the input text, including removing HTML tags, special characters, and extra spaces; Segment the sentence into words or subword units.
3. The malicious semantic alignment method based on the global semantic graph according to claim 1 is characterized in that: The process of capturing the global semantic information of a sentence through the AMR parser and converting each input text sentence into a global semantic graph includes: Identify the main components of a sentence through the AMR parser, including analyzing the grammatical structure of the sentence to identify the main actions or states, participants, and other relevant elements; Based on the analysis results, concept nodes are constructed and a set of semantic roles are assigned to each predicate to describe the relationship between different participants and predicates; All identified concept nodes and the relationships between them are organized into a directed acyclic graph, namely the global semantic graph, in which nodes represent various concepts or entities, and edges represent the semantic relationships between them. Finally, after the AMR graph is constructed, the nodes in the AMR graph are initialized according to the semantic labels, and the processed AMR structure is output.
4. The malicious semantic alignment method based on the global semantic graph according to claim 1 is characterized in that: The text encoding of the input text comprises: The input text enters the text encoder, and the pre-trained language model Roberta is used to encode the question text to obtain the global semantic information of the text and generate initial semantic labels; the initial semantic labels are used to initialize the global semantic graph nodes obtained from the AMR parser.
5. The malicious semantic alignment method based on the global semantic graph according to claim 1 is characterized in that: The graph encoding of the global semantic graph by the graph convolutional neural network includes: The global semantic graph obtained by AMR parsing is encoded through a two-layer graph convolutional neural network R-GCN to capture the abstract semantic structure.
6. The malicious semantic alignment method based on the global semantic graph according to claim 1 is characterized in that: In the word-level feature interaction and sentence-level feature interaction, the word-level feature interaction learns the word-level embedding vector by calculating the cross-sentence attention coefficient and the multi-view matching function, and enhances the node interaction feature through the multi-view matching function to obtain the embedding vector of the word-level feature interaction; The sentence-level feature interaction is performed by using a bidirectional long short-term memory network aggregation to learn an embedding vector of the sentence-level feature interaction.
7. The malicious semantic alignment method based on the global semantic graph according to claim 1 is characterized in that: The word-level and sentence-level embedding vectors are connected as the final feature representation, and the similarity score is obtained through the output layer to determine whether the text contains malicious semantics and whether it is malicious content. The word-level and sentence-level embedding vectors are concatenated as the final feature representation and input into a multi-layer perceptron to generate the final similarity score. The Sigmoid activation function is used to limit the score to the range of (0, 1). Finally, it is determined whether the text contains malicious semantics and whether it is malicious content.
8. A malicious semantic alignment system based on a global semantic graph, characterized by: include: A data receiving module, configured to receive text data to be analyzed as input; The preprocessing module is used to perform natural language preprocessing operations on the input data; The semantic data extraction module is used to capture the global semantic information of sentences through the AMR parser and convert each input text sentence into a global semantic graph; The text encoding module is used to extract the semantic features of the text and perform text encoding on the input text; Graph encoding module, used to encode the global semantic graph through graph convolutional neural network; Feature interaction module, used to perform word-level feature interaction and sentence-level feature interaction to obtain word-level and sentence-level embedding vectors; The malicious semantic alignment module is used to connect the word-level and sentence-level embedding vectors as the final feature representation, obtain the similarity score through the output layer, and determine whether the text contains malicious semantics and whether it is malicious content.
9. The malicious semantic alignment system based on global semantic graph according to claim 8, characterized in that: In the word-level feature interaction and sentence-level feature interaction, the word-level feature interaction learns the word-level embedding vector by calculating the cross-sentence attention coefficient and the multi-view matching function, and enhances the node interaction feature through the multi-view matching function to obtain the embedding vector of the word-level feature interaction; The sentence-level feature interaction is performed by using a bidirectional long short-term memory network aggregation to learn an embedding vector of the sentence-level feature interaction.
10. An electronic device, characterized in that: include: The device comprises at least one processor, at least one memory and a communication interface; wherein the processor, memory and communication interface communicate with each other; The memory stores program instructions that can be executed by the processor, and the processor calls the program instructions to execute the malicious semantic alignment method based on the global semantic graph as described in any one of claims 1 to 7.