Method for explaining implicit prisoner sex in dialogue
By constructing DIOLE tasks and DAKIEM models, the problem of detecting and interpreting implicit offensive language in dialogue is solved, and efficient identification and explanation of implicit offensiveness on social media platforms is achieved, which improves user understanding and maintains the health of the platform.
Patent Information
- Application Number
- CN202510444339.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-10
- Publication Date
- 2025-08-12
AI Technical Summary
The prior art is difficult to accurately detect and interpret implicit offensive language in conversations, especially on social media platforms, leading to the spread of potential harm and bias.
A dialogue implicit offensive language interpretation task (DIOLE) was constructed, and interpreted by generating high-quality data sets and using a dual-path attention and knowledge injection interpretation model (DAKIEM), including contextual building module (SEM), context learning module (CLM) and knowledge injection module (KIM), combined with pre-trained language model T5 for interpretation generation.
It improves the accuracy of detection and interpretation of implicit offensive language, provides clear context-dependent analysis and natural language interpretation, and enhances the reliability of dialogue comprehension.
Smart Images

Figure CN120470102A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to a method for interpreting implicitly offensive language in conversations. First, the task is defined and a dataset is constructed. Explanations are generated using a dual-path attention and knowledge injection model. This method falls within the research fields of machine learning, natural language processing, and natural language generation. Background Art
[0002] With the rapid development of social media platforms, the impact of implicitly offensive language in online communication has become increasingly prominent. Compared to directly offensive speech, implicitly offensive language often uses sarcasm, innuendo, or ambiguity, making it more confusing and potentially harmful. This type of language can subtly exacerbate prejudice, foster hostility, and even influence public opinion, while victims often find it difficult to directly refute or gain support. Therefore, detecting and interpreting implicitly offensive language is crucial to maintaining a healthy ecosystem on social platforms, promoting rational discussion, and enhancing understanding among users.
[0003] Offensive language detection technology has advanced significantly in recent years. Early approaches relied on dictionary-based methods and machine learning classifiers. With the rise of deep learning, more sophisticated models have emerged, capable of capturing complex linguistic patterns. However, existing research primarily focuses on identifying explicit offensive content in isolated sentences. Detecting and interpreting implicit offensive language in conversations remains exploratory, primarily due to dataset limitations and model capacity constraints. Summary of the Invention
[0004] This method addresses the shortcomings of existing research in modeling the context of offensive language and can more accurately capture the contextual dependence of implicit offensive expressions. In addition, this invention provides an explanatory perspective for offensive language research and provides a clear basis for reasoning, generating reasonable and easy-to-read natural language explanations. From a technical solution perspective, we provide a method for interpreting implicit offensive language in conversations. After defining the task, we generate a dataset through zero-shot prompts and integrate methods such as pre-trained language models, attention mechanisms, knowledge graphs, and natural language generation. The specific steps are as follows:
[0005] Step 1: Task Proposal and Definition
[0006] The Dialogue Implicit Offensive Language Explanation (DIOLE) task was proposed. The DIOLE task involves providing a detailed explanation of offensive language implicit in a speaker's speech during a single-turn conversation, revealing the underlying offensive factors, identifying the specific manifestations of the offensive language, and analyzing its relevance to the conversational context. It takes the conversation text as input and ultimately requires the model to provide a natural language explanation.
[0007] Step 2: Dataset Construction
[0008] (1) We use the latest automated dataset construction methods and ChatGPT to generate samples in the dataset. Through carefully designed positive prompt words, ChatGPT generates single-round conversations in English, in which the respondent's words may imply offensive expressions that are context-dependent. For offensive replies, a natural language explanation in English is given to explain why they contain offense. In addition, to improve data diversity and reduce duplication, we limit the number of samples generated in each round and use specific topic keywords to guide the generation of different types of conversations.
[0009] (2) Subsequently, we conducted targeted optimization based on two issues in the data: “redundant information” and “salient features.” Redundant information includes unnecessary sentence components and synonyms, which we standardized to reduce noise. In terms of salient features, some sentence patterns appeared too frequently in offensive or non-offensive samples, which may cause the model to rely on surface features rather than semantic understanding. Therefore, we conducted sentence deduplication and data distribution balance optimization.
[0010] (3) To ensure the validity and generalization of the data, we introduced manual annotation verification after data cleaning. By recruiting annotators with good English skills from the university community and using a voting mechanism to determine the final labels, we ensured the reliability of the data quality and provided high-quality annotated data for subsequent research.
[0011] Step 3: Construct a dual-path attention and knowledge injection explanation model
[0012] (1) A dual-path attention and knowledge-injected explanation model (DAKIEM) is proposed as the baseline model for the DIOLE task. DAKIEM consists of three main modules: the context establishment module (SEM), the context learning module (CLM), and the knowledge injection module (KIM). First, SEM and CLM encode the conversation text, and then the introduced external knowledge is encoded through KIM. Then, the conversation features are combined with the knowledge features, and finally the synthesized features are input into the T5 decoder to generate the final result.
[0013] (2) SEM: It enhances attention to the most salient parts of the context and establishes the language scene. It uses the T5 encoder to generate an initial representation from the first speaker's sentence. It is then optimized through multi-head crisscross attention (MCA), where the first speaker is used as Q and processed through MLP layers with residual connections and layer normalization.
[0014]
[0015] (3) CLM: CLM uses multi-head crisscross attention (MCA) to learn context-aware representations of the responder's sentences to capture the dynamic relationship between the first speaker and the responder's sentences. First, the responder's sentence is encoded to obtain an initial representation. Then, through the MCA mechanism, the responder's representation is enabled to query relevant information from the first speaker's sentence to enhance its understanding of the context. Finally, the output is further optimized so that the responder's representation can more fully incorporate contextual information, which is crucial for explaining context-dependent implicit offensiveness.
[0016]
[0017] (4) KIM: By introducing external knowledge from ConceptNet, the model's understanding of implicit offensive language is enhanced. The incorporation of structured knowledge enables the model to capture cultural meanings that may not be obvious in the conversation text. First, a knowledge concept subgraph is constructed from the entities in the sentences of both parties and encoded using R-GCN. Then, the self-attention score Z is calculated through graph convolution, and only the 80% nodes with the highest scores are retained to compress the subgraph:
[0018]
[0019] Among them, σ is a nonlinear activation function, is the adjacency matrix including self-connections, and C represents the number of concept nodes in the subgraph. for degree matrix for normalization; X is the concept embedding matrix obtained by R-GCN, with an embedding dimension of F; θ att ∈R F×1 is the parameter matrix for computing the self-attention score. The optimized knowledge is then aligned with the responder’s sentence context, enabling the model to contextualize external knowledge in a specific conversation:
[0020]
[0021] (5) Finally, L S , G R and K C are concatenated together. This combined representation is then fed into the T5 decoder to generate explanations. The loss is calculated as the cross entropy between the generated explanations and the true explanation tokens. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 It is a flowchart of the method for interpreting implicit offensive language in conversation.
[0023] Figure 2 It is the implicit offensive dialogue explanation dataset construction process.
[0024] Figure 3 This is an example of automated data cleaning.
[0025] Figure 4 This is the structure of the dual-path attention and knowledge injection explanation model proposed in this invention. DETAILED DESCRIPTION
[0026] The method of the present invention is further described in detail below with reference to the accompanying drawings and embodiments of the present invention. It should be understood that this example is only used to illustrate the present invention and is not intended to limit the scope of the present invention. The present invention is a method for interpreting implicit offensive language in a conversation. Figure 1 The system flow chart of the present invention is given. The specific implementation steps are as follows:
[0027] Step 1: Task Proposal and Definition
[0028] The Dialogue Implicit Offensive Language Explanation (DIOLE) task was proposed. The DIOLE task involves providing a detailed explanation of offensive language implicit in a speaker's speech during a single-turn conversation, revealing the underlying offensive factors, identifying the specific manifestations of the offensive language, and analyzing its relevance to the conversational context. It takes the conversation text as input and ultimately requires the model to provide a natural language explanation.
[0029] Step 2: Dataset Construction
[0030] The overall construction process of the dataset can be referred to Figure 2 .
[0031] (1) We use the latest automated dataset construction methods and ChatGPT to generate samples in the dataset. Through carefully designed positive prompt words, ChatGPT generates single-round conversations in which the respondent's words may imply offensive expressions that are context-dependent. For offensive replies, a natural language explanation in English is given to explain why they contain offense. In addition, to improve data diversity and reduce duplication, we limit the number of samples generated in each round and combine specific topic keywords to guide the generation of different categories of conversations.
[0032] (2) Subsequently, we conducted targeted optimization based on the two problems existing in the data: "redundant information" and "salient features". Redundant information includes unnecessary sentence components and synonymous expressions, which we standardized to reduce noise; in terms of salient features, some sentences appear too frequently in offensive or non-offensive samples, which may cause the model to rely on surface features rather than semantic understanding. Therefore, we conducted sentence deduplication and data distribution balance optimization. For specific processing methods, please refer to Figure 3 .
[0033] (3) To ensure the validity and generalization of the data, we introduced manual annotation verification after data cleaning. By recruiting annotators with good English skills from the university community and using a voting mechanism to determine the final labels, we ensured the reliability of the data quality and provided high-quality annotated data for subsequent research.
[0034] Step 3: Construct a dual-path attention and knowledge injection explanation model
[0035] (1) DAKIEM consists of three main modules: Context Establishment Module (SEM), Context Learning Module (CLM) and Knowledge Injection Module (KIM). First, SEM and CLM encode the conversation text, and then KIM encodes the introduced external knowledge. Then, the conversation features are combined with the knowledge features, and finally the synthesized features are input into the T5 decoder to generate the final result. The overall structure of the model can be found in Figure 4 .
[0036] (2) SEM: It enhances attention to the most salient parts of the context and establishes the language scene. It uses the T5 encoder to generate an initial representation from the first speaker's sentence. It is then optimized through multi-head crisscross attention (MCA), where the first speaker is used as Q and processed through MLP layers with residual connections and layer normalization.
[0037]
[0038] (3) CLM: CLM uses multi-head crisscross attention (MCA) to learn context-aware representations of the responder's sentences to capture the dynamic relationship between the first speaker and the responder's sentences. First, the responder's sentence is encoded to obtain an initial representation. Then, through the MCA mechanism, the responder's representation is enabled to query relevant information from the first speaker's sentence to enhance its understanding of the context. Finally, the output is further optimized so that the responder's representation can more fully incorporate contextual information, which is crucial for explaining context-dependent implicit offensiveness.
[0039]
[0040] (4) KIM: By introducing external knowledge from ConceptNet, the model's understanding of implicit offensive language is enhanced. The incorporation of structured knowledge enables the model to capture cultural meanings that may not be obvious in the conversation text. First, a knowledge concept subgraph is constructed from the entities in the sentences of both parties and encoded using R-GCN. Then, the self-attention score Z is calculated through graph convolution, and only the 80% nodes with the highest scores are retained to compress the subgraph:
[0041]
[0042] Among them, σ is a nonlinear activation function, is the adjacency matrix including self-connections, and C represents the number of concept nodes in the subgraph. for degree matrix for normalization; X is the concept embedding matrix obtained by R-GCN, with an embedding dimension of F; θ att ∈R F×1 is the parameter matrix for computing the self-attention score. The optimized knowledge is then aligned with the responder’s sentence context, enabling the model to contextualize external knowledge in a specific conversation:
[0043]
[0044] (5) Finally, L S , G R and K C are concatenated together. This combined representation is then fed into the T5 decoder to generate explanations. The loss is calculated as the cross entropy between the generated explanations and the true explanation tokens.
Claims
1. A method for interpreting implicit offensive language in a conversation, characterized in that: The following steps are involved: Step 1: The Dialogue Implicit Offensive Language Explanation task (DIOLE) was proposed. Step 2: To support the DIOLE task proposed in Step 1, we constructed the Implicit Offensive Dialogue Explanation Dataset (IODED). Step 3: To support the DIOLE task proposed in Step 1, a dual-path attention and knowledge-injected explanation model (DAKIEM) was developed as the baseline model for the DIOLE task.
2. The method according to claim 1, characterized in that Propose DIOLE tasks, including; a. Given a round of conversation between two people, the first speaker's words open the topic of the conversation, and the second speaker responds to the first speaker's words with an implicit offense. The task requires providing a brief natural language explanation of why the latter speaker's remarks are offensive; b. Implicitly offensive responses are those that appear neutral or harmless but may actually contain content that is offensive, derogatory, or offensive to others.
3. The method according to claim 1, characterized in that Construct the IODED dataset, including: a. Design zero-shot prompt words with positive intent to generate offensive instances, and at the same time, design prompt words to generate non-offensive instances for data balance; b. Under human supervision, ChatGPT is used to generate a single-turn English conversation instance. The second speaker's speech may or may not contain offensive content. If the second speaker's speech contains offensive content, ChatGPT is required to provide an English natural language explanation of why the speech was judged offensive; c. Use automated methods to clean the data, remove redundancy and noise, eliminate unnecessary sentence components, unify synonyms, adjust elements with superficial semantic significance, and optimize sentence length distribution; d. Human experts verify the data and determine the final classification label of the data through voting to ensure data quality and rationality.
4. The method according to claim 1, wherein Development of the DAKIEM model, including: a. Scenario building module: This module uses the T5 encoder and cross-attention mechanism to model the conversation scenario using the language encoding of the first speaker as Q. b. Context Injection Module: Through the T5 encoder and cross-attention mechanism, the language encoding of the next speaker is used as Q to inject context into the implicit offensive speech; c. Knowledge injection module: First, subgraphs related to the conversation are extracted from the commonsense knowledge graph, encoded using R-GCN, and compressed to remove irrelevant knowledge nodes. Feature enhancement is then performed using the self-attention mechanism. d. After combining the outputs of the three encoding modules, use the T5 decoder to generate a reasonable natural language explanation.