Legal knowledge intelligent question and answer matching method in the legal field
By constructing a knowledge base for legal knowledge intelligence problems and using matching algorithms and machine learning models to process problem vectors, the problem of low matching accuracy of legal knowledge intelligence questions and answers in the existing technology is solved, and higher matching accuracy and automatic answer generation ability are achieved.
Patent Information
- Application Number
- CN202410276676.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-03-12
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-03-12
AI Technical Summary
The accuracy of matching legal knowledge and intelligent Q&A in the prior art is low, resulting in insufficient matching results.
By constructing a knowledge base for legal knowledge wisdom problems, we obtain the initial matching legal knowledge wisdom problems and pre-process them, and convert them into a problem vector, and match them with the pre-set legal knowledge wisdom problems in the knowledge base for legal knowledge wisdom, and finally automatically generate corresponding answers through the pre-set machine learning model.
The accuracy of matching legal knowledge wisdom question-and-answer questions is improved, and the automatic generation of answers to legal knowledge wisdom questions to be matched is realized, which enhances the accuracy of matching results.
Smart Images

Figure CN118093822B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of natural language processing, and in particular to a legal knowledge intelligent question-answer matching method in the legal field. Background Art
[0002] With the advancement of science and technology and the development of society, the Internet plays a pivotal role in people's lives, and digital informationization has become an important part of the development process of the world today. Thanks to the Internet as a medium, a large amount of information is disseminated and shared worldwide in a digital way. At the same time, the continuous development of the Internet is constantly changing the way people access the Internet and obtain information from it. With the rapid development of social informatization and the Internet, people's demand for intelligent question-and-answer systems is growing. People are keen to ask questions on intelligent question-and-answer systems, get answers, and communicate with others to share their knowledge. With the surge in the number of users, the advantages of automatic question-and-answer systems are more obvious, and their fast processing capabilities and all-weather service capabilities far exceed those of manual customer service.
[0003] The existing traditional automatic question-and-answer system can reduce the communication between consumers and manual customer service, greatly reducing the workload of customer service and reducing the operating costs of enterprises. Users can directly ask questions online, and the system will automatically give reasonable answers based on the corresponding questions, avoiding the trouble of waiting for manual customer service replies for traditional inquiries, and also reducing users' consultation costs.
[0004] For example, the knowledge question and answer matching method, device, equipment and storage medium announced with announcement number: CN113486140B include: obtaining a target question text and an inverted index library; querying each question character in the target question text in the inverted index library respectively to obtain a question character score set, the question character score set includes: a question character, an answer text and a question character and answer correlation score; wherein the question character is a character in the question text; according to the question character score set, the question character and answer correlation score are summed for each answer text to obtain a correlation total score set; according to the correlation total score set, the target correlation total score is determined; the answer text corresponding to the target correlation total score is used as the target The method comprises the following steps: obtaining a plurality of question characters to be scored; obtaining a question character to be scored from the plurality of question characters to be scored as a target question character; inputting the target question character into a relevance scoring model to calculate the relevance score between the question character and the answer, and obtaining an answer text relevance score set, wherein the answer text relevance score set includes: the answer text and the relevance score between the question character and the answer; updating the inverted index library with the target question character and the answer text relevance score set as associated data; and repeatedly executing the step of obtaining a question character to be scored from the plurality of question characters to be scored as a target question character until the acquisition of the question character to be scored is completed.
[0005] For example, the announcement number is: CN112800203B, which announces a question-answer matching method and system that integrates text and knowledge representation, including: obtaining questions and answer records from an intelligent customer service system, and establishing a question-answer pair training set including correctly matched question-answer pairs and incorrectly matched question-answer pairs; constructing a deep learning network model and its loss function that combine text and knowledge representation, using the question-answer pair training set as the input of the deep learning network model, learning the optimal parameters of the deep neural network model on the training set by minimizing the loss function, and obtaining a trained deep neural network model; receiving questions from users, and inputting the questions into the trained deep learning network model, and outputting matching answers.
[0006] However, in the process of implementing the technical solution of the invention in the embodiments of the present application, the present application found that the above technology has at least the following technical problems:
[0007] In the prior art, the automatic question-answering system matches relevant legal knowledge intelligence questions according to any matching algorithm, and then obtains the answers to the corresponding questions from the existing legal knowledge intelligence question library. The matching algorithm is single and there is a problem of low accuracy in the matching of legal knowledge intelligence questions and answers. Summary of the invention
[0008] The embodiment of the present application solves the problem of low accuracy of intelligent question and answer matching of legal knowledge in the prior art by providing a method for intelligent question and answer matching of legal knowledge in the legal field, thereby improving the accuracy of intelligent question and answer matching of legal knowledge.
[0009] An embodiment of the present application provides a legal knowledge intelligent question-answer matching method in the legal field, comprising the following steps: S1, constructing a legal knowledge intelligent question knowledge base, wherein the legal knowledge intelligent question knowledge base contains preset legal knowledge intelligent questions and their corresponding answers; S2, obtaining initial legal knowledge intelligent questions to be matched and preprocessing the obtained questions to obtain legal knowledge intelligent questions to be matched; S3, converting the preprocessed legal knowledge intelligent questions to be matched into question vectors, and using a matching algorithm to match the preset legal knowledge intelligent questions in the legal knowledge intelligent question knowledge base until the matching results meet the matching algorithm evaluation index, wherein the question vectors include semantic question vectors and graph question vectors, and the matching algorithm evaluation indexes are used to evaluate the degree of conformity of the matching results, and the degree of conformity includes keyword conformity, semantic conformity and legal knowledge graph conformity; S4, automatically generating corresponding answers to the legal knowledge intelligent questions whose matching results meet the matching method evaluation indexes through a preset machine learning model.
[0010] Furthermore, the specific construction process of the legal knowledge smart question knowledge base is as follows: determine the legal scope and target audience included in the legal knowledge smart question knowledge base, and collect corresponding legal texts based on the determined legal scope and target audience, and store the collected legal texts in the legal knowledge smart question knowledge base; organize and classify the stored legal texts, and construct a reference legal knowledge graph; convert the classified legal texts into a computer-processable vector format, construct a legal knowledge smart question knowledge base, and check and update the constructed legal knowledge smart question knowledge base within a preset time interval.
[0011] Furthermore, the specific steps of the preprocessing are as follows: obtaining a first legal knowledge wisdom question to be matched, wherein the first legal knowledge wisdom question to be matched represents the question after the initial legal knowledge wisdom question to be matched is processed by word segmentation; obtaining a second legal knowledge wisdom question to be matched, wherein the second legal knowledge wisdom question to be matched represents the question after the first legal knowledge wisdom question to be matched is processed by removing stop words; obtaining a legal knowledge wisdom question to be matched, wherein the legal knowledge wisdom question to be matched represents the question after the second legal knowledge wisdom question to be matched is processed by stem extraction.
[0012] Furthermore, the specific steps of the matching algorithm are as follows: Step 1: Obtain the pre-processed legal knowledge smart questions to be matched; Step 2: Extract the keyword text to be matched in the legal knowledge smart questions to be matched, and match the extracted keyword text to be matched with the preset keywords in the legal knowledge smart questions knowledge base to obtain a first matching result; Step 3: Extract the semantics in the legal knowledge smart questions to be matched, and match the extracted semantics with the preset semantics in the legal knowledge smart questions knowledge base to obtain a second matching result; Step 4: Match the legal knowledge smart questions to be matched with the preset questions in the preset legal knowledge graph in the legal knowledge smart questions knowledge base to obtain a third matching result; Step 5: Analyze the first matching result, the second matching result and the third matching result to obtain a matching result that meets the matching algorithm evaluation index.
[0013] Furthermore, the specific steps for matching with preset keywords in the legal knowledge wisdom question knowledge base are as follows: decomposing the legal knowledge wisdom question to be matched into phrase texts, wherein the phrase texts represent words and phrases decomposed from the legal knowledge wisdom question to be matched; defining a keyword list based on the decomposed phrase texts, and constructing a keyword list set, wherein the keyword list contains all keyword texts to be matched, and the keyword texts to be matched contain keywords extracted from the phrase texts; using a string matching algorithm to match the keyword texts to be matched with preset keywords in the legal knowledge wisdom question knowledge base to obtain a first matching result, wherein the first matching result is the result of matching the keyword texts to be matched with preset keywords in the legal knowledge wisdom question knowledge base.
[0014] Furthermore, the specific evaluation method of the keyword conformity is as follows: obtaining keyword conformity evaluation data of the legal knowledge wisdom question to be matched, the keyword conformity evaluation data including keyword position data and keyword density data; calculating the keyword conformity index of the legal knowledge wisdom question to be matched according to the obtained keyword conformity evaluation data, and comparing it with the reference keyword conformity index to evaluate the keyword conformity deviation of the legal knowledge wisdom question to be matched, the keyword conformity index is used to describe the keyword conformity of the matching result of the legal knowledge wisdom question to be matched; the keyword conformity index is calculated using the following formula: In the formula, e represents a natural constant, i represents the number of the legal knowledge and wisdom question to be matched, i = 1, 2, ..., I, I is the total number of legal knowledge and wisdom questions to be matched, ij represents the number of the keyword in the i-th legal knowledge and wisdom question to be matched, ij = i.1, i.2, ..., iJ, iJ is the total number of keywords in the i-th legal knowledge and wisdom question to be matched, GJ i is the keyword matching index of the i-th legal knowledge wisdom question to be matched, Di.j is the keyword position data of the ijth keyword in the ith legal knowledge wisdom question to be matched, is the reference keyword position data of the ijth keyword in the i-th legal knowledge wisdom question to be matched, ΔD is the reference deviation of the keyword position data of the keyword in the legal knowledge wisdom question to be matched, and W i is the keyword density data of the i-th legal knowledge and wisdom question to be matched, W i 0 is the keyword reference density data of the i-th legal knowledge wisdom question to be matched, ΔW is the reference deviation of the keyword density data of the legal knowledge wisdom question to be matched, α is the weight factor of the absolute deviation of the keyword position data relative to the keyword conformity index, and β is the weight factor of the absolute deviation of the keyword density data relative to the keyword conformity index.
[0015] Furthermore, the specific steps of matching with the preset semantics in the legal knowledge wisdom question knowledge base are as follows: performing semantic form conversion on the phrase text decomposed into the matching legal knowledge wisdom question, and extracting semantic features from the converted content, wherein the semantic features include word level, phrase level and sentence level; matching the extracted semantic features with the preset semantic features in the legal knowledge wisdom question knowledge base to obtain similarity data, and comparing the deviation of the obtained similarity data with the set threshold to obtain a second matching result, wherein the similarity data indicates the degree of similarity between the extracted semantic features and the preset semantic features in the legal knowledge wisdom question knowledge base.
[0016] Furthermore, the specific steps of converting the preprocessed legal knowledge wisdom questions to be matched into question vectors are as follows: remove special characters and punctuation marks from the preprocessed legal knowledge wisdom questions to be matched and unify the case formats to obtain the legal knowledge wisdom sentences to be matched; divide the obtained legal knowledge wisdom sentences to be matched into words and clauses, and map the obtained words and clauses to a high-dimensional vector space to obtain vectors of the words and clauses; use a vector synthesis method to convert the obtained word and clause vectors into question vectors corresponding to the legal knowledge wisdom questions to be matched.
[0017] Furthermore, the specific evaluation method of the semantic conformity is as follows: obtain the semantic question vector of the legal knowledge wisdom question to be matched, the semantic question vector includes the semantic question word vector and the semantic question sentence vector; calculate the semantic conformity index of the legal knowledge wisdom question to be matched according to the obtained semantic question vector, and compare it with the reference semantic conformity index to evaluate the semantic conformity deviation of the legal knowledge wisdom question to be matched, the semantic conformity index is used to describe the semantic conformity of the matching result; the semantic conformity index is calculated using the following formula: Wherein, i represents the number of the legal knowledge wisdom question to be matched, i=1,2,...,I, I is the total number of the legal knowledge wisdom questions to be matched, ix represents the number of the semantic question word of the i-th legal knowledge wisdom question to be matched, ix=i.1,i.2,...,iX, iX is the total number of semantic question words of the i-th legal knowledge wisdom question to be matched, iy represents the number of the semantic question sentence of the i-th legal knowledge wisdom question to be matched, iy=i.1,i.2,...,iY, iY is the total number of semantic question sentences of the i-th legal knowledge wisdom question to be matched, YY i is the semantic conformity index of the i-th legal knowledge wisdom question to be matched, is the semantic question word vector of the ixth semantic question word in the ith legal knowledge wisdom question to be matched, is the reference semantic question word vector of the ixth semantic question word in the ith legal knowledge wisdom question to be matched, is the semantic question sentence vector of the ith semantic question word in the ith legal knowledge wisdom question to be matched, is the reference semantic question sentence vector of the ith semantic question word in the ith legal knowledge wisdom question to be matched, χ is the weight factor of the absolute deviation of the semantic question word vector relative to the semantic conformity index, δ is the weight factor of the absolute deviation of the semantic question sentence vector relative to the semantic conformity index; the absolute deviation of the semantic question word vector represents the absolute value of the cosine value of the angle between the semantic question word vector of the legal knowledge wisdom question to be matched and the reference semantic question word vector; the absolute deviation of the semantic question sentence vector represents the absolute value of the cosine value of the angle between the semantic question sentence vector of the legal knowledge wisdom question to be matched and the reference semantic question sentence vector.
[0018] Furthermore, a specific evaluation method for the degree of conformity of the legal knowledge graph is as follows: obtaining a graph question vector of the legal knowledge wisdom question to be matched, the graph question vector including a graph question word vector and a graph question sentence vector; obtaining a legal knowledge graph conformity index of the legal knowledge wisdom question to be matched based on the obtained graph question vector, and comparing it with the reference legal knowledge graph conformity index to evaluate the legal knowledge graph conformity deviation of the legal knowledge wisdom question to be matched, the legal knowledge graph conformity index being used to describe the legal knowledge graph conformity of the matching result.
[0019] One or more technical solutions provided in the embodiments of the present application have at least the following technical effects or advantages:
[0020] 1. By constructing a legal knowledge smart question knowledge base, the initial legal knowledge smart question to be matched is preprocessed and the preprocessed legal knowledge smart question to be matched is converted into a question vector, and then the question vector is matched with a matching algorithm to obtain a matching result, and finally the answer to the legal knowledge smart question to be matched is obtained according to the matching result, thereby realizing the automatic generation of the answer to the legal knowledge smart question to be matched, and then realizing the improvement of the accuracy of legal knowledge smart question and answer matching, and effectively solving the problem of low accuracy of legal knowledge smart question and answer matching in the prior art.
[0021] 2. By obtaining the keyword conformity evaluation data of the legal knowledge wisdom questions to be matched, and then calculating the keyword conformity index of the legal knowledge wisdom questions to be matched based on the obtained keyword conformity evaluation data, and finally evaluating the keyword conformity deviation of the legal knowledge wisdom questions to be matched through the calculated keyword conformity index, the keyword conformity of the legal knowledge wisdom questions to be matched is quantified, thereby achieving a more accurate evaluation of the keyword conformity of the legal knowledge wisdom questions to be matched.
[0022] 3. By obtaining the semantic question vector data of the legal knowledge wisdom question to be matched, and then calculating the semantic conformity index of the legal knowledge wisdom question to be matched based on the obtained semantic question vector data, and finally evaluating the semantic conformity deviation of the legal knowledge wisdom question to be matched by calculating the semantic conformity index, the numeration of the semantic conformity of the legal knowledge wisdom question to be matched is realized, and then a more accurate evaluation of the semantic conformity of the legal knowledge wisdom question to be matched is realized. BRIEF DESCRIPTION OF THE DRAWINGS
[0023] Figure 1 A flow chart of a method for matching legal knowledge intelligent questions and answers in the legal field provided in an embodiment of the present application;
[0024] Figure 2 A flow chart of the preprocessing method provided in the embodiment of the present application;
[0025] Figure 3 A flowchart of the matching algorithm provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The embodiments of the present application solve the problem of low accuracy of legal knowledge intelligent question and answer matching in the prior art by providing a legal knowledge intelligent question and answer matching method in the legal field. The method constructs a legal knowledge intelligent question knowledge base, then obtains initial legal knowledge intelligent questions to be matched and pre-processes the obtained questions to obtain legal knowledge intelligent questions to be matched. The pre-processed legal knowledge intelligent questions to be matched are then converted into question vectors, and a matching algorithm is used to match the preset legal knowledge intelligent questions in the legal knowledge intelligent question knowledge base until the matching results meet the matching algorithm evaluation indicators. Finally, a preset machine learning model is used to automatically generate corresponding answers to the legal knowledge intelligent questions whose matching results meet the matching method evaluation indicators, thereby improving the accuracy of legal knowledge intelligent question and answer matching.
[0027] The technical solution in the embodiment of the present application is to solve the problem of low accuracy of the above-mentioned legal knowledge intelligent question and answer matching, and the overall idea is as follows:
[0028] By constructing a knowledge base of legal knowledge smart questions, preprocessing the initial legal knowledge smart questions to be matched and converting the preprocessed legal knowledge smart questions to be matched into question vectors, and then matching the question vectors with the matching algorithm to obtain matching results, and finally automatically generating corresponding answers based on the matching results, the effect of improving the accuracy of legal knowledge smart question and answer matching is achieved.
[0029] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0030] like Figure 1 As shown, it is a flow chart of the legal knowledge intelligent question and answer matching method in the legal field provided by an embodiment of the present application, and the method includes the following steps: S1, constructing a knowledge base: constructing a legal knowledge intelligent question knowledge base, and the legal knowledge intelligent question knowledge base contains preset legal knowledge intelligent questions and their corresponding answers; S2, preprocessing: obtaining the initial legal knowledge intelligent questions to be matched and preprocessing the obtained questions to obtain the legal knowledge intelligent questions to be matched; S3, problem vector matching: converting the preprocessed legal knowledge intelligent questions to be matched into problem vectors, and using the matching algorithm to match the preset legal knowledge intelligent questions in the legal knowledge intelligent question knowledge base until the matching results meet the matching algorithm evaluation index, the problem vector includes a semantic problem vector and a graph problem vector, and the matching algorithm evaluation index is used to evaluate the degree of conformity of the matching results, and the degree of conformity includes the keyword conformity, the semantic conformity and the legal knowledge graph conformity; S4, generating answers: automatically generating corresponding answers to the legal knowledge intelligent questions whose matching results meet the matching method evaluation index through a preset machine learning model.
[0031] In this embodiment, a machine learning model is an expression of an algorithm that combs through massive amounts of data to find patterns or make predictions. It includes model parameters and decision functions, and is generally used to implement human learning behavior to acquire new knowledge and skills and continuously improve its own performance. Its main tasks include classification, regression, clustering, and density estimation. An appropriate machine learning model is usually selected based on the nature and scale of the problem. Commonly used models include support vector machines (SVMs), naive Bayes, logistic regression, and deep neural networks. The training steps of the preset machine learning model are generally to train the selected machine learning model using a labeled data set until the model converges. During the training process, the model will learn how to associate the legal knowledge intelligence questions to be matched with the corresponding answers; the autonomy of legal knowledge intelligence questions and answers is realized.
[0032] Furthermore, the specific construction process of the legal knowledge wisdom question knowledge base is as follows: determine the legal scope and target audience included in the legal knowledge wisdom question knowledge base, and collect corresponding legal texts based on the determined legal scope and target audience, and store the collected legal texts in the legal knowledge wisdom question knowledge base; organize and classify the stored legal texts, and construct a reference legal knowledge graph; convert the classified legal texts into a computer-processable vector format, construct a legal knowledge wisdom question knowledge base, and check and update the constructed legal knowledge wisdom question knowledge base within preset time intervals.
[0033] In this embodiment, the legal scope included in the legal knowledge intelligent question knowledge base is various legal texts, such as the constitutions, civil laws and criminal laws of various countries, as well as cases, legal comments and judicial interpretations; the target audience generally includes legal practitioners, government departments and public institutions, etc.; computer-processable vector formats include one-dimensional arrays, lists and sets, etc.; the integrity and timeliness of the legal knowledge intelligent question knowledge base are improved.
[0034] Further, such as Figure 2 As shown, it is a flow chart of the preprocessing method provided by an embodiment of the present invention, and the specific steps of the preprocessing are as follows: obtaining a first legal knowledge wisdom question to be matched, the first legal knowledge wisdom question to be matched represents the question after the initial legal knowledge wisdom question to be matched is processed by word segmentation; obtaining a second legal knowledge wisdom question to be matched, the second legal knowledge wisdom question to be matched represents the question after the first legal knowledge wisdom question to be matched is processed by removing stop words; obtaining a legal knowledge wisdom question to be matched, the legal knowledge wisdom question to be matched represents the question after the second legal knowledge wisdom question to be matched is processed by stem extraction.
[0035] In this embodiment, the initial legal knowledge wisdom question to be matched is processed by word segmentation to obtain the first legal knowledge wisdom question to be matched; the first legal knowledge wisdom question to be matched is processed by removing stop words to obtain the second legal knowledge wisdom question to be matched; the second legal knowledge wisdom question to be matched is processed by stem extraction to obtain the legal knowledge wisdom question to be matched; thereby improving the matching efficiency of subsequent legal knowledge wisdom questions to be matched.
[0036] Further, such as Figure 3 As shown, it is a flow chart of the matching algorithm provided in an embodiment of the present application, and the specific steps of the matching algorithm are as follows: Step 1, obtaining the legal knowledge wisdom question to be matched: obtaining the preprocessed legal knowledge wisdom question to be matched; Step 2, keyword matching: extracting the keyword text to be matched in the legal knowledge wisdom question to be matched, and matching the extracted keyword text to be matched with the preset keyword in the legal knowledge wisdom question knowledge base to obtain a first matching result; Step 3, semantic matching: extracting the semantics in the legal knowledge wisdom question to be matched, and matching the extracted semantics with the preset semantics in the legal knowledge wisdom question knowledge base to obtain a second matching result; Step 4, legal knowledge graph matching: matching the legal knowledge wisdom question to be matched with the preset question in the preset legal knowledge graph in the legal knowledge wisdom question knowledge base to obtain a third matching result; Step 5, obtaining the matching result: analyzing the first matching result, the second matching result and the third matching result to obtain a matching result that meets the matching algorithm evaluation index.
[0037] In this embodiment, the accuracy of the matching result is improved.
[0038] Furthermore, the specific steps for matching with preset keywords in the legal knowledge wisdom question knowledge base are as follows: decompose the legal knowledge wisdom question to be matched into phrase texts, where the phrase texts represent the words and phrases decomposed from the legal knowledge wisdom question to be matched; define a keyword list based on the decomposed phrase texts, and construct a keyword list set, where the keyword list contains all keyword texts to be matched, and the keyword texts to be matched contain keywords extracted from the phrase texts; use a string matching algorithm to match the keyword texts to be matched with the preset keywords in the legal knowledge wisdom question knowledge base to obtain a first matching result, which is the result of matching the keyword texts to be matched with the preset keywords in the legal knowledge wisdom question knowledge base.
[0039] In this embodiment, decomposing the to-be-matched legal knowledge and wisdom questions into phrase texts is to express and combine the key words, phrases or concepts involved in the question in more detail. For example, "the to-be-matched legal knowledge and wisdom questions" can be decomposed into "law", "knowledge", "wisdom" and "questions", and described in more detail as "legal knowledge", "legal field", "legal wisdom knowledge" and "legal intelligent methods", thereby improving the efficiency of retrieving texts containing specific keywords.
[0040] Furthermore, the specific evaluation method of keyword conformity is as follows: obtain keyword conformity evaluation data of the legal knowledge wisdom question to be matched, the keyword conformity evaluation data includes keyword position data and keyword density data; calculate the keyword conformity index of the legal knowledge wisdom question to be matched based on the obtained keyword conformity evaluation data, and compare it with the reference keyword conformity index to evaluate the keyword conformity deviation of the legal knowledge wisdom question to be matched, the keyword conformity index is used to describe the keyword conformity of the matching result of the legal knowledge wisdom question to be matched; the keyword conformity index is calculated using the following formula: In the formula, e represents a natural constant, i represents the number of the legal knowledge and wisdom question to be matched, i = 1, 2, ..., I, I is the total number of legal knowledge and wisdom questions to be matched, ij represents the number of the keyword in the i-th legal knowledge and wisdom question to be matched, ij = i.1, i.2, ..., iJ, iJ is the total number of keywords in the i-th legal knowledge and wisdom question to be matched, GJ i is the keyword matching index of the i-th legal knowledge wisdom question to be matched, D i.j is the keyword position data of the ijth keyword in the ith legal knowledge wisdom question to be matched, is the reference keyword position data of the ijth keyword in the i-th legal knowledge wisdom question to be matched, ΔD is the reference deviation of the keyword position data of the keyword in the legal knowledge wisdom question to be matched, and W i is the keyword density data of the i-th legal knowledge and wisdom question to be matched, W i 0 is the keyword reference density data of the i-th legal knowledge wisdom question to be matched, ΔW is the reference deviation of the keyword density data of the legal knowledge wisdom question to be matched, α is the weight factor of the absolute deviation of the keyword position data relative to the keyword conformity index, and β is the weight factor of the absolute deviation of the keyword density data relative to the keyword conformity index.
[0041] In this embodiment, numerical evaluation of the degree of keyword matching is achieved.
[0042] Furthermore, the specific steps for matching with the preset semantics in the legal knowledge wisdom question knowledge base are as follows: semantic form conversion is performed on the phrase text decomposed into the matching legal knowledge wisdom question, and semantic features are extracted from the converted content, and the semantic features include word level, phrase level and sentence level; the extracted semantic features are matched with the preset semantic features in the legal knowledge wisdom question knowledge base to obtain similarity data, and the deviation of the obtained similarity data with the set threshold is compared to obtain a second matching result, and the similarity data represents the degree of similarity between the extracted semantic features and the preset semantic features in the legal knowledge wisdom question knowledge base.
[0043] In this embodiment, semantic form conversion is to convert a phrase text or a short phrase text from one expression form into another semantically related but different expression form, the specific content of which depends on the context and meaning of the phrase text or short phrase text to be converted; thereby achieving improved efficiency in retrieving information containing specific semantics.
[0044] Furthermore, the specific steps of converting the preprocessed legal knowledge wisdom questions to be matched into question vectors are as follows: remove special characters and punctuation marks from the preprocessed legal knowledge wisdom questions to be matched and unify the uppercase and lowercase formats to obtain the legal knowledge wisdom sentences to be matched; divide the obtained legal knowledge wisdom sentences to be matched into words and clauses, and map the obtained words and clauses to the high-dimensional vector space to obtain the vectors of the words and clauses; use the vector synthesis method to convert the obtained word and clause vectors into the question vector corresponding to the legal knowledge wisdom questions to be matched.
[0045] In this embodiment, the vectorization of the legal knowledge intelligence questions to be matched is achieved.
[0046] Furthermore, the specific evaluation method of semantic conformity is as follows: obtain the semantic question vector of the legal knowledge wisdom question to be matched, the semantic question vector includes the semantic question word vector and the semantic question sentence vector; calculate the semantic conformity index of the legal knowledge wisdom question to be matched according to the obtained semantic question vector, and compare it with the reference semantic conformity index to evaluate the semantic conformity deviation of the legal knowledge wisdom question to be matched, the semantic conformity index is used to describe the semantic conformity of the matching result; the semantic conformity index is calculated using the following formula: Wherein, i represents the number of the legal knowledge wisdom question to be matched, i=1,2,...,I, I is the total number of the legal knowledge wisdom questions to be matched, ix represents the number of the semantic question word of the i-th legal knowledge wisdom question to be matched, ix=i.1,i.2,...,iX, iX is the total number of semantic question words of the i-th legal knowledge wisdom question to be matched, iy represents the number of the semantic question sentence of the i-th legal knowledge wisdom question to be matched, iy=i.1,i.2,...,iY, iY is the total number of semantic question sentences of the i-th legal knowledge wisdom question to be matched, YY i is the semantic conformity index of the i-th legal knowledge wisdom question to be matched, is the semantic question word vector of the ixth semantic question word in the ith legal knowledge wisdom question to be matched, is the reference semantic question word vector of the ixth semantic question word in the ith legal knowledge wisdom question to be matched, is the semantic question sentence vector of the ith semantic question word in the ith legal knowledge wisdom question to be matched, is the reference semantic question sentence vector of the ith semantic question word in the ith legal knowledge wisdom question to be matched, χ is the weight factor of the absolute deviation of the semantic question word vector relative to the semantic conformity index, δ is the weight factor of the absolute deviation of the semantic question sentence vector relative to the semantic conformity index; the absolute deviation of the semantic question word vector represents the absolute value of the cosine value of the angle between the semantic question word vector of the legal knowledge wisdom question to be matched and the reference semantic question word vector; the absolute deviation of the semantic question sentence vector represents the absolute value of the cosine value of the angle between the semantic question sentence vector of the legal knowledge wisdom question to be matched and the reference semantic question sentence vector.
[0047] In this embodiment, the calculation of the semantic conformity index is based on the dot product of the vectors. and Represents the dot product of vectors; the dot product is also called the scalar product, and its result is the length of the projection of a vector in the direction of another vector, which is a scalar; it implements the numerical evaluation of the degree of semantic conformity.
[0048] Furthermore, a specific evaluation method for the degree of conformity of the legal knowledge graph is as follows: obtaining a graph question vector of the legal knowledge wisdom question to be matched, the graph question vector including a graph question word vector and a graph question sentence vector; obtaining a legal knowledge graph conformity index of the legal knowledge wisdom question to be matched based on the obtained graph question vector, and comparing it with the reference legal knowledge graph conformity index to evaluate the deviation of the legal knowledge graph conformity of the legal knowledge wisdom question to be matched, the legal knowledge graph conformity index is used to describe the degree of conformity of the matching result to the legal knowledge graph.
[0049] In this implementation, the legal knowledge graph compliance index is calculated using the following formula: Wherein, i represents the number of the legal knowledge wisdom question to be matched, i=1,2,...,I, I is the total number of legal knowledge wisdom questions to be matched, im represents the number of the graph question word of the i-th legal knowledge wisdom question to be matched, im=i.1,i.2,...,iM, iM is the total number of graph question words of the i-th legal knowledge wisdom question to be matched, in represents the number of the graph question sentence of the i-th legal knowledge wisdom question to be matched, in=i.1,i.2,...,iN, iN is the total number of graph question sentences of the i-th legal knowledge wisdom question to be matched, FL i is the legal knowledge graph conformity index of the i-th legal knowledge wisdom question to be matched, is the graph question word vector of the im-th graph question word in the i-th legal knowledge wisdom question to be matched, is the reference graph question word vector of the im-th graph question word in the i-th legal knowledge wisdom question to be matched, is the graph question sentence vector of the in-th graph question word in the i-th legal knowledge wisdom question to be matched, is the reference graph question sentence vector of the in-th graph question word in the i-th legal knowledge wisdom question to be matched, ε is the weight factor of the absolute deviation of the graph question word vector relative to the legal knowledge graph conformity index, φ is the weight factor of the absolute deviation of the graph question sentence vector relative to the legal knowledge graph conformity index; the absolute deviation of the graph question word vector represents the absolute value of the cosine value of the angle between the graph question word vector of the legal knowledge wisdom question to be matched and the reference graph question word vector; the absolute deviation of the graph question sentence vector represents the absolute value of the cosine value of the angle between the graph question sentence vector of the legal knowledge wisdom question to be matched and the reference graph question sentence vector; in the formula and Represents the dot product of a vector; the legal knowledge graph is a technical tool that structures, relates and visualizes information in the legal field. With the help of the legal knowledge graph, legal information retrieval can be more efficient, promoting the development of legal intelligent systems; and a numerical evaluation of the degree of compliance of the legal knowledge graph is achieved.
[0050] The technical scheme in the above-mentioned embodiment of the present application has at least the following technical effects or advantages: relative to the knowledge question-answering matching method, device, equipment and storage medium announced with announcement number: CN113486140B, the embodiment of the present application obtains the keyword conformity evaluation data of the to-be-matched legal knowledge wisdom question, and then calculates the keyword conformity index of the to-be-matched legal knowledge wisdom question based on the obtained keyword conformity evaluation data, and finally evaluates the keyword conformity deviation of the to-be-matched legal knowledge wisdom question through the calculated keyword conformity index, thereby realizing the digitization of the keyword conformity of the to-be-matched legal knowledge wisdom question, and then realizing the A more accurate assessment of the degree of keyword conformity of knowledge and wisdom questions; relative to a question-answer matching method and system that integrates text and knowledge representation as announced in Announcement No.: CN112800203B, the embodiment of the present application obtains the semantic question vector data of the legal knowledge and wisdom questions to be matched, and then calculates the semantic conformity index of the legal knowledge and wisdom questions to be matched based on the acquired semantic question vector data, and finally evaluates the semantic conformity deviation of the legal knowledge and wisdom questions to be matched by calculating the semantic conformity index, thereby realizing the numeration of the semantic conformity of the legal knowledge and wisdom questions to be matched, and further realizing a more accurate assessment of the semantic conformity of the legal knowledge and wisdom questions to be matched.
[0051] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0052] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0053] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0054] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0055] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0056] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A legal knowledge intelligent question-answer matching method in the legal field, characterized in that: The following steps are involved: S1, constructing a legal knowledge and wisdom question knowledge base, wherein the legal knowledge and wisdom question knowledge base includes preset legal knowledge and wisdom questions and their corresponding answers; S2, obtaining initial legal knowledge and wisdom questions to be matched and preprocessing the obtained initial legal knowledge and wisdom questions to be matched to obtain legal knowledge and wisdom questions to be matched; S3, converting the pre-processed legal knowledge intelligence question to be matched into a question vector, and using a matching algorithm to match the preset legal knowledge intelligence question in the legal knowledge intelligence question knowledge base until the matching result meets the matching algorithm evaluation index, the question vector includes a semantic question vector and a graph question vector, and the matching algorithm evaluation index is used to evaluate the degree of conformity of the matching result, and the degree of conformity includes a keyword conformity degree, a semantic conformity degree, and a legal knowledge graph conformity degree; S4, automatically generates corresponding answers to legal knowledge wisdom questions whose matching results meet the matching method evaluation indicators through a preset machine learning model; The specific evaluation method of the keyword compliance degree is as follows: Obtain keyword match degree evaluation data of the legal knowledge wisdom question to be matched, wherein the keyword match degree evaluation data includes keyword position data and keyword density data; Calculate the keyword conformity index of the to-be-matched legal knowledge wisdom question based on the acquired keyword conformity evaluation data, and compare it with the reference keyword conformity index to evaluate the keyword conformity deviation of the to-be-matched legal knowledge wisdom question, wherein the keyword conformity index is used to describe the keyword conformity of the matching result of the to-be-matched legal knowledge wisdom question; The keyword matching index is calculated using the following formula: ; In the formula, represents a natural constant, Indicates the number of the legal knowledge wisdom question to be matched, , is the total number of legal knowledge wisdom questions to be matched, Indicates The number of keywords in the legal knowledge and wisdom questions to be matched, , For the The total number of keywords in the legal knowledge and wisdom questions to be matched, For the The keyword matching degree index of the legal knowledge and wisdom questions to be matched, For the The first of the legal knowledge wisdom questions to be matched Keyword position data for keywords, For the The first of the legal knowledge wisdom questions to be matched Reference keyword position data for keywords, The keyword position data reference deviation of the keywords in the legal knowledge wisdom question to be matched, For the Keyword density data of legal knowledge and wisdom questions to be matched, For the Keyword reference density data of legal knowledge and wisdom questions to be matched, The keyword density data reference deviation of the legal knowledge and wisdom questions to be matched, is the weight factor of the absolute deviation of keyword position data relative to the keyword matching index, It is the weight factor of the absolute deviation of keyword density data relative to the keyword matching index; The specific evaluation method of the semantic conformity is as follows: Obtaining a semantic question vector of the legal knowledge wisdom question to be matched, wherein the semantic question vector includes a semantic question word vector and a semantic question sentence vector; Calculate the semantic conformity index of the legal knowledge wisdom question to be matched according to the acquired semantic question vector, and compare it with the reference semantic conformity index to evaluate the semantic conformity deviation of the legal knowledge wisdom question to be matched, wherein the semantic conformity index is used to describe the semantic conformity of the matching result; The semantic conformity index is calculated using the following formula: ; In the formula, Indicates the number of the legal knowledge wisdom question to be matched, , is the total number of legal knowledge wisdom questions to be matched, Indicates The number of the semantic question words of the legal knowledge and wisdom questions to be matched, , For the The total number of semantic question words to be matched with legal knowledge and wisdom questions, Indicates The number of the semantic question sentence of the legal knowledge and wisdom question to be matched, , For the The total number of semantic question sentences to be matched with legal knowledge and wisdom questions, For the The semantic matching index of the legal knowledge and wisdom questions to be matched, For the The first of the legal knowledge wisdom questions to be matched The semantic question word vector of the semantic question words, For the The first of the legal knowledge wisdom questions to be matched The reference semantic question word vector of the semantic question word, For the The first of the legal knowledge wisdom questions to be matched The semantic question sentence vector of the semantic question words, For the The first of the legal knowledge wisdom questions to be matched The reference semantic question sentence vector of the semantic question words, is the weight factor of the absolute deviation of the semantic question word vector relative to the semantic conformity index, is the weight factor of the absolute deviation of the semantic question sentence vector relative to the semantic conformity index; The absolute deviation of the semantic question word vector represents the absolute value of the cosine value of the angle between the semantic question word vector of the legal knowledge and wisdom question to be matched and the reference semantic question word vector; The absolute deviation of the semantic question sentence vector represents the absolute value of the cosine value of the angle between the semantic question sentence vector of the legal knowledge and wisdom question to be matched and the reference semantic question sentence vector; The specific evaluation method for the compliance degree of the legal knowledge graph is as follows: Obtaining a graph question vector of a legal knowledge wisdom question to be matched, wherein the graph question vector includes a graph question word vector and a graph question sentence vector; Obtain the legal knowledge graph conformity index of the legal knowledge wisdom question to be matched according to the acquired graph question vector, and compare it with the reference legal knowledge graph conformity index to evaluate the legal knowledge graph conformity deviation of the legal knowledge wisdom question to be matched, wherein the legal knowledge graph conformity index is used to describe the legal knowledge graph conformity of the matching result; The legal knowledge graph compliance index is calculated using the following formula: ; In the formula, Indicates the number of the legal knowledge wisdom question to be matched, , is the total number of legal knowledge wisdom questions to be matched, Indicates The number of the graph question words to be matched with the legal knowledge and wisdom questions, , For the The total number of graph question words to be matched with legal knowledge and wisdom questions, Indicates The number of the graph question sentence to be matched with the legal knowledge wisdom question, , For the The total number of graph question sentences to be matched with legal knowledge and wisdom questions, For the The legal knowledge graph conformity index of the legal knowledge wisdom question to be matched, For the The first of the legal knowledge wisdom questions to be matched The graph question word vectors of graph question words, For the The first of the legal knowledge wisdom questions to be matched The reference graph question word vectors of graph question words, For the The first of the legal knowledge wisdom questions to be matched The graph question sentence vector of the graph question words, For the The first of the legal knowledge wisdom questions to be matched The reference graph question sentence vector of the graph question words, is the weight factor of the absolute deviation of the graph problem word vector relative to the legal knowledge graph conformity index, is the weight factor of the absolute deviation of the graph question sentence vector relative to the legal knowledge graph conformity index; The graph question word vector absolute deviation represents the absolute value of the cosine value of the angle between the graph question word vector of the legal knowledge wisdom question to be matched and the reference graph question word vector; The absolute deviation of the graph question sentence vector represents the absolute value of the cosine value of the angle between the graph question sentence vector of the legal knowledge wisdom question to be matched and the reference graph question sentence vector.
2. The legal knowledge intelligent question-answer matching method in the legal field as claimed in claim 1, characterized in that: The specific construction process of the legal knowledge wisdom question knowledge base is as follows: Determine the legal scope and target audience included in the legal knowledge wisdom question knowledge base, collect corresponding legal texts according to the determined legal scope and target audience, and store the collected legal texts in the legal knowledge wisdom question knowledge base; Organize and classify the stored legal texts and construct a reference legal knowledge graph; The classified legal texts are converted into a computer-processable vector format to construct a legal knowledge and wisdom question knowledge base, and the constructed legal knowledge and wisdom question knowledge base is checked and updated at preset time intervals.
3. The legal knowledge intelligent question-answer matching method in the legal field as claimed in claim 1, characterized in that: The specific steps of the pretreatment are as follows: Obtaining a first legal knowledge wisdom question to be matched, wherein the first legal knowledge wisdom question to be matched represents the question after word segmentation processing is performed on the initial legal knowledge wisdom question to be matched; Obtaining a second legal knowledge wisdom question to be matched, wherein the second legal knowledge wisdom question to be matched represents the question after the first legal knowledge wisdom question to be matched is processed by removing stop words; A legal knowledge wisdom question to be matched is obtained, wherein the legal knowledge wisdom question to be matched represents the question after stem extraction processing is performed on the second legal knowledge wisdom question to be matched.
4. The legal knowledge intelligent question-answer matching method in the legal field as claimed in claim 1, characterized in that: The specific steps of the matching algorithm are as follows: Step 1: Obtain the pre-processed legal knowledge intelligence questions to be matched; Step 2: extracting the keyword text to be matched in the legal knowledge wisdom question to be matched, and matching the extracted keyword text to be matched with the preset keywords in the legal knowledge wisdom question knowledge base to obtain a first matching result; Step 3: extracting the semantics in the legal knowledge wisdom question to be matched, and matching the extracted semantics with the preset semantics in the legal knowledge wisdom question knowledge base to obtain a second matching result; Step 4: Match the legal knowledge smart question to be matched with the preset question in the preset legal knowledge graph in the legal knowledge smart question knowledge base to obtain a third matching result; Step 5: Analyze the first matching result, the second matching result, and the third matching result to obtain a matching result that meets the matching algorithm evaluation index.
5. The legal knowledge intelligent question-answer matching method in the legal field as claimed in claim 4, characterized in that: The specific steps of matching the preset keywords in the legal knowledge wisdom question knowledge base are as follows: Decomposing the to-be-matched legal knowledge and wisdom questions into phrase texts, wherein the phrase texts represent words and phrases decomposed from the to-be-matched legal knowledge and wisdom questions; A keyword list is defined according to the decomposed phrase text, and a keyword list set is constructed, wherein the keyword list includes all the keyword texts to be matched, and the keyword texts to be matched include the keywords extracted from the phrase text; A string matching algorithm is used to match the keyword text to be matched with the preset keywords in the legal knowledge and wisdom question knowledge base to obtain a first matching result, which is the result of matching the keyword text to be matched with the preset keywords in the legal knowledge and wisdom question knowledge base.
6. The legal knowledge intelligent question-answer matching method in the legal field as claimed in claim 4, characterized in that: The specific steps of matching the preset semantics in the legal knowledge wisdom question knowledge base are as follows: Perform semantic form conversion on the phrase text decomposed into the matching legal knowledge wisdom question, and extract semantic features from the converted content, wherein the semantic features include word level, phrase level and sentence level; The extracted semantic features are matched with the preset semantic features in the legal knowledge wisdom question knowledge base to obtain similarity data, and the deviation of the obtained similarity data with the set threshold is compared to obtain a second matching result, wherein the similarity data indicates the degree of similarity between the extracted semantic features and the preset semantic features in the legal knowledge wisdom question knowledge base.
7. The legal knowledge intelligent question-answer matching method in the legal field as claimed in claim 1, characterized in that: The specific steps of converting the pre-processed legal knowledge intelligence question to be matched into a question vector are as follows: Remove special characters and punctuation marks from the preprocessed legal knowledge and wisdom questions to be matched and unify the uppercase and lowercase formats to obtain the legal knowledge and wisdom sentences to be matched; Segment the obtained legal knowledge and wisdom sentences to be matched into words and clauses, and map the obtained words and clauses into a high-dimensional vector space to obtain vectors of the words and clauses; Using the vector synthesis method, the acquired word and clause vectors are converted into question vectors corresponding to the legal knowledge and wisdom questions to be matched.
Citation Information
Patent Citations
A question-answering matching method and system that integrates text and knowledge representation
CN112800203B
Methods, devices, equipment, and storage media for knowledge-based question answering
CN113486140B
Auxiliary response method and system for intelligent customer service
CN111078832A
Epidemic disease consulting, preventing and training system construction method and system
CN112905764A
Question and answer processing method and device, computer equipment and readable storage medium
CN112948562A