A method and system for detecting text semantic conflicts based on large model construction context association
By employing a context association method based on a large model, text is segmented to generate triplet data, confidence scores are calculated, and a logic graph is constructed to identify contradictory relationships and repair semantic conflicts. This solves the accuracy and consistency problems of traditional language models and improves the accuracy and logic of text generation.
Patent Information
- Application Number
- CN202411277834.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-12
- Publication Date
- 2025-11-04
- Estimated Expiration
- 2044-09-12
Smart Images

Figure CN119474395B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The application belongs to the technical field of semantic error correction, and particularly relates to a text semantic conflict detection method and system based on large model construction of context association. BACKGROUND
[0002] The traditional semantic error correction method based on a neural network language model is easily affected by local high-frequency or low-frequency sequences, and the effect is not stable enough. When the accuracy and recall rate need to be balanced and adjusted, it is not easy to control by threshold. It can be well applied to spelling checking tasks, but it is weak in supporting grammar correction tasks with varying sentence lengths.
[0003] In the semantic error correction method based on a large model, the large model has insufficient ability for spelling correction, and is prone to omission and incorrect correction. In addition, it can detect some grammar errors but cannot modify them correctly.
[0004] In the semantic error correction method based on a knowledge graph, the construction of the knowledge graph has high artificial cost, and the values of nodes and edges have no industry standard and are completely defined by the user. At the same time, due to the lack of a unified standard, it is difficult to integrate multi-source data. In addition, the knowledge graph has difficulty in distinguishing between concept nodes and object nodes, and cannot uniformly define the labels of nodes and edges. SUMMARY
[0005] (I) Invention purpose
[0006] In order to overcome the above shortcomings, the purpose of the present application is to provide a text semantic conflict detection method and system based on large model construction of context association, to solve the above technical problems.
[0007] (II) Technical solutions
[0008] In order to achieve the above purpose, the technical solutions provided by the present application are as follows:
[0009] A text semantic conflict detection method based on large model construction of context association, comprising the following steps:
[0010] S1: The original text is cut using a cutting function to prevent the text input from being too long to exceed the token number limit of the large model, or to prevent the long text from reducing the accuracy of the large model in extracting triples;
[0011] S2: For each piece of cut text, use a large model to extract triples information to generate a data group of entity corresponding relationship, the data group is: <entity1, relationship1, entity2>, <entity1, relationship1, entity2>, <entity1, relationship2, entity2>, <entity1, relationship3, entity2>, <entity1, relationship4, entity3>, …, <entityx, relationshipy, entityz>;
[0012] S3: Extract all entity pairs and relationship data sets. For the same entity pair, different text content may have the same or different entity relationships. The same entity relationship is verified, and the confidence is increased accordingly. Different entity relationships are verified, and the confidence is decreased accordingly. The confidence score of <entity i, relationship k, entity j> is calculated as follows:
[0013] Score <实体i,关系k,实体j> =∑ 关系l=关系k α·1 {<实体i,关系1,实体j>} +∑ 关系l≈关系k β·1 {<实体i,关系1,实体j>} +∑ 关系l≠关系k γ·1 {<实体i,关系1,实体j>} ,
[0014] Wherein α is the score coefficient corresponding to the same entity relationship, β is the score coefficient corresponding to the similar entity relationship, and γ is the score coefficient corresponding to the inconsistent entity relationship.
[0015] S4: Aggregate all triples to construct a matter graph and point out the contradictory relationships with low confidence in the matter graph.
[0016] S5: For the contradictory relationship found, combine the large model to repair the semantic conflict in the text.
[0017] Preferably, the segmentation function includes the following segmentation methods:
[0018] Based on the sentence, the text is segmented according to the sentence boundary, and each sentence becomes a segmented text segment;
[0019] Based on the paragraph, the segmentation is performed according to the paragraph boundary, and each paragraph is taken as a text segment;
[0020] Based on the length, set a maximum length limit. When the text exceeds this length, segmentation is performed until each segment does not exceed this length;
[0021] Based on semantics, use syntax analysis or semantic segmentation to identify natural breakpoints in the text, and then perform segmentation.
[0022] Preferably, in S2, when the large model extracts the entity pair and relationship data set, the input text is first converted into a format that the model can understand, usually including word segmentation and adding special marks. Secondly, the model will process each token in the text, predict whether each token is part of a named entity, and the type of entity. Finally, after identifying the entity, the model will further identify the relationship of these entities, including the following ways:
[0023] Use dependency syntax analysis to determine the syntactic relationship between entities;
[0024] Identify relationships between two entities using span classification;
[0025] Analyze global relationships of entities in text using graph neural networks or other models.
[0026] Preferably, the specific steps in S4 include:
[0027] Step 1: Initialize an empty graph, containing entity nodes and relationship edges, add each triple as an edge to the graph, and the weight of the edge is the confidence score of the triple;
[0028] Step 2: Ensure that all entities in the graph are standardized, that is, instances of different names but referring to the same entity are merged into a single node;
[0029] Step 3: If there are multiple relationships for the same entity pair, aggregate the confidence scores of these relationships by taking the average, maximum value, or according to other logic;
[0030] Step 4: Traverse all edges in the graph to find contradictory or inconsistent relationships;
[0031] Step 5: Set a confidence threshold, only relationships above this threshold are considered reliable, and relationships below the threshold need further review or be marked as potential contradictions;
[0032] Step 6: Use visualization tools to display the fact graph, making it easier to analyze and understand the relationships between entities;
[0033] Step 7: Users can modify and edit the generated fact graph, enhancing user engagement and interactivity, and users can assess the quality of the answer based on the displayed graph logic information and results.
[0034] Preferably, the specific steps in S5 include:
[0035] A1 Analyze the fact graph to identify relationships with low confidence or logical contradictions from the constructed fact graph;
[0036] A2 Extract relevant context, extract relevant context information from the original text around the entities of the contradictory relationship, including sentences, paragraphs, or entire documents;
[0037] A3 Use large models for in-depth analysis to understand the relationships between entities and their roles in the text;
[0038] A4 Generate candidate solutions, based on the understanding of large models, generate possible solutions or relationship correction suggestions, including changing the type of entity, adjusting the relationship description, or proposing new explanations;
[0039] A5 Evaluate solutions, use large models to evaluate each candidate solution and predict its confidence level;
[0040] A6 Manual review and selection, for solutions with low confidence level, need manual review and select the final solution;
[0041] A7 Update the matter graph, apply the selected solution to the matter graph, update or delete contradictory relationships, and ensure the consistency and accuracy of the graph.
[0042] A large model-based context-related text semantic conflict detection system, comprising:
[0043] Text processing module, responsible for receiving and preprocessing input text data, including word segmentation, removing stop words, and part-of-speech tagging;
[0044] Text segmentation module, text segmentation according to sentence, paragraph, length or semantic, generate text segments suitable for model processing;
[0045] Entity and relationship extraction module, use large model to process segmented text segments, extract entities and their relationships, generate triple data;
[0046] Confidence score module, according to the extracted triple data, calculate the confidence score of each entity to the relationship;
[0047] Matter graph construction module, aggregate the extracted triples, construct the matter graph representing entities and relationships, and perform entity standardization and relationship aggregation;
[0048] Contradictory relationship identification and visualization module, identify relationships with low confidence or logical contradictions in the matter graph, and display the graph through visualization tools;
[0049] Conflict repair module, for the identified contradictory relationships, use large model for in-depth analysis, generate and evaluate candidate solutions, including manual review process;
[0050] User interaction module, provide user interface, allow users to modify, edit and review the graph, enhance user participation;
[0051] Knowledge base and storage module, store matter graph, extracted triples, solutions and other data, for internal use and external query.
[0052] Advantages:
[0053] 1、The present application significantly improves the accuracy of large language model information generation through context association. Users can rely on this system to generate more accurate and reliable text content, whether it is academic research, business reports or daily communication, to ensure the correctness of information transmission, thereby enhancing trust and professionalism.
[0054] 2、The present application generates text that conforms to semantic logic by combining large models with structured data. This method not only improves the logicality of the text, but also ensures that the generated text is consistent with existing knowledge structures. In this way, the system can display text that repairs user semantic contradictions, helping users avoid potential misunderstandings or confusion. This is particularly important in legal documents, technical manuals and other documents that require high accuracy, ensuring the rigor and authority of the text.
[0055] 3、The present application can also display the contradiction and error probability extracted from the user's text, providing an intuitive probability display that allows users to quickly identify uncertainties and potential problems in the text. This makes the system more user-friendly and improves the interpretability of the generated results. Users can not only see the problems in the text, but also understand the likelihood of these problems occurring, allowing them to make more informed decisions. This transparent information display enhances user trust in the system and improves user satisfaction with the generated text. BRIEF DESCRIPTION OF DRAWINGS
[0056] Figure 1 is a flowchart of the present application. DETAILED DESCRIPTION
[0057] To make the purpose, technical scheme and advantages of the present application clearer, the following will combine specific embodiments and refer to the attached drawings Figure 1 , further explain the present application. It should be understood that these descriptions are only exemplary and do not limit the scope of the present application. In addition, in the following description, the description of known structures and technologies is omitted to avoid unnecessary confusion of the concept of the present application.
[0058] A text semantic conflict detection method based on large model context association, characterized by the following steps:
[0059] S1: The original text is divided using a segmentation function to prevent the text from exceeding the token limit of the large model or to prevent the long text from reducing the accuracy of the large model's extraction of triples.
[0060] S2: For each piece of text after segmentation, use a large model to extract triple information, generate entity corresponding relationship data sets, data sets are: <entity1, relationship1, entity2>, <entity1, relationship1, entity2>, <entity1, relationship2, entity2>, <entity1, relationship3, entity2>, <entity1, relationship4, entity3>, …, <entityx, relationshipy, entityz>;
[0061] S3: Extract all entity pairs and relationship data sets. For the same entity pair, different text content may have the same or different entity relationships. The same entity relationship is verified, and the confidence is increased accordingly. Different entity relationships are verified, and the confidence is decreased accordingly. The confidence score calculation method of <entityi, relationshipk, entityj> is:
[0062] Score <实体i,关系k,实体j> =∑ 关系l=关系k α·1 {<实体i,关系1,实体j>} +∑ 关系l≈关系k β·1 {<实体i,关系l,实体j>} +∑ 关系l≠关系k γ·1 {<实体i,关系1,实体j>} ,
[0063] Wherein, alpha is the score coefficient corresponding to the same entity relationship, beta is the score coefficient corresponding to the similar entity relationship, and gamma is the score coefficient corresponding to the inconsistent entity relationship;
[0064] S4: Aggregate all triples to construct a matter graph and point out the contradictory relationships with low confidence in the matter graph.
[0065] S5: For the found contradictory relationships, combine the large model to repair the semantic conflicts in the text.
[0066] The segmentation function includes the following segmentation methods:
[0067] Based on the sentence, the text is segmented according to the sentence boundary, and each sentence becomes a segmented text segment;
[0068] Based on the paragraph, segment according to the paragraph boundary, and each paragraph is a text segment;
[0069] Based on length, set a maximum length limit, when the text exceeds this length, segment until each segment does not exceed this length;
[0070] Based on semantics, use syntax analysis or semantic segmentation to identify natural breakpoints in the text, and then segment.
[0071] In S2, the large model extracts entity pairs and relationship data sets by first converting the input text into a format that the model can understand, usually including tokenization and adding special markers. Then the model processes each token in the text, predicting whether each token is part of a named entity and the type of entity. Finally, after identifying the entities, the model further identifies the relationships between them, including the following methods:
[0072] Using dependency syntax analysis to determine the syntactic relationship between entities;
[0073] Using span classification to identify the relationship between two entities;
[0074] Using graph neural networks or other models to analyze the global relationship of entities in the text.
[0075] The specific steps in S4 include:
[0076] Step 1: Initialize an empty graph, which contains entity nodes and relationship edges. Add each triple as an edge to the graph, and the weight of the edge is the confidence score of the triple;
[0077] Step 2: Ensure that all entities in the graph are standardized, that is, instances of different names but referring to the same entity are merged into a single node;
[0078] Step 3: If there are multiple relationships for the same entity pair, aggregate the confidence scores of these relationships by taking the average, maximum value, or according to other logic;
[0079] Step 4: Traverse all edges in the graph to find contradictory or inconsistent relationships;
[0080] Step 5: Set a confidence threshold, only relationships above this threshold are considered reliable, and relationships below the threshold need further review or be marked as potential contradictions;
[0081] Step 6: Use visualization tools to display the fact graph, making it easier to analyze and understand the relationships between entities;
[0082] Step 7: Users can modify and edit the generated fact graph, enhancing user engagement and interactivity. Users can assess the quality of the answer based on the displayed graph logic information and results.
[0083] The specific steps in S5 include:
[0084] A1 analyzes the fact graph and identifies relationships with low confidence or logical contradictions from the constructed fact graph;
[0085] A2 extracts relevant context, extracts relevant context information from the original text around the entities in the contradictory relationship, including sentences, paragraphs or entire documents;
[0086] A3 uses large models for in-depth analysis, understands the relationship between entities and their role in the text;
[0087] A4 generates candidate solutions, generates possible solutions or relationship correction suggestions based on the understanding of large models, including changing the type of entities, adjusting relationship descriptions or proposing new explanations;
[0088] A5 evaluates solutions, evaluates each candidate solution using large models to predict its confidence;
[0089] A6 manual review and selection, for solutions with low confidence, manual review is needed, and the final solution is selected;
[0090] A7 updates the fact graph, applies the selected solution to the fact graph, updates or deletes contradictory relationships, and ensures the consistency and accuracy of the graph.
[0091] A large model-based text semantic conflict detection system based on context association, comprising:
[0092] Text processing module, responsible for receiving and preprocessing input text data, including word segmentation, removing stop words, and part-of-speech tagging;
[0093] Text segmentation module, text segmentation according to sentence, paragraph, length or semantics, generating text segments suitable for model processing;
[0094] Entity and relationship extraction module, using large models to process segmented text segments, extracting entities and their relationships, generating triple data;
[0095] Confidence scoring module, according to the extracted triple data, calculate the confidence score of each entity to the relationship;
[0096] Fact graph construction module, aggregate the extracted triples, construct the fact graph representing entities and relationships, and perform entity standardization and relationship aggregation;
[0097] Contradictory relationship identification and visualization module, identify relationships with low confidence or logical contradictions in the fact graph, and display the graph through visualization tools;
[0098] Conflict repair module, for the identified contradictory relationships, use large models for in-depth analysis, generate and evaluate candidate solutions, including manual review process;
[0099] A user interaction module provides a user interface to allow users to modify, edit and review the graph, enhancing user engagement;
[0100] A knowledge base and storage module stores the matter graph, extracted triples, solutions and other data for internal use by the system and external queries.
[0101] The present application uses a large model to summarize the key points of information in the text, and then extracts triples <entity 1, relationship, entity 2> from the summarized key information to construct a matter graph. At the same time, during extraction, scoring is performed according to the confidence level. The scoring can be determined by the large model based on the co-occurrence probability of triples. If the probability of occurrence of the same triple is large or the repetition frequency is high, it is considered that the confidence level of the triple is high. If there are contradictory elements in a triple, such as two elements in two triples being the same and the last triple being inconsistent, the accuracy of the two triples is reduced. Finally, the large model can extract the relevant graph and score the existence probability of the graph edge to display. The edge with a small existence probability is considered to have a contradiction, which needs to be displayed to the customer.
[0102] The present application can be applied to the task of large model semantic conflict mining combined with large language models, which can significantly solve the problem of large model semantic illusion and improve the accuracy of text generation.
[0103] The present application can be applied to the single-text Chinese semantic contradiction analysis and mining scene, and can find the semantic contradiction and ambiguity problem in the text context, and display the modification suggestion and judgment logic to the user. It can improve the user's text writing and correction efficiency, optimize the semantic contradiction problem before and after the large model text generation, and improve the large model output experience.
[0104] The present application can be applied to the multi-text mutual verification scene, and can find semantic contradictions in multi-texts and solve the knowledge confidence problem in non-syngeneic texts. At the same time, it can analyze and mine the accuracy of each data source, and optimize the subsequent RAG generation.
[0105] The present application significantly improves the accuracy of large language model generated information through context association. Users can rely on this system to generate more accurate and reliable text content, whether it is academic research, business reports or daily communication, which can ensure the correctness of information transmission, thereby enhancing trust and professionalism.
[0106] The present application generates text that conforms to semantic logic by combining large models with structured data. This approach not only improves the logicality of the text, but also ensures that the generated text is consistent with existing knowledge structures. In this way, the system can display text that repairs semantic contradictions of the user, helping the user to avoid potential misunderstandings or confusion. This is particularly important in legal documents, technical manuals and other documents that require high accuracy, ensuring the rigor and authority of the text.
[0107] The present application can also display the probability of contradictions and errors extracted from the user's text, intuitive probability display, which allows the user to quickly identify uncertainties and potential problems in the text, making it more user-friendly and improving the explainability of the generated results. Not only can the user see the problems in the text, but also understand the size of the possibility of these problems, so as to make a more intelligent decision. This transparent information display enhances the user's trust in the system and improves the user's satisfaction with the generated text.
[0108] It should be noted that in this paper, relational terms such as first and second are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "contain" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "includes a" does not exclude the presence of other identical elements in the process, method, article or device that includes the element.
[0109] The above embodiments are only used to illustrate the technical solutions of the present application, but not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A method for detecting contextually associated text semantic conflicts based on a large model, characterized in that, Comprising the following steps: S1: split the original text using the split function to prevent the text from being too long and exceeding the token limit of the large model, or to prevent long text from reducing the accuracy of triple extraction by the large model; S2: For each piece of text after splitting, use the large model to extract triple information to generate entity corresponding relationship data sets, data sets are: <entity1, relationship1, entity2>, <entity1, relationship2, entity2>, <entity1, relationship3, entity2>, <entity1, relationship4, entity3>, …, <entityx, relationshipy, entityz>; S3: Extract all entity pairs and relationship data sets. For the same entity pair, different text content may have the same or different entity relationships. The same entity relationship is verified, and the confidence is increased accordingly. Different entity relationships are verified, and the confidence is decreased accordingly. The confidence score calculation method of <entityi, relationshipk, entityj> is: ; wherein is a scoring coefficient corresponding to the same entity relationship, is a scoring coefficient corresponding to the similar entity relationship, is a scoring coefficient corresponding to the inconsistent entity relationship; S4: Aggregate all triples to construct a matter graph and identify contradictory relationships with lower confidence in the matter graph; S5: For the identified contradictory relationships, combine the large model to repair the semantic conflicts in the text, including the following steps: A1: Analyze the matter graph to identify relationships with low confidence or logical contradictions from the constructed matter graph; A2: Extract relevant context. Extract relevant context information, including sentences, paragraphs, or entire documents, from the original text around the entity of the contradictory relationship; A3: Use the large model for in-depth analysis to understand the relationship between entities and their role in the text; A4: Generate candidate solutions based on the understanding of the large model to generate possible solutions or relationship modification suggestions, including changing the type of entity, adjusting the relationship description, or proposing new explanations; A5: Evaluate the solution. Use the large model to evaluate each candidate solution and predict its confidence; A6: Manual review and selection. For solutions with low confidence, manual review is required, and the final solution is selected; A7: Update the matter graph. Apply the selected solution to the matter graph to update or delete contradictory relationships and ensure the consistency and accuracy of the graph.
2. The method according to claim 1, wherein, The split function includes the following split methods: Based on sentences, split the text according to sentence boundaries, and each sentence becomes a split text segment; Based on paragraphs, split according to paragraph boundaries, and each paragraph is a text segment; Based on length, set a maximum length limit. When the text exceeds this length, split until each segment does not exceed this length; Based on semantics, use syntax analysis or semantic segmentation to identify natural breaks in the text, and then split.
3. The method of claim 1, wherein the method is based on a large model to construct a context-related text semantic conflict detection method. In S2, when the large model extracts entity pairs and relationship data sets, it first converts the input text into a format that the model can understand, usually including tokenization and adding special markers. Secondly, the model processes each token in the text to predict whether it is part of a named entity and the type of entity. Finally, after identifying entities, the model further identifies the relationship between these entities, including the following methods: Using dependency parsing to determine the syntactic relationship between entities; Using span classification to identify the relationship between two entities; Using graph neural networks or other models to analyze the global relationships of entities in the text.
4. The method of claim 1, wherein the method is based on a large model to construct a context-related text semantic conflict detection method. The specific steps in S4 include: Step 1: Initialize an empty graph, containing entity nodes and relationship edges, add each triple as an edge to the graph, and the weight of the edge is the confidence score of the triple; Step 2: Ensure that all entities in the graph are standardized, that is, instances of different names but referring to the same entity are merged into a single node; Step 3: If there are multiple relationships for the same entity pair, aggregate the confidence scores of these relationships by taking the average, maximum, or according to other logic; Step 4: Traverse all edges in the graph to find contradictory or inconsistent relationships; Step 5: Set a confidence threshold, only relationships above this threshold are considered reliable, and relationships below the threshold need further review or be marked as potentially contradictory; Step 6: Use visualization tools to display the fact graph, making it easier to analyze and understand the relationships between entities; Step 7: Users can modify and edit the generated fact graph, enhancing user engagement and interactivity, and users can evaluate the quality of the answer based on the displayed graph logic information and results. 5.A system for detecting contextually associated text semantic conflicts based on large models, characterized in that, For implementing the method for detecting semantic conflicts in text based on context association based on large models according to any one of claims 1-4, comprising: A text processing module is responsible for receiving and preprocessing input text data, including word segmentation, removing stop words, and part-of-speech tagging; A text segmentation module segments the text according to sentences, paragraphs, length, or semantics to generate text segments suitable for model processing; An entity and relationship extraction module uses a large model to process segmented text segments, extracts entities and their relationships, and generates triple data; A confidence scoring module calculates the confidence score of each entity pair relationship based on the extracted triple data; A fact graph construction module aggregates the extracted triples to construct a fact graph representing entities and relationships, and performs entity standardization and relationship aggregation; A contradictory relationship identification and visualization module identifies relationships with low confidence or logical contradictions in the fact graph and displays the graph through visualization tools; A conflict repair module uses a large model to analyze the identified contradictory relationships in depth, generates and evaluates candidate solutions, including a manual review process; A user interaction module provides a user interface that allows users to modify, edit, and review the graph, enhancing user engagement; A knowledge base and storage module stores fact graphs, extracted triples, solutions, and other data for internal use and external queries.
Citation Information
Patent Citations
Knowledge graph construction method and device, equipment and storage medium
CN117952208A