A machine learning-based question and answer intelligent matching method
By using deep learning models to analyze the semantic layers of legal texts, identify and process the logical relationships between various elements in the sentences, and generate a semantic logic hierarchy table and network structure, the problem of insufficient identification of semantic nuances in existing technologies is solved, and more accurate matching of legal questions and answers is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- GUANGXI ZHIFU TECH CO LTD
- Filing Date
- 2025-10-24
- Publication Date
- 2026-06-26
AI Technical Summary
Existing technologies rely on word similarity for matching when dealing with legal issues, failing to deeply analyze the logical structure and semantic level of statements. This makes it difficult to accurately identify subtle semantic differences in complex or ambiguous legal issues, and it cannot flexibly adjust the relationship between questions and answers, thus affecting the accuracy of matching results.
By acquiring legal consultation texts, identifying the subject, behavior, object, and cited provisions, using a deep learning model for semantic hierarchical analysis, generating a semantic logic hierarchy table, extracting keyword groups and constructing a semantic network, identifying semantic units, adjusting logical direction offsets, and generating a question-and-answer matching result set, we can ensure logical coherence and semantic consistency.
It improves the accuracy of matching legal questions with answers, enhances the ability to identify semantic consistency between different expressions, reduces mismatches, and provides more intelligent and accurate question-and-answer matching results.
Smart Images

Figure CN121328728B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of legal consulting service technology, and in particular to a machine learning-based intelligent question-and-answer matching method. Background Technology
[0002] The field of legal consultation services encompasses research on the intelligent identification and matching of legal issues through natural language processing and semantic understanding technologies. The core lies in semantically analyzing the legal questions raised by users and providing relevant answers or reference information based on legal knowledge bases, legal provisions, and case databases. Legal consultation service systems typically rely on technologies such as accurate identification of legal terminology, classification and organization of legal knowledge, and optimization of question-and-answer matching mechanisms to achieve efficient legal consultation services. This development has gradually formed a technological system encompassing knowledge graph construction, semantic analysis and reasoning, and automated question-and-answer matching for different legal scenarios, thereby supporting the application of intelligent legal services.
[0003] Among them, machine learning-based intelligent question-answering matching refers to a technical approach that uses machine learning models to model and determine the semantic relationship between legal questions and answers. It primarily addresses the technical aspects of matching questions and answers in legal consultations, particularly in understanding the semantics of legal questions and identifying the relevance of answers. By extracting features from legal question-and-answer data, the model learns the semantic association between questions and answers to determine their degree of matching. Specifically, this includes feature extraction from the text of legal questions and answers, using specific semantic vector representation techniques, and calculating semantic similarity based on these features, thereby automating the determination of the matching degree between legal questions and answers. It mainly relies on machine learning techniques for training and learning; through the annotation of sample data and the optimization of the model, the system can automatically identify the semantic matching relationship between legal questions and the most relevant answers.
[0004] Existing technologies for handling legal issues often rely on lexical similarity for matching, failing to delve into the logical structure and semantic level of statements. For complex or ambiguous legal issues, the technology struggles to accurately identify subtle semantic differences. Current methods lack the ability to handle semantic shifts and logical inconsistencies, and cannot flexibly adjust the relationship between questions and answers, leading to occasional errors or inconsistencies in matching results. Particularly in scenarios with significant differences in legal citations, the system easily overlooks details, impacting service quality and matching accuracy. Summary of the Invention
[0005] To address the technical problems existing in the prior art, this invention provides a machine learning-based intelligent question-answering matching method. The technical solution is as follows:
[0006] A machine learning-based question-answering intelligent matching method includes the following steps:
[0007] SS1: Obtain the input legal consultation text, identify the subject, behavior, object and cited clause in the sentence, parse the text in segments according to semantic level, use deep learning model to identify semantic logic and contextual reference at the same level, determine the dependency and connection order between semantics, record the identified content as structured entries, and generate a semantic logic hierarchical table.
[0008] S2: Extract keyword groups based on the semantic logic hierarchical table, compare the semantic direction with the logical position and the correspondence of the text reference, identify the convergence of expressions and aggregate them into semantic units, record the semantic connection and hierarchical relationship between words, form a semantic network structure, and generate a semantic aggregation mapping table.
[0009] S3: Based on the semantic aggregation mapping table, call the semantic items of the question and the semantic items of the answer, compare the semantic expression and logical direction, identify the semantically consistent and logically connected sentence segments, organize them into corresponding entries, mark the related articles and keywords, summarize the structured records, and generate the question and answer matching set;
[0010] S4: Based on the question-and-answer matching set, use a reinforcement learning model to examine the segments in the questions and answers that deviate from the logical direction, identify semantically incoherent areas, adjust the paragraph order and correct the logical direction, clean up semantically conflicting text, reintegrate the revised content into the matching structure, and generate a question-and-answer matching revision set.
[0011] S5: Call the question-and-answer matching revision set and the semantic logic hierarchy table for consistency verification, check the logical coherence between semantic levels, merge and reorganize the parts with stable logical and semantic matching to form a structured question-and-answer output set, and generate a question-and-answer intelligent matching result set.
[0012] As a further aspect of the present invention
[0013] The semantic logic hierarchy table includes subject, behavior, object, text reference, semantic hierarchy, logical relationship, and contextual reference;
[0014] The semantic aggregation mapping table includes keyword groups, semantic directions, logical positions, text references, semantic units, semantic links, and hierarchical relationships;
[0015] The question-and-answer matching set includes matching pairs, semantic pointers, logical flow, clauses, keywords, and structured records;
[0016] The question-and-answer matching revision set includes semantic offset position, offset paragraph, revised text, and adjusted matching structure;
[0017] The question-and-answer intelligent matching result set includes verified content, semantic connections, logically stable content, and the sorted matching structure.
[0018] As a further aspect of the present invention, the step of obtaining the semantic logic hierarchy table is as follows:
[0019] S101: Obtain the input legal consultation text, identify the complex sentence structure in the text, call up the subject phrases, verb phrases and object phrases in it, encode the three types of phrases by position and construct a sentence dependency matrix, extract the syntactic dependency path based on the matrix, and record the semantic element group covered by each path to generate a semantic dependency path group.
[0020] S102: Call the semantic dependency path group, input the semantic element sequence in the path to the preset deep semantic recognition model, classify and predict the semantic type between semantic units at the same level, and perform multi-label discrimination on the context pointing relationship in each group of semantic paths. Based on the discrimination results, reconstruct the connection order between semantics to obtain a semantic level pointing label set.
[0021] S103: Call the semantic hierarchy pointing tag set, combine the context pointing tag and semantic type tag in each semantic tag to construct a nested hierarchical structure of semantic combination, arrange the connection relationship between the combination blocks in the subordinate order, record the dependency index of each group of connections, and generate a semantic logic hierarchical table.
[0022] As a further aspect of the present invention, the step of obtaining the semantic aggregation mapping table is as follows:
[0023] S201: Obtain the semantic logic layer table, retrieve the subject, behavior, object and reference text of each semantic layer, combine nouns and verbs that appear more frequently than the set benchmark value, extract keyword groups, and calculate the position weight ratio according to their order and distribution in the semantic layer to obtain the keyword group weight ratio value.
[0024] S202: Based on the keyword group weight ratio, compare each keyword group in terms of semantic direction, logical position and number of citations in the text, calculate the semantic direction angle difference rate and logical displacement difference, and take a weighted average after comparing the two values to obtain the semantic relevance coefficient.
[0025] S203: Based on the semantic relevance coefficient, filter words with similar semantic direction or consistent logical relationship, combine them into semantic units, calculate the number of connections between units and the ratio of hierarchical dependency, calculate the overall connectivity of semantic network nodes based on the ratio of the number of connections to the dependency ratio, and establish a structural mapping accordingly to generate a semantic aggregation mapping table.
[0026] As a further aspect of the present invention, the step of obtaining the question-and-answer matching set is as follows:
[0027] S301: Obtain the semantic aggregation mapping table, extract the sentence content of the question semantic item and the answer semantic item, compare the semantic direction, logical direction and keyword distribution of the two types of semantic items, calculate the angle difference of the semantic direction and the logical path offset, and integrate them according to the proportional relationship of the two values to obtain the semantic corresponding offset value.
[0028] S302: Based on the semantic correspondence offset value, select the sentence segments whose difference is within the semantic convergence threshold range, calculate their semantic similarity rate and logical coherence, perform a weighted comparison of the two indicators and take the average value, record the consistency between the sentence segments, and generate a semantic matching strength coefficient.
[0029] S303: Based on the semantic matching strength coefficient, merge the sentence segments with high matching degree to form question-answer pairs, mark their related articles and keywords, count the occurrence frequency and article co-occurrence ratio of each pair, organize them into structured records, and generate a question-answer matching correspondence set.
[0030] As a further aspect of the present invention, the step of obtaining the question-and-answer matching revision set is as follows:
[0031] S401: Obtain the question-and-answer matching set, identify the continuous sentence segments appearing in each set of questions and answers, monitor the connection order of the main structure between sentences and the consistency of the direction of verb-object phrases, locate the content with logical transitions or thematic breaks based on whether the semantic main line between adjacent sentences is continuous, extract the segments with semantic jump features, and generate a set of semantic jump labeled segments.
[0032] S402: Call the set of semantic jump annotation segments, input the segments in sequence into the structure review process constructed by the reinforcement learning model, and identify whether there is a topic disconnect or direction misalignment between the preceding and following sentences based on the model's judgment criteria for semantic coherence and structural rationality within the segments. Then, perform sequence reorganization and semantic direction revision operations on the problematic segments to obtain a set of semantic order revision segments.
[0033] S403: Revise the fragment set according to the semantic order, align each revised fragment with the corresponding position of the original question and answer, replace paragraphs with semantic breaks in the original matched content, organize and rearrange the semantic connections between paragraphs, remove redundant terms in the sentences that no longer have semantic reference function, and complete the content reconstruction according to the original question and answer structure to generate a question matching revision set.
[0034] As a further aspect of the present invention, the step of obtaining the question-and-answer intelligent matching result set is as follows:
[0035] S501: Obtain the question-and-answer matching revision set and the semantic logic hierarchical table, verify the correspondence between the two in the semantic layer, calculate the connection ratio and semantic consistency rate between the levels, mark the levels with a connection ratio lower than the set benchmark value, record the difference range, and obtain the level connection consistency value.
[0036] S502: Based on the hierarchical connection consistency value, review the semantic layers with unstable connection rates, compare their semantic connection directions and logical order, calculate the logical offset and semantic volatility, perform a weighted average and normalization on the two values, and generate a semantic stability coefficient.
[0037] S503: Based on the semantic stability coefficient, filter content with stable semantic structure, integrate the semantic units and logical levels of questions and answers, calculate the coherence rate and matching concentration of each node, organize them into a matching structure that can be directly output, and generate a question-and-answer intelligent matching result set.
[0038] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following:
[0039] This invention optimizes the matching accuracy of legal questions and answers by identifying and processing the logical relationships and contextual references between various elements in legal texts through semantic layering analysis. Keyword extraction and semantic network construction enhance the ability to recognize semantic consistency between different expressions, improving the flexibility of the matching process. This solution can correct semantic deviations and logical inconsistencies, ensuring logical coherence and semantic consistency of the results. Compared to existing technologies, this approach effectively reduces false matches, improves the accuracy of legal question-and-answer matching, and makes legal consultation services more intelligent and precise when facing complex issues, providing more reliable question-and-answer matching results. Attached Figure Description
[0040] Figure 1 This is a flowchart of the method of the present invention;
[0041] Figure 2 This is a flowchart illustrating the process of obtaining the semantic logic hierarchical table of this invention.
[0042] Figure 3 This is a flowchart illustrating the process of obtaining the semantic aggregation mapping table in this invention.
[0043] Figure 4 This is a flowchart illustrating the process of obtaining the corresponding set for question-and-answer matching in this invention.
[0044] Figure 5 This is a flowchart illustrating the process of obtaining the question-and-answer matching revision set in this invention.
[0045] Figure 6 This is a flowchart illustrating the process of obtaining the intelligent question-and-answer matching result set of this invention. Detailed Implementation
[0046] The present invention will now be described in further detail with reference to the accompanying drawings. These drawings are simplified schematic diagrams, illustrating only the basic structure of the invention, and therefore only show the components relevant to the invention.
[0047] refer to Figures 1 to 6 A machine learning-based question-answering intelligent matching method includes the following steps:
[0048] S1: Obtain the input legal consultation text, identify the subjects, behaviors, objects and cited clauses involved in the sentences, segment and parse the text according to the semantic level, use a deep learning-based semantic analysis model to identify the logical direction and contextual direction in sentences at the same level, determine the dependence and connection order between semantics, and record the identified content as structured entries to generate a semantic logic hierarchical table.
[0049] S2: Extract keyword groups based on the semantic logic hierarchical table, compare their correspondence in semantic direction, logical position and text reference, identify words with similar or consistent expressions, integrate them into semantic units, record the semantic connections and hierarchical relationships between words, form a semantic network structure, and generate a semantic aggregation mapping table.
[0050] S3: Based on the semantic aggregation mapping table, call the content of the question semantic items and the answer semantic items, compare the semantic orientation and logical direction of the two, identify the sentences with consistent meaning and smooth logical connection, merge them into matching pairs, mark the related articles and keywords, organize them into structured matching records, and generate question and answer matching correspondence sets;
[0051] S4: Based on the question-and-answer matching set, examine the parts in the question and answer that are inconsistent in logical direction, identify the location of semantic offset, adjust the expression order of the offset paragraphs, delete the segments with semantic conflicts or logical breaks, and re-incorporate the revised text into the matching structure to generate a question-and-answer matching revision set;
[0052] S5: Call the question-and-answer matching revision set and semantic logic layer table for consistency review, check whether the connection between semantic layers is coherent, summarize and organize the content with stable logical and semantic relationships, form a matching structure that can be directly used for question-and-answer output, and generate a question-and-answer intelligent matching result set.
[0053] The semantic logic hierarchy table includes subject, behavior, object, text reference, semantic hierarchy, logical relationship, and contextual reference. The semantic aggregation mapping table includes keyword groups, semantic direction, logical position, text reference, semantic unit, semantic link, and hierarchical relationship. The question-and-answer matching correspondence set includes matching pairs, semantic reference, logical direction, text, keywords, and structured records. The question-and-answer matching revision set includes semantic offset position, offset paragraph, revised text, and adjusted matching structure. The question-and-answer intelligent matching result set includes reviewed content, semantic connection, logically stable content, and organized matching structure.
[0054] Please see Figure 2 The steps to obtain the semantic logic hierarchical table are as follows:
[0055] S101: Obtain the input legal consultation text, identify the complex sentence structure in the text, call up the subject phrases, verb phrases and object phrases in it, encode the three types of phrases by position and construct a sentence dependency matrix, extract the syntactic dependency path based on the matrix, and record the semantic element group covered by each path to generate a semantic dependency path group.
[0056] The input legal consultation text, in one embodiment, reads: "On March 15, 2023, I borrowed RMB 50,000 from Mr. Li, agreeing to a monthly interest rate of 0.5%, and agreeing to repay the principal and interest on March 14, 2024. Now Mr. Li is demanding immediate repayment, claiming I have breached the contract, but the loan agreement does not stipulate a penalty clause for early repayment. Can I refuse immediate repayment and continue to repay according to the contract?" After obtaining this legal consultation text, preliminary language processing is performed on its content, including word segmentation, part-of-speech tagging, and named entity recognition. In one embodiment, "I" and "Mr. Li" are identified as... The main phrases, "borrow," "repay," "request," "refuse," and "repay," are verb phrases, while "RMB 50,000," "principal and interest," "immediate repayment," and "default clauses" are object phrases. For the identified set of subject, verb, and object phrases, positional encoding is performed, assigning a unique numerical identifier to each phrase. For example, "I" can be encoded as 1, "Li Mou" as 2, "borrow" as 10, and "RMB 50,000" as 20. This encoding is achieved through linear mapping; the starting and ending positions of the phrase in the text determine its encoding value. Specifically, for the starting position... and end position The phrase, its encoded value Calculated as In one embodiment, the phrase "I" (start position 0, end position 1) is encoded as follows: The phrase "Li Mou" (start position 7, end position 9) is encoded as follows: This encoded value identifies the phrase's location information in the text. A statement dependency matrix is constructed based on these location codes. It is A two-dimensional array, Represents the total number of all subject, verb, and object phrases in the text; matrix elements Indicates the first The phrase and the first The strength of the dependency relationship between phrases is set within the range [0,1], initially set to 0. When there is a direct syntactic dependency between two phrases, the corresponding matrix element is set to 0.8; if there is an indirect dependency, it is set to 0.4. In one embodiment, "I" and "borrow" have a direct dependency relationship, then... Assigned a value of 0.8, and given the direct dependency between "loan" and "RMB 50,000", then... The value is assigned to 0.8. If there is an indirect dependency between "I" and "RMB 50,000" (connected by "loan"), then... Assigned a value of 0.4, this dependency relation is obtained through parsing by a syntactic analyzer. The syntactic analyzer identifies subject-verb-object structures, modifiers, and parallel relations. In one embodiment, for "I borrowed RMB 50,000 from Li on March 15, 2023", it identifies "I" as the subject of "borrowing", "RMB 50,000" as the object of "borrowing", and "from Li" as a prepositional phrase modifying "borrowing". Using this statement dependency matrix, a depth-first search (DFS) algorithm is used to extract the syntactic dependency path. In one embodiment, starting from the subject "I" (encoding 1), the search begins with the verb "borrowing" (encoding 10), which has a dependency relation with "borrowing", and then searches for the object "RMB 50,000" (encoding 20), which has a dependency relation with "borrowing", forming the path "I..." loan "RMB 50,000", during the path extraction process, the semantic element groups covered by each path are recorded. Specifically, for each path... Its semantic element group In one embodiment, the path "I" loan The semantic element group for "RMB 50,000" is {"I", "borrow", "RMB 50,000"}, and the semantic element group for the path "Li Mou demanded that I repay immediately" is {"Li Mou", "demand", "I", "repay immediately"}. Additionally, the "agreement" is extracted. return Principal and interest (semantic element group {agreement, repayment, principal and interest}) and "I reject Other paths, such as "Immediate Repayment" (semantic element group {I, Refuse, Immediate Repayment}), are aggregated to generate semantic dependency path groups by summarizing all identified paths and their corresponding semantic element groups.
[0057] S102: Call the semantic dependency path group, input the semantic element sequence in the path to the preset deep semantic recognition model, classify and predict the semantic type between semantic units at the same level, and perform multi-label discrimination on the context pointing relationship in each group of semantic paths. Based on the discrimination results, reconstruct the connection order between semantics to obtain the semantic level pointing label set.
[0058] The obtained semantic dependency path group is invoked, and the semantic element sequence in the path, in one embodiment {“I”, “borrow”, “RMB 50,000”}, is input into a preset deep semantic recognition model. This model is built on the Transformer architecture and includes a multi-layer self-attention mechanism and a feedforward network. The input sequence is the word vector representation in the path. Each word vector is generated by a pre-trained legal domain word embedding model, and the word embedding dimension is set to 768 dimensions. For this semantic element sequence, the model classifies and predicts the semantic type between semantic units at the same level. The semantic types cover “subject”, “object”, “behavior”, “time”, “location”, “cause”, “result”, “condition”, etc. This classification prediction uses a multi-class Softmax function to output each In one embodiment, the model predicts the semantic type of "I" as "subject" with a probability of 0.98, "borrow" as "behavior" with a probability of 0.95, and "RMB 50,000" as "object" with a probability of 0.97. The classification criterion is that if the predicted probability value of a semantic type is higher than 0.75, it is classified into that type. If multiple types have probabilities higher than 0.75, the one with the highest probability value is selected. Simultaneously, multi-label discrimination is performed on the contextual relationships in each semantic path. Contextual relationships include "sequential," "contrast," "parallel," "causal," "conditional," "explanatory," and "supplementary." The discrimination process outputs the probability value of each relationship through a Sigmoid activation function. In one embodiment, for the path "I..." loan "Agreement" and "Path Agreement" return The model identifies the relationship between "principal and interest" as a "sequential" relationship with a probability of 0.88 and an "explanatory" relationship with a probability of 0.12. When the probability of a certain pointing relationship exceeds a preset threshold of 0.60, that pointing relationship is considered to exist. If the probabilities of multiple pointing relationships are all above 0.60, they are all retained. These probability values reflect the logical connection between semantic units. By analyzing the semantic type and contextual pointing relationships, the order of semantic connection is reconstructed. Specifically, for semantic elements within the same clause, their order of connection is mainly determined by syntactic dependency relations. In one embodiment, "I..." loan In the sequence of "RMB 50,000," "I" takes precedence over "borrow," and "borrow" takes precedence over "RMB 50,000." For the connection between different clauses or independent phrases, adjustments are primarily made based on the judgment results of the contextual pointing relationship. In one embodiment, if path A points to path B in a "causal" relationship, then path A takes precedence over path B; if it is an "explanatory" relationship, then path B takes precedence over path A. The importance of each semantic unit in the entire semantic network is determined by calculating its centrality score. The score calculation method is as follows: ,in For semantic units and The strength of the contextual reference relationship between them (1 if a reference relationship exists, 0 otherwise). The centrality score represents the total number of semantic units. The higher the centrality score, the earlier the unit is linked. In one embodiment, in legal consultation text, the path containing the semantic action of "borrowing" has a high centrality score. Because multiple paths are associated with it, its centrality score is 0.67, while the centrality score of "default clause" is relatively low, at 0.25. By sorting all semantic units by centrality score and making fine adjustments based on the discriminative contextual pointing relationship, a semantic hierarchical pointing tag set is obtained.
[0059] S103: Call the semantic hierarchy pointing tag set, combine the context pointing tag and semantic type tag in each semantic tag to construct a nested hierarchical structure of semantic composition, arrange the connection relationship between the combination blocks in the subordinate order, record the dependency index of each group of connections, and generate a semantic logic hierarchical table.
[0060] The system retrieves a set of semantic hierarchy pointing tags and combines the context pointing tags and semantic type tags in each semantic tag to construct a nested hierarchical structure of semantic combinations. In one embodiment, for the statement "I borrowed RMB 50,000 from Mr. Li on March 15, 2023, with an agreed monthly interest rate of 0.5%, and agreed to repay the principal and interest on March 14, 2024" in a legal consultation text, the top-level semantic combination is identified as "loan behavior," with a semantic type of "behavior," a time tag of "March 15, 2023," a subject tag of "I," and object tags of "Mr. Li" and "RMB 50,000." Nested under this "loan behavior" is the semantic combination "agreement," whose semantic class... The block is designated as "Agreement," and its content includes "monthly interest rate of 0.5%" and "principal and interest to be repaid on March 14, 2024." The semantic type of "monthly interest rate of 0.5%" is "Agreement Content," while "principal and interest to be repaid on March 14, 2024" includes the "behavior" type of "repayment," the "object" type of "principal and interest," and the "time" type of "March 14, 2024." The connections between the blocks are arranged in a subordinate order. In one embodiment, "borrowing behavior" is the primary level, "Agreement" is its directly subordinate secondary level, and "Agreement Content" and "repayment of principal and interest" are subordinate levels of "Agreement." This subordinate relationship is based on... The following text refers to the label. In one embodiment, there is a contextual relationship of "sequential" and "supplementary" between "loan" and "agreement," indicating that "agreement" is a further elaboration of the "loan" behavior. The dependency index of each connection is recorded. The dependency index is an integer value indicating which upper-level semantic combination the current semantic combination belongs to. In one embodiment, the dependency index of the top-level semantic combination is 0, indicating no upper level, while the dependency index of the "agreement" semantic combination is 1, indicating that it belongs to the first semantic combination "loan behavior." In this way, a tree-like or graph-like nested hierarchical structure is constructed. In one embodiment, for the sentence "Li Mou demanded that I repay immediately," the top-level semantic combination (IDS2)... The semantic type of "Li Mou demands that I repay the loan immediately" is "behavior", the context is "sequential", the subordinate level is 1, and the dependent index is 0. The semantic type of "I have defaulted" (IDS2.1) nested below it is "statement of fact", the context is "cause and effect", the subordinate level is 2, and the dependent index is S2. In another embodiment, the semantic type of the semantic combination "The loan contract does not stipulate a default clause for early repayment" (IDS3) is "statement of fact", the context is "contrast", the subordinate level is 1, and the dependent index is 0. All these semantic combinations and their attributes (ID, content, type, direction, level, index) are summarized and organized to generate a semantic logic hierarchical table.
[0061] Please see Figure 3 The steps to obtain the semantic aggregation mapping table are as follows:
[0062] S201: Obtain the semantic logic layer table, retrieve the subject, behavior, object and reference text of each semantic layer, combine nouns and verbs that appear more frequently than the set benchmark value, extract keyword groups, and calculate the position weight ratio according to their order and distribution in the semantic layer to obtain the keyword group weight ratio value.
[0063] The semantic logic layered table is obtained, which is the structured entries generated after parsing the legal consultation text. In one embodiment, for the consultation "My landlord wants to raise the rent during the contract period and threatens to terminate the contract. Is this legal? What does Article 214 of the Contract Law stipulate?", the system obtains the corresponding semantic logic layered table. This table contains the following structured entries: Level L1 records the semantic subject "tenant", semantic behavior "consultation", semantic object "rent, contract", and semantic direction "query"; Level L2 records the semantic subject "landlord", semantic behavior "increase", semantic object "rent", cited article "Article 509 of the Civil Code", and semantic direction "claim". Level L3 records the semantic subject "contract", semantic action "agreement", semantic object "rent", and semantic direction "claim"; Level L4 records the semantic subject "landlord", semantic action "request", semantic object "termination, contract", cited article "Article 214 of the Civil Code", and semantic direction "refute"; Level L5 records the semantic subject "tenant", semantic action "refuse", semantic object "increase, rent", cited article "Article 214 of the Civil Code", and semantic direction "refute". The system retrieves nouns and verbs in the "semantic subject", "semantic action", and "semantic object" columns of the above entries, counts their frequency, and sets a frequency benchmark value. This benchmark value The settings are based on a benchmark library containing 1000 annotated legal consultation texts. The average frequency of high-frequency interference words (such as "question" and "law") is statistically analyzed, and an exclusion threshold is set accordingly. In one embodiment, the settings are as follows: The system filters out entries with a frequency higher than 1. Vocabulary (such as "tenant", "rent", "contract", "landlord", "improve"), these high-frequency words are paired to extract keyword phrases, for example (Landlord, increase), (Increase, rent), and calculate the position weight ratio based on its order and distribution in the semantic logic hierarchical table entries. Position weight ratio The calculation logic is as follows ,in For keyword phrases The formula calculates the average hierarchical position (L1 to L5) of all words in the hierarchical entries. The advantage of this formula is that by calculating the reciprocal of the average hierarchical position, keyword groups distributed at earlier levels (lower hierarchical numbers) in the semantic logical hierarchy table receive a higher positional weight ratio. The system retrieves the hierarchical entry data and calculates... Average hierarchical position of "Landlord" (occurring in L2, L4) and "Promotion" (occurring in L2, L5) in (Landlord, Promotion) And calculate its reciprocal to get This process is followed to process all extracted keyword groups and obtain the weight ratio value of each keyword group.
[0064] S202: Based on the keyword group weight ratio, compare each keyword group in terms of semantic direction, logical position and number of times it is cited in the text, calculate the semantic direction angle difference rate and logical displacement difference, and take a weighted average after comparing the two values to obtain the semantic relevance coefficient.
[0065] Based on the keyword group weight ratio and the average logical position of each keyword group. And the original records in the hierarchical entries, for different keyword groups (e.g. (Landlord, Improvement) and (Increase, rent) is compared, and non-numerical "semantic directions" (such as "query" in L1, "claim" in L2, and "refutation" in L4) are quantified. The quantification standard is as follows: "query" or neutral semantics are assigned a value of 0, affirmative semantics such as "claim" are assigned a value of +1, and negative semantics such as "refutation" are assigned a value of -1. The system retrieves... and The average semantic direction is calculated by quantifying the semantic direction of each word in the hierarchical entries for all corresponding semantic directions. and and retrieve and The number of unique “quoted articles” involved (509 articles involving L2 and 214 articles involving L4 / L5) and (Involving 509 L2 entries and 214 L5 entries), the semantic direction angle difference rate was calculated. Logic shift difference and the degree of difference in the citation of provisions The calculation logic of the three is as follows: ( The maximum range of quantized values for semantic direction, i.e., 2). ( (Total number of levels, i.e., 5), and ( The maximum number of references in the case library is preset to 10. The differences among these three items are compared, and a weighted average is taken to obtain the semantic relevance coefficient. The calculation logic is as follows: The advantage of the formula lies in its ability to comprehensively consider differences in semantic direction. , displacement of logical position and the differences in the cited provisions And calculate in reverse ( This transforms differences into relevance, enabling a quantitative assessment of multi-dimensional similarity between keyword groups, where weighting coefficients... The setup was based on a regression analysis experiment using 500 pre-annotated legal consultation question-and-answer pairs. This experiment determined the optimal parameters by adjusting the three weights and comparing the output results with those of manually annotated pairs. (Semantic direction) has the greatest impact on relevance; setting... , (Logical position) Next, set , (Article citation) Minimizes impact, setting The sum of the three is 1, and the system substitutes them. and corresponding , , Value, calculated The result is and The semantic correlation coefficient between them.
[0066] S203: Based on the semantic relevance coefficient, select words with similar semantic direction or consistent logical relationship, combine them into semantic units, calculate the number of connections between units and the ratio of hierarchical dependency, calculate the overall connectivity of semantic network nodes based on the ratio of the number of connections to the dependency ratio, and establish a structural mapping to generate a semantic aggregation mapping table.
[0067] The semantic relevance coefficients between each keyword group obtained in step S202 ,For example and coefficients between Set the filtering threshold The threshold was set based on ROC (Receiver Operating Characteristic) curve analysis of 500 labeled legal consultation Q&A pairs used in step S202, calculating different... The true positive rate (correct aggregation) and false positive rate (incorrect aggregation) are selected based on the value of the Youden Index, which is the highest value. The value is used as a threshold in one embodiment. The system will calculate the results. and If a comparison is made, Then determine and Those with similar semantic directions and consistent logical relationships are grouped into semantic units. ={Landlord, Increase, Rent}, calculate the number of connections within this unit. Dependence ratio between superior and inferior Number of links The sum of the number of times words within a unit appear together at the same level (e.g., L2) in the hierarchical entries described in S201, along with the hierarchical dependency ratio. The proportion of links with hierarchical relationships (e.g., L2 level number is less than L5) to the total number of links, based on the number of links. Dependence ratio Calculate the overall connectivity of semantic network nodes Overall connectivity The calculation logic is as follows The advantage of this formula is that it incorporates the tightness of the connections within the unit. and hierarchical stability of structure The more connections a unit has and the clearer its hierarchical relationships, the better it becomes. The higher the value, the more likely the system will substitute it. of and Value, calculated The result indicates The system determines the semantic unit based on its connectivity level. Its included keyword groups (such as ), and the calculated overall connectivity rate As mapping entries, and based on this, a structural mapping is established, Mapping to the [Rental Contract Dispute] node will transfer another unit. (Including (tenant, contract), (termination, contract) etc.) are mapped to the [contract termination dispute] node, generating a semantic aggregation mapping table.
[0068] Please see Figure 4 The steps for obtaining the corresponding set in question-and-answer matching are as follows:
[0069] S301: Obtain the semantic aggregation mapping table, extract the sentence content of the question semantic item and the answer semantic item, compare the semantic direction, logical direction and keyword distribution of the two types of semantic items, calculate the angle difference of the semantic direction and the logical path offset, and integrate them according to the proportional relationship of the two values to obtain the semantic corresponding offset value.
[0070] Based on a semantic aggregation mapping table containing semantic units SU1: "Loan Contract Establishment and Guarantee" and SU2: "Debt Default and Recovery," question semantic items are extracted, namely SU1 and its contained keyword groups KG1, KG2, and KG3, and SU2 and its contained keyword groups KG4 and KG5. Simultaneously, potential answer semantic items are extracted from a legal question-and-answer knowledge base. In one embodiment, A1: "The loan contract takes effect upon its establishment, and the guarantor assumes guarantee liability for the debt," and A2: "If the debtor fails to perform within the due period, the creditor has the right to demand that the guarantor assume liability." After extracting the sentence content, the semantic direction, logical flow, and keyword distribution of the two types of semantic items are compared. The first step is to calculate the angle difference of the semantic direction. The calculation calls the semantic vectors defined in S202. The average vector of problem item SU1 (based on KG1[2,1], KG2[2,1], and KG3[3,1]) is calculated as follows: Answer option A1 is obtained by vectorizing the keywords (contract, effective, guarantor, liability). Calculate the angle difference The second step is to calculate the logical path offset. This calculation calls upon the keyword group weight ratio value calculated in S201, and the average weight ratio value of question item SU1 is... The answer option A1 is assigned a pre-defined logical position weight in the knowledge base. Then logical path offset The values are integrated based on their proportional relationship and then summed using a weighted average. Calculate the offset value, where (Angle difference weight) is set to 0.4. The logical offset weight is set to 0.6. This weighting is based on statistical analysis of historical question-answer pairs. The analysis shows that the matching contribution of logical position (60%) is slightly higher than that of semantic vector direction (40%). Substituting this into the numerical calculation... The offset values between SU2 and A2 are calculated in the same way to obtain the semantically corresponding offset values.
[0071] S302: Based on the semantic correspondence offset value, select the sentence segments whose difference is within the semantic convergence threshold range, calculate their semantic similarity rate and logical coherence, perform a weighted comparison of the two indicators and take the average value, record the consistency between the sentence segments, and generate the semantic matching strength coefficient.
[0072] In one embodiment, the semantically corresponding offset value array is invoked. and Segment segments whose differences fall within the semantic convergence threshold are selected, and a "semantic convergence threshold" is set. The threshold is 0.100. This threshold was determined statistically by analyzing the distribution of offset values of irrelevant question-answer pairs. Its function is to filter out answer items that are significantly off-logic or semantically flawed. During the judgment process... The (Q1,A1) segments were judged to have semantic convergence. The sentence pairs identified as (Q2, A2) are semantically similar. For the selected sentence pairs, their semantic similarity rate is calculated. Logical coherence semantic similarity rate It is derived by calculating the Jaccard similarity coefficient between the keyword sets of the question item and the answer item (which requires synonym expansion). The keyword set of question item Q1 ={Zhang San, loan, agreement, Wang Wu, assume responsibility}, the keyword set for answer option A1 ={contract, effective, guarantor, liability}, mapped using a thesaurus (Wang Wu -> guarantor, assume liability -> liability), the intersection size is 3 and the union size is 6. Logical coherence This is based on the logical path offset calculated in S301. It was transformed. ,but The two indicators are weighted and compared, and the average value is taken to calculate the semantic matching strength coefficient. The weight (Similarity rate) and The (connectivity) is set to 0.5. This equal weighting (0.5 / 0.5) is based on testing of boundary cases, which found that the matching accuracy under equal weighting is higher than other ratios. Substituting these values into the calculation... Calculate in the same way Generate semantic matching strength coefficients.
[0073] S303: Based on the semantic matching strength coefficient, merge the sentence segments with high matching degree to form question-answer pairs, mark their related articles and keywords, count the occurrence frequency and article co-occurrence ratio of each pair, organize them into structured records, and generate a question-answer matching correspondence set.
[0074] Based on the semantic matching strength coefficient array, in one embodiment and Segments with high matching scores will be merged, and a "matching score baseline value" will be set. The baseline value is 0.85. This value was determined through ROC curve analysis of the labeled question-answer pair test set. 0.85 is the balance point between precision and recall. When making this judgment... The results were discarded due to insufficient matching. Sentences deemed to have a high degree of matching are merged to form question-and-answer pairs, i.e., Pair_1: {Question: SU2(“Debt default and recourse”), Answer: A2(“If a debtor fails to perform on time, the creditor has the right to demand that the guarantor bear liability”)}. For the merged pairs, their related articles and keywords are marked. This process involves searching the legal database for the keywords of A2, matching the related article: “Article 688 of the Civil Code”, and marking it with the keywords {overdue, recourse, guarantee liability}. The frequency of occurrence and the co-occurrence ratio of each pair are statistically analyzed. Taking Pair_1 as an example, if it already exists in historical matching, its frequency count is updated from 120 times to 121 times. If the A2 sentence appears a total of 150 times in the knowledge base, and 135 of those times co-occur with “Article 688 of the Civil Code”, then the co-occurrence ratio is [missing information]. This information is organized into structured records to generate a question-and-answer matching set.
[0075] Please see Figure 5 The steps to obtain the question-and-answer matching revision set are as follows:
[0076] S401: Obtain the question-and-answer matching set, identify the continuous sentence segments appearing in each set of questions and answers, monitor the connection order of the main structure between sentences and the consistency of the direction of verb-object phrases, locate the content with logical transitions or thematic breaks based on whether the semantic main line between adjacent sentences is continuous, extract the segments with semantic jump features, and generate a set of semantic jump labeled segments.
[0077] The system retrieves the question-and-answer matching set, which contains the question "My landlord wants to raise the rent during the contract period and threatens to terminate the contract. Is this legal?" and the answer "A1: Hello, according to Article 509 of the Civil Code, both parties to a contract should fully perform their obligations. A2: Therefore, it is illegal for the landlord to unilaterally raise the rent during the contract period. A3: A lease contract is a legal act between the two parties. A4: Regarding the termination of the contract, if the contract has not expired, the landlord has no right to unilaterally terminate it. A5: You can refuse the rent increase request." The system parses this answer and identifies its continuous sentence sequence [A1, A...]. [2, A3, A4, A5], and then analyze the connection order of the main structure of adjacent sentences in the sequence, extracting the main structure of A1 {both parties to the contract, performance, obligations}, the main structure of A2 {landlord, rent increase, illegal}, the main structure of A3 {lease contract, is, legal act}, the main structure of A4 {landlord, termination, no right}, and the main structure of A5 {you, refuse, rent increase request}, and evaluate the directional coherence of verb-object phrases. The system uses the vector cosine similarity of the main keywords (verbs and nouns) of adjacent sentences to quantify the continuity of the semantic main line, and sets a continuity benchmark value. ,this The acquisition relies on a validation set of 10,000 legal sentence pairs labeled "continuous" or "broken". The cosine similarity of all sentence pairs in this validation set is calculated by iterating through them, and a value of 0.40 is selected to optimize the F1 score for binary classification between "continuous" and "broken". The system applies this value. The similarity scores are as follows: A1 to A2 = 0.55 (higher than 0.40); A2 to A3 = 0.12 (lower than 0.40); A3 to A4 = 0.30 (lower than 0.40); A4 to A5 = 0.15 (lower than 0.40). The system compares the calculated values of 0.12, 0.30, and 0.15 with the baseline value. The comparison determined that there were thematic breaks or logical shifts between A2 and A3, A3 and A4, and A4 and A5. The system then located all pairs of pairs that did not reach the required similarity score. The sentence positions were identified, and segments with semantic jump characteristics were extracted, namely A3: "A lease agreement is a legal act between the two parties," A4: "Regarding the termination of the contract..." and A5: "You can refuse the rent increase request." These segments and their context data were organized into entries. Specific entries include: tag IDJ001, corresponding to matching pair IDQA-1024, located in answer A, A2. Position A3, the jump type is determined to be "theme break", with a similarity score of 0.12, labeled IDJ002, corresponding to the matching pair IDQA-1024, located at A3 of answer A. Position A4, the jump type is determined to be "topic switch", with a similarity score of 0.30, and the annotation IDJ003 corresponds to the matching pair IDQA-1024, located in A4 of answer A. At position A5, the jump type is determined to be "theme regression", with a similarity score of 0.15. The system summarizes items J001, J002, and J003 and generates a set of semantic jump annotation fragments.
[0078] S402: Call the semantic jump annotation fragment set, input the segments in it into the structure review process constructed by the reinforcement learning model in sequence, and identify whether there is a topic disconnect or direction misalignment between the preceding and following sentences based on the model's judgment criteria for semantic coherence and structural rationality within the segment. Then, perform sequence reorganization and semantic direction revision operations on the problematic segments to obtain the semantic order revision fragment set.
[0079] The semantic jump annotation fragment set, namely the J001, J002, and J003 annotations generated in S401, is invoked. These annotations are all associated with answer A ([A1, A2, A3, A4, A5]). The semantic jump segments indicated in the annotations ["A2: Therefore, it is illegal for the landlord to unilaterally raise the rent during the contract period," "A3: The lease contract is a legal act between the two parties," "A4: Regarding the termination of the contract, if the contract has not expired, the landlord has no right to unilaterally terminate it," "A5: You can refuse the rent increase request"] are sent to the reinforcement learning structure review process. In this process, the state of the reinforcement learning agent... The initial state of the sequence of sentences to be reviewed and the coherence score vector between adjacent sentences in the sequence is set as follows: The sequence is [A2, A3, A4, A5], and the corresponding coherence score vector is [0.12, 0.30, 0.15]. The agent's action space... Set to include {for any statement The set of operations that perform "shift forward one position", "shift backward one position", and "remove" operations, with a reward function. This is defined as the increase in the overall coherence score of a passage after an agent performs an action. This overall coherence score is the arithmetic sum of the coherence scores of all adjacent sentences in the passage. The agent selects actions based on a policy network trained on 100,000 sets of legal texts before and after revisions. State, total coherence score is The policy network detected that the score of 0.12 between A2 and A3 was the lowest globally, and identified this connection point as the primary problem to be solved. It then evaluated the available actions for A3 and executed the "remove A3" action, transforming the sequence into [A2, A4, A5]. The coherence score between A2 and A4 was recalculated to 0.45, and the coherence score between A4 and A5 to 0.15. The new state... The overall coherence score is The system calculates the reward. Intelligent agents in Continuing with the decision-making process in the current state, the coherence score between A4 and A5 is detected to be 0.15, which is the lowest at present. The action for A5 is evaluated, and the action "shift A5 one position forward" is executed. The sequence becomes [A2, A5, A4], and the coherence score between A2 and A5 is calculated to be 0.85, and the coherence score between A5 and A4 is 0.30. The new state is determined. The overall coherence score is Calculate rewards ,exist In this state, the coherence scores of all adjacent statements [0.85, 0.30] are greater than the termination threshold of 0.20 (this threshold of 0.20 is set by statistically analyzing the coherence scores of 5000 sets of revised texts and selecting their 85th percentile). Based on this, the agent determines that the sequence [A2, A5, A4] is a stable structure, and at the same time records the removed statement [A3] separately to form a semantic order revision fragment set.
[0080] S403: Revise the fragment set according to semantic order, align each revised fragment with the corresponding position in the original question and answer, replace paragraphs with semantic breaks in the original matched content, organize and rearrange the semantic connections between paragraphs after rearrangement, remove redundant terms in the sentences that no longer have semantic reference function, and complete the content reconstruction according to the original question and answer structure to generate the question matching revision set.
[0081] Based on the semantic order of the revised fragment set, namely the revised sequence [A2,A5,A4] and the removed fragment [A3] produced in step S402 for the original segment [A2,A3,A4,A5], the system aligns this revised fragment ["A2: Therefore, it is illegal for the landlord to unilaterally raise the rent during the contract period", "A5: You can refuse the rent increase request", "A4: Regarding the termination of the contract, if the contract has not expired, the landlord has no right to unilaterally terminate it"] with the corresponding position in the original question and answer record, specifically locking the original answer. The text block [A2,A3,A4,A5] in A is replaced. The reorganized sequence [A2,A3,A4] replaces the semantically broken [A2,A3,A4,A5] paragraphs in the original matched content, transforming the original answer sequence [A1,A2,A3,A4,A5] into the new sequence [A1,A2,A5,A4]. After the operation, the system organizes the semantic connections between the rearranged paragraphs in the new sequence, examines the connection between A1 and A2 (maintaining original coherence), and examines the connection between A2 and A5. The ending of A2 ({…illegal}) and the beginning of A5 ({You may refuse…}) both revolve around the theme of "rent increase," so the connection is deemed smooth. Examining the connection between A5 and A4, the ending of A5 ({…rent increase request}) and the beginning of A4 ({Regarding contract termination…}) achieve a smooth topic switch using "Regarding," so the connection is deemed valid. The system cleans up redundant terms in the statements that no longer have semantic reference function, namely, A3: "A lease contract is a legal act between the two parties," which was identified as a free segment in S402 and has been removed, ensuring that this statement does not appear in the revision. Within the revised answer, the content is reconstructed according to the original single text structure of the question and answer. The text content of [A1, A2, A5, A4] is merged into: "Hello, according to Article 509 of the Civil Code, both parties to a contract should fully perform their obligations. Therefore, it is illegal for the landlord to unilaterally raise the rent during the contract period. You can refuse the rent increase request. Regarding the termination of the contract, if the contract has not expired, the landlord has no right to unilaterally terminate it." This revised answer text is paired with the original question to form a new matching record, producing a question-and-answer matching revision set.
[0082] Please see Figure 6 The steps for obtaining the question-and-answer intelligent matching result set are as follows:
[0083] S501: Obtain the question-answer matching revision set and the semantic logic hierarchy table, verify the correspondence between the two in the semantic layer, calculate the connection ratio and semantic consistency rate between the levels, mark the levels with a connection ratio lower than the set benchmark value, record the difference range, and obtain the level connection consistency value.
[0084] Retrieve the question-and-answer matching revision set (including the corresponding response Pair_1_rev, whose question semantic unit is SU2: "Debt default and recovery", and the answer A2_rev: "Debtor fails to perform on time..."). , The semantic logic hierarchy table generated in step S101 (including L1: "Contract Formation", L2: "Breach of Contract", L3: "Liability Recovery") is checked to verify the correspondence between the semantic layers. In this example, both question SU2 and answer A2_rev completely cover levels L2 and L3, and the connection between levels is relatively good. semantic consistency rate The calculation then proceeds, and the connection ratio is... Defined as the ratio of the number of matching levels covered by the answer to the total number of levels involved in the question, hence Pair_1_rev semantic consistency rate Then the continuous value of S403 is directly used. ,Right now "Connectivity ratio benchmark value" Set to 0.80, this value is derived from statistical analysis of verified legal question-and-answer pairs. Levels with a connection ratio below this value will be flagged. (This is based on a judgment process.) Not lower than Therefore, Pair_1_rev is not marked; conversely, if the other pair corresponds to Pair_2, it is marked. Then Pair_2 is labeled, and the difference interval L1 is recorded to obtain the hierarchical connection consistency value.
[0085] S502: Based on the hierarchical connection consistency value, review the semantic layers with unstable connection rates, compare their semantic connection directions and logical order, calculate the logical offset and semantic volatility, perform weighted averaging and normalization on the two values, and generate a semantic stability coefficient.
[0086] Call hierarchy connection consistency value (Pair_1_rev) Pair_2 This is used to identify the stability of the connection. The semantic layer with unstable connection (i.e., the missing L1 layer in Pair_2) will be reviewed, its semantic connection direction and logical order will be compared, and the logical offset will be calculated. With semantic volatility Logical offset Calculated as the ratio of the number of missing levels to the total number of levels in the problem, therefore Pair_2's... And Pair_1_rev semantic volatility Depend on Calculate ( (For S501 record value), if Pair_2's ,but ;Pair_1_rev Two values ( and Semantic instability values are calculated using a weighted average. The weight (0.7) and The configuration of (0.3) is based on the analysis of failure matching cases. Substituting the values, , ,pass After normalization, we get and , which is the semantic stability coefficient.
[0087] S503: Based on the semantic stability coefficient, filter content with stable semantic structure, integrate the semantic units and logical levels of questions and answers, calculate the coherence rate and matching concentration of each node, organize them into a matching structure that can be directly output, and generate a question-and-answer intelligent matching result set.
[0088] Call the semantic stability coefficient array (in one embodiment) , The content is filtered, and the filtering criterion is the "semantic stability threshold". The threshold was set at 0.90 (this value was determined based on usability testing by legal professionals; values above 0.90 are considered logically complete and semantically clear). Based on the assessment, Higher than Therefore, Pair_1_rev is determined to be structurally stable and is retained; Below If the structure is unstable, it is discarded. For the selected Pair_1_rev, its question semantic unit SU2, answer semantic unit A2_rev, and logical hierarchy (L2->L3) are integrated, and the coherence rate of the nodes is calculated. Matching concentration Continuity We can directly use its semantic stability coefficient, that is Matching concentration The calculation method is as follows If there are 2 non-core words in A2_rev (total word count 18), then The system organizes information such as matching number, question semantic unit, logical level, matching answer, related clauses, stability coefficient, and matching concentration into structured records to generate a question-and-answer intelligent matching result set.
[0089] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.
Claims
1. A machine learning-based intelligent question-answering matching method, characterized in that, Includes the following steps: S1: Obtain the input legal consultation text, identify the subject, behavior, object and cited clause in the statement, parse the text in segments according to semantic level, use deep learning model to identify semantic logic and contextual reference at the same level, determine the dependency and connection order between semantics, record the identified content as structured entries, and generate a semantic logic hierarchical table. S2: Extract keyword groups based on the semantic logic hierarchical table, compare the semantic direction with the logical position and the correspondence of the text reference, identify the convergence of expressions and aggregate them into semantic units, record the semantic connection and hierarchical relationship between words, form a semantic network structure, and generate a semantic aggregation mapping table. S3: Based on the semantic aggregation mapping table, call the semantic items of the question and the semantic items of the answer, compare the semantic expression and logical direction, identify the semantically consistent and logically connected sentence segments, organize them into corresponding entries, mark the related articles and keywords, summarize the structured records, and generate the question and answer matching set; S4: Based on the question-and-answer matching set, use a reinforcement learning model to examine the segments in the questions and answers that deviate from the logical direction, identify semantically incoherent areas, adjust the paragraph order and correct the logical direction, clean up semantically conflicting text, reintegrate the revised content into the matching structure, and generate a question-and-answer matching revision set. S5: Call the question-and-answer matching revision set and the semantic logic hierarchy table for consistency review, check the logical coherence between semantic levels, merge and reorganize the parts with stable logical and semantic matching to form a structured question-and-answer output set, and generate a question-and-answer intelligent matching result set; The question-and-answer intelligent matching result set includes verified content, semantic connections, logically stable content, and the sorted matching structure.
2. The machine learning-based question-answering intelligent matching method according to claim 1, characterized in that: The semantic logic hierarchy table includes subject, behavior, object, text reference, semantic hierarchy, logical relationship, and contextual reference; The semantic aggregation mapping table includes keyword groups, semantic directions, logical positions, text references, semantic units, semantic links, and hierarchical relationships; The question-and-answer matching set includes matching pairs, semantic pointers, logical flow, clauses, keywords, and structured records; The question-and-answer matching revision set includes semantic offset position, offset paragraph, revised text, and adjusted matching structure.
3. The machine learning-based question-answering intelligent matching method according to claim 1, characterized in that: The steps for obtaining the semantic logic hierarchical table are as follows: S101: Obtain the input legal consultation text, identify the complex sentence structure in the text, call up the subject phrases, verb phrases and object phrases in it, encode the three types of phrases by position and construct a sentence dependency matrix, extract the syntactic dependency path based on the matrix, and record the semantic element group covered by each path to generate a semantic dependency path group. S102: Call the semantic dependency path group, input the semantic element sequence in the path to the preset deep semantic recognition model, classify and predict the semantic type between semantic units at the same level, and perform multi-label discrimination on the context pointing relationship in each group of semantic paths. Based on the discrimination results, reconstruct the connection order between semantics to obtain a semantic level pointing label set. S103: Call the semantic hierarchy pointing tag set, combine the context pointing tag and semantic type tag in each semantic tag to construct a nested hierarchical structure of semantic combination, arrange the connection relationship between the combination blocks in the subordinate order, record the dependency index of each group of connections, and generate a semantic logic hierarchical table.
4. The machine learning-based question-answering intelligent matching method according to claim 1, characterized in that: The steps for obtaining the semantic aggregation mapping table are as follows: S201: Obtain the semantic logic layer table, retrieve the subject, behavior, object and reference text of each semantic layer, combine nouns and verbs that appear more frequently than the set benchmark value, extract keyword groups, and calculate the position weight ratio according to their order and distribution in the semantic layer to obtain the keyword group weight ratio value. S202: Based on the keyword group weight ratio, compare each keyword group in terms of semantic direction, logical position and number of citations in the text, calculate the semantic direction angle difference rate and logical displacement difference, and take a weighted average after comparing the two values to obtain the semantic relevance coefficient. S203: Based on the semantic relevance coefficient, filter words with similar semantic direction or consistent logical relationship, combine them into semantic units, calculate the number of connections between units and the ratio of hierarchical dependency, calculate the overall connectivity of semantic network nodes based on the ratio of the number of connections to the dependency ratio, and establish a structural mapping accordingly to generate a semantic aggregation mapping table.
5. The machine learning-based question-answering intelligent matching method according to claim 1, characterized in that: The steps for obtaining the question-and-answer matching set are as follows: S301: Obtain the semantic aggregation mapping table, extract the sentence content of the question semantic item and the answer semantic item, compare the semantic direction, logical direction and keyword distribution of the two types of semantic items, calculate the angle difference of the semantic direction and the logical path offset, and integrate them according to the proportional relationship of the two values to obtain the semantic corresponding offset value. S302: Based on the semantic correspondence offset value, select the sentence segments whose difference is within the semantic convergence threshold range, calculate their semantic similarity rate and logical coherence, perform a weighted comparison and take the average value, record the consistency between the sentence segments, and generate a semantic matching strength coefficient. S303: Based on the semantic matching strength coefficient, merge the sentence segments with high matching degree to form question-answer pairs, mark their related articles and keywords, count the occurrence frequency and article co-occurrence ratio of each pair, organize them into structured records, and generate a question-answer matching correspondence set.
6. The machine learning-based question-answering intelligent matching method according to claim 1, characterized in that: The steps for obtaining the question-and-answer matching revision set are as follows: S401: Obtain the question-and-answer matching set, identify the continuous sentence segments appearing in each set of questions and answers, monitor the connection order of the main structure between sentences and the consistency of the direction of verb-object phrases, locate the content with logical transitions or thematic breaks based on whether the semantic main line between adjacent sentences is continuous, extract the segments with semantic jump features, and generate a set of semantic jump labeled segments. S402: Call the semantic jump annotation fragment set, input the segments in it into the structure review process constructed by the reinforcement learning model in sequence, and identify whether there is a topic disconnect or direction misalignment between the preceding and following sentences based on the model's judgment criteria for semantic coherence and structural rationality within the segment. Then, perform sequence reorganization and semantic direction revision operations on the problematic segments to obtain a semantic order revision fragment set. S403: Revise the fragment set according to the semantic order, align each revised fragment with the corresponding position of the original question and answer, replace paragraphs with semantic breaks in the original matched content, organize and rearrange the semantic connections between paragraphs, remove redundant terms in the sentences that no longer have semantic reference function, and complete the content reconstruction according to the original question and answer structure to generate a question matching revision set.
7. The machine learning-based question-answering intelligent matching method according to claim 1, characterized in that: The steps for obtaining the question-and-answer intelligent matching result set are as follows: S501: Obtain the question-and-answer matching revision set and the semantic logic hierarchical table, verify the correspondence between the two in the semantic layer, calculate the connection ratio and semantic consistency rate between the levels, mark the levels with a connection ratio lower than the set benchmark value, record the difference range, and obtain the level connection consistency value. S502: Based on the hierarchical connection consistency value, review the semantic layers with unstable connection rates, compare their semantic connection directions and logical order, calculate the logical offset and semantic volatility, perform a weighted average and normalization on the two values, and generate a semantic stability coefficient. S503: Based on the semantic stability coefficient, filter content with stable semantic structure, integrate the semantic units and logical levels of questions and answers, calculate the coherence rate and matching concentration of each node, organize them into a matching structure that can be directly output, and generate a question-and-answer intelligent matching result set.