A long document extraction question answering construction method based on semantic boundary graph and bidirectional evidence consistency constraint
Patent Information
- Application Number
- CN202611265561.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-20
- Publication Date
- 2026-10-16
AI Technical Summary
[0005]本发明旨在解决长文档抽取式问答构建过程中因固定窗口或单一语义相似度导致的跨主题答案、答案边界不完整、证据不能完整支持答案以及问题—答案—证据之间缺少闭环验证的问题,并提高问答样本对原始长文档的可追溯性
[0008]利用语义变化、实体变化、标题层级、时间或条件变化以及上下文连接关系等多维特征确定语义边界,可降低仅依赖向量距离造成的错误边界判断;
Smart Images

Figure CN122925564A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of natural language processing technology, specifically to a method for constructing long document extraction-based question answering based on semantic boundary graphs and bidirectional evidence consistency constraints. Background Technology
[0002] For long documents such as technical documents, product manuals, corporate policies, laws and regulations, research papers, and industry reports, existing extractive question-answering data construction typically uses fixed-length windows, sentence-by-sentence segmentation, or text vector similarity to determine candidate text regions, and then constructs questions and answers from these candidate regions. Since long documents often have multi-level headings, multiple topics, continuous entity relationships, and contextual relationships such as time and conditions, processing them solely based on fixed length or single vector distance can easily lead to candidate answers spanning different semantic topics, or misinterpreting normal semantic transitions as topic boundaries.
[0003] On the other hand, even if the question, answer, and evidence are semantically related, the selected evidence may still not fully support the answer; or when judging from the answer and evidence in reverse, it may be impossible to determine the actual relationship asked in the question. Existing solutions, if they only perform question-answer relevance or one-way evidence matching, are unlikely to form a complete evidence loop. Furthermore, if the question-answer sample lacks information on the original text character positions, semantic regions, and evidence paths, it is difficult to subsequently trace the original text and perform automatic quality verification.
[0004] Therefore, there is a need for an extractive question-answering construction method that can determine semantic boundaries within long documents, use semantic boundaries to limit candidate question-answering regions, and jointly verify the supporting relationships between questions, answers, and evidence in both positive and negative directions. Summary of the Invention
[0005] This invention aims to address the problems of cross-topic answers, incomplete answer boundaries, incomplete evidence to support answers, and lack of closed-loop verification between questions, answers, and evidence caused by fixed windows or single semantic similarity in the construction of long document extraction question answering, and to improve the traceability of question answering samples to the original long document.
[0006] This invention provides a method for constructing long document extraction-based question answering based on semantic boundary graphs and bidirectional evidence consistency constraints. The method is implemented by a processor executing a computer program stored in memory, and includes the following steps: S1: Obtain and normalize the target long document, restore the document title, paragraphs, lists, tables and other structural information, and establish the original position index of the basic text unit, including document identifier, page number, paragraph number, character start position and character end position; S2, based on one or more of the following: sentence-ending punctuation, heading level, referential relationship, entity continuity, time continuity, topic continuity, inter-sentence conjunctions, paragraph structure, and table structure, divides basic text units into semantic units and generates semantic representations for semantic units; S3, calculate the degree of semantic change for adjacent semantic units, and further determine the characteristics of entity change, title level change, time or condition change, and context connection relationship change, and determine the strong semantic boundary based on the above characteristics; S4. Construct a semantic boundary graph based on semantic units and strong semantic boundaries, so that each semantic unit corresponds to a semantic node, adjacent semantic units have at least an order relationship, and establish continuous semantic relationships or boundary relationships based on whether there are strong semantic boundaries between adjacent semantic units. S5. Based on the semantic boundary graph, semantic nodes with continuous semantic relationships that do not cross strong semantic boundaries are combined into candidate question-answering regions, and the candidate question-answering regions are constrained by semantic continuity, entity or topic existence and information relationship integrity. S6, determine candidate answers within the candidate question-and-answer area. The candidate answers are derived from the target long document and are continuous text. The answer boundaries are determined by semantic integrity, syntactic integrity, entity integrity, relevance to the candidate question, and relationship with the semantic boundary. S7. Based on the semantic region where the candidate answer is located, determine the candidate question, establish the association between the candidate question, the candidate answer and the semantic node in the semantic boundary graph, and determine the semantic path from the question to the answer; S8, calculate positive evidence consistency for candidate questions, candidate answers and evidence fragments, wherein the positive evidence consistency is used to determine whether the evidence fragments can support the candidate answers when given a question; S9, calculate the reverse evidence consistency for candidate answers and evidence fragments, the reverse evidence consistency is used to determine whether the information or relationship asked by the candidate question can be determined in reverse when given an answer and evidence fragment; S10 performs joint screening of positive evidence consistency, negative evidence consistency, and structural consistency between candidate questions, candidate answers, evidence fragments, and semantic boundary graphs. The screened candidate questions and answers are then used to form structured extractable question and answer samples. At the same time, the original text positions, semantic boundary markers, and evidence paths of questions, answers, and evidence are saved.
[0007] This invention does not rely solely on semantic vectors for text clustering, nor does it rely solely on the similarity between evidence and answers for screening. Instead, it first uses multidimensional features to determine semantic boundaries, and then uses a semantic boundary graph to explicitly define continuous semantic regions that can form candidate questions and answers. Within these regions, continuous original text answers are determined, and it is further required that there are structural relationships between questions, answers, and evidence that conform to the semantic boundary graph. Based on this, positive and negative evidence consistency verification is performed respectively, and the two types of consistency are combined with graph structure consistency for candidate question and answer screening.
[0008] Determining semantic boundaries by using multi-dimensional features such as semantic changes, entity changes, heading level, time or conditional changes, and contextual connections can reduce erroneous boundary judgments caused by relying solely on vector distance. By distinguishing between continuous semantic relationships and boundary relationships using semantic boundary maps, candidate question-answer regions can be restricted from crossing strong semantic boundaries, thereby reducing the generation of cross-topic answers; By limiting candidate answers to continuous text within the original long document and preserving character positions, the traceability of the original text of the answer is improved. By verifying the support relationship between evidence and answer through positive evidence consistency, and by verifying whether the answer and evidence can determine the relationship asked in the question through negative evidence consistency, the number of erroneous question and answer samples caused by one-way relevance can be reduced. By jointly screening bidirectional evidence consistency and semantic boundary graph structure consistency, we can simultaneously constrain semantic regions, answer ranges, and evidence relationships, thereby improving the evidence closure and verifiability of the output question-and-answer samples. Attached Figure Description
[0009] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0010] Figure 1 This is a flowchart illustrating the overall process of the method of the present invention. Figure 2 A schematic diagram illustrating the normalization of long documents and the establishment of original position indexes; Figure 3 A schematic diagram illustrating the determination of semantic boundaries for multiple features; Figure 4 This is a schematic diagram of the semantic boundary graph structure; Figure 5 This is a schematic diagram illustrating the consistency constraints of positive and negative evidence. Figure 6 This is a diagram illustrating the comprehensive scoring and final verification. Detailed Implementation
[0011] To make the objectives, technical solutions, and technical effects of this invention clearer and more complete, the specific embodiments of this invention will be described in detail below in conjunction with the technical solutions of this invention.
[0012] This embodiment provides a method for constructing extractive question-answering data from long documents based on semantic boundary graphs and bidirectional evidence consistency constraints. This method can run on servers, workstations, or cloud computing clusters equipped with processors and memory. The processor reads and executes the computer program stored in memory to implement the following steps. This method is used to automatically construct extractive question-answering data from documents that are long, have multiple thematic levels, and complex semantic relationships.
[0013] In this embodiment, "extractive question answering" means that the question text, answer text, and supporting evidence text in the constructed question-and-answer system can all be located at their corresponding text positions in the original long document. Specifically, the question can be directly extracted from semantic units with inquiring meaning in the original text or formed from multiple semantic units in the original text according to preset combination rules; the answer maintains the continuous text form of the original text and does not generate its content freely, thus ensuring that the final answer can be traced back to the original document.
[0014] The long documents processed by this invention are not limited to documents in a single field, but can include technical documents, product manuals, corporate policies, laws and regulations, scientific research papers, industry reports, medical texts, project documents, and other texts with multiple paragraphs, multiple themes, or multiple levels of structure.
[0015] Unlike clustering methods that rely solely on vector distances between sentences, this implementation first determines the boundaries between different semantic regions within a document. Then, it constructs a semantic boundary graph with nodes and relationships using these boundaries. Based on this graph, candidate questions, candidate answers, and evidence paths are generated, and joint constraints are applied through evidence consistency in both forward and reverse directions. Therefore, the final question-and-answer output not only needs to be semantically relevant but also needs to be supported by continuous evidence from the original document.
[0016] Specifically, it includes the following steps S1 to S12.
[0017] Step S1: Obtain and normalize the long document. Obtain the target long document to be processed, perform text parsing, format normalization, and document structure restoration on the target long document to form basic text units with original position indexes.
[0018] The target long document can be an electronic document, text obtained from scanning a document and then undergoing text recognition, or structured text stored in a database.
[0019] After acquiring the target long document, first remove control characters that do not express actual semantics, repeated spaces, abnormal line breaks, and meaningless page markers, while retaining information that expresses the document structure, including: document title; first-level headings; second-level headings; third-level headings; paragraphs; list items; tables; figure captions; page numbers; and the original document location. For paragraphs spanning multiple pages, they are not truncated directly according to the page number, but are merged based on the paragraph continuity between adjacent pages. For example, if there is no sentence-ending punctuation on page P, and the beginning of page P+1 is plain text without a new heading marker, the text at the end of page P and the text at the beginning of page P+1 are considered as a single continuous text unit.
[0020] Each text unit is assigned a unique location identifier, including document identifier, page number, paragraph number, character start position, and character end position.
[0021] Through the above processing, every subsequent question, answer, and piece of evidence can be traced back to its actual location in the original document.
[0022] In one embodiment, for table content, the table header, row labels, column labels, and cell content are converted into structured text in a top-to-bottom, left-to-right order, while preserving table coordinate information. For example, "Project Name | Detection Result | Detection Date" together with the corresponding cell data form a semantic unit. For list structures, list numbers or bullet points are preserved, enabling subsequent semantic analysis to distinguish between ordinary paragraphs and content with parallel relationships.
[0023] The purpose of this step is not to directly generate questions and answers, but to create a long document representation that is traceable, locatable, and preserves the original document structure.
[0024] Step S2, as follows Figure 2 Semantic units and their basic semantic representations are constructed. The basic text obtained in step S1 is further divided into multiple semantic units according to semantic integrity.
[0025] The semantic unit can be a single sentence or a collection of consecutive sentences with complete semantic relationships. Unlike existing technologies that simply segment sentences according to line breaks or periods, this implementation further considers the following information beyond syntactic boundaries: sentence-ending punctuation; heading level; referential relationships; entity continuity; temporal continuity; thematic continuity; inter-sentence connectors; paragraph structure; and table structure. For example, “The device uses liquid cooling for heat dissipation.” and “Coolant is pumped into the heat dissipation assembly.” Although these two sentences can be considered as separate sentences, they have a strong connection in terms of the entity “coolant,” the action “heat dissipation,” and the contextual theme, thus allowing for the establishment of a continuous semantic relationship.
[0026] For each semantic unit Encode the corresponding semantic vector:
[0027] Where, represents the first indivual Semantic unit, This represents its semantic vector.
[0028] This implementation does not require limiting to a specific encoding model; a Transformer-type text encoding model or other encoding models that can map text to a unified semantic space can be used.
[0029] In one embodiment, all semantic vectors are normalized using the L2 norm, enabling comparison of vectors from different semantic units on a uniform scale. It should be noted that the semantic vectors obtained in this step serve only as the basis for subsequent boundary judgment and semantic relationship calculation; they are not used to directly generate question answers from the clustering results. This differs from existing approaches that obtain sentence vectors through contrastive learning, then cluster them to obtain vector clusters, and finally perform document analysis based on these clusters.
[0030] Step S3: Determine candidate locations for semantic boundaries. The degree of semantic change between adjacent semantic units is calculated to determine the possible locations of semantic boundaries.
[0031] For two adjacent semantic units and Calculate the degree of semantic change:
[0032] in, The larger the value, the more significant the semantic change between two adjacent semantic units.
[0033] However, this implementation method does not directly... Larger positions are identified as semantic boundaries. This is because relying solely on vector distance might misinterpret normal semantic transitions as topic boundaries, and may also fail to recognize structural information such as title and entity changes. Therefore, this implementation further acquires: semantic change features; entity change features; title level change features; time or condition change features; and conjunction change features.
[0034] In one embodiment, the above features are used to form a comprehensive boundary score:
[0035] in: The degree of semantic change; This represents the degree of change in entities within adjacent semantic units; The degree of change in document structure hierarchy; This indicates the degree of change in the contextual connection relationship; , , , For the corresponding weights. In one embodiment, take... =0.4、 =0.3、 =0.2、 =0.1, and the preset boundary threshold is 0.6; the above weights and thresholds can be adjusted according to the labeled semantic boundary samples by means of grid search or gradient descent, so as to maximize the accuracy of the comprehensive boundary score in judging the labeled strong semantic boundary positions. This invention does not limit the specific values of the weights and thresholds.
[0036] when When it exceeds the preset boundary threshold, and Strong semantic boundaries are defined between them. For example, when a long document changes from "equipment structure" to "equipment maintenance methods," even if the two topics still have some similarity at the lexical level, the overall boundary score can still be significantly higher because the heading level, core entities, and action types have all changed.
[0037] Step S4, as follows Figure 4 A semantic boundary graph is constructed based on the semantic units obtained in step S2 and the semantic boundaries obtained in step S3. The semantic boundary graph is represented as follows:
[0038] in: Represents a set of semantic nodes; Represents a set of semantic relation edges; This represents the weight corresponding to each relation edge.
[0039] Each semantic unit corresponds to a semantic node. Adjacent semantic units must establish at least a sequential relationship; when there is no strong semantic boundary between two semantic units, a continuous semantic relationship is established; when there is a clear semantic boundary between two semantic units, a boundary relationship is established. For example, a long document might contain: A. Device A includes a control module; B. The control module receives sensor data; C. Control commands are generated based on the sensor data; D. Device maintenance includes regular cleaning; E. Power needs to be disconnected during cleaning. Here, A, B, and C belong to the same technical topic, and D marks the beginning of the maintenance topic.
[0040] Therefore, AB establishes a continuous semantic relationship; BC establishes a continuous semantic relationship; CD establishes a relatively strong semantic boundary; and DE establishes a continuous semantic relationship. Thus, the semantic boundary graph not only preserves the text order but also the boundary relationships between different semantic regions.
[0041] Furthermore, such as Figure 4 Each semantic node stores its original text location, the paragraph it belongs to, its title, the entity set, time information, conditional information, and semantic vector. Thus, the semantic boundary graph possesses both semantic attributes and original text location attributes.
[0042] This step is one of the key technical features of this invention. Its function is to no longer simply represent long documents as independent sentences, but to form a structured representation that can describe "which content is continuous and which content belongs to different semantic regions".
[0043] Step S5: Generate candidate question-answering regions based on the semantic boundary graph. According to the node relationships in the semantic boundary graph, nodes with continuous semantic relationships that do not cross strong semantic boundaries are grouped into candidate question-answering regions. For any candidate region:
[0044] Require: Semantic continuity within the region; There must be at least one identifiable entity or topic within the region; Relatively complete information relationships can be formed within the region; There are no strong semantic boundaries exceeding a preset threshold at the region boundary.
[0045] By using the above constraints, we avoid directly generating candidate answers using a fixed-length window.
[0046] For example, consider the following text: "A certain device uses a liquid cooling structure. The liquid cooling structure includes a circulation pump, a heat exchanger, and cooling pipes. The circulation pump is used to circulate the coolant. The cooling pipes need to be inspected periodically during device maintenance." Using a fixed three-sentence window, "device maintenance" might be placed in the same candidate answer as the preceding description of the liquid cooling structure. However, by using a semantic boundary graph, "device maintenance" can be identified as a new semantic region, thus limiting the candidate region to: "A certain device uses a liquid cooling structure. The liquid cooling structure includes a circulation pump, a heat exchanger, and cooling pipes. The circulation pump is used to circulate the coolant." This improves the semantic completeness of the answer.
[0047] Step S6: Determine candidate answers and answer boundaries. Determine candidate answers within each candidate question-and-answer area.
[0048] Candidate answers must meet the following criteria: they come from the original document; they are continuous text; their start and end positions are locatable; they do not cross irrelevant semantic boundaries; and they contain at least one entity, attribute, action, condition, result, or relationship that can be queried by the question.
[0049] For example, the candidate text "The system includes a data acquisition module, an analysis module, and an output module. The data acquisition module is used to acquire sensor data, and the analysis module generates analysis results based on the sensor data" can be used to form the answer "The data acquisition module is used to acquire sensor data, and the analysis module generates analysis results based on the sensor data," without adding irrelevant subsequent paragraphs to the answer.
[0050] To reduce the problem of answer boundaries being too short or too long, the candidate answer boundaries are scored.
[0051] The answer boundary scoring takes into account: semantic integrity; syntactic integrity; entity integrity; relevance to the candidate question; and distance from the semantic boundary.
[0052] In one embodiment, the answer range that simultaneously satisfies both the complete sentence boundary and the semantic region boundary is preferentially selected. If an answer candidate crosses a strong semantic boundary, the quality score of that candidate answer is reduced; similarly, if an answer is within the semantic region but truncated into a complete sentence, its quality score is also reduced.
[0053] Therefore, this invention does not simply adopt the approach of "fixing after the central sentence". "One sentence as the answer". After fixing... While this sentence-by-sentence approach can maintain a certain degree of coherence, it relies heavily on the accuracy of the central sentence, and The scope is difficult to determine.
[0054] Step S7: Generate candidate questions and question-answer relationships. Based on the semantic region where the candidate answers are located, identify candidate question texts that have a direct semantic relationship with the answers from the original document.
[0055] The problem in this embodiment can be obtained by extraction or by lightweight rearrangement based on the semantic units of the original text. However, the core entities, attributes or relationships involved in the problem must be found in the original document.
[0056] For example: Original text: "Liquid cooling systems include circulating pumps, heat exchangers, and cooling piping." This raises the question: "What are the components of a liquid cooling system?" The corresponding answer is: "Circulating pump, heat exchanger, and cooling piping". For a candidate problem and answer ,Establish: The question-and-answer relationship.
[0057] Simultaneously save the original location of the question; the original location of the answer; the semantic node to which the question belongs; the semantic node to which the answer belongs; and the semantic path between the two. If there is no valid semantic path between the question and the answer, proceed to the next step.
[0058] This prevents situations where "the question seems reasonable, but the answer actually comes from another topic area in the document."
[0059] Step S8, as follows Figure 5 Establish positive evidence consistency constraints. For each candidate question-answer pair, determine the corresponding evidence segment. Positive evidence consistency is used to determine whether, given a question, the candidate evidence reasonably supports the answer.
[0060] The evidence fragments are determined as follows: Using the semantic node containing the candidate answer as a reference, within its candidate question-and-answer region, the process extends forward and backward along the continuous semantic relationships of the semantic boundary graph, sequentially incorporating adjacent semantic nodes that share core entities, attributes, or relationships with the candidate question and the candidate answer, until a strong semantic boundary is reached or a preset maximum number of expanded nodes is achieved. The original text corresponding to the resulting set of semantic nodes is then used as the evidence fragment. When the semantic node containing the candidate answer can independently cover the entity, attribute, or relationship inquired about by the question, the original text corresponding to that semantic node itself can be used as the evidence fragment. The resulting evidence fragments also have a locatable start and end position in the original text.
[0061] Regarding the question ,Answer and evidence Calculate positive consistency:
[0062] in: Indicates the degree of semantic connection between the issue and the evidence; It indicates the degree of semantic connection between the answer and the evidence.
[0063] When the question is relevant to the evidence, and the answer is also relevant to the evidence. High. For example: Question: "What are the components of a liquid cooling system?" Answer: "Circulating pump, heat exchanger, and cooling piping." Evidence: "The liquid cooling system includes a circulating pump, a heat exchanger, and cooling piping." At this point, the question, the answer, and the evidence form a highly consistent semantic ternary relationship.
[0064] And if the evidence is: "The cooling pipes need to be inspected regularly during the maintenance of the liquid cooling system." Although it includes "liquid cooling system" and "cooling piping", it cannot fully support the question of "what components the liquid cooling system includes", thus reducing the consistency of positive evidence.
[0065] Step S9: Establish reverse evidence consistency constraints. This step further establishes reverse evidence consistency based on step S8. Reverse consistency is used to determine whether, given an answer and evidence, it is possible to reverse-determine the information requested by the current question. Its purpose is to address errors that cannot be detected solely through "question-answer relevance."
[0066] For example: Question: "What are the components of a liquid cooling system?" Answer: "Cooling piping". Evidence: "The cooling pipes need to be inspected regularly during the maintenance of the liquid cooling system." There is some semantic relevance between the question and the answer, but the evidence does not explicitly state that "cooling pipes are a component of the liquid cooling system." Therefore, even with a significant positive relevance, the consistency of the negative evidence remains low. In one embodiment, negative consistency is defined as:
[0067] Furthermore, different evidence matching methods can be used to calculate positive consistency and negative consistency. For example, the positive direction can be examined more closely:
[0068] The reverse direction is the key focus:
[0069] When both directions meet the requirements, the candidate question and answer is considered to have a relatively complete evidence loop.
[0070] Step S10, as follows Figure 6 Questions and answers are filtered based on the consistency of two-way evidence. The consistency of positive evidence, the consistency of negative evidence, and the consistency of semantic boundary graph structure are jointly calculated.
[0071] In one embodiment, a comprehensive quality score is generated:
[0072] in: Consistency of positive evidence; Consistency of reverse evidence; To ensure structural consistency between candidate questions and answers and semantic boundary graphs; , , As a preset weight. In one embodiment, take =0.35、 =0.35、 =0.3, the preset quality threshold is 0.65, and the corresponding thresholds for positive evidence consistency and negative evidence consistency are 0.5 respectively; the above weights and thresholds can also be adjusted according to the labeled question-and-answer quality samples, and the present invention does not limit their specific values.
[0073] in, At least the following factors should be considered: whether the question and answer are located in the same or directly related semantic regions; whether the answer crosses a strong semantic boundary; whether there is a valid semantic path between the question and the answer; whether the evidence covers the node where the answer is located; and whether the evidence covers the relationship between the question and the answer.
[0074] When the overall quality score When the value exceeds a preset threshold, the corresponding question and answer are retained. When a candidate answer crosses a strong semantic boundary, even if its text similarity is high, its validity is reduced. This will lower the final quality score.
[0075] When there is semantic relevance between candidate questions, answers, and evidence but a two-way evidence loop is lacking, then... or The reduction in concentration will eliminate them.
[0076] This results in a joint screening mechanism consisting of semantic boundary constraints, positive evidence constraints, and negative evidence constraints.
[0077] Step S11: Form structured extracted question-answer samples. The candidate questions and answers selected in step S10 are used to form structured question-answer samples.
[0078] Each question-and-answer sample includes at least the question text, answer text, evidence text, the original position of the question, the original position of the answer, the original position of the evidence, semantic boundary markers, evidence path, and question quality score. The question text, answer text, and evidence text all preserve the start and end positions of characters in the original document. Therefore, even if the question-and-answer sample is exported to other training systems, the original text can be relocated using the position index.
[0079] Multiple candidate questions can be generated for the same candidate region, but when multiple questions correspond to the exact same answer and evidence range, only the question with the highest quality score is retained.
[0080] For question-and-answer questions with completely overlapping answers but different scopes of evidence, multiple samples can be retained, but it is necessary to ensure that different samples have different question semantics or different evidence paths.
[0081] Step S12: Quality verification and output of the final question-and-answer dataset. The final quality verification is performed on the question-and-answer samples formed in step S11. The final verification includes: 1. Answer integrity verification: Check if the answer is continuous text from the original document. If the answer contains character jumps, spans irrelevant paragraphs, or cannot be retrieved from its position in the original text, the sample is deleted.
[0082] 2. Semantic boundary verification: Check whether the answer crosses a strong semantic boundary that is not allowed to be crossed. If it crosses a strong semantic boundary, try to narrow down the answer range again; if a complete answer cannot be formed, delete the sample.
[0083] 3. Evidence coverage verification: Check whether the evidence fragments cover the semantic nodes corresponding to the answer and the key relationships on which the question depends.
[0084] 4. Two-way consistency verification: Calculate the consistency in both the forward and reverse directions. If the consistency in either direction falls below the corresponding threshold, the sample is marked as a low-confidence sample.
[0085] 5. Duplicate sample elimination: Joint deduplication is performed on the question text, answer text, and evidence text. When the question text, answer text, and evidence text of multiple questions and answers are completely identical, only one sample is retained.
[0086] 6. The final output will be a long document extraction question-answering dataset formed by all verified question-answer samples.
[0087] Effectiveness Verification Examples (The following data are exemplary data used to illustrate the effectiveness verification method). To verify the technical effectiveness of this method compared to the fixed-length window segmentation method and the semantic vector similarity clustering method alone in reducing cross-topic answers and improving evidence closure, a total of 120 long documents of various types, including enterprise product manuals, industry technical standards, laws and regulations, and scientific research papers, with an average length of approximately 8,000 words, were selected as the test set. Candidate answer regions were segmented using a fixed-length window (Comparison Method 1), candidate answer regions were determined using only semantic vector cosine similarity clustering (Comparison Method 2), and the present invention's method used semantic boundary graphs to limit candidate question-and-answer regions and combined with bidirectional evidence consistency joint screening to construct extractive question-and-answer samples. Each method generated 1,000 question-and-answer samples, which were then blind-reviewed by human reviewers with relevant domain backgrounds. Review indicators included the cross-topic answer rate, evidence completeness support rate, and human qualification rate of the question-and-answer samples. The review results are as follows: Compared with Method 1, the cross-topic rate of the answers is about 28%, the evidence completeness support rate is about 52%, and the human qualification rate is about 48%; compared with Method 2, the cross-topic rate of the answers is about 18%, the evidence completeness support rate is about 63%, and the human qualification rate is about 59%; the cross-topic rate of the answers of the present invention is about 6%, the evidence completeness support rate is about 84%, and the human qualification rate is about 81%.
[0088] The above results show that, by defining candidate question-and-answer regions using semantic boundary maps and combining positive and negative bidirectional evidence consistency and structural consistency for joint screening, this invention can significantly reduce the proportion of cross-topic answers compared to fixed window segmentation and single semantic similarity clustering methods, and significantly improve the completeness of evidence support for answers and the human qualification rate of question-and-answer samples.
Claims
1. A method for constructing long document extraction-based question answering based on semantic boundary graphs and bidirectional evidence consistency constraints, characterized in that, The method is implemented by a processor executing a computer program stored in memory, and the method includes: The target long document is obtained, and text parsing, format normalization, and document structure restoration are performed on the target long document to form basic text units with original position indexes; the original position indexes include at least the document identifier, page number, paragraph number, character start position, and character end position; for paragraphs spanning multiple pages, they are merged according to the paragraph continuation relationship in adjacent pages; for table content, the table header, row labels, column labels, cell content, and table coordinate information are retained; Based on one or more of the following factors: sentence-ending punctuation, heading level, referential relationship, entity continuity, temporal continuity, thematic continuity, inter-sentence connectors, paragraph structure, and table structure, the basic text unit is divided into multiple semantic units, and the semantic representation of each semantic unit is obtained. The semantic change degree of adjacent semantic units is calculated, and semantic boundaries are determined based on a comprehensive boundary score, which combines entity change features, title level change features, time or condition change features, and context connection relationship change features. The comprehensive boundary score integrates at least three features from the semantic change degree, entity change degree, document structure level change degree, time or condition change degree, and context connection relationship change degree. When the comprehensive boundary score reaches a preset boundary threshold, adjacent semantic units are identified as strong semantic boundaries. A semantic boundary graph is constructed based on the semantic units and the semantic boundaries, wherein each semantic unit corresponds to a semantic node, an order relationship is established between adjacent semantic units, and a continuous semantic relationship or boundary relationship is established based on whether there is a strong semantic boundary between adjacent semantic units. Based on the semantic boundary graph, semantic nodes with continuous semantic relationships that do not cross strong semantic boundaries are combined into candidate question-answering regions; Within the candidate question-and-answer area, continuous text from the target long document is identified as candidate answers, and the original start and end positions of the candidate answers are determined. Candidate questions are determined based on the semantic region where the candidate answers are located, and the association between the candidate questions, the candidate answers and the semantic nodes in the semantic boundary graph, as well as the semantic path from the question to the answer, are established. For the candidate question, the candidate answer, and the evidence fragment, a positive evidence consistency is determined. The positive evidence consistency is used to determine whether the evidence fragment can support the candidate answer given a candidate question. For the candidate answer and the evidence fragment, reverse evidence consistency is determined. The reverse evidence consistency is used to determine whether the information or relationship asked by the candidate question can be determined in reverse given the candidate answer and the evidence fragment. The consistency of positive evidence, the consistency of negative evidence, and the structural consistency of candidate questions, candidate answers, and evidence fragments in the semantic boundary graph are used to form a comprehensive quality score according to a preset weight. When the comprehensive quality score reaches a preset quality threshold and the consistency of positive evidence and the consistency of negative evidence reach the corresponding thresholds, the corresponding candidate questions and answers are retained. The selected candidate questions and answers are used to form a structured extraction question and answer sample.
2. The method according to claim 1, characterized in that, Each semantic node in the semantic boundary graph stores at least one or more attributes from the following: original text location, paragraph to which it belongs, title to which it belongs, entity set, time information, conditional information, and semantic representation; the relation edges in the semantic boundary graph store at least the relation type and relation weight.
3. The method according to claim 1, characterized in that, The candidate question-answering region satisfies the following conditions: there are continuous semantic relationships within the region; there are at least identifiable entities or topics within the region; relatively complete information relationships can be formed within the region; and there are no strong semantic boundaries at the region boundaries that exceed the preset boundary threshold.
4. The method according to claim 1, characterized in that, The candidate answer is determined by answer boundary scoring, which considers at least semantic completeness, syntactic completeness, and entity completeness; when the candidate answer truncates a complete sentence, the quality score of the candidate answer is reduced.
5. The method according to claim 4, characterized in that, The answer boundary scoring also considers the relevance between the candidate question and the candidate answer, as well as the relationship between the candidate answer and strong semantic boundaries; when the candidate answer crosses a strong semantic boundary, the quality score of the candidate answer is reduced.
6. The method according to claim 1, characterized in that, The candidate question is a semantic unit with query meaning extracted from the target long document, or a question text formed by multiple original semantic units according to a preset combination rule; the core entities, attributes or relationships involved in the candidate question can be located in the target long document; when there is no valid semantic path in the semantic boundary graph between the candidate question and the candidate answer, the corresponding candidate question and answer is deleted.
7. The method according to claim 1, characterized in that, The consistency of positive evidence is determined at least based on the degree of semantic association between the question and the evidence, the degree of semantic association between the answer and the evidence, and the degree of coverage of the answer by the evidence; the consistency of negative evidence is determined at least based on the degree of semantic association between the answer and the evidence, the degree of coverage of the information or relationship inquired by the question by the evidence, and the degree of certainty of the information or relationship inquired by the question by the answer and the evidence.
8. The method according to claim 1, characterized in that, The structural consistency includes at least: whether the candidate question and the candidate answer are located in the same or directly related semantic regions, whether the candidate answer crosses a strong semantic boundary, whether there is a valid semantic path between the candidate question and the candidate answer, whether the evidence covers the semantic node where the candidate answer is located, and whether the evidence covers the relationship between the candidate question and the candidate answer.
9. The method according to claim 1, characterized in that, The structured extracted question-answering sample includes at least the question text, answer text, evidence text, original question location, original answer location, original evidence location, semantic boundary markers, evidence path, and question quality score; The question text, answer text, and evidence text respectively store the corresponding start and end positions of the original text.
10. The method according to claim 9, characterized in that, The structured question-and-answer samples are subjected to at least three of the following verifications: answer continuity verification, semantic boundary verification, evidence coverage verification, bidirectional consistency verification, and duplicate sample elimination. When a verification fails, the corresponding sample is deleted or marked.