Law question and answer interaction method, device and equipment and storage medium
By combining vectorized keywords and using vector library search combined with legal question and answer models, the problem of inaccurate legal information retrieval in traditional methods is solved, and the effect of quickly obtaining accurate legal information is achieved.
Patent Information
- Application Number
- CN202411122457.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-15
- Publication Date
- 2024-12-03
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Traditional legal entry retrieval and analysis methods are difficult to meet the need to quickly obtain accurate legal information, and insufficient semantic understanding leads to the inability to provide accurate legal information.
By obtaining legal questions to be answered, determining the target keyword collection and vectorizing, using the preset vector library to retrieve associated legal entries and cases, and generating reply results in combination with the legal question and answer model.
It provides users with accurate legal information and improves the accuracy and efficiency of legal information retrieval.
Smart Images

Figure CN119066169A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a legal question-and-answer interactive method, device, equipment and storage medium. Background Art
[0002] In an era of rapid development of digitalization and informatization, the legal field has an increasing demand for efficient and accurate acquisition and processing of legal information.
[0003] With the continuous updating and expansion of a large number of legal items and the complexity and diversity of legal cases, traditional legal item retrieval and analysis methods have been unable to meet people's needs for rapid acquisition of accurate legal information.
[0004] Based on the above needs, some natural language processing and machine learning technologies have been applied in the field of legal information processing. For example, keyword retrieval and text classification algorithms are used to perform preliminary screening and classification of legal documents. However, this method cannot provide users with accurate legal information due to insufficient semantic understanding and other reasons. Summary of the invention
[0005] The present invention provides a legal question-and-answer interactive method, device, equipment and storage medium to achieve the effect of providing accurate legal information to users.
[0006] According to one aspect of the present invention, a legal question-answering interactive method is provided, comprising:
[0007] Obtaining a legal question to be answered, and determining a target keyword set based on the legal question to be answered;
[0008] Vectorizing the target keywords in the target keyword set to obtain a feature vector list associated with the target keyword set, and retrieving a target vector set associated with the feature vector list in a preset vector library;
[0009] According to the association relationship between legal items and legal cases, the legal items and legal cases associated with the target vector set are determined in the preset vector library as search results, and the legal resources are determined according to the search results;
[0010] The unanswered legal question and the legal resources are input into the legal question and answer big model to obtain the legal answer result output by the legal question and answer big model.
[0011] According to another aspect of the present invention, a legal question-answering interactive device is provided, comprising:
[0012] A keyword determination module, used to obtain the legal issues to be answered and determine a target keyword set based on the legal issues to be answered;
[0013] A vector retrieval module is used to vectorize the target keywords in the target keyword set, obtain a feature vector list associated with the target keyword set, and retrieve a target vector set associated with the feature vector list in a preset vector library;
[0014] A legal resource determination module, for determining the legal items and legal cases associated with the target vector set in the preset vector library as search results based on the association relationship between the legal items and the legal cases, and determining the legal resources based on the search results;
[0015] The answer result output module is used to input the legal question to be answered and the legal resources into the legal question and answer big model to obtain the legal answer result output by the legal question and answer big model.
[0016] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0017] at least one processor; and
[0018] a memory communicatively connected to the at least one processor; wherein,
[0019] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the legal question and answer interactive method described in any embodiment of the present invention.
[0020] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the legal question-and-answer interaction method described in any embodiment of the present invention when executed.
[0021] According to another aspect of the present invention, a computer program product is provided, including a computer program, which implements the legal question-and-answer interaction method of any embodiment of the present disclosure when executed by a processor.
[0022] The technical solution of the embodiment of the present invention, after obtaining the legal issues to be answered, determines the target keyword set based on the legal issues to be answered, and then vectorizes the target keywords in the target keyword set to obtain a feature vector list associated with the target keyword set, and retrieves the target vector set associated with the feature vector list in a preset vector library. Furthermore, based on the association between legal entries and legal cases, the legal entries and legal cases associated with the target vector set are determined in the preset vector library as search results, and the legal resources are determined based on the search results. Finally, the legal issues to be answered and the legal resources are input into the legal question and answer big model to obtain the legal answer results output by the legal question and answer big model. The legal entries and legal cases associated with the legal issues to be answered can be retrieved in the vector library, and the legal answer results are generated based on the retrieved legal entries and legal cases, so as to provide users with accurate legal information.
[0023] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. 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 creative work.
[0025] Figure 1 is a flow chart of a legal question-and-answer interactive method provided according to Embodiment 1 of the present invention;
[0026] Figure 2a is a flow chart of a legal question-and-answer interactive method provided according to Embodiment 2 of the present invention;
[0027] Figure 2b This is a scene diagram of a legal question-and-answer interactive method provided according to Embodiment 2 of the present invention;
[0028] Figure 3 is a structural diagram of a legal question-and-answer interactive device provided according to Embodiment 3 of the present invention;
[0029] Figure 4 It is a schematic diagram of the structure of an electronic device that implements the legal question-and-answer interactive method of an embodiment of the present invention. DETAILED DESCRIPTION
[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0032] Embodiment 1
[0033] Figure 1 A flowchart of a legal question-answering interactive method is provided for the first embodiment of the present invention. This embodiment is applicable to the case of performing legal question-answering interaction through a large language model. The method can be executed by a legal question-answering interactive device. The legal question-answering interactive device can be implemented in the form of hardware and / or software. The legal question-answering interactive device can be configured in various general-purpose computing devices. Figure 1 As shown, the method includes:
[0034] S110, obtaining legal issues to be answered, and determining a target keyword set based on the legal issues to be answered.
[0035] Legal questions to be answered are legal questions provided by users that need to be answered, for example, "Please find intellectual property infringement cases in XX province in XX year", "Please find the plaintiff, defendant and court handling the XX intellectual property infringement case" or "Please find legal items related to the XX case". Users can raise legal questions to be answered in the form of voice or text.
[0036] The target keywords are determined based on the legal questions to be answered and are used to filter the vocabulary of legal information related to the legal questions to be answered. For example, the target keywords can be obtained by parsing the legal questions to be answered, or by conditionally extracting the legal questions to be answered by inputting them into the legal question-answering big model, or by parsing the legal questions to be answered and historical dialogue information.
[0037] In the embodiment of the present invention, after obtaining the legal question to be answered input by the user, the target keyword set is first determined based on the question to be answered. Specifically, the legal question to be answered may be input into a pre-trained legal question-answering model for conditional extraction to obtain screening words associated with the legal question to be answered, which are subsequently referred to as target keywords, and a keyword set is composed of multiple target keywords; the legal question to be answered may also be subjected to text parsing to obtain the keywords contained therein, and a keyword set is composed of multiple keywords; only using the legal question-answering model for conditional extraction or only using text parsing may not be able to obtain complete keywords, so both methods may be used to obtain keywords, and the keywords obtained by the two methods are taken as a union to obtain the target keyword set.
[0038] S120 , vectorizing the target keywords in the target keyword set to obtain a feature vector list associated with the target keyword set, and retrieving a target vector set associated with the feature vector list in a preset vector library.
[0039] The preset vector library contains pre-stored legal information indexes, for example, legal entries and feature vectors corresponding to the legal entries, legal cases and feature vectors corresponding to the legal cases, etc. Among them, feature vectors may include sparse feature vectors and dense feature vectors. In addition, the preset vector library also includes the association between legal entries and legal cases. When a legal entry is provided, the corresponding legal case can be retrieved. Conversely, when a legal case is provided, the corresponding legal entry can also be retrieved.
[0040] In an embodiment of the present invention, in order to retrieve a target keyword set associated with a legal question to be answered, the target keywords in the target keyword set are vectorized to obtain a feature vector list associated with the target keyword set, and then based on the feature vector list, a target vector set associated with the feature vector list is retrieved in a preset vector library. Specifically, the target keywords in the target keyword set can be sparsely embedded and densely embedded, respectively, to obtain a sparse feature vector and a dense feature vector. Exemplarily, the target keywords can be sparsely embedded through the Best Matching 25 (BM25) BM25 algorithm to obtain a sparse feature vector; the target keywords can be densely embedded through the Embedding model to obtain a dense feature vector.
[0041] Furthermore, all target keywords are simultaneously input into the preset vector library for comparison, so as to retrieve a target vector set associated with the feature vector list in the preset vector library. For example, the dense feature vectors of the target keywords can be extracted in sequence, and compared with the preset dense feature vectors in the preset vector library respectively, to obtain a dense feature vector whose similarity with the dense feature vector of the target keyword is higher than a set threshold; the sparse feature vectors of the target keywords can be extracted in sequence, and compared with the preset sparse feature vectors in the preset vector library respectively, to obtain a sparse feature vector whose similarity with the sparse feature vector of the target keyword is higher than a set threshold. The set of the obtained sparse feature vectors and dense feature vectors is used as the target vector set.
[0042] S130. According to the association relationship between legal items and legal cases, the legal items and legal cases associated with the target vector set are determined in the preset vector library as search results, and the legal resources are determined according to the search results.
[0043] In the embodiment of the present invention, the preset vector library also includes the association relationship between legal items and legal cases. After determining the target vector set associated with the legal question to be answered, the legal items and legal cases associated with the target vector set are determined in the preset vector library as search results based on the association relationship between the legal items and the legal cases, and the legal resources are determined based on the search results. Specifically, the legal items or legal cases associated with the target vector set can be determined first, and then the legal cases corresponding to the legal items or the legal items corresponding to the legal cases can be determined based on the association relationship between the legal items and the legal cases.
[0044] S140. Input the legal questions to be answered and the legal resources into the legal question and answer big model, and obtain the legal answer results output by the legal question and answer big model.
[0045] In the embodiment of the present invention, in order to improve the accuracy of the legal answer result output by the legal question-answering big model, the legal question to be answered and the legal resource input are simultaneously input into the legal question-answering big model, and the legal question-answering big model outputs the legal answer result based on the legal question to be answered. The legal answer result includes the answer framework of the legal question to be answered and the legal information corresponding to the legal question to be answered contained in the legal resource.
[0046] Optionally, before obtaining the legal question to be answered and determining the target keyword set based on the legal question to be answered, the following is further included:
[0047] Input the legal text as a training sample into the basic large language model to obtain the output of the basic large language model;
[0048] Based on the output results and the cross entropy loss function, the loss value is calculated, and based on the loss value, the parameters in the basic large language model are adjusted to obtain the legal question-answering large model.
[0049] Legal texts are used to train the basic large language model. Legal texts are texts such as legal concepts, legal entries, or legal cases. The basic large language model is a pre-trained large language model architecture suitable for processing legal texts, such as a model with a Transformer architecture. The basic large language model is a model pre-trained using general texts. The language knowledge and patterns learned from massive general texts provide a strong starting point for processing legal texts.
[0050] In this optional embodiment, the pre-collected legal texts are input as training samples into the basic large language model to obtain the output of the basic large language model. Further, based on the output results and the cross entropy loss function, the loss value is calculated, and the parameters in the basic large language model are adjusted based on the loss value to obtain the legal question-answering large model.
[0051] Before using the legal question-answering model in the future, you can use the test data set to evaluate the pre-trained legal question-answering model. The evaluation indicators include accuracy, recall, and F1 value. Based on the evaluation indicators, you can analyze the model's deficiencies and optimize and adjust the model. In the subsequent use of the legal question-answering model, you can also regularly update the legal text and retrain the model to adapt to changes in legal provisions and learn new cases.
[0052] The technical solution of the embodiment of the present invention, after obtaining the legal issues to be answered, determines the target keyword set based on the legal issues to be answered, and then vectorizes the target keywords in the target keyword set to obtain a feature vector list associated with the target keyword set, and retrieves the target vector set associated with the feature vector list in a preset vector library. Furthermore, based on the association between legal entries and legal cases, the legal entries and legal cases associated with the target vector set are determined in the preset vector library as search results, and the legal resources are determined based on the search results. Finally, the legal issues to be answered and the legal resources are input into the legal question and answer big model to obtain the legal answer results output by the legal question and answer big model. The legal entries and legal cases associated with the legal issues to be answered can be retrieved in the vector library, and the legal answer results are generated based on the retrieved legal entries and legal cases, so as to provide users with accurate legal information.
[0053] Embodiment 2
[0054] Figure 2aThis is a flowchart of a legal question-and-answer interactive method provided in the second embodiment of the present invention. This embodiment further refines the above-mentioned embodiments and provides specific steps of vectorizing target keywords in a target keyword set to obtain a list of feature vectors associated with the target keyword set, and retrieving a target vector set associated with the feature vector list in a preset vector library, determining the legal entries and legal cases associated with the target vector set as search results in the preset vector library based on the association between legal entries and legal cases, and determining the legal resources based on the search results, as well as inputting the legal questions and legal resources to be answered into the legal question-and-answer big model to obtain the legal answer results output by the legal question-and-answer big model. Figure 2a As shown, the method includes:
[0055] S210: Obtain legal issues to be answered, and determine a target keyword set based on the legal issues to be answered.
[0056] Optionally, based on the legal questions to be answered, determine a target keyword set, including:
[0057] Analyze the legal question to be answered to obtain at least one first keyword;
[0058] Input the legal question to be answered into the legal question-answering model for conditional extraction, and obtain at least one second keyword output by the legal question-answering model;
[0059] Take the union of the first keyword and the second keyword to form the target keyword set.
[0060] In this optional embodiment, a specific method for determining a target keyword set based on the legal question to be answered is provided: Figure 2b As shown, firstly, the legal question to be answered is subjected to text parsing to obtain at least one first keyword, and at the same time, the legal question to be answered is input into the legal question and answer big model for conditional extraction to obtain at least one second keyword output by the legal question and answer big model. Exemplarily, the legal question to be answered is "Please find intellectual property infringement cases in XX province in XX year", and the legal question to be answered is subjected to text parsing to obtain the first keywords including "XX province", "intellectual property" and "infringement", and the second keywords obtained by the legal question and answer big model through conditional extraction include "intellectual property infringement cases", and the union of the first keyword and the second keyword can be taken as the target keyword set. Through semantic parsing and conditional extraction of the legal question and answer big model, and obtaining the union of keywords by two methods as the target keyword set, it can ensure the comprehensiveness and accuracy of the target keywords, and avoid false detection and missed detection in subsequent legal information retrieval.
[0061] Optionally, based on the legal questions to be answered, a target keyword set is determined, which also includes:
[0062] Obtaining the legal question to be answered, and determining a set number of historical conversation texts initiated before the legal question to be answered, and forming an interactive text with the legal question to be answered and the historical conversation texts;
[0063] Parsing the interactive text to obtain at least one first keyword;
[0064] Input the interactive text into the legal question-answering model for conditional extraction to obtain at least one second keyword output by the legal question-answering model;
[0065] Take the union of the first keyword and the second keyword to form the target keyword.
[0066] In this optional embodiment, another implementation method for determining a target keyword set based on the legal question to be answered is provided: first, the legal question to be answered is obtained, and a set number of historical conversation texts initiated before the legal question to be answered is determined, and the legal question to be answered and the historical conversation text constitute an interactive text. For example, 10 rounds of dialogue before the legal question to be answered can be obtained as historical conversation texts. Further, the legal question to be answered and the historical conversation text constitute an interactive text. Further, the interactive text is parsed to obtain at least one first keyword, and at the same time, the interactive text is input into the legal question and answer big model for conditional extraction to obtain at least one second keyword output by the legal question and answer big model. Finally, the union of the first keyword and the second keyword is taken to constitute the target keyword. By also taking the historical conversation text as input, the ability to integrate and understand information in multiple rounds of dialogue can be enhanced, and the changes in user needs in multiple rounds of communication can be accurately captured.
[0067] S220 , respectively perform sparse embedding and dense embedding on the target keywords in the target keyword set to obtain a sparse feature vector and a dense feature vector.
[0068] In the embodiment of the present invention, after obtaining the target keyword set, the target keywords in the target keyword set are sparsely embedded and densely embedded respectively to obtain a sparse feature vector and a dense feature vector. By performing sparse embedding and dense embedding simultaneously in two ways, the comprehensiveness and accuracy of the search can be improved in the subsequent legal resource search process.
[0069] S230: Compare the sparse feature vector with the sparse vectors in the preset vector library to obtain candidate sparse vectors whose similarity is higher than a set threshold.
[0070] In the embodiment of the present invention, the sparse feature vector is first compared with the sparse vectors in the preset vector library to obtain candidate sparse vectors whose similarity is higher than a set threshold. The vectors in the preset vector library can be added by local writing or by user uploading.
[0071] S240: Compare the dense feature vector with dense vectors in a preset vector library to obtain candidate dense vectors whose similarity is higher than a set threshold.
[0072] In the embodiment of the present invention, after the sparse vector is retrieved, the dense feature vector is compared with the dense vectors in the preset vector library to obtain candidate dense vectors whose similarity is higher than a set threshold.
[0073] S250 , forming a target vector set associated with the feature vector list from the set of candidate sparse vectors and the set of candidate dense vectors.
[0074] In the embodiment of the present invention, in order to improve the retrieval accuracy, the set of candidate sparse vectors and candidate dense vectors constitutes a target vector set associated with the feature vector list. Exemplarily, the union of the candidate sparse vectors and the candidate dense vectors can be directly used as the target vector set.
[0075] S260. Determine the legal text associated with the target vector set in a preset vector library.
[0076] In the embodiment of the present invention, since the preset vector library contains both vectors and texts associated with the vectors, such as legal entries or legal cases, after determining the target vector set, the legal text associated with the target vector set is determined in the preset vector library. The legal text may be information such as legal entries and legal cases.
[0077] S270. Based on the association between legal terms and legal cases, determine legal cases and legal terms associated with the legal text in a preset vector library as search results.
[0078] In the embodiment of the present invention, based on the association between legal items and legal cases, the legal cases and legal items associated with the legal text are determined in the preset vector library as the search results. Exemplarily, when the retrieved legal text is a legal item, based on the association between the legal item and the legal case, the legal case corresponding to the legal item is determined, and the legal case and the legal item are used as the search results together; when the retrieved legal text is a legal case, based on the association between the legal item and the legal case, the legal item corresponding to the legal case is determined, and the legal case and the legal item are used as the search results together.
[0079] The association between legal entries and legal cases can be achieved by extracting features using methods such as the bag-of-words model or term frequency-inverse document frequency (TF-IDF), and then measuring the similarity between legal entries and legal cases based on semantic matching algorithms such as cosine similarity calculation.
[0080] S280. According to the attribute screening conditions added by the user when initiating the legal question to be answered, information meeting the attribute screening conditions is screened out in the search results as legal resources.
[0081] Legal resources are used to provide information basis when the legal question-and-answer model answers questions to be answered. Legal resources can be legal entries or legal cases, etc.
[0082] In an embodiment of the present invention, based on the attribute screening conditions added by the user when initiating the legal question to be answered, such as the time screening conditions or the location screening conditions, the information that meets the attribute screening conditions is screened out in the search results as legal resources. Exemplarily, the user can add a time screening condition when initiating the legal question to be answered. For example, the legal question to be answered is an intellectual property infringement case in XX Province, and the additional attribute screening condition is XX year XX month. At this time, the search results may contain multiple legal entries and corresponding legal cases, and the search results that meet the above time conditions can be further screened out according to the attribute screening conditions as legal resources.
[0083] S290. The unanswered legal questions and legal resources are input into the legal question and answer big model. The legal question and answer big model determines the legal information related to the unanswered legal questions in the legal resources based on the unanswered legal questions.
[0084] In the embodiment of the present invention, the legal question to be answered and the legal resources are input into the legal question-answering model, and the legal question-answering model determines the legal information associated with the legal question to be answered in the legal resources according to the legal question to be answered. For example, the legal question to be answered is "Please find the plaintiff, defendant and handling court of XX intellectual property infringement case". At this time, the user does not need to obtain the complete intellectual property infringement case or legal entry, so it is only necessary to extract the plaintiff, defendant and handling court of the case specified by the user from the legal resources as the legal information associated with the legal question to be answered.
[0085] S291. Construct legal response results based on the legal issues to be answered and legal information.
[0086] In an embodiment of the present invention, a legal reply result is constructed based on the legal question to be answered and the determined legal information. Specifically, a reply logic can be generated according to the legal question to be answered, and the legal information can be added to the reply logic to complete the construction of the legal reply result. For example, the legal question to be answered is "Please find the plaintiff, defendant and handling court of XX intellectual property infringement case", and the legal reply logic can be determined as "The plaintiff of XX intellectual property infringement case is (), the defendant is (), and the handling court is (). Finally, the found legal information is added to the above reply logic to obtain the legal reply result.
[0087] Optionally, before inputting the legal question to be answered and the legal resources into the legal question-answering model, the following steps are further included:
[0088] Rank legal resources based on their relevance to the legal questions to be answered;
[0089] Based on the legal issues to be answered and legal information, construct legal response results, including:
[0090] Determine the framework of the response based on the legal questions to be answered;
[0091] The legal information is sorted based on its position in the legal resources, and then filled into the reply framework based on the sorting result to obtain a legal reply result.
[0092] In this optional embodiment, before inputting the legal question to be answered and the legal resources into the legal question-answering model, the following steps are further included:
[0093] The legal resources are sorted based on the relevance between the legal resources and the legal issues to be answered. For example, the legal resources can be sorted based on the vector relevance between the legal resources and the legal issues to be answered.
[0094] Accordingly, based on the legal issues to be answered and the legal information, a legal response result is constructed, including:
[0095] Determine the framework of the response based on the legal questions to be answered;
[0096] The legal information is sorted based on its position in the legal resources, and then filled into the reply framework based on the sorting result to obtain a legal reply result.
[0097] In the embodiment of the present invention, based on the legal question to be answered, a reply framework is determined. The reply framework may include the question part of the legal question to be answered, and a blank part, and the blank part is waiting to be filled with the retrieved legal information. Finally, based on the arrangement position of the legal information in the legal resources, the legal information is sorted through the re-ranking model, and the legal information is filled into the reply framework based on the sorting result to obtain the legal reply result. Information with a high degree of relevance to the legal question to be answered can be filled in the front part of the reply result, so that the user can obtain the desired content more quickly, thereby improving the user's business processing efficiency.
[0098] The technical solution of the embodiment of the present invention performs sparse embedding and dense embedding on the target keywords at the same time, and retrieves the corresponding target vector collection in the preset vector library based on the obtained sparse feature vectors and dense feature vectors, and determines the legal text associated with the target vector collection in the preset vector library, and based on the association relationship between legal items and legal cases, determines the legal cases and legal items associated with the legal text in the preset vector library as the search results, and based on the attribute filtering conditions attached by the user when initiating the legal question to be answered, filters out the information that meets the attribute filtering conditions in the search results as legal resources, and finally inputs the legal question to be answered and the legal resources into the legal question and answer big model, which determines the legal information associated with the legal question to be answered in the legal resources based on the legal question to be answered, and constructs the legal reply result based on the legal question to be answered and the legal information, which can improve the relevance of the reply content to the legal question to be answered, as well as the legal professionalism.
[0099] Embodiment 3
[0100] Figure 3 A schematic diagram of the structure of a legal question-and-answer interactive device provided in Embodiment 3 of the present invention.
[0101] like Figure 3 As shown, the device comprises:
[0102] A keyword determination module 310 is used to obtain the legal question to be answered and determine a target keyword set based on the legal question to be answered;
[0103] A vector retrieval module 320 is used to vectorize the target keywords in the target keyword set, obtain a feature vector list associated with the target keyword set, and retrieve a target vector set associated with the feature vector list in a preset vector library;
[0104] A legal resource determination module 330 is used to determine the legal items and legal cases associated with the target vector set in the preset vector library as search results according to the association relationship between the legal items and the legal cases, and determine the legal resources according to the search results;
[0105] The answer result output module 340 is used to input the unanswered legal question and the legal resources into the legal question and answer big model to obtain the legal answer result output by the legal question and answer big model.
[0106] The technical solution of the embodiment of the present invention, after obtaining the legal issues to be answered, determines the target keyword set based on the legal issues to be answered, and then vectorizes the target keywords in the target keyword set to obtain a feature vector list associated with the target keyword set, and retrieves the target vector set associated with the feature vector list in a preset vector library. Furthermore, based on the association between legal entries and legal cases, the legal entries and legal cases associated with the target vector set are determined in the preset vector library as search results, and the legal resources are determined based on the search results. Finally, the legal issues to be answered and the legal resources are input into the legal question and answer big model to obtain the legal answer results output by the legal question and answer big model. The legal entries and legal cases associated with the legal issues to be answered can be retrieved in the vector library, and the legal answer results are generated based on the retrieved legal entries and legal cases, so as to provide users with accurate legal information.
[0107] Optionally, the keyword determination module 310 is specifically used to:
[0108] Parsing the legal question to be answered to obtain at least one first keyword;
[0109] Inputting the unanswered legal question into the legal question-answering model for conditional extraction to obtain at least one second keyword output by the legal question-answering model;
[0110] The union of the first keyword and the second keyword is taken to form a target keyword set.
[0111] Optionally, the vector retrieval module 320 is specifically used for:
[0112] Performing sparse embedding and dense embedding on the target keywords in the target keyword set respectively to obtain a sparse feature vector and a dense feature vector;
[0113] Comparing the sparse feature vector with the sparse vectors in the preset vector library to obtain candidate sparse vectors whose similarity is higher than a set threshold;
[0114] Comparing the dense feature vector with the dense vectors in the preset vector library to obtain candidate dense vectors whose similarity is higher than a set threshold;
[0115] The set of candidate sparse vectors and candidate dense vectors constitutes a target vector set associated with the feature vector list.
[0116] Optionally, the legal resource determination module 330 is specifically used to:
[0117] Determining the legal text associated with the target vector set in the preset vector library;
[0118] Based on the association between legal terms and legal cases, determining the legal cases and legal terms associated with the legal text in the preset vector library as search results;
[0119] According to the attribute screening conditions added by the user when initiating the legal question to be answered, information meeting the attribute screening conditions is screened out from the search results as legal resources.
[0120] Optionally, the reply result output module 340 includes:
[0121] A legal information determination unit, configured to input the unanswered legal question and the legal resource into a legal question-and-answer big model, wherein the legal question-and-answer big model determines, in the legal resource, legal information associated with the unanswered legal question based on the unanswered legal question;
[0122] The answer result constructing unit is used to construct a legal answer result based on the legal question to be answered and the legal information.
[0123] Optionally, the legal question-and-answer interactive device also includes:
[0124] A resource sorting module, used for sorting the legal resources based on the relevance between the legal resources and the legal questions to be answered before inputting the legal questions to be answered and the legal resources into the legal question-answering macromodel;
[0125] The reply result building block is used to:
[0126] Determine the framework of the response based on the legal questions to be answered;
[0127] The legal information is sorted based on its arrangement position in the legal resources, and then filled into the reply framework based on the sorting result to obtain a legal reply result.
[0128] Optionally, the keyword determination module 310 is further used to:
[0129] Acquire the legal question to be answered, and determine a set number of historical conversation texts initiated before the legal question to be answered, and form an interactive text with the legal question to be answered and the historical conversation texts;
[0130] Parsing the interactive text to obtain at least one first keyword;
[0131] Inputting the interactive text into the legal question-answering model for conditional extraction to obtain at least one second keyword output by the legal question-answering model;
[0132] The union of the first keyword and the second keyword is taken to form a target keyword.
[0133] The legal question-and-answer interactive device provided in the embodiment of the present invention can execute the legal question-and-answer interactive method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0134] In the technical solution of the present invention, the collection, storage, use, processing, transmission, provision and disclosure of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0135] Embodiment 4
[0136] According to an embodiment of the present invention, the present invention also provides an electronic device, a readable storage medium and a computer program product.
[0137] Figure 4 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, applicators, blade applicators, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0138] like Figure 4 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0139] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0140] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the legal question-answering interactive method.
[0141] In some embodiments, the legal question-and-answer interaction method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the legal question-and-answer interaction method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to execute the legal question-and-answer interaction method in any other appropriate manner (e.g., by means of firmware).
[0142] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0143] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or application.
[0144] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0145] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0146] The systems and techniques described herein may be implemented in a computing system that includes a backend component (e.g., as a data applier), or a computing system that includes a middleware component (e.g., an application applier), or a computing system that includes a frontend component (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0147] A computing system may include a client and an application server. The client and the application server are generally remote from each other and usually interact through a communication network. The relationship between the client and the application server is generated by computer programs running on corresponding computers and having a client-application server relationship with each other. The application server may be a cloud application server, also known as a cloud computing application server or a cloud host, which is a host product in a cloud computing application system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS applications.
[0148] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0149] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. A legal question-answering interactive method, characterized in that: include: Obtaining a legal question to be answered, and determining a target keyword set based on the legal question to be answered; Vectorizing the target keywords in the target keyword set to obtain a feature vector list associated with the target keyword set, and retrieving a target vector set associated with the feature vector list in a preset vector library; According to the association relationship between legal items and legal cases, the legal items and legal cases associated with the target vector set are determined in the preset vector library as search results, and the legal resources are determined according to the search results; The unanswered legal question and the legal resources are input into the legal question and answer big model to obtain the legal answer result output by the legal question and answer big model.
2. The method according to claim 1, characterized in that Based on the legal issues to be answered, a target keyword set is determined, including: Parsing the legal question to be answered to obtain at least one first keyword; Inputting the unanswered legal question into the legal question-answering model for conditional extraction to obtain at least one second keyword output by the legal question-answering model; The union of the first keyword and the second keyword is taken to form a target keyword set.
3. The method according to claim 1, characterized in that Vectorizing the target keywords in the target keyword set to obtain a feature vector list associated with the target keyword set, and retrieving a target vector set associated with the feature vector list in a preset vector library, including: Performing sparse embedding and dense embedding on the target keywords in the target keyword set respectively to obtain a sparse feature vector and a dense feature vector; Comparing the sparse feature vector with the sparse vectors in the preset vector library to obtain candidate sparse vectors whose similarity is higher than a set threshold; Comparing the dense feature vector with the dense vectors in the preset vector library to obtain candidate dense vectors whose similarity is higher than a set threshold; The set of candidate sparse vectors and candidate dense vectors constitutes a target vector set associated with the feature vector list.
4. The method according to claim 1, characterized in that According to the association relationship between legal items and legal cases, determining the legal items and legal cases associated with the target vector set in the preset vector library as search results, and determining legal resources according to the search results, including: Determining the legal text associated with the target vector set in the preset vector library; Based on the association between legal terms and legal cases, determining the legal cases and legal terms associated with the legal text in the preset vector library as search results; According to the attribute screening conditions added by the user when initiating the legal question to be answered, information meeting the attribute screening conditions is screened out from the search results as legal resources.
5. The method according to claim 1, characterized in that Input the unanswered legal question and the legal resources into the legal question-answering model, and obtain the legal answer result output by the legal question-answering model, including: Inputting the unanswered legal question and the legal resources into the legal question-answering big model, the legal question-answering big model determining the legal information associated with the unanswered legal question in the legal resources according to the unanswered legal question; Based on the legal question to be answered and the legal information, a legal answer result is constructed.
6. The method according to claim 5, characterized in that Before inputting the legal questions to be answered and the legal resources into the legal question-answering model, the following steps are also included: ranking the legal resources based on their relevance to the legal question to be answered; Based on the legal question to be answered and the legal information, a legal answer result is constructed, including: Determine the framework of the response based on the legal questions to be answered; The legal information is sorted based on its arrangement position in the legal resources, and then filled into the reply framework based on the sorting result to obtain a legal reply result.
7. The method according to claim 1, characterized in that Based on the legal issues to be answered, determining a target keyword set also includes: Acquire the legal question to be answered, and determine a set number of historical conversation texts initiated before the legal question to be answered, and form an interactive text with the legal question to be answered and the historical conversation texts; Parsing the interactive text to obtain at least one first keyword; Inputting the interactive text into the legal question-answering model for conditional extraction to obtain at least one second keyword output by the legal question-answering model; The union of the first keyword and the second keyword is taken to form a target keyword.
8. A legal question-and-answer interactive device, characterized in that: include: A keyword determination module, used to obtain the legal issues to be answered and determine a target keyword set based on the legal issues to be answered; A vector retrieval module is used to vectorize the target keywords in the target keyword set, obtain a feature vector list associated with the target keyword set, and retrieve a target vector set associated with the feature vector list in a preset vector library; A legal resource determination module, for determining the legal items and legal cases associated with the target vector set in the preset vector library as search results based on the association relationship between the legal items and the legal cases, and determining the legal resources based on the search results; The answer result output module is used to input the legal question to be answered and the legal resources into the legal question and answer big model to obtain the legal answer result output by the legal question and answer big model.
9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the legal question-and-answer interactive method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the legal question-and-answer interactive method according to any one of claims 1 to 7 when executed.
Citation Information
Patent Citations
Question and answer method and device, equipment, medium and product
CN117216210A
Law and regulation question-answering system based on generative language model and construction method
CN117271716A
Text query method and device, electronic equipment and storage medium
CN118484517A
Cited By
Information processing method and device, equipment, storage medium and program product
CN120561249A
