Query interaction system and method based on legal consultation
By analyzing user basic information and important keyword factors, and using answer matching models and historical data to adjust answers, the problem of system understanding difficulty and satisfaction acquisition caused by irregular word use of user input problems is solved, and a more accurate and flexible legal consultation interaction is achieved.
Patent Information
- Application Number
- CN202510545954.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-28
- Publication Date
- 2025-08-12
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing legal consultation and query interaction system uses irregular words due to different knowledge level or language abilities when users enter questions, which increases the difficulty of system understanding, and it is difficult to obtain user satisfaction, and it is impossible to optimize the answers independently.
By analyzing user basic information, obtaining keywords and important factors, using the answer matching model to output matching answers, and adjusting answers based on historical data and similarity, providing preset questions to optimize interaction.
It improves the accuracy and user satisfaction of the answers, reduces the difficulty of system understanding, and enhances the flexibility and user experience of the system.
Smart Images

Figure CN120470087A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of artificial intelligence and relates to legal interactive consultation technology, specifically a query interaction system and method based on legal consultation. Background Art
[0002] With socioeconomic development and rising legal awareness, more and more individuals and businesses are seeking convenient and efficient legal services. Legal issues span all aspects of life, such as marriage, inheritance, traffic accidents, and labor disputes, and the demand for legal services is growing. However, legal resources are unevenly distributed across geography and economic conditions. Some remote or economically underdeveloped areas may lack sufficient lawyers, making it difficult for residents and businesses in these areas to obtain professional and timely legal advice.
[0003] With the development of artificial intelligence technology, in order to meet the legal consulting needs of many legal consultants, many smart devices for legal consulting services have emerged. Users interact with the system through consultation. Through this interaction, users can raise legal-related questions or needs, and the system provides corresponding legal information, suggestions or solutions based on the user's input. Through this interactive query, a step-by-step query service can be provided for non-professionals.
[0004] At present, most query interaction systems based on legal consultation, when interacting with users to answer questions, ignore the fact that the questions input by users may result in irregular or inaccurate wording due to their own knowledge level or language ability, making it more difficult for the system to understand, thereby increasing the system's computing power; at the same time, most query interaction systems based on legal consultation find it difficult to obtain the user's satisfaction with the answer. When the user's satisfaction is not high, it is difficult to independently optimize the subsequent answers, which reduces the user experience and the flexibility of the system.
[0005] Therefore, the present invention discloses a query interaction system and method based on legal consultation, which are used to solve the above technical problems. Summary of the Invention
[0006] The present invention aims to solve at least one of the technical problems existing in the prior art; to this end, the present invention proposes a query interaction system and method based on legal consultation, which is used to solve the technical problems that when interactively answering questions with users, the system becomes more difficult to understand because of the differences in the user's knowledge level or language ability, etc., which leads to irregular or inaccurate wording and difficulty in obtaining user satisfaction with the answers. When the user's satisfaction is not high, it is difficult to autonomously optimize subsequent answers. The present invention obtains preset questions by analyzing basic information, inputs keywords and important factors corresponding to each keyword into an answer matching model to obtain matching answers, outputs the matching answers to the user as the answers to the current target questions, and sets preset questions for the user to choose next to the current target question based on historical data; obtains the similarity between the latest target question and the previous target question, and adjusts the answers to the latest target question based on the similarity to solve the above problems.
[0007] To achieve the above-mentioned object, the first aspect of the present invention provides a query interaction system based on legal consultation, comprising: a question answering module, and a question setting module, an answer correction module and a database connected thereto;
[0008] The question setting module is used to obtain basic information of users seeking legal advice, analyze the basic information to obtain preset questions, and mark the preset questions selected by the user or the questions entered by the user as target questions; the basic information includes geographic location and user age; the preset questions are questions that the system provides users with possible queries before the user conducts the current query;
[0009] The question answering module is configured to extract keywords from the target question and the important factors corresponding to each keyword, input the keywords and the important factors corresponding to each keyword into an answer matching model to obtain a matching answer, and output the matching answer to the user as the answer to the current target question; set a preset question for the user to select next to the current target question based on historical data, and push the preset question for the user to select next to a preset area; wherein the answer matching model is obtained through training of an artificial intelligence model; and the preset area is an area manually planned on the display screen;
[0010] The answer correction module is used to extract the user's latest target question, obtain the similarity between the latest target question and the previous target question, and adjust the answer to the latest target question based on the similarity.
[0011] Preferably, the basic information of the user seeking legal advice is obtained, including:
[0012] Obtain the location of the device display screen clicked by the user or the location of the user when consulting via mobile phone, and mark the location as the geographic location; when the user clicks the device display screen, determine whether the user is a new user through face recognition after authorization; if yes, pop up an age input window, and the user enters his age in the age input window to obtain the user age; if no, obtain the user age of the current user from the database;
[0013] When a user makes a consultation via a mobile phone, it is identified whether the current mobile phone is making a consultation for the first time; if so, an age input window pops up, and the user fills in his or her age in the age input window to obtain the user's age; if not, the user's age corresponding to the current mobile phone is obtained from the database.
[0014] Preferably, the analysis of the basic information to obtain the preset questions includes:
[0015] Extracting the user's geographic location, marking the area where the geographic location is located as an analysis area, and combining the historical questions raised by users in the analysis area into a historical question group 1; marking users of the same age as the current user as reference users, and combining the historical questions raised by reference users in the database into a historical question group 2;
[0016] Determine whether there are similar questions in history question group one and history question group two; if yes, extract the number of similar questions T1 in history question group one and the number of similar questions T2 in history question group two, select the question with the highest number of questions and mark it as the output question, and obtain the ranked number PL of output questions based on the formula PL = α1 × T1 + α2 × T2; if no, multiply the number of non-similar questions in history question group one by the proportional adjustment coefficient α1 to obtain the ranked number PL of non-similar questions in history question group one, and multiply the number of non-similar questions in history question group two by the proportional adjustment coefficient α2 to obtain the ranked number PL of non-similar questions in history question group two; wherein α1 and α2 are both proportional adjustment coefficients greater than 0, and α1 + α2 = 1, α1 < α2; similar questions refer to questions with the same keywords and the same questioning method;
[0017] Sort each output question and each non-similar question according to the sorting quantity PL from large to small to obtain a sorting table 1, and mark the questions corresponding to the first n sequence numbers in the sorting table 1 as preset questions.
[0018] It is worth noting that the questions entered by users may use irregular or inaccurate words due to their own knowledge level or language ability, which will interfere with the system's understanding and answering. At the same time, when users enter their first question, they may not express themselves well due to the lack of a fixed template, which may lead to the omission or misunderstanding of key information, affecting the accurate answer to the question. Because the legal issues that users from different regions and different ages want to consult have certain similarities, the present invention will analyze the user's location and age to obtain the questions that the user may ask each time the user asks the first question, and provide the user with preset questions to choose from. The preset questions can also indirectly help users master questioning skills, making it more convenient for users while reducing the difficulty of understanding the system.
[0019] Preferably, the step of extracting keywords of the target question and the important factors corresponding to each keyword includes:
[0020] Use natural language recognition technology to obtain the keywords of the target question, and then determine whether the keywords belong to the legal keyword library. If yes, obtain the evaluation factor Pi of the corresponding keyword based on the legal keyword library. If not, mark the evaluation factor Pi of the keyword as 0. The legal keyword library and the evaluation factor Pi corresponding to each keyword in the legal keyword library are all obtained through manual setting.
[0021] Obtain the probability GLi of each keyword appearing in the target question, and obtain the importance factor ZYi corresponding to each keyword based on the formula ZYi = β×(exp(δ1×GLi+δ2×Pi)-1); where i is the sequence number of the keyword; β is the amplitude adjustment coefficient of the manually set exp() function, and the value range of β is (0,1]; δ1 and δ2 are both proportional adjustment coefficients greater than 0, and δ1+δ2=1, δ1>δ2.
[0022] Preferably, the answer matching model is obtained through artificial intelligence model training, including:
[0023] Obtain keywords of the target question, important factors corresponding to each keyword, and corresponding matching answers through the database; integrate the keywords, important factors corresponding to each keyword, and corresponding matching answers into several groups of training data and test data; use the training data to train the artificial intelligence model, use the test data to test the trained artificial intelligence model, and adjust the artificial intelligence model according to the test results; finally, obtain an answer matching model whose input is the keywords of the target question, the important factors corresponding to each keyword, and the output is the matching answer; wherein the artificial intelligence model includes a Transformer neural network or a convolutional neural network.
[0024] Specifically, the trained artificial intelligence model is tested using test data, and the specific steps for adjusting the artificial intelligence model based on the test results are as follows:
[0025] The keywords in the test data and the important factors corresponding to each keyword are input into the trained artificial intelligence model to obtain the corresponding matching answers; the corresponding matching answers are compared with the corresponding matching answers in the test data. When the gap between the two meets the expert's expectations, there is no need to adjust the parameters, and the next set of test data is tested; when the gap between the two does not meet the expert's expectations, the corresponding parameters are adjusted until the gap between the two meets the expert's expectations, and then the next set of test data is tested. When the test data whose matching answers meet the expert's expectations in all the test data accounts for 90% or more of the total test data, an answer matching model is obtained with the input being the keywords of the target question, the important factors corresponding to each keyword, and the output being the matching answers.
[0026] It is worth noting that when obtaining matching answers, the data input into the answer matching model of the present invention includes not only keywords, but also important factors corresponding to each keyword; this is done to enable the answer matching model to understand the core of the problem and the user's intention more accurately when analyzing the problem, and to reduce errors that may be caused by the isolated use of keywords, thereby improving the matching degree and quality of the answers.
[0027] Preferably, the setting of the preset questions for the user to select next to the current target question based on historical data includes:
[0028] Extract the next target question selected or entered by other users after entering the current target question in the historical data, and mark the next target question as a reference question; count the number of reference questions, and sort the reference questions from large to small according to the number to obtain a sorting table 2, and set the questions corresponding to the first n serial numbers in the sorting table 2 as the preset questions for the user to select next.
[0029] It is worth noting that the preset questions obtained in this step are different from the preset questions before entering the first target question. The preset questions in this step are obtained by analyzing the next target questions selected or entered by other users in historical data after entering the current target question. This can make the preset questions raised by the system better conform to human thinking and expectations, and can improve user satisfaction with the system.
[0030] Preferably, obtaining the similarity between the latest target question and the previous target question includes:
[0031] Extract co-occurring words in sequence, count the total number of co-occurring words C, obtain the total number of times each keyword appears in the latest target question and the previous target question ZC, and use the total number C divided by the total number ZC to get the probability GP of the current keyword appearing;
[0032] The number of words CZ of the longest similar sentence between the latest target question and the previous target question is obtained, and the similarity SD is obtained based on the formula SD = μ1×ln(μ2×GP+μ3×2×CZ / ZS+1); where ZS is the total number of words in the latest target question and the previous target question; μ1 is the amplitude adjustment coefficient of the manually set ln() function, and the value range of μ1 is (0,2); μ2 and μ3 are both proportional adjustment coefficients greater than 0, and μ2+μ3=1, μ2<μ3.
[0033] It is worth noting that the present invention indirectly expresses the user's satisfaction with the system's answer through similarity. If the user is satisfied with the answer to the previous target question, it is difficult for the user to repeat the previous statement in the next target question, because the answer obtained in this way is already known to the user; but if the user is not satisfied with the answer to the previous target question, the expression statement may be optimized based on the previous target question in the next target question, and the question may be repeated. In this way, the new target question obtained on the basis of the last time may be extremely similar to the previous target question. Therefore, similarity can be used to analyze the user's satisfaction with the current answer. When the similarity is high, it means that the system's answer to the previous question cannot completely solve the user's problem, and the user needs a further and more complete answer. Therefore, the present invention indirectly expresses the user's satisfaction with the answer through similarity, and then optimizes the subsequent answers based on the satisfaction, so that the system can perceive the user's true expectations when interacting with the user, thereby improving the flexibility of the system and the user's satisfaction.
[0034] Preferably, adjusting the answer to the latest target question based on similarity includes:
[0035] A1: Extract the similarity SD and determine whether it is greater than the similarity threshold SYZ; if yes, jump to A2; if no, do not adjust the answer to the latest target question; the similarity threshold SYZ is obtained by the number of words in the target sentence;
[0036] A2: Extract the changing words between the latest target question and the previous target question, extract the maximum value DZY, mode ZZY, and percentile WZY of the importance factor ZYi corresponding to each keyword in the previous target question, and calculate the importance factor BZY of each changing word based on the formula BZY = (ρ1 × DZY + ρ2 × ZZY + ρ3 × WZY). Changing words are keywords that appear in the latest target question but not in the previous target question. The percentile WZY is manually set. ρ1, ρ2, and ρ3 are all proportional adjustment coefficients, and the value range of ρ1, ρ2, and ρ3 is (0, 2).
[0037] A3: Determine in sequence whether each variable word is a keyword for the latest target question. If so, mark the larger of the important factors ZYi and BZY as the important factor for the current keyword. If not, mark the variable word as a keyword and the important factor BZY as the important factor for the current keyword.
[0038] A4: Input the keywords and the important factors corresponding to each keyword into the answer matching model to obtain the matching answer, and output the matching answer as the answer to the latest target question to the user.
[0039] It is worth noting that the interactive answering mechanism of the present invention has the ability to autonomously optimize the answers, and updates the important factors of the keywords of the new questions based on the user satisfaction indirectly expressed by the similarity, so that the important factors of the current question keywords not only take into account the importance of each keyword in the sentence, but also take into account the user's query intention and preference for each keyword, so that the system can better understand the user's real needs and thus provide more accurate answers.
[0040] Preferably, the similarity threshold SYZ is obtained by the number of words in the target sentence, including:
[0041] The total number of words ZZS between the latest target question and the previous target question is extracted, and the similarity threshold SYZ is obtained based on the formula SYZ = BSY × σ / exp(ZZS / BZZS); among them, BZZS is the manually set standard total number of words, BSY is the manually set standard similarity threshold; σ is the manually set amplitude adjustment coefficient of the exp() function, and the value range of σ is (0,2).
[0042] A second aspect of the present invention provides a query interaction method based on legal consultation, comprising the following steps:
[0043] S1: Obtain basic information of the user when seeking legal advice, analyze the basic information to obtain preset questions, and mark the preset questions selected by the user or the questions entered by the user as target questions;
[0044] S2: Extract keywords from the target question and the important factors corresponding to each keyword, input the keywords and the important factors corresponding to each keyword into the answer matching model to obtain a matching answer, and output the matching answer to the user as the answer to the current target question; set a preset question for the user to choose from after the current target question based on historical data, and push the preset question for the user to choose to a preset area;
[0045] S3: Extract the user's latest target question, obtain the similarity between the latest target question and the previous target question, and adjust the answer to the latest target question based on the similarity.
[0046] Compared with the prior art, the present invention has the following beneficial effects:
[0047] 1. The present invention obtains preset questions by analyzing basic information, inputs keywords and important factors corresponding to each keyword into the answer matching model to obtain matching answers, outputs the matching answers to the user as the answers to the current target questions, and sets preset questions for the user to choose next to the current target question based on historical data; obtains the similarity between the latest target question and the previous target question, and adjusts the answer to the latest target question based on the similarity, thereby solving the technical problems of ignoring the fact that the user inputted questions may be difficult to understand due to the user's knowledge level or language ability when answering interactively with the user, and it is difficult to obtain the user's satisfaction with the answer. When the user's satisfaction is not high, it is difficult to autonomously optimize the subsequent answers. The present invention can improve the accuracy of the answer by performing personalized analysis of user needs through an autonomous optimization mechanism.
[0048] 2. The questions entered by users may use irregular or inaccurate words due to their own knowledge level or language ability, which will interfere with the system's understanding and answering. At the same time, when users enter their first question, they may not express themselves well due to the lack of a fixed template, which may lead to omissions or misunderstandings of key information and affect the accurate answer to the question. Because the legal issues that users from different regions and ages want to consult have certain similarities, the present invention will analyze the user's location and age each time a user asks a question for the first time, and use this to provide users with preset questions to choose from. The preset questions can also indirectly help users master questioning skills, making it more convenient for users while reducing the difficulty of the system's understanding.
[0049] 3. The present invention indirectly expresses the user's satisfaction with the system's answer through similarity. If the user is satisfied with the answer to the previous target question, it is difficult for the user to repeat the previous statement in the next target question, because the answer obtained in this way is already known to the user; but if the user is dissatisfied with the answer to the previous target question, the user may optimize the expression statement based on the previous target question in the next target question, and repeat the question. In this way, the new target question obtained on the basis of the previous one may be extremely similar to the previous target question. Therefore, similarity can be used to analyze the user's satisfaction with the current answer. When the similarity is high, it means that the system's answer to the previous question cannot completely solve the user's problem, and the user needs a further and more complete answer. Therefore, the present invention indirectly expresses the user's satisfaction with the answer through similarity, and then optimizes the subsequent answers based on the satisfaction, so that the system can perceive the user's true expectations when interacting with the user, thereby improving the flexibility of the system and the user's satisfaction. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0051] Figure 1 Schematic diagram of the operating steps of the present invention;
[0052] Figure 2 Schematic diagram of the system module of the present invention;
[0053] Figure 3 A schematic diagram of the operation steps for obtaining a preset problem in the present invention;
[0054] Figure 4 Schematic diagram of the operational steps for adjusting the answer to the latest target question in the present invention. DETAILED DESCRIPTION
[0055] The technical solutions of the present invention will be clearly and completely described below in conjunction with the embodiments. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.
[0056] See also Figure 1-Figure 2, a first aspect of the present invention provides an interactive query system based on legal consultation, comprising: a question answering module, and a question setting module, an answer correction module and a database connected thereto;
[0057] Question setting module: used to obtain basic information of users seeking legal advice, analyze the basic information to obtain preset questions, and mark the preset questions selected by the user or the questions entered by the user as target questions; basic information includes geographic location and user age; preset questions are questions that the system provides users with possible queries before conducting this query;
[0058] Question answering module: This module is used to extract keywords from the target question and the important factors corresponding to each keyword, input the keywords and the important factors corresponding to each keyword into the answer matching model to obtain a matching answer, and output the matching answer to the user as the answer to the current target question; based on historical data, it sets a preset question for the user to choose from after the current target question, and pushes the preset question to a preset area; the answer matching model is obtained through artificial intelligence model training; the preset area is an area manually planned on the display screen;
[0059] Answer correction module: used to extract the user's latest target question, obtain the similarity between the latest target question and the previous target question, and adjust the answer to the latest target question based on the similarity.
[0060] It should be noted that the preset questions are questions that the system provides to the user before the user makes this query. One question and the corresponding system answer constitute a query.
[0061] It should be noted that the preset question for the user to select next is pushed to the preset area, and the next in the preset question for the user to select next represents the most recent next time.
[0062] This application obtains basic information about users seeking legal advice, including:
[0063] Obtain the location of the device display screen clicked by the user or the location of the user when consulting via mobile phone, and mark the location as the geographic location; when the user clicks the device display screen, determine whether the user is a new user through face recognition after authorization; if yes, pop up an age input window, and the user enters his age in the age input window to obtain the user age; if no, obtain the user age of the current user from the database;
[0064] When a user makes a consultation via a mobile phone, it is identified whether the current mobile phone is making a consultation for the first time; if so, an age input window pops up, and the user fills in his or her age in the age input window to obtain the user's age; if not, the user's age corresponding to the current mobile phone is obtained from the database.
[0065] It should be noted that when a user consults via a mobile phone, if the user wants to change the age, the user can set the age through the setting button in the consultation window.
[0066] See also Figure 3 In this application, the basic information is analyzed to obtain the preset questions, including:
[0067] Extract the user's geographic location, mark the area where the geographic location is located as the analysis area, and group the historical questions raised by users in the analysis area into historical question group 1; mark users of the same age as the current user as reference users, and group the historical questions raised by reference users in the database into historical question group 2;
[0068] Determine whether there are similar questions in history question group one and history question group two; if yes, extract the number of similar questions T1 in history question group one and the number of similar questions T2 in history question group two, select the question with the highest number of questions and mark it as the output question, and obtain the ranked number PL of output questions based on the formula PL = α1 × T1 + α2 × T2; if no, multiply the number of non-similar questions in history question group one by the proportional adjustment coefficient α1 to obtain the ranked number PL of non-similar questions in history question group one, and multiply the number of non-similar questions in history question group two by the proportional adjustment coefficient α2 to obtain the ranked number PL of non-similar questions in history question group two; wherein α1 and α2 are both proportional adjustment coefficients greater than 0, and α1 + α2 = 1, α1 < α2; similar questions refer to questions with the same keywords and the same questioning method;
[0069] Sort each output question and each non-similar question according to the sorting quantity PL from large to small to obtain a sorting table 1, and mark the questions corresponding to the first n serial numbers in the sorting table 1 as preset questions.
[0070] It should be noted that the planning of each area in the geographical location is obtained through manual planning, such as: one county is one area, and one town is one area.
[0071] It should be noted that in determining whether there are similar questions in the history question group 1 and the history question group 2, similar questions refer to questions with the same keywords and the same questioning method.
[0072] It should be noted that the present invention selects the question with the highest number of questions as the output question. This is done because the same similar question may have several expressions in historical question group one and historical question group two. At this time, if the similar question is output to the display screen as a preset question, it is faced with not knowing which expression to select as the preset question for this similar question. Therefore, the present invention selects the expression with the highest number of questions in this step and outputs the expression with the highest number of questions as the preset question to the display screen.
[0073] It should be noted that both α1 and α2 are manually set proportional adjustment coefficients greater than 0. The reason why α1 is less than α2 is that: α1 is multiplied by the number of historical questions asked by users in the analysis area, T1; α2 is multiplied by the number of historical questions asked by users of the same age as the current user, T2. Because for users of similar ages, the similarity in thinking style and problems encountered is higher, therefore, the proportional adjustment coefficient α2 set in the present invention is greater than the proportional adjustment coefficient α1.
[0074] This application extracts the keywords of the target question and the important factors corresponding to each keyword, including:
[0075] Use natural language recognition technology to obtain the keywords of the target question, and then determine whether the keywords belong to the legal keyword library. If yes, obtain the evaluation factor Pi of the corresponding keyword based on the legal keyword library. If not, mark the evaluation factor Pi of the keyword as 0. The legal keyword library and the evaluation factor Pi corresponding to each keyword in the legal keyword library are all obtained through manual setting.
[0076] Obtain the probability GLi of each keyword appearing in the target question, and obtain the importance factor ZYi corresponding to each keyword based on the formula ZYi=β×(exp(δ1×GLi+δ2×Pi)-1); where i is the keyword number; β is the manually set amplitude adjustment coefficient of the exp() function, and the value range of β is (0,1]; δ1 and δ2 are both manually set proportional adjustment coefficients greater than 0, and δ1+δ2=1, δ1>δ2.
[0077] It should be noted that the sequence number i is obtained by sorting the keywords from large to small according to the number of times they appear in the current target question. When there are several keywords with the same number of appearances, these keywords will be internally sorted in the order of appearance from front to back.
[0078] It should be noted that the probability Gli of each keyword appearing in the target question is obtained by dividing the number of times the keyword appears by the total number of times each keyword appears in the target question.
[0079] It should be noted that β is the amplitude adjustment coefficient of the manually set exp() function, which is used to adjust the probability GLi of each keyword appearing in the target question and the influence of the evaluation factor Pi on the important factor ZYi. When other conditions remain unchanged, the larger β is, the greater the impact on the important factor ZYi, and the smaller β is, the smaller the impact on the important factor ZYi.
[0080] It should be noted that δ1 and δ2 are both manually set proportional adjustment coefficients greater than 0. The reason why δ1>δ2 is that: δ1 is multiplied by the probability GLi of each keyword appearing in the target question, and δ2 is multiplied by the evaluation factor Pi of the keyword. Because for the important factors of the keywords, the probability Gli of appearing in the target question has a greater impact on the important factors than the fixed evaluation factor Pi. Therefore, the proportional adjustment coefficient δ1 set in the present invention is greater than the proportional adjustment coefficient δ2.
[0081] It should be noted that the legal keyword library includes:
[0082] Legal procedures: prosecution, appeal, arbitration, mediation, defense, execution, trial, investigation, etc.;
[0083] Legal documents: contracts, wills, complaints, statements of defence, appeals, judgments, awards, etc.;
[0084] Legal entity: company, enterprise, partnership, sole proprietorship, legal person, natural person, etc.;
[0085] Legal provisions: citations of specific legal provisions, such as Article 1,254 of the Civil Code of the People's Republic of China;
[0086] Legal services: legal consultation, lawyer services, notarization, appraisal, intellectual property protection, etc.;
[0087] Legal disputes: contract disputes, intellectual property disputes, labor disputes, marriage and family disputes, etc.;
[0088] Legal terms: life imprisonment, fixed-term imprisonment, fine, detention, arrest, compensation, infringement, etc.;
[0089] Legal figures: judges, lawyers, prosecutors, parties involved, witnesses, appraisers, etc.
[0090] In this embodiment, if the evaluation factor Pi of a certain keyword is 0.1, and the probability Gli of the current keyword appearing in the target question is 5%, then based on the formula ZYi=β×(exp(δ1×GLi+δ2×Pi)-1)=0.9×(exp(0.6×5%+0.4×0.1)-1)=0.0652, the importance factor ZYi=0.0652 corresponding to each keyword is obtained; wherein, in this embodiment, the value of the amplitude adjustment coefficient β is 0.9, the value of the proportional adjustment coefficient δ1 is 0.6, and the value of the proportional adjustment coefficient δ2 is 0.4.
[0091] The answer matching model in this application is obtained through artificial intelligence model training, including:
[0092] Obtain keywords of the target question, important factors corresponding to each keyword, and corresponding matching answers through the database; integrate the keywords, important factors corresponding to each keyword, and corresponding matching answers into several groups of training data and test data; use the training data to train the artificial intelligence model, use the test data to test the trained artificial intelligence model, and adjust the artificial intelligence model according to the test results; finally, obtain an answer matching model whose input is the keywords of the target question, the important factors corresponding to each keyword, and the output is the matching answer; wherein the artificial intelligence model includes a Transformer neural network or a convolutional neural network.
[0093] It should be noted that the matching answers are obtained by experts based on the keywords of the target question and the importance factors corresponding to each keyword. The larger the importance factor corresponding to the keyword of the target question, the higher the importance of this keyword in the target question, and the more inclined the matching answer is to answer this keyword.
[0094] Specifically, the trained artificial intelligence model is tested using test data, and the specific steps for adjusting the artificial intelligence model based on the test results are as follows:
[0095] The keywords in the test data and the important factors corresponding to each keyword are input into the trained artificial intelligence model to obtain the corresponding matching answers; the corresponding matching answers are compared with the corresponding matching answers in the test data. When the gap between the two meets the expert's expectations, there is no need to adjust the parameters, and the next set of test data is tested; when the gap between the two does not meet the expert's expectations, the corresponding parameters are adjusted until the gap between the two meets the expert's expectations, and then the next set of test data is tested. When the test data whose matching answers meet the expert's expectations in all the test data accounts for 90% or more of the total test data, an answer matching model is obtained with the input being the keywords of the target question, the important factors corresponding to each keyword, and the output being the matching answers.
[0096] It should be noted that the matching answers include relevant legal provisions and related cases.
[0097] It should be noted that the corresponding matching answers in the test data are obtained through expert settings.
[0098] In this application, the current target question is set based on historical data. The following preset questions are available for users to choose from, including:
[0099] Extract the next target question selected or entered by other users after entering the current target question in the historical data, and mark the next target question as a reference question; count the number of reference questions, and sort the reference questions from large to small according to the number to obtain a sorting table 2, and set the questions corresponding to the first n serial numbers in the sorting table 2 as the preset questions for the user to select next.
[0100] In this embodiment, the value of n is 5.
[0101] In this application, the similarity between the latest target question and the previous target question is obtained, including:
[0102] Extract co-occurring words in sequence, count the total number of co-occurring words C, obtain the total number of times each keyword appears in the latest target question and the previous target question ZC, and use the total number C divided by the total number ZC to get the probability GP of the current keyword appearing;
[0103] The number of words CZ of the longest similar sentence between the latest target question and the previous target question is obtained, and the similarity SD is obtained based on the formula SD = μ1×ln(μ2×GP+μ3×2×CZ / ZS+1); where ZS is the total number of words in the latest target question and the previous target question; μ1 is the manually set amplitude adjustment coefficient of the ln() function, and the value range of μ1 is (0,2); μ2 and μ3 are both manually set proportional adjustment coefficients greater than 0, and μ2+μ3=1, μ2<μ3.
[0104] It should be noted that μ1 is the manually set amplitude adjustment coefficient of the ln() function, and μ1 is used to adjust the influence of the probability GP of the current keyword and the number of words CZ of the longest similar sentence on the similarity SD. When other conditions remain unchanged, the larger μ1 is, the greater the influence on the similarity SD is, and the smaller μ1 is, the smaller the influence on the similarity SD is.
[0105] It should be noted that μ2 and μ3 are both manually set proportional adjustment coefficients greater than 0. The reason why μ2 is less than μ3 is that: μ2 is multiplied by the probability GP of the current keyword appearing, and μ3 is multiplied by the number of words CZ in the longest similar sentence between the latest target question and the previous target question. Because for the similarity SD, the influence of the number of words CZ in the longest similar sentence between the latest target question and the previous target question on the similarity SD is greater than the probability GPi of the current keyword appearing. Therefore, the proportional adjustment coefficient μ2 set in the present invention is less than the proportional adjustment coefficient μ3.
[0106] It should be noted that co-occurring words are keywords that appear in both target questions.
[0107] It should be noted that the specific steps for counting the total number C of co-occurring words are as follows:
[0108] If the latest target question is: How to prevent landlords from setting loopholes in contracts?
[0109] The target question last time was: How can I prevent the landlord from deliberately setting loopholes in the contract?
[0110] At this time, the latest target problem keywords are: prevention, landlord, contract, setting loopholes;
[0111] The keywords for the last target question were: prevent, landlord, intentional, contract, setting loopholes;
[0112] Therefore, the co-occurring words between the latest target question and the previous target question are: prevent, landlord, contract, set loopholes; the co-occurring words appear in both the latest target question and the previous target question, so the total number of co-occurring words C = 8;
[0113] The total number of times each keyword appears in the latest target question and the previous target question is ZC=9.
[0114] It should be noted that the longest similar sentence is the longest number of words that appear in the same sentence between the two target questions. For example, the latest target question is: The landlord deliberately created a loophole in the contract, causing me to suffer losses during a dispute. How can I protect my rights?
[0115] The target question last time was: The landlord deliberately set loopholes in the contract, causing me to suffer losses during a dispute. How can I avoid the losses?
[0116] The longest similar sentence between the latest target question and the previous target question is: The landlord deliberately created a loophole in the contract, causing me to suffer losses during the dispute. Therefore, the word count CZ of the longest similar sentence is 22 words.
[0117] In another embodiment, if the total number of co-occurring words C = 6, and the total number of times the keyword appears ZC = 10, then the probability of the current keyword appearing GP = C / ZC = 6 / 10 = 0.6;
[0118] If the number of words CZ in the longest similar sentence between the latest target question and the previous target question is 20, then based on the formula SD=μ1×ln(μ2×GP+μ3×2×CZ / ZS+1)=0.9×ln(0.4×0.6+0.6×2×20 / 90+1)=0.3689, the similarity SD=0.3689 is obtained; wherein, in this embodiment, the total number of words ZS of the latest target question and the previous target question is 90, the value of the amplitude adjustment coefficient μ1 is 0.9, the value of the proportional adjustment coefficient μ2 is 0.4, and the value of the proportional adjustment coefficient μ3 is 0.6.
[0119] See also Figure 4 In this application, the answers to the latest target questions are adjusted based on similarity, including:
[0120] A1: Extract the similarity SD and determine whether it is greater than the similarity threshold SYZ. If yes, jump to A2. If no, do not adjust the answer to the latest target question. The similarity threshold SYZ is obtained by the number of words in the target sentence.
[0121] A2: Extract the changing words between the latest target question and the previous target question, extract the maximum value DZY, mode ZZY, and percentile WZY of the importance factor ZYi corresponding to each keyword in the previous target question, and calculate the importance factor BZY of each changing word based on the formula BZY = (ρ1×DZY+ρ2×ZZY+ρ3×WZY). Changing words are keywords that appear in the latest target question but not in the previous target question. The percentile WZY is manually set. ρ1, ρ2, and ρ3 are manually set proportional adjustment coefficients, and the value range of ρ1, ρ2, and ρ3 is (0, 2).
[0122] A3: Determine in sequence whether each variable word is a keyword for the latest target question. If so, mark the larger of the important factors ZYi and BZY as the important factor for the current keyword. If not, mark the variable word as a keyword and the important factor BZY as the important factor for the current keyword.
[0123] A4: Input the keywords and the important factors corresponding to each keyword into the answer matching model to obtain the matching answer, and output the matching answer as the answer to the latest target question to the user.
[0124] It should be noted that the steps for obtaining percentile WZY are:
[0125] The important factors ZYi corresponding to the keywords in the previous target question are numbered in descending order, and the percentile of each number is obtained. The number at or closest to the set percentile is marked as the target number, and the important factor ZYi corresponding to the target number is marked as the percentile WZY; in this embodiment, the set percentile is 40%.
[0126] The similarity threshold SYZ in this application is obtained by the number of words in the target sentence, including:
[0127] The total number of words ZZS between the latest target question and the previous target question is extracted, and the similarity threshold SYZ is obtained based on the formula SYZ = BSY × σ / exp(ZZS / BZZS); among them, BZZS is the manually set standard total number of words, BSY is the manually set standard similarity threshold; σ is the manually set amplitude adjustment coefficient of the exp() function, and the value range of σ is (0,2).
[0128] It should be noted that σ is the manually set amplitude adjustment coefficient of the exp() function, and σ is used to adjust the influence of the total number of words ZZS between the latest target question and the previous target question on the similarity threshold SYZ. When other conditions remain unchanged, the larger σ is, the greater the influence on the similarity threshold SYZ is, and the smaller σ is, the smaller the influence on the similarity threshold SYZ is.
[0129] A second embodiment of the present invention provides a query interaction method based on legal consultation, comprising the following steps:
[0130] S1: Obtain basic information of the user when seeking legal advice, analyze the basic information to obtain preset questions, and mark the preset questions selected by the user or the questions entered by the user as target questions;
[0131] S2: Extract keywords from the target question and the important factors corresponding to each keyword, input the keywords and the important factors corresponding to each keyword into the answer matching model to obtain a matching answer, and output the matching answer to the user as the answer to the current target question; set a preset question for the user to choose from after the current target question based on historical data, and push the preset question for the user to choose to a preset area;
[0132] S3: Extract the user's latest target question, obtain the similarity between the latest target question and the previous target question, and adjust the answer to the latest target question based on the similarity.
[0133] Some of the data in the above formula are calculated by removing the dimensions and taking their numerical values. The formula is a formula that is closest to the actual situation obtained by software simulation of a large amount of collected data; the preset parameters and preset thresholds in the formula are set by technical personnel in this field according to actual conditions or obtained through simulation of a large amount of data.
[0134] Working principle of the present invention:
[0135] The present invention first obtains the basic information of the user when seeking legal advice, analyzes the basic information to obtain preset questions, and marks the preset questions selected by the user or the questions entered by the user as target questions. This step will analyze the user's location and age to obtain questions that the user may ask, which is used to provide the user with optional preset questions, and the preset questions can indirectly help the user master the questioning skills, which is convenient for the user and reduces the difficulty of understanding the system; then extract the keywords of the target question and the important factors corresponding to each keyword, input the keywords and the important factors corresponding to each keyword into the answer matching model to obtain matching answers, and output the matching answers to the user as the answers to the current target question; set the current target question based on historical data and then let the user choose The system then extracts the user's latest target question and obtains the similarity between the latest target question and the previous target question. This step indirectly expresses the user's satisfaction with the answer through similarity, and then optimizes subsequent answers based on the satisfaction, so that the system can perceive the user's true expectations when interacting with the user, thereby improving the system's flexibility and user satisfaction. Finally, the answer to the latest target question is adjusted based on the similarity. This step makes the important factor of the current question keyword take into account not only the importance of each keyword in the sentence, but also the user's query intention and preference for each keyword, so that the system can better understand the user's real needs and provide more accurate answers.
[0136] The above embodiments are only used to illustrate the technical method of the present invention and are not intended to limit the present invention. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical method of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical method of the present invention.
Claims
1. A query interaction system based on legal consultation, characterized in that: include: Question answering module, and its connected question setting module, answer correction module and database; The question setting module is used to obtain basic information of users seeking legal advice, analyze the basic information to obtain preset questions, and mark the preset questions selected by the user or the questions entered by the user as target questions; the basic information includes geographic location and user age; the preset questions are questions that the system provides users with possible queries before the user conducts the current query; The question answering module is configured to extract keywords from the target question and the important factors corresponding to each keyword, input the keywords and the important factors corresponding to each keyword into an answer matching model to obtain a matching answer, and output the matching answer to the user as the answer to the current target question; set a preset question for the user to select next to the current target question based on historical data, and push the preset question for the user to select next to a preset area; wherein the answer matching model is obtained through training of an artificial intelligence model; The answer correction module is used to extract the user's latest target question, obtain the similarity between the latest target question and the previous target question, and adjust the answer to the latest target question based on the similarity.
2. The query interaction system based on legal consultation according to claim 1 is characterized in that: The basic information obtained when the user seeks legal advice includes: Obtain the location of the device display screen clicked by the user or the location of the user when consulting via mobile phone, and mark the location as the geographic location; when the user clicks the device display screen, determine whether the user is a new user through face recognition after authorization; if yes, pop up an age input window, and the user enters his age in the age input window to obtain the user age; if no, obtain the user age of the current user from the database; When a user makes a consultation via a mobile phone, it is identified whether the current mobile phone is making a consultation for the first time; if so, an age input window pops up, and the user fills in his or her age in the age input window to obtain the user's age; if not, the user's age corresponding to the current mobile phone is obtained from the database.
3. The query interaction system based on legal consultation according to claim 1 is characterized in that: The analysis of the basic information to obtain preset questions includes: Extracting the user's geographic location, marking the area where the geographic location is located as an analysis area, and combining the historical questions raised by users in the analysis area into a historical question group 1; marking users of the same age as the current user as reference users, and combining the historical questions raised by reference users in the database into a historical question group 2; Determine whether there are similar questions in history question group one and history question group two; if yes, extract the number of similar questions T1 in history question group one and the number of similar questions T2 in history question group two, select the question with the highest number of questions and mark it as the output question, and obtain the ranked number PL of output questions based on the formula PL = α1 × T1 + α2 × T2; if no, multiply the number of non-similar questions in history question group one by the proportional adjustment coefficient α1 to obtain the ranked number PL of non-similar questions in history question group one, and multiply the number of non-similar questions in history question group two by the proportional adjustment coefficient α2 to obtain the ranked number PL of non-similar questions in history question group two; wherein α1 and α2 are both proportional adjustment coefficients greater than 0, and α1 + α2 = 1, α1 < α2; similar questions refer to questions with the same keywords and the same questioning method; Sort each output question and each non-similar question according to the sorting quantity PL from large to small to obtain a sorting table 1, and mark the questions corresponding to the first n sequence numbers in the sorting table 1 as preset questions.
4. The query interaction system based on legal consultation according to claim 1 is characterized in that: The extraction of keywords for the target question and the important factors corresponding to each keyword includes: Use natural language recognition technology to obtain the keywords of the target question, and then determine whether the keywords belong to the legal keyword library; if yes, obtain the evaluation factor Pi of the corresponding keyword based on the legal keyword library; if not, mark the evaluation factor Pi of the keyword as 0; Obtain the probability GLi of each keyword appearing in the target question, and obtain the importance factor ZYi corresponding to each keyword based on the formula ZYi = β×(exp(δ1×GLi+δ2×Pi)-1); where i is the sequence number of the keyword; β is the amplitude adjustment coefficient of the exp() function, and the value range of β is (0,1]; δ1 and δ2 are both proportional adjustment coefficients greater than 0, and δ1+δ2=1, δ1>δ2.
5. The query interaction system based on legal consultation according to claim 1 is characterized in that: The answer matching model is obtained through artificial intelligence model training, including: Obtain keywords of the target question, important factors corresponding to each keyword, and corresponding matching answers through the database; integrate the keywords, important factors corresponding to each keyword, and corresponding matching answers into several groups of training data and test data; use the training data to train the artificial intelligence model, use the test data to test the trained artificial intelligence model, and adjust the artificial intelligence model according to the test results; finally, obtain an answer matching model whose input is the keywords of the target question, the important factors corresponding to each keyword, and the output is the matching answer; wherein the artificial intelligence model includes a Transformer neural network or a convolutional neural network.
6. The query interaction system based on legal consultation according to claim 1 is characterized in that: The preset questions for the user to select after setting the current target question based on historical data include: Extract the next target question selected or entered by other users after entering the current target question in the historical data, and mark the next target question as a reference question; count the number of reference questions, and sort the reference questions from large to small according to the number to obtain a sorting table 2, and set the questions corresponding to the first n serial numbers in the sorting table 2 as the preset questions for the user to select next.
7. The query interaction system based on legal consultation according to claim 1 is characterized in that: The obtaining of the similarity between the latest target question and the previous target question includes: Extract co-occurring words in sequence, count the total number of co-occurring words C, obtain the total number of times each keyword appears in the latest target question and the previous target question ZC, and use the total number C divided by the total number ZC to get the probability GP of the current keyword appearing; Get the number of words CZ of the longest similar sentence between the latest target question and the previous target question, and get the similarity SD based on the formula SD = μ1×ln(μ2×GP+μ3×2×CZ / ZS+1); where ZS is the total number of words in the latest target question and the previous target question; μ1 is the amplitude adjustment coefficient of the ln() function, and the value range of μ1 is (0,2); μ2 and μ3 are both proportional adjustment coefficients greater than 0, and μ2+μ3=1, μ2<μ3.
8. The query interaction system based on legal consultation according to claim 7 is characterized in that: The adjustment of the answer to the latest target question based on similarity includes: A1: Extract the similarity SD and determine whether it is greater than the similarity threshold SYZ; if yes, jump to A2; if no, do not adjust the answer to the latest target question; the similarity threshold SYZ is obtained by the number of words in the target sentence; A2: Extract the changing words between the latest target question and the previous target question. Extract the maximum value DZY, mode ZZY, and percentile WZY of the importance factor ZYi corresponding to each keyword in the previous target question. Calculate the importance factor BZY of each changing word based on the formula BZY = (ρ1 × DZY + ρ2 × ZZY + ρ3 × WZY). Changing words are keywords that appear in the latest target question but not in the previous target question. ρ1, ρ2, and ρ3 are all proportional adjustment coefficients, and the value range of ρ1, ρ2, and ρ3 is (0, 2). A3: Determine in sequence whether each variable word is a keyword for the latest target question. If so, mark the larger of the important factors ZYi and BZY as the important factor for the current keyword. If not, mark the variable word as a keyword and the important factor BZY as the important factor for the current keyword. A4: Input the keywords and the important factors corresponding to each keyword into the answer matching model to obtain the matching answer, and output the matching answer as the answer to the latest target question to the user.
9. The query interaction system based on legal consultation according to claim 8, characterized in that: The similarity threshold SYZ is obtained by the number of words in the target sentence, including: Extract the total number of words ZZS between the latest target question and the previous target question, and obtain the similarity threshold SYZ based on the formula SYZ = BSY × σ / exp(ZZS / BZZS); where BZZS is the standard total number of words, BSY is the standard similarity threshold, and σ is the amplitude adjustment coefficient of the exp() function, and the value range of σ is (0,2).
10. A query interaction method based on legal consultation, operating on a query interaction system based on legal consultation according to any one of claims 1 to 9, characterized in that: S1: Obtain basic information of the user when seeking legal advice, analyze the basic information to obtain preset questions, and mark the preset questions selected by the user or the questions entered by the user as target questions; S2: Extract keywords from the target question and the important factors corresponding to each keyword, input the keywords and the important factors corresponding to each keyword into the answer matching model to obtain a matching answer, and output the matching answer to the user as the answer to the current target question; set a preset question for the user to choose from after the current target question based on historical data, and push the preset question for the user to choose to a preset area; S3: Extract the user's latest target question, obtain the similarity between the latest target question and the previous target question, and adjust the answer to the latest target question based on the similarity.