Text quality detection method, electronic equipment and program product
By constructing semantic trees and weighted causal graphs, combined with multi-layer temporal consistency tensors, the problem of identifying deep causal relationships in texts that is difficult to identify in existing technologies is solved. This enables quantifiable evaluation of logical consistency and conflict localization, improving the accuracy of text quality detection and the interpretability of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-12-03
- Publication Date
- 2026-03-17
AI Technical Summary
Existing text quality assessment methods mainly rely on surface grammar checks, semantic similarity matching, or language model black-box scoring, which makes it difficult to identify deep causal relationships and logical errors in text, such as missing causal relationships, contradictions, and logical breaks, affecting the credibility of the content and the security of its use.
By constructing a semantic tree structure, extracting causal event triples, establishing a weighted causal graph, and introducing a multi-layer temporal consistency tensor, logical consistency scoring and conflict localization are performed to generate repair solutions and form a closed-loop optimization mechanism.
It enables structured and quantifiable evaluation of textual logical consistency, accurately locates and classifies conflict types, significantly improves the accuracy and interpretability of detection, reduces the cost of manual review, and enhances the robustness of the system.
Smart Images

Figure CN121683752A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computer technology and natural language processing, and particularly relates to a text quality detection method, an electronic device and a program product. BACKGROUND
[0002] With the rapid development of artificial intelligence technology, especially the wide application of large language models (LLMs) in intelligent question answering, content generation, automatic summarization, dialogue systems and other scenarios, the quality problem of artificial intelligence generated content (AIGC) is increasingly prominent. The current mainstream text quality evaluation methods mainly include: rule-based or statistical language specification detection (such as spelling, grammar checking), fact consistency verification based on semantic similarity or question-answer alignment, and black-box evaluation mechanism relying on large model scoring. The above-mentioned technologies in text quality evaluation rely on surface syntax checking, semantic similarity matching or language model black-box scoring, and the effect of text detection evaluation is still difficult to meet the actual demand.
[0003] It should be noted that the information disclosed in the above background section is only used to strengthen the understanding of the background of the present disclosure, and therefore can include information that does not constitute prior art known to those of ordinary skill in the art. SUMMARY
[0004] The present disclosure provides a text quality detection method, an electronic device and a program product, which at least partially solves the problem that the related art text quality evaluation relies on surface syntax checking, semantic similarity matching or language model black-box scoring, and the effect of text detection evaluation is still difficult to meet the actual demand.
[0005] Other characteristics and advantages of the present disclosure will become apparent from the following detailed description, or will be learned by practice of the present disclosure.
[0006] According to one aspect of the present disclosure, a text quality detection method is provided, comprising: performing structural analysis on input text, extracting language components, syntax relationships and entity information, and constructing a semantic tree structure based on the language components, syntax relationships and entity information; constructing a causal graph based on the semantic tree structure, and assigning weights to causal edges in the causal graph according to a multi-layer time consistency tensor to obtain a weighted causal graph; wherein the multi-layer time consistency tensor reflects time and context consistency; calculating a logical consistency score based on the weighted causal graph; when the logical consistency score is lower than a preset score threshold, locating a causal relationship with logical conflicts and identifying a conflict type according to the multi-layer time consistency tensor to obtain a conflict causal chain containing the conflict type and the location; wherein the conflict type includes time conflict, logical conflict or context conflict.
[0007] In one embodiment of the present disclosure, the input text is subjected to structured analysis to extract linguistic components, grammatical relationships and entity information, and a semantic tree structure is constructed based on the linguistic components, grammatical relationships and entity information, comprising: performing sentence segmentation on the input text to obtain a sentence sequence; performing structured analysis on the sentence sequence to extract linguistic components, grammatical relationships and entity information, and constructing a semantic tree structure based on the linguistic components, grammatical relationships and entity information.
[0008] In one embodiment of the present disclosure, the sentence sequence is subjected to structured analysis to extract linguistic components, grammatical relationships and entity information, and a semantic tree structure is constructed based on the linguistic components, grammatical relationships and entity information, comprising: performing word segmentation and part-of-speech tagging on the sentence sequence to obtain a plurality of words and the part-of-speech of each word; performing dependency syntax analysis based on the plurality of words and the part-of-speech of each word to obtain dependency relationships between the plurality of words; identifying named entities in the sentence sequence; and constructing a semantic tree structure based on the dependency relationships between the plurality of words and the named entities in the sentence sequence.
[0009] In one embodiment of the present disclosure, a causal graph is constructed based on the semantic tree structure, and a weighted causal graph is obtained by assigning weights to the causal edges in the causal graph according to a multi-layer time consistency tensor, comprising: extracting causal event triples from the semantic tree structure, the causal event triples including a timestamp vector, a context vector and a source weight; constructing the causal event triples into a causal graph; determining dynamic weights of the causal edges in the causal graph according to the multi-layer time consistency tensor, and assigning weights to the causal edges in the causal graph to obtain a weighted causal graph.
[0010] In one embodiment of the present disclosure, the dynamic weights of the causal edges in the causal graph are determined according to the multi-layer time consistency tensor, comprising: calculating the dynamic weights of the causal edges in the causal graph based on explicit time consistency, implicit time inference consistency and context time stability.
[0011] In one embodiment of the present disclosure, the dynamic weights of the causal edges in the causal graph are calculated based on explicit time consistency, implicit time inference consistency and context time stability, comprising: calculating the dynamic weights of the causal edges in the causal graph based on explicit time consistency, a first weight corresponding to the explicit time consistency, implicit time inference consistency, a second weight corresponding to the implicit time inference consistency, context time stability, and a third weight corresponding to the context time stability; wherein the first weight is greater than the second weight, and the second weight is greater than the third weight.
[0012] In one embodiment of the present disclosure, a logical consistency score is calculated based on the weighted causal graph, comprising: calculating the logical consistency score based on the total number of causal edges in the weighted causal graph, the dynamic weights of the causal edges, and the structural consistency score of the causal edges.
[0013] In one embodiment of the present disclosure, the method further comprises: extracting a conflict position and context in the input text based on the conflict causal chain and the conflict position context vector; generating a plurality of candidate repair schemes based on the conflict type; determining a target repair scheme from the plurality of candidate repair schemes using logical consistency scoring and semantic coverage; and repairing the conflict position and context extracted from the original input text based on the target repair scheme to obtain a repaired text, the target repair scheme including at least one of predicate replacement, time marker adjustment, and intermediate event supplementation.
[0014] According to yet another aspect of the present disclosure, an electronic device is provided, comprising: a memory for storing instructions; and a processor for invoking the instructions stored in the memory to implement the text quality detection method described above.
[0015] According to yet another aspect of the present disclosure, a computer-readable storage medium is provided, having stored thereon computer instructions which, when executed by a processor, implement the text quality detection method described above.
[0016] According to yet another aspect of the present disclosure, a computer program product is provided, having stored instructions which, when executed by a computer, cause the computer to implement the text quality detection method described above.
[0017] According to yet another aspect of the present disclosure, a chip is provided, comprising at least one processor and an interface; the interface is configured to provide program instructions or data for the at least one processor; and the at least one processor is configured to execute the program instructions to implement the text quality detection method described above.
[0018] The text quality detection method, electronic device and program product provided by the embodiments of the present disclosure achieve deep syntactic semantic parsing of text by constructing a semantic tree structure, and on this basis, extract causal relationships and construct a weighted causal graph. A multi-layer time sequence consistency tensor is innovatively introduced to comprehensively quantify the rationality of causal edges from three dimensions of explicit time markers, implicit time sequence inference and context stability. This scheme not only realizes the structured and quantifiable evaluation of logical consistency, but also accurately locates the conflict position and classifies the conflict type (time / logical / context conflict) when the score is lower than the threshold, significantly improving the accuracy and traceability of the detection. Compared with the prior art, the embodiments of the present disclosure deeply integrate causal reasoning, time sequence modeling and graph analysis to form an automatic detection closed loop for logical quality, which has outstanding technical effects in improving the reliability of AIGC content, reducing the cost of manual review, and enhancing the robustness of the system.
[0019] It should be understood that the foregoing general description and the following detailed description are only exemplary and explanatory, and cannot limit the present disclosure. BRIEF DESCRIPTION OF DRAWINGS
[0020] The accompanying drawings, which are incorporated herein and constitute part of the specification, illustrate embodiments consistent with the present disclosure and, together with the description, further serve to explain the principles of the present disclosure.
[0021] It is apparent that the accompanying drawings in the following description merely show some embodiments of the present disclosure and can assist a person of ordinary skill in the art to obtain other drawings based on these drawings without creative effort.
[0022] Figure 1 A flow chart of a text quality detection method in an embodiment of the present disclosure is shown; Figure 2 A flow chart of a semantic tree structure construction in an embodiment of the present disclosure is shown; Figure 3 Another flow chart of a semantic tree structure construction in an embodiment of the present disclosure is shown; Figure 4 A flow chart of a causal graph atlas weighting in an embodiment of the present disclosure is shown; Figure 5 A flow chart of a text repair in an embodiment of the present disclosure is shown; Figure 6 Another flow chart of a text quality detection method in an embodiment of the present disclosure is shown; Figure 7 A schematic diagram of a semantic tree structure in an embodiment of the present disclosure is shown; Figure 8 A schematic diagram of a text quality detection device in an embodiment of the present disclosure is shown; Figure 9 A structural block diagram of an electronic device in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION
[0023] To facilitate understanding of the technical solutions of the present disclosure, the present disclosure will be further described below with reference to the accompanying drawings.
[0024] The terms "first" and "second" and the like in the specification of the present disclosure, claims and drawings are only used to distinguish different objects, and are not used to describe a specific order. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device, etc. including a series of steps or units is not limited to the listed steps or units, but can optionally include other steps or units not listed or inherent to the process, method, product or device, etc.
[0025] The term "embodiment" as used herein means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this disclosure. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0026] In this disclosure, "at least one (item)" means one or more, "more than" means two or more, "at least two (items)" means two or three or more, and "and / or" is used to describe the relationship between related objects, indicating that there can be three relationships. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist simultaneously, where A and B can be singular or plural. "Or" indicates that there can be two relationships, such as only A exists and only B exists; when A and B are not mutually exclusive, it can also mean that there are three relationships, such as only A exists, only B exists, and A and B exist simultaneously. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items. For example, at least one (item) of a, b, or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c".
[0027] To facilitate understanding, the relevant concepts involved in this disclosure are explained below: Causal structure: refers to the logical chain of "cause → action → result" described in the text. For example: Because he was late, he missed the interview. In quality assessment, it is used to judge whether the text is logically sound and coherent.
[0028] Extended trigger word library: Based on the traditional trigger word list, a set of causal trigger words is constructed by combining semantic pattern mining and dynamic generation mechanisms. It not only includes explicit causal markers (such as "because...therefore...", "cause"), but also covers implicit inference trigger patterns (without explicit markers but with logical causal inference).
[0029] Multi-layer temporal consistency tensor: A three-dimensional data structure used to quantify the degree of temporal consistency of causal chains. It includes three dimensions: explicit temporal consistency, implicit temporal inference consistency, and contextual temporal stability. Each dimension has a value range of 0 to 1, and the overall consistency score can be calculated by combining weights.
[0030] Weighted Causal Graph (G=(V,E,W)): A graph structure constructed with causal events as the node set V, causal relationships as the edge set E, and consistency weights as W. W reflects the temporal and contextual rationality score of each causal relationship, used to support conflict detection and visualization.
[0031] Consistency scoring is a rating of whether the causal structure in a text is reasonable, complete, and consistent. A higher score indicates clearer logical relationships and higher credibility. It is used to quantitatively assess text quality, facilitating system-wide judgment of merit.
[0032] Conflict Repair Closed Loop: This refers to the system automatically locating the problem and generating modification suggestions after discovering causal conflicts or breaks in the text, then re-evaluating it, forming a cycle of "evaluation → repair → re-evaluation". This mechanism automates and makes the text quality optimization process traceable.
[0033] With the development of artificial intelligence, especially large language models (LLM), text data is widely used in scenarios such as intelligent question answering, summary generation, education, and law. Its quality directly affects the model training effect and the accuracy, stability, and controllability of the system output.
[0034] The inventors discovered that existing text quality assessment methods mainly include: Language standardization checks: such as spelling, grammar, and repetition, focusing on the surface form of the text; Semantic or factual consistency assessment: Based on methods such as semantic alignment and question-answering verification, determine whether the generated content matches the original text or facts; Manual scoring or template rule systems: suitable for some scenarios, but have high labor costs and are difficult to scale; Large model scoring mechanisms: such as text scoring in GPT-like models, but these are usually black-box outputs, lacking structural interpretation and traceability.
[0035] However, the above methods generally ignore the causal relationships and logical structure in the text, making it difficult to identify deep-seated problems such as "missing causal relationships," "contradictions," and "logical breaks," which are especially common in AI-generated text and directly affect the credibility and security of the content.
[0036] Causal graphs, as an important form of modeling the "cause-action-effect" logical relationship in text, possess excellent structural expressiveness and interpretability, and are key to supporting logical consistency judgments. However, a systematic method for automatically modeling and evaluating text quality using causal graphs is currently lacking. The proposed embodiment of this disclosure provides a text quality detection and evaluation method based on causal graph modeling and consistency analysis. This method can structurally extract causal relationships from text, perform logical consistency scoring, locate conflicts and defects, and generate optimization suggestions, thereby constructing an interpretable, reproducible, and closed-loop intelligent text quality control system.
[0037] The deficiencies of the above solutions and the proposed solutions are the result of the inventor's practice and careful research. Therefore, the discovery process of the above problems and the solutions proposed in this disclosure below should be considered as the inventor's contribution to this disclosure.
[0038] It is understood that the data involved in this disclosure (including but not limited to the data itself, the acquisition or use of the data) shall comply with the requirements of relevant laws, regulations and provisions. Before using the technical solutions disclosed in the embodiments of this disclosure, users shall be informed of the types, scope of use, and usage scenarios of the personal information involved in this disclosure in an appropriate manner in accordance with relevant laws and regulations, and their authorization shall be obtained.
[0039] The solutions disclosed herein can be widely applied to scenarios such as artificial intelligence generated content (AIGC), dialogue systems, text review, knowledge base construction, and intelligent document management.
[0040] The following detailed description of this exemplary implementation method is provided in conjunction with the accompanying drawings and embodiments.
[0041] Figure 1 This diagram illustrates a text quality detection method according to an embodiment of the present disclosure, such as... Figure 1 As shown, the text quality detection method provided in this embodiment includes S101-S104.
[0042] In S101, the input text is subjected to structured analysis to extract language components, grammatical relations and entity information, and a semantic tree structure is constructed based on the language components, grammatical relations and entity information.
[0043] The input text undergoes word segmentation, part-of-speech tagging, dependency parsing, and named entity recognition to extract language components, grammatical relations, and entity information, which are then integrated into a semantic tree structure. This step transforms unstructured text into a structured representation with hierarchical semantics and syntactic relations, providing an accurate semantic foundation for subsequent causal relationship identification. It overcomes the limitations of traditional methods that rely solely on keywords or surface semantics, enabling explicit modeling of the internal logical structure of sentences (such as subject-verb-object and causal complex sentence structures), significantly improving the accuracy of subsequent causal extraction.
[0044] In S102, a causal graph is constructed based on a semantic tree structure, and weights are assigned to the causal edges in the causal graph according to the multi-layer temporal consistency tensor to obtain a weighted causal graph; wherein, the multi-layer temporal consistency tensor reflects the consistency of time and context.
[0045] Based on semantic tree recognition of causal relationships, a causal graph is constructed with events as nodes and causal relationships as edges. A multi-layered temporal consistency tensor (covering explicit time, implicit temporal inference, and contextual stability) is introduced to assign dynamic weights to each causal edge, forming a weighted causal graph. For the first time, the rationality of multi-dimensional temporal relationships is quantified and integrated into the graph weight calculation, enabling the system not only to determine "whether causation exists" but also to evaluate "whether the causation is reasonable in time and context," thereby effectively identifying errors that appear grammatically correct but are logically absurd (such as "the match was postponed to yesterday due to heavy rain").
[0046] In S103, a logical consistency score is calculated based on a weighted causal graph.
[0047] Based on the weights and structural rationality of each edge in the weighted causal graph, a full-text-level logical consistency score is calculated to achieve a quantitative assessment of the overall logical quality of the text. This provides interpretable and comparable numerical indicators, replacing black-box scoring and facilitating automated decision-making (such as whether manual review or repair is required).
[0048] In S104, when the logical consistency score is lower than the preset score threshold, the causal relationship with logical conflict is located and the conflict type is identified based on the multi-layer temporal consistency tensor, resulting in a conflict causal chain containing the conflict type and location; where the conflict type includes temporal conflict, logical conflict or contextual conflict.
[0049] When the score is below the threshold, the system backtracks through the multi-layer temporal consistency tensor to locate the specific conflict edge and identifies the conflict type (temporal conflict, logical conflict, or contextual conflict) based on the low score dimension. It outputs the conflict causal chain with position and type, realizing the leap from "overall score" to "local attribution", supporting accurate diagnosis and subsequent repair, and greatly improving the interpretability and practicality of the system.
[0050] The above steps constitute a structured, quantifiable, and traceable logical quality detection closed loop, which effectively solves the technical problem of automatically identifying deep logical errors such as causal breaks, time reversals, and abrupt contextual errors in AIGC texts. It has made significant progress in improving content credibility, reducing review costs, and enhancing the robustness of intelligent systems.
[0051] In some embodiments, the input text undergoes structured analysis to extract linguistic components, grammatical relations, and entity information, and a semantic tree structure is constructed based on these components, which may include... Figure 2 S201-S202 are shown.
[0052] In S201, the input text is segmented into sentences to obtain a sentence sequence.
[0053] The input text is segmented into sentences, which are divided into a sequence of sentences that are semantically complete and logically independent. This ensures that subsequent analysis is performed on reasonable semantic units and avoids interference from sentence boundaries.
[0054] In S202, the sentence sequence is subjected to structured analysis to extract language components, grammatical relations and entity information, and a semantic tree structure is constructed based on language components, grammatical relations and entity information.
[0055] Based on sentence sequences, natural language processing techniques such as word segmentation, part-of-speech tagging, dependency parsing, and named entity recognition are used to extract the linguistic components, grammatical dependencies, and key entities of each sentence. This information is then integrated to construct a semantic tree structure, which explicitly expresses the hierarchical semantics and logical structure within the sentence.
[0056] This disclosure transforms raw unstructured text into an intermediate representation with a clear syntactic-semantic structure, providing a high-precision, structured input foundation for subsequent causal relationship extraction and logical consistency modeling. Compared to directly performing keyword matching or shallow semantic analysis on the raw text, this solution significantly improves the ability to understand complex sentence structures (such as nested causal complex sentences and implicit logical connections), effectively supporting the accurate detection of deep logical errors and serving as a key prerequisite for achieving high-quality text logic evaluation.
[0057] In some implementations, structured analysis is performed on sentence sequences to extract linguistic components, grammatical relations, and entity information. A semantic tree structure is then constructed based on these components, which may include... Figure 3 S301-S304 are shown.
[0058] In S301, the sentence sequence is segmented and part-of-speech tagging is performed to obtain multiple segments and the part-of-speech tag for each segment.
[0059] By segmenting words and tagging parts of speech, sentences are broken down into basic language units (such as nouns and verbs), clarifying the grammatical roles of each word.
[0060] In S302, dependency parsing is performed based on multiple word segments and the part-of-speech tag of each word segment to obtain the dependency relationships between multiple word segments.
[0061] Dependency parsing based on part-of-speech information identifies grammatical dependency relationships between words (such as subject-verb, verb-object, adverbial, etc.) and reveals the syntactic skeleton of sentences.
[0062] In S303, named entities are identified in the sentence sequence.
[0063] Further identify named entities (such as names, times, places, events, etc.) in sentences to enhance the accuracy of semantic understanding.
[0064] In S304, a semantic tree structure is constructed based on the dependencies between multiple word segments and named entities in the sentence sequence.
[0065] By integrating dependency relationships and named entity information, a hierarchical semantic tree structure is constructed to fully express the grammatical structure and core semantic elements of a sentence.
[0066] This disclosure transforms the original text into a structured intermediate representation that combines syntactic structure and semantic elements. It not only preserves key logical components such as event subjects, actions, and time, but also explicitly depicts the dependency and modification relationships between them. This deep parsing significantly improves the accuracy of subsequent causal relationship extraction, particularly in identifying implicit causality, complex sentences, and cross-component logical connections, laying a solid technical foundation for achieving high-precision logical consistency detection.
[0067] In some embodiments, a causal graph is constructed based on a semantic tree structure, and weights are assigned to the causal edges in the causal graph according to a multi-layer temporal consistency tensor to obtain a weighted causal graph, which may include... Figure 4 S401-S403 are shown.
[0068] In S401, causal event triples are extracted from the semantic tree structure. The causal event triples include a timestamp vector, a context vector, and a source weight.
[0069] Based on the semantic tree structure, causal event triples (cause event – causal relationship – result event) are identified and extracted. Each triple is then appended with a timestamp vector (reflecting the event sequence), a context vector (characterizing the context theme), and a source weight (representing confidence level) to form a standardized causal knowledge unit.
[0070] In S402, causal event triples are constructed into a causal graph.
[0071] By integrating multiple causal event triples, a causal graph is constructed with events as nodes and causal relationships as edges, explicitly expressing the complex causal logic network in the text.
[0072] In S403, the dynamic weights of causal edges in the causal graph are determined based on the multi-layer temporal consistency tensor, and weights are assigned to the causal edges in the causal graph to obtain a weighted causal graph.
[0073] A multi-layer temporal consistency tensor (integrating explicit temporal consistency, implicit temporal inference consistency, and contextual temporal stability) is introduced to dynamically calculate the rationality score of each causal edge and assign weights accordingly to generate a weighted causal graph.
[0074] This disclosure transforms the causal logic in text from a qualitative description into a computable, comparable, and traceable graph structure model. Through multi-dimensional temporal and contextual consistency assessment, the system can not only determine "whether causation exists," but also assess "whether the causation is valid in terms of temporal sequence and contextual logic," thereby effectively identifying deep logical errors such as "the cause occurs after the effect" or "the result seriously conflicts with the context." The resulting weighted causal graph provides a high-precision, structured foundation for subsequent logical consistency scoring and conflict localization, significantly improving the accuracy and interpretability of AI-generated text logic quality detection.
[0075] In some embodiments, the above-mentioned determination of the dynamic weights of causal edges in the causal graph based on the multi-layer temporal consistency tensor can be based on explicit temporal consistency, implicit temporal inference consistency, and contextual temporal stability to calculate the dynamic weights of causal edges in the causal graph.
[0076] In some embodiments, the dynamic weights of causal edges in the causal graph are calculated based on explicit temporal consistency, implicit temporal inference consistency, and contextual temporal stability. This can be done by calculating the dynamic weights of causal edges in the causal graph based on explicit temporal consistency, the first weight corresponding to explicit temporal consistency, the second weight corresponding to implicit temporal inference consistency, the contextual temporal stability, and the third weight corresponding to contextual temporal stability; wherein the first weight is greater than the second weight, and the second weight is greater than the third weight.
[0077] This disclosure employs a multi-layered temporal consistency tensor to calculate the dynamic weights of causal edges in a causal graph, thereby accurately assessing the quality of textual logic. Specifically, it combines explicit temporal consistency (e.g., clear chronological order), implicit temporal inference consistency (e.g., logical sequence), and contextual temporal stability (i.e., consistency between events and their context), assigning different weights (from highest to lowest priority: explicit temporal consistency, implicit temporal inference consistency, and contextual temporal stability) to reflect the importance of each factor. This method not only identifies the rationality of causal logic in text but also effectively captures potential logical breaks or inconsistencies, thus improving the quality and credibility of the text's logical structure. Ultimately, this method enhances the detection and repair accuracy of deep logical errors in text.
[0078] In some embodiments, a logical consistency score is calculated based on a weighted causal graph. This score can be calculated based on the total number of causal edges, the dynamic weights of the causal edges, and the structural consistency scores of the causal edges in the weighted causal graph. This disclosure embodiment achieves a quantitative assessment of the text's logical quality by comprehensively considering the number of causal edges, dynamic weights, and structural consistency scores, making the score more comprehensive and objective, and effectively reflecting the overall rationality and credibility of the causal chain.
[0079] In some embodiments, the above-described text quality detection method may further include Figure 5 S501-S504.
[0080] In S501, conflict locations and contexts are extracted from the input text based on conflict causal chains and conflict location context vectors.
[0081] Locate the specific position of the conflict in the original text and its context, and combine it with context vectors to ensure the restoration of semantic coherence.
[0082] In S502, multiple candidate repair schemes are generated based on the conflict type.
[0083] Based on the type of conflict (such as time conflict, abrupt context, etc.), multiple candidate repair solutions are intelligently generated (such as adjusting time, replacing predicate, and supplementing mediating events).
[0084] In S503, the target repair scheme is determined from multiple candidate repair schemes by using logical consistency scores and semantic coverage.
[0085] By combining logical consistency score (which measures the causal rationality after repair) and semantic coverage (which measures the integrity of information retention), the optimal solution, i.e. the target repair solution, is selected.
[0086] In S504, the conflict positions and context extracted from the original input text are repaired based on the target repair scheme to obtain the repaired text. The target repair scheme includes at least one of predicate replacement, time stamp adjustment, and mediating event supplementation.
[0087] The selected solution is applied to the original text to generate a logically coherent and semantically complete repaired text.
[0088] The embodiments disclosed herein construct a closed-loop optimization mechanism of "detection-location-generation-optimization-repair", which not only improves the logical rigor of AI-generated text, but also significantly reduces the cost of manual intervention and enhances the system's self-healing ability and output reliability.
[0089] This disclosure aims to address the problem that existing technologies, which rely on surface-level syntax checking, semantic similarity matching, or large-scale black-box scoring, struggle to identify deep logical flaws such as "time reversal," "causal break," and "contextual abruptness." This disclosure automatically extracts causal event triples from text, constructs a weighted causal graph, and combines it with a multi-layered temporal consistency tensor for logical consistency scoring. When logical conflicts are detected, the problem location can be precisely pinpointed, and optimization suggestions can be generated, forming a closed-loop mechanism of "identification—scoring—repair." This achieves a structured, quantifiable, interpretable, and repairable automatic assessment of textual logical quality, significantly improving the detection rate and repair capability of deep logical errors, and outputting traceable hierarchical evidence and reusable logical evolution data.
[0090] The following is for reference. Figure 6 This disclosure provides a detailed description of the text quality detection method provided in the embodiments.
[0091] like Figure 6 As shown, the original text T is first standardized to obtain a cleaned sentence sequence. As an example, a series of processes can be performed on the original text T, including: cleaning up noisy characters (special symbols, control codes, etc.); standardizing capitalization, punctuation, and line breaks; and removing HTML tags and hyperlinks. Then, sentence segmentation is performed, dividing the unsegmented continuous text T into several semantically complete and logically clear sentences. , , ..., This provides the basic unit for subsequent event extraction and causal analysis, resulting in the cleaned sentence sequence { , , ..., }
[0092] Next, perform syntactic and syntactic structure analysis on the cleaned sentence sequence to obtain semantic tree structure data. As an example, through natural language processing techniques, each sentence can be structurally analyzed to extract linguistic components, syntactic relations, and entity information, providing a structured semantic basis for subsequent causal event extraction and graph modeling.
[0093] For the cleaned sentence sequence { , , ..., }, perform word segmentation and词性 tagging. Use Chinese word segmentation tools or English Tokenizers to segment each sentence and identify nouns, verbs, adjectives, adverbs, conjunctions, etc.; the output structure example is as follows: {"token": "He", "POS ": "pronoun"}, {"token": "is ill", "POS ": "verb"}, {"token": "already", "POS ": "adverb"} Then perform dependency syntactic analysis to identify the dependency relationships between words. Common dependency relationships: subject (SBV), verb-object (VOB), attributive-middle (ATT), adverbial-middle (ADV), complement (CMP), verb aspect information (ASP), etc.
[0094] Output structure example: Analyzing the sentence "He took the medicine" gives: "took" ←SBV— "He"; "took" ←VOB— "medicine"; "took" ←ASP— "already".
[0095] Next, perform named entity recognition using NER models or toolkits (such as LTP, spaCy, transformer-based NER) to identify entities with specific semantic roles in the sentence, such as person names, place names, organization names, times, numerical values, etc.
[0096] Construct a semantic tree structure by integrating the dependency structure of the sentence and entity annotation to construct a tree-like structure representation for semantic understanding.
[0097] Output structure example: Because he has a cold, so he asks for leave, refer to Figure 7 .
[0098] After that, perform causal event unit extraction on the semantic tree structure data to transform the semantic tree structure into a standardized causal event triple set for causal graph modeling.
[0099] It should be noted that in the translation of "词性 tagging", it is not very clear what is specifically meant in the original Chinese. The above translation is a rough approximation. And for some specific technical terms, it is recommended to adjust according to the actual context and professional knowledge.As an example, the processing flow for semantic tree structure data includes: using an extended trigger lexicon to identify explicit and implicit causal markers. This lexicon can be automatically expanded through corpus statistics and semantic similarity inference, and the word weights can be dynamically adjusted in combination with historical matching results; combining the explicit / implicit time dimensions of dependency syntax relations and multi-level temporal consistency tensors to determine the boundaries of causal units, remove modifying phrases, and ensure that the logical core is not disturbed; and mapping different expressions to a unified event identifier (EventID) through a cross-context event coreization mechanism to ensure the consistency of causal nodes, resulting in a standardized set of causal triples (Cause, Relation, Effect, Attr), where Attr contains a timestamp vector, a context vector, and a source weight.
[0100] Then, a dynamically weighted causal graph is constructed. The processing flow for the standardized causal triple set (including time, context, and source weights) includes: constructing the triples into a causal graph; and calculating the dynamic weights of causal edges based on a multi-layer temporal consistency tensor (explicit temporal consistency, implicit temporal inference consistency, contextual temporal stability, and a weighted average of consistency scores, reflecting comprehensive temporal consistency).
[0101] in, It is a comprehensive credibility score of a causal relationship, used to measure whether it is valid in terms of time, logic and context. It serves as the direct basis for subsequent scoring, conflict detection and repair.
[0102] This indicates the score for explicit temporal consistency. This represents the consistency score for implicit temporal inference. This represents the contextual temporal stability score. α, β, and γ represent the adjustable weight coefficients for different dimensions (α+β+γ=1).
[0103] The weighted causal graph structure is G=(V,E,W), where V represents the set of event nodes in the graph, with each node corresponding to a standardized event (i.e., the EventID extracted above), such as V1 = "Signing a contract (2025-08-13)" and V2 = "Not cooperating (2025-08-14)". E1 represents the set of causal relationships between event nodes, with each edge representing a causal chain, such as E1 =(V1—V2, Type=Time-Causal). W is the dynamic weight of each causal edge, calculated from a multi-layer temporal consistency tensor.
[0104] For example: "He signed the contract yesterday, but decided not to cooperate today."
[0105] Assumption: = 1.0, explicit time: yesterday to today, the order is reasonable.
[0106] = 0.9, Implicit time inference: The action of signing the contract should have preceded the decision of "not cooperating", so a score of 0.9, slightly lower than the full score, was given, indicating that it is likely reasonable but not absolute.
[0107] = 0.4, Contextual event: The sudden appearance of "non-cooperation" is correct in chronological order, but it conflicts with the overall context, so a low score of 0.4 was given.
[0108] In some embodiments, the weighting coefficients are taken as follows: α = 0.5, with explicit temporal consistency having the highest weight as the most direct and objective basis for causal order.
[0109] β = 0.3, implicit time is the primary criterion for judgment when there is no explicit time, and its weight is the second highest.
[0110] γ = 0.2, contextual temporal stability is mainly used to detect abrupt contextual changes or thematic conflicts, so it has the lowest weight.
[0111] Substitute into the formula: = 0.5 × 1.0 + 0.3 × 0.9 + 0.2 × 0.4 = 0.83 This indicates that the causal chain is basically reasonable in terms of time sequence, but there is a clear conflict in the context (leading to a decrease in the overall weight).
[0112] Consistency scoring and conflict localization: This step summarizes the credibility of all causal relationships into a full-text logical consistency score.
[0113] The processing flow for the weighted causal graph G is as follows: Calculate the logical consistency score using the following formula:
[0114] Where E represents the set of all causal relationships (causal edges) in the text. This represents the total number of causal edges, used to calculate the average value. This represents a causal edge, from event i (Cause) to event j (Effect). This represents the overall credibility weight of the causal edge (derived from the weighted calculation of the multi-layer temporal consistency tensor mentioned earlier, ranging from 0 to 1). The structural consistency score of the causal edge reflects the causal type matching degree and the semantic rationality of the event (range 0~1).
[0115] The conflict localization module is activated only when the total logical consistency score of the entire text is less than θ.
[0116] Once an edge is identified as potentially conflicting, its multi-level temporal consistency tensor is checked: if Significantly low values (e.g., <0.5) are marked as explicit time conflicts; if The value is significantly lower, and it is marked as an implicit logical conflict. if The value is significantly lower, and it is marked as a contextual conflict.
[0117] Each conflict edge is recorded as a structured object, forming a list of conflict causal chains. This yields the following: a textual logical consistency score (0–100); and a list of conflict causal chains (including conflict type and location).
[0118] Adaptive conflict resolution generation can be performed on a list of conflict causal chains and contextual vectors of conflict nodes, following the process: Extract conflict nodes and their context; Multiple candidate repair solutions are generated based on causal type (predicate replacement, time stamp adjustment, and mediator event supplementation). The optimal solution is selected and replaced with the original text using consistency score and semantic coverage. Output: The repaired text version and a list of repair solutions (including candidates and scores).
[0119] Logical evolution chain tracing performs the following processing flow on the text and causal graph data before and after repair, as well as the repair scheme and score change records: compare the causal graphs before and after repair, record the modified triples, weight changes, score changes, and repair reasons; store in the logical evolution database, supporting retrieval and report generation; output: logical evolution chain (including version sequence, score curve, and repair reason classification), and exportable logical evolution report (for manual review or model retraining).
[0120] In one specific embodiment, the input text is: "Due to heavy rain, the match was postponed to yesterday." The processing flow is as follows: The three-person group draw (heavy rain, cause, postponed the match), (postponed the match, cause, took place yesterday); Tensor weights are calculated as follows: W = 0.92 for the first line and W = 0.35 for the second line. Consistency score, total score 63 (below the threshold of 75); The following options were generated after the repair: "Postponed to today", "Postponed to tomorrow", "Postponed to yesterday afternoon (with background reasons)". Select "Postpone to today" as the final fix; Evolutionary chain record, ΔScore=+26, reason for repair=time conflict; Output: The corrected text reads: "Due to heavy rain, the match has been postponed to today." Consistency score: 89; Logical evolution chain: Version 1 (63 points) — Version 2 (89 points).
[0121] This disclosure proposes for the first time a "multi-layer temporal consistency tensor" structure, which unifies the modeling of three dimensions: explicit time, implicit inference, and contextual temporal stability, and introduces a dynamic weighting mechanism to accurately quantify the credibility of causal relationships at the graph structure level. Simultaneously, by combining an adaptive conflict repair generation mechanism with a traceable logical evolution chain, it achieves closed-loop control throughout the entire process from detection and repair to re-evaluation, significantly improving the accuracy of logical error detection, automated repair capabilities, and system interpretability.
[0122] Based on the same inventive concept, this disclosure also provides a text quality detection device, such as... Figure 8 As shown, the text quality detection device includes a structured analysis module 801, a graph construction module 802, a consistency scoring module 803, and a quality detection module 804.
[0123] The structured analysis module 801 is used to perform structured analysis on the input text, extract language components, grammatical relations and entity information, and construct a semantic tree structure based on language components, grammatical relations and entity information; The graph construction module 802 is used to construct a causal graph based on a semantic tree structure, and to assign weights to the causal edges in the causal graph according to the multi-layer temporal consistency tensor to obtain a weighted causal graph; wherein, the multi-layer temporal consistency tensor reflects the consistency between time and context. The consistency scoring module 803 is used to calculate the logical consistency score based on the weighted causal graph. The quality inspection module 804 is used to locate the causal relationship with logical conflict and identify the conflict type based on the multi-layer temporal consistency tensor when the logical consistency score is lower than the preset score threshold, and obtain the conflict causal chain containing the conflict type and location; wherein, the conflict type includes temporal conflict, logical conflict or contextual conflict.
[0124] In some embodiments, the text quality detection device further includes a text repair module.
[0125] The text repair module is used to extract conflict locations and contexts from the input text based on the conflict causal chain and the context vector of the conflict location; generate multiple candidate repair schemes based on the conflict type; determine the target repair scheme from the multiple candidate repair schemes using logical consistency score and semantic coverage; and repair the conflict locations and contexts extracted from the original input text based on the target repair scheme to obtain the repaired text. The target repair scheme includes at least one of predicate replacement, time stamp adjustment, and mediating event supplementation.
[0126] The concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to define the order of functions performed by these devices, modules or units or their interdependencies.
[0127] Regarding the text quality detection device in the above embodiments, the specific way in which each module performs its operation has been described in detail in the embodiments related to the text quality detection method, and will not be elaborated here.
[0128] It should be noted that although several modules or units for the device used to perform actions have been mentioned in the detailed description above, this division is not mandatory. In fact, according to embodiments of this disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided and embodied by multiple modules or units.
[0129] Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software, in one or more hardware modules or integrated circuits, or in different network and / or processor devices and / or microcontroller devices.
[0130] The following reference Figure 9 This describes the electronic device provided in the embodiments of this disclosure. Figure 9 The electronic device 900 shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments disclosed herein.
[0131] Figure 9 This diagram illustrates the architecture of an electronic device 900 provided in an embodiment of the present invention. Figure 9 As shown, the electronic device 900 includes, but is not limited to, at least one processor 910 and at least one memory 920. The memory 920 is used to store instructions.
[0132] In some embodiments, memory 920 may include a readable medium in the form of volatile memory cells, such as random access memory (RAM) 9201 and / or cache 9202, and may further include read-only memory (ROM) 9203.
[0133] In some embodiments, the memory 920 may also include a program / utility 9204 having a set (at least one) program module 9205, such program module 9205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of these examples may include an implementation of a network environment.
[0134] In some embodiments, the memory 920 may also store data.
[0135] As an example, processor 910 can read data stored in memory 920, which may be stored at the same memory address as the instruction, or the data may be stored at a different memory address than the instruction.
[0136] Processor 910 is configured to invoke instructions stored in memory 920 to implement the steps described in the "Exemplary Methods" section above, according to various exemplary embodiments of this disclosure. For example, processor 910 can execute the steps of the above-described text quality detection method embodiments.
[0137] It should be noted that the processor 910 described above can be a general-purpose processor or a special-purpose processor. The processor 910 may include one or more processing cores, and the processor 910 executes various functional applications and data processing by running instructions.
[0138] In some embodiments, processor 910 may include a central processing unit (CPU) and / or a baseband processor.
[0139] In some embodiments, the processor 910 may determine an instruction based on the priority identifier and / or function category information carried in each control instruction.
[0140] In this disclosure, the processor 910 and memory 920 can be configured separately or integrated together. As an example, the processor 910 and memory 920 can be integrated on a single board or a system-on-chip (SOC).
[0141] like Figure 9 As shown, the electronic device 900 is presented in the form of a general-purpose computing device. The electronic device 900 may also include a bus 930.
[0142] Bus 930 can represent one or more of several types of bus structures, including a memory bus or memory controller, peripheral bus, graphics acceleration port, processor, or a local bus using any of the various bus structures.
[0143] Electronic device 900 can also communicate with one or more external devices 940 (e.g., keyboard, pointing device, Bluetooth device, etc.), and with one or more devices that enable a user to interact with electronic device 900, and / or with any device that enables electronic device 900 to communicate with one or more other computing devices (e.g., router, modem, etc.). Such communication can be performed through input / output (I / O) interface 950.
[0144] Furthermore, the electronic device 900 can also communicate with one or more networks (such as local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via the network adapter 960.
[0145] like Figure 9 As shown, the network adapter 960 communicates with other modules of the electronic device 900 via the bus 930.
[0146] It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 900, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0147] It is understood that the structure illustrated in the embodiments of this disclosure does not constitute a specific limitation on the electronic device 900. In other embodiments of this disclosure, the electronic device 900 may include... Figure 9 This may involve more or fewer components, or combining certain components, or splitting certain components, or different component arrangements. Figure 9 The components shown can be implemented in hardware, software, or a combination of both.
[0148] This disclosure also provides a computer-readable storage medium storing computer instructions thereon, which, when executed by a processor, implement the text quality detection method described in the above method embodiments.
[0149] In this disclosure, the computer-readable storage medium is one capable of sending, propagating, or transmitting computer instructions for use by or in connection with an instruction execution system, apparatus, or device. As an example, the computer-readable storage medium is a non-volatile storage medium.
[0150] In some embodiments, more specific examples of computer-readable storage media in this disclosure may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, USB flash drives, portable hard drives, or any suitable combination of the foregoing.
[0151] In this embodiment of the disclosure, the computer-readable storage medium may include data signals propagated in baseband or as part of a carrier wave, wherein computer instructions (readable program code) are carried.
[0152] In some examples, computational instructions contained on a computer-readable storage medium may be transmitted using any suitable medium, including but not limited to wireless, wired, optical fiber, RF, etc., or any suitable combination thereof.
[0153] This disclosure also provides a computer program product storing instructions that, when executed by a computer, cause the computer to perform the text quality detection method described in the above-described method embodiments. These instructions may be program code. In specific implementations, the program code may be written using any combination of one or more programming languages. The program code may execute entirely on a user's computing device, partially on a user's device, as a standalone software package, partially on a user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0154] This disclosure also provides a chip, including at least one processor and an interface; the interface is used to provide program instructions or data to at least one processor; the at least one processor is used to execute the program instructions to implement the text quality detection method described in the above method embodiments.
[0155] In some embodiments, the chip may further include a memory for storing program instructions and data, the memory being located within or outside the processor.
[0156] Those skilled in the art will understand that all or part of the steps of the above embodiments can be specifically implemented in the following forms: a completely hardware implementation, a completely software implementation (including firmware, microcode, etc.), or a combination of hardware and software implementations, which can be collectively referred to as "circuit", "module" or "system".
[0157] Other embodiments of this disclosure will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein.
[0158] This disclosure is intended to cover any variations, uses, or adaptations of this disclosure that follow the general principles of this disclosure and include common knowledge or customary techniques in the art not disclosed herein. The description and examples are to be considered exemplary only, and the true scope and spirit of this disclosure are indicated by the appended claims.
Claims
1. A method of text quality detection, characterized by, The method comprises: performing structural analysis on the input text to extract language components, grammatical relationships and entity information, and constructing a semantic tree structure based on the language components, grammatical relationships and entity information; constructing a causal graph based on the semantic tree structure, and assigning weights to the causal edges in the causal graph according to a multi-layer temporal consistency tensor to obtain a weighted causal graph; wherein the multi-layer temporal consistency tensor reflects temporal and contextual consistency; calculating a logical consistency score based on the weighted causal graph; when the logical consistency score is lower than a preset score threshold, locating a causal relationship with a logical conflict and identifying a conflict type according to the multi-layer temporal consistency tensor to obtain a conflict causal chain containing the conflict type and location; wherein the conflict type includes a temporal conflict, a logical conflict or a contextual conflict.
2. The method of claim 1, wherein, The method of performing structural analysis on the input text to extract language components, grammatical relationships and entity information, and constructing a semantic tree structure based on the language components, grammatical relationships and entity information, comprises: performing sentence segmentation on the input text to obtain a sentence sequence; performing structural analysis on the sentence sequence to extract language components, grammatical relationships and entity information, and constructing a semantic tree structure based on the language components, grammatical relationships and entity information.
3. The method of claim 2, wherein, The method of performing structural analysis on the sentence sequence to extract language components, grammatical relationships and entity information, and constructing a semantic tree structure based on the language components, grammatical relationships and entity information, comprises: performing word segmentation and part-of-speech tagging on the sentence sequence to obtain a plurality of segmented words and the part-of-speech of each segmented word; performing dependency syntax analysis based on the plurality of segmented words and the part-of-speech of each segmented word to obtain dependency relationships between the plurality of segmented words; identifying named entities in the sentence sequence; constructing the semantic tree structure based on the dependency relationships between the plurality of segmented words and the named entities in the sentence sequence.
4. The method of claim 1, wherein, The method of constructing a causal graph based on the semantic tree structure, and assigning weights to the causal edges in the causal graph according to a multi-layer temporal consistency tensor to obtain a weighted causal graph, comprises: extracting causal event triples from the semantic tree structure, the causal event triples comprising a timestamp vector, a context vector and a source weight; constructing the causal event triples into a causal graph; determining dynamic weights of causal edges in the causal graph according to the multi-layer temporal consistency tensor, and assigning weights to the causal edges in the causal graph to obtain the weighted causal graph.
5. The method of claim 4, wherein, The method of determining dynamic weights of causal edges in the causal graph according to the multi-layer temporal consistency tensor, comprises: calculating the dynamic weights of the causal edges in the causal graph based on explicit temporal consistency, implicit temporal inference consistency and contextual temporal stability.
6. The method of claim 5, wherein, The method of calculating the dynamic weights of the causal edges in the causal graph based on explicit temporal consistency, implicit temporal inference consistency and contextual temporal stability, comprises: calculate a dynamic weight of a causal edge in the causal graph based on explicit time consistency, a first weight corresponding to the explicit time consistency, implicit time sequence inference consistency, a second weight corresponding to the implicit time sequence inference consistency, context time stability, and a third weight corresponding to the context time stability; wherein the first weight is greater than the second weight, and the second weight is greater than the third weight.
7. The method of claim 1, wherein, The logic consistency score is calculated based on the weighted causal graph, including: The logic consistency score is calculated based on the total number of causal edges in the weighted causal graph, the dynamic weight of the causal edge, and the structural consistency score of the causal edge.
8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: extracting a conflict position and context in the input text based on the conflict causal chain and the conflict position context vector; generating a plurality of candidate repair schemes based on the conflict type; determining a target repair scheme from the plurality of candidate repair schemes using the logic consistency score and the semantic coverage rate; repairing the conflict position and context extracted from the original input text based on the target repair scheme to obtain a repaired text, wherein the target repair scheme includes at least one of predicate replacement, time label adjustment, and intermediate event supplementation.
9. An electronic device, comprising: including: a memory for storing instructions; a processor for calling the instructions stored in the memory to implement the text quality detection method according to any one of claims 1-8.
10. A computer program product, characterised in that, The computer program product stores instructions, which when executed by a computer, cause the computer to implement the text quality detection method according to any one of claims 1-8.