Intelligent question answering method and device, and electronic device

By using a legal knowledge graph to establish the relationship between transactions and clauses when corporate secretaries inquire about legal issues, the problem of inaccurate answers and low efficiency in existing technologies is solved, enabling fast and accurate legal clause inquiries.

CN114880453BActive Publication Date: 2025-11-11SHENZHEN VALUE ONLINE INFORMATION POLYTRON TECH INC
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210582869.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-26
Publication Date
2025-11-11
Estimated Expiration
2042-05-26

AI Technical Summary

Technical Problem

In existing technologies, when corporate secretaries search for legal issues, they often find it difficult to accurately match similar questions and obtain standardized answers. Furthermore, the answers from different individuals are inconsistent, resulting in low search efficiency and a lack of authoritative information.

Method used

By identifying business keywords in user questions, matching them with preset legal business keywords, and using a legal knowledge graph to establish the relationship between transactions and clauses, the system returns clauses with a relevance greater than a threshold as the answer.

Benefits of technology

It enables quick and accurate retrieval of legal provisions, improves search efficiency, ensures the standardization and authority of answers, and reduces the return of useless answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114880453B_ABST
    Figure CN114880453B_ABST
Patent Text Reader

Abstract

This application relates to the field of intelligent question-answering technology, and provides intelligent question-answering methods, devices, and electronic devices, including: identifying business keywords from user questions that are identical to preset business keywords to obtain target keywords; matching corresponding transactions based on the target business keywords to return a set of target transactions; determining target transactions based on selection instructions issued by the user in the target transaction set; determining a set of candidate answers based on the target transactions through an established legal knowledge graph, wherein the legal knowledge graph describes the relationship between the transactions and clauses; and returning clauses in the candidate answers that are more relevant to the user question than a preset threshold as answers to the user. This application can provide standardized and authoritative answers to intelligent question-answering questions involving legal business issues.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of intelligent question answering technology, and in particular relates to intelligent question answering methods, devices, electronic devices and computer-readable storage media. Background Technology

[0002] With the deepening of the rule of law in all aspects, corporate compliance management, risk prevention and control, and corporate governance have become important foundations for the core competitiveness and corporate value of listed companies. For listed companies, which are the cornerstone of the healthy development of the capital market, compliance management is their lifeline. Company secretaries of listed companies typically need to independently search for the necessary legal provisions. However, due to the numerous markets and complex legal relationships involved in the operation and management of listed companies, and the fact that the search process requires strong professional knowledge, it is very difficult for company secretaries who are not professionals in these fields.

[0003] In existing technologies, legal information is retrieved by using a question-and-answer pair approach, which matches the user's question with the most similar question in the history of questions and answers and returns the corresponding answer. However, there are cases where there are no similar questions in the history of questions and answers, and for the same type of question, different people give different answers, which are of reference value but not sufficient as answers to legal questions. Summary of the Invention

[0004] This application provides intelligent question-answering methods, devices, and electronic devices, which can solve the problems in the prior art where corresponding questions and answers cannot be found when querying business issues involving law, and the answers found are not standardized enough.

[0005] Firstly, embodiments of this application provide an intelligent question-answering method, including:

[0006] The target keywords are obtained by identifying the same business keywords as the preset business keywords from the user questions. The preset business keywords are predefined keywords corresponding to legal business.

[0007] Match the corresponding transactions based on the target business keywords, and return a target transaction set. The transaction is a pre-generated statement that includes the business keywords. The target transaction set is used to store the transactions corresponding to the target business keywords.

[0008] The target transaction is determined based on the selection instruction issued by the user in the target transaction set;

[0009] Based on the target transaction, a set of candidate answers is determined by establishing a regulatory knowledge graph, wherein the regulatory knowledge graph describes the relationship between the transaction and the clauses, and the set of candidate answers is used to store the clauses corresponding to the target transaction;

[0010] The answer candidate will return the terms that are more relevant to the user's question than a preset threshold to the user as the answer.

[0011] Secondly, embodiments of this application provide an intelligent question-answering device, including:

[0012] The keyword acquisition module identifies target keywords by finding business keywords that are the same as preset business keywords from user questions. The preset business keywords are predefined keywords that correspond to legal business.

[0013] The transaction set acquisition module is used to match the corresponding transactions according to the target keyword and return the target transaction set. The transaction is a pre-generated statement that includes the business keyword. The target transaction set is used to store the transactions corresponding to the target keyword.

[0014] The target transaction acquisition module is used to determine the target transaction based on the selection instruction issued by the user in the target transaction set;

[0015] The candidate answer acquisition module is used to determine a set of candidate answers based on the target transaction through an established legal knowledge graph, wherein the legal knowledge graph describes the relationship between the transaction and the clauses, and the set of candidate answers is used to store the clauses corresponding to the target transaction;

[0016] The answer retrieval module is used to return the terms in the answer candidate set that are more relevant to the user's question than a preset threshold as answers to the user.

[0017] Thirdly, embodiments of this application provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the intelligent question-answering method described in the first aspect above.

[0018] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the intelligent question-answering method described in the first aspect above.

[0019] Fifthly, embodiments of this application provide a computer program product that, when run on an electronic device, causes the electronic device to execute the intelligent question-answering method described in any of the first aspects above.

[0020] The beneficial effects of this application embodiment compared to the prior art are as follows: It identifies business keywords in the user's question that are identical to preset business keywords, obtains target keywords, matches the transactions corresponding to the user's question based on the target keywords, and returns a set of target transactions. Since the transactions are pre-generated statements including business keywords, the transactions corresponding to the user's question can be accurately obtained based on the target keywords, avoiding situations where similar questions cannot be matched. After obtaining the target transaction selected by the user, since the legal knowledge graph describes the relationship between transactions and clauses, the clauses corresponding to the target transaction can be determined through the established legal knowledge graph. Since clauses are the expression of normative document content, it avoids the problem of non-standard and unauthoritative answers returned to the user based on the clauses in the answer candidate set. Furthermore, since a greater relevance to the user's question indicates a better match between the clause and the user's question, using clauses in the answer candidate set with a relevance greater than a preset threshold as answers returned to the user for reference allows the user to find the required legal clauses more quickly and accurately. Attached Figure Description

[0021] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.

[0022] Figure 1 This is a flowchart illustrating an intelligent question-answering method provided in an embodiment of this application;

[0023] Figure 2 This is a flowchart of the knowledge graph construction process provided in an embodiment of this application;

[0024] Figure 3 This is a schematic diagram of the structure of the intelligent question-answering device provided in the embodiments of this application;

[0025] Figure 4 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0026] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0027] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.

[0028] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.

[0029] References to "one embodiment" or "some embodiments" in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized.

[0030] Example 1:

[0031] Figure 1 A flowchart illustrating an intelligent question-answering method provided by an embodiment of the present invention is shown below in detail:

[0032] Step S11: Identify the business keywords that are the same as the preset business keywords from the user questions to obtain the target keywords. The preset business keywords are predefined keywords that correspond to legal business.

[0033] Specifically, the aforementioned legal services refer to business in various industries that involve legal knowledge during the process. For example, when a company goes public, it is necessary to verify whether the company meets the basic conditions for listing in China, such as whether its legal status complies with the provisions of the Company Law, the Securities Law, and the Listing Management Law.

[0034] In this embodiment, based on predefined keywords corresponding to business activities involving legal knowledge, the business keywords present in the user's input question are obtained as target keywords. For example, in the financial industry, equity business corresponds to keywords such as equity / shares, acquisition, transfer, merger, and acquisition. Based on the user question "What documents are needed to process equity transfer?", which corresponds to equity business, the target keyword obtained from this user question is "equity transfer".

[0035] In this embodiment of the application, the same business keywords existing in the user's question are obtained as target keywords based on preset business keywords. Since the business keywords are predefined based on keywords corresponding to legal business, the legal business corresponding to the user's question can be described more accurately based on the target keywords, so that the corresponding legal answer can be obtained based on the legal business corresponding to the user's question.

[0036] Step S12: Match the corresponding transactions according to the target business keywords and return the target transaction set. The transactions are pre-generated statements that include the business keywords. The target transaction set is used to store the transactions corresponding to the target business keywords.

[0037] Specifically, based on the obtained target business keywords, the system searches for transactions corresponding to the target business keywords in pre-generated transactions, stores all the found transactions in a target transaction set, and returns the target transaction set to the user for selection.

[0038] Step S13: Determine the target transaction based on the selection instruction issued by the user in the above target transaction set.

[0039] Specifically, the transaction selected by the user from the target transaction set returned above is used as the target transaction, which is used to query the corresponding answer to the user's question in subsequent queries.

[0040] In this embodiment, since the query is performed on the target transaction selected by the user, the subsequent query is targeted, thereby reducing the query for answers to unnecessary transactions and improving the efficiency of answer query.

[0041] Step S14: Based on the aforementioned target transaction, determine the candidate set of answers using the established regulatory knowledge graph.

[0042] The aforementioned legal knowledge graph describes the relationship between the aforementioned transactions and clauses, and the aforementioned candidate answer set is used to store the clauses corresponding to the aforementioned target transactions.

[0043] Specifically, based on the target transaction selected by the user, the relevant clauses in the pre-established legal knowledge graph are obtained, and the obtained relevant clauses are used as the candidate set of answers.

[0044] In this embodiment of the application, since the pre-established regulatory knowledge graph describes the relationship between transactions and clauses, the clauses that are related to the target transaction can be obtained according to the target transaction, and the answer candidate set of the target transaction can be obtained. Subsequently, it is only necessary to determine the answer of the target transaction from the answer candidate set, thereby reducing the amount of computation required to calculate the answer of the target transaction.

[0045] Step S15: Return the terms in the above answer candidate set that are more relevant to the user's question than a preset threshold as answers to the user.

[0046] The process involves calculating the relevance between the user's question and each item in the candidate answer set. Based on the calculation results, items with a relevance greater than a pre-set threshold are returned to the user as answers to the question. For example, if there are 7 items in the candidate answer set, meaning all 7 items are related to the target transaction, the relevance between each item and the user's question is calculated. If 3 items have a relevance greater than a preset threshold, these 3 items are returned to the user as answers, sorted in descending order of relevance for easy viewing.

[0047] In this embodiment of the application, the relevance between each clause in the candidate answer set and the user's question is calculated. Since the relevance describes the correlation between the user's question and the clause, clauses with a relevance greater than a preset threshold are returned to the user as answers, which can reduce the possibility of returning useless answers.

[0048] In this embodiment, by obtaining the target keywords from the user's question, matching the corresponding transactions based on the target keywords, and returning a set of target transactions for the user to choose from, since business keywords are predefined based on keywords corresponding to legal business, and transactions are statements including business keywords, the returned transactions are all related to the user's question and include the target keywords. This provides accurate and relevant transactions so that the user can select the transaction they need to query, reducing unnecessary subsequent queries and thus improving query efficiency. The transaction selected by the user is taken as the target transaction. A legal knowledge graph is used to obtain clauses related to the target transaction as a candidate set of answers. Clauses with a relevance greater than a preset threshold to the user's question are returned as answers to the user. Because the legal knowledge graph is built based on transactions and clauses, and directly uses clauses as answers, the returned answers are standardized and authoritative. Furthermore, the clauses returned to the user are more relevant to the user's question and more referential, allowing the user to quickly and accurately find the required legal clauses.

[0049] In some embodiments, the above-described intelligent question-answering method, when constructing a regulatory knowledge graph, includes:

[0050] A1. Generate transactions based on preset business keywords and their corresponding business attributes.

[0051] A2. Extract all clauses from the set of laws and regulations.

[0052] A3. Associate the above matters with the corresponding terms.

[0053] Specifically, transactions can be associated with corresponding terms by business experts, or by using a deep learning-trained model.

[0054] A4. Generate a transaction triple based on the above transactions, the above clauses, and the relationship between the above transactions and the above clauses.

[0055] Specifically, define transaction nodes and clause nodes, and generate transaction triples in the form of "transaction-relationship-clause" based on the above transactions, the above clauses, and the relationships between the above transactions and the above clauses.

[0056] In some embodiments, a clause triplets in the form of "clause-belongs to-law" are also generated based on the foregoing clauses, the law to which the foregoing clauses apply, and the relationship between the foregoing clauses and the law to which the foregoing clauses apply, to facilitate the lookup of the source of the corresponding clauses.

[0057] A5. Based on graph neural networks, construct a regulatory knowledge graph according to the above transaction triples.

[0058] In this embodiment, transactions are generated by predefined business keywords and associated with their corresponding clauses. Transaction triples are generated based on the relationship between transactions and clauses, and a graph neural network is constructed based on the generated transaction triples. Since clauses from the legal and regulatory set are extracted, the clauses associated with transactions in the constructed legal knowledge graph are standardized and authoritative, thereby ensuring the authenticity and authority of the answers that users can find when consulting legal issues.

[0059] In some embodiments, step A1 specifically includes:

[0060] A11. Obtain all business keywords for legal services.

[0061] Specifically, all business keywords corresponding to legal services can be obtained either by manually summarizing them or by using a deep learning training model.

[0062] A12. Based on the above business keywords and their corresponding business attributes, generate candidate transactions according to the preset transaction script template.

[0063] Specifically, based on the acquired business keywords, the corresponding business attributes are obtained. These business attributes describe the nature of the business keywords; for example, for a shareholders' meeting, the corresponding business attributes include the meeting time and procedures.

[0064] In this embodiment, candidate transactions are generated according to the aforementioned business keywords and their corresponding business attributes using a preset script template. The script template can be set to "About + [Business Keyword] + [Business Attribute] + [Closing Word]", where the closing word includes terms such as regulations, systems, decisions, and notices. The specific closing word is determined based on the business keywords and their business attributes. For example, if a company is holding a shareholders' meeting, the corresponding business keyword is "shareholders' meeting," and the attribute is "meeting time." Therefore, according to the script template, the generated candidate transaction would be "Regarding the requirements for the time of the shareholders' meeting."

[0065] In some embodiments, since it is difficult to limit transactions to a small scope using only business keywords and business attributes in certain situations, it is necessary to add constraints to restrict transactions. Therefore, for transactions with constraints, the wording template is set as "about + [constraints] + [business keywords] + [business attributes] + [closing words]". For example, listed companies in my country are divided into stock-type listed companies and bond-type listed companies. Stock-type listed companies and bond-type listed companies can be used as constraints, such as "the time requirements for share transfer of stock-type listed companies".

[0066] A13. Vectorize the above candidate transactions to obtain the semantic vectors of the above candidate transactions.

[0067] Specifically, each candidate transaction is vectorized using Sentence-BERT (Bidirectional Encoder Representations from Transformers) semantic representation to obtain a semantic vector for each candidate transaction. BERT is a language representation model that can be used for semantic similarity calculation. Sentence-BERT employs a Siamese network structure to address the computational overhead of the BERT model. Each candidate transaction is input into Sentence-BERT to obtain its semantic vector, which can be used for semantic similarity calculation or unsupervised clustering tasks.

[0068] A14. Cluster the semantic vectors of the above candidate transactions using a clustering algorithm, and generate the final transactions based on the clustering results.

[0069] Specifically, since different business keywords correspond to different business attributes, the candidate transactions generated based on the above steps may include unreasonable transactions, such as "regulations on the remuneration system for shareholders' meetings". Therefore, by using a clustering algorithm, such as DBSCAN (Density-Based Spatial Clustering of Applications with Noise), the semantic vectors of each candidate transaction obtained above are clustered. Based on semantic relationships, obviously unreasonable transactions are filtered out as outliers to obtain the final transaction.

[0070] In this embodiment, candidate transactions are generated by obtaining all business keywords and their corresponding business attributes of legal business according to a preset script template. The candidate transactions are then vectorized to obtain their semantic vectors. Clustering is performed to remove unreasonable transactions from the candidate transactions, resulting in the final transactions. Since clustering is performed based on the semantic vectors of the candidate transactions, unreasonable transactions can be effectively filtered out, avoiding unnecessary storage space occupation and increasing the scale of the legal knowledge graph.

[0071] In some embodiments, after clustering the semantic vectors of each candidate transaction and obtaining the final transaction based on the clustering results, the final transaction can be manually adjusted to delete any remaining unreasonable transactions.

[0072] In some embodiments, step A5 specifically includes:

[0073] A51. Pre-encode the above transaction triples using BERT.

[0074] Specifically, the transaction triple includes the head entity transaction and the tail entity clause, as well as the relationship between the transaction and the corresponding clause. The head entity and tail entity of the above transaction triple, i.e. the transaction and the clause, are pre-encoded based on the BERT model to obtain their semantic vectors.

[0075] A52. Input the pre-encoded transaction triples into a graph neural network for further encoding to obtain the encoded representation of the transaction triples.

[0076] A53. Construct a regulatory knowledge graph based on the transactions, clauses, and the relationships between the transactions and clauses in the transaction triples.

[0077] Specifically, such as Figure 2As shown, the head and tail entities of the aforementioned transaction triples, i.e., the transaction and the clause, are pre-encoded into the BERT model to obtain their semantic vectors. These vectors are then used as input to a graph neural network (GNN). The GNN, such as the R-GCN relational graph convolutional neural network, further encodes the transaction, clause, and the relationship between transactions and clauses. This process integrates the structural information of the transaction triples, i.e., the relationship between transactions and clauses within the transaction triples, into the node encoding of the regulatory knowledge graph. The encoded representation after the GNN encoding is then input into the relational decoder to calculate the score, which is used as the loss function. The model parameters of the GNN and the relational decoder are updated based on optimization algorithms, such as gradient descent.

[0078] In this embodiment of the application, since the transaction triple describes the relationship between the transaction and the clause, after BERT encoding based on the transaction triple, it is input into the graph neural network for further encoding to construct the regulatory knowledge graph, which includes the relationship information between the transaction and the clause. Therefore, the clause that is related to the transaction can be quickly queried by using the regulatory knowledge graph constructed based on the transaction triple.

[0079] In some embodiments, step S11 above further includes:

[0080] Obtain the abbreviations of business keywords present in user questions, and then extract the target keywords based on these abbreviations.

[0081] Specifically, since some business keywords have abbreviations, users may use abbreviations to describe their questions. Therefore, by pre-organizing a table of association between the abbreviations and full names of business keywords, when matching business keywords in user questions, the abbreviations of business keywords in the questions are replaced with the full names of the corresponding business keywords through the association table, thereby obtaining the target keywords in the user questions.

[0082] In this embodiment of the application, an association table is used to describe the correspondence between the abbreviation of a business keyword and the full name of the business keyword. Therefore, when the abbreviation of a business keyword appears in a user question, the business keyword corresponding to the abbreviation can be obtained through the association table, thereby obtaining the target keyword in the user question. This avoids the problem that the corresponding target keyword cannot be obtained when the description of the business keyword used in the user question is different.

[0083] In some embodiments, step S12 includes:

[0084] B1. Match transactions that include the target keywords mentioned above to obtain matching results.

[0085] Specifically, transactions containing the target keyword are obtained through algorithms, such as pattern matching, thereby obtaining all transactions containing the target keyword.

[0086] B2. Vectorize the user question and the transactions in the matching results, and calculate the cosine similarity between the user question and each transaction in the matching results.

[0087] Specifically, the obtained transactions and user questions including target keywords are vectorized based on Sentence-BERT to obtain semantic vectors of transactions and user questions including target keywords. Based on the semantic vectors of each transaction and user question including target keywords, the cosine similarity of each transaction and user question including target keywords is calculated.

[0088] B3. Return the target transaction set based on the cosine similarity mentioned above.

[0089] The target transaction set mentioned above stores transactions whose cosine similarity is greater than a preset similarity threshold.

[0090] Specifically, transactions with a cosine similarity greater than a preset similarity threshold to the user's question are stored in a target transaction set, and this target transaction set is returned to the user.

[0091] In some embodiments, if there are no transactions with a cosine similarity greater than a preset similarity threshold to the user's question, then a specified number of transactions with the highest cosine similarity to the user's question are stored in the target transaction set to avoid the situation where there are no transactions among the transactions returned to the user.

[0092] In this embodiment, the target keywords in the obtained user question are matched with the corresponding transactions, and the cosine similarity between the user question and the corresponding transaction is calculated to return transactions with a similarity greater than a preset threshold to the user question. Since the cosine similarity is evaluated by calculating the cosine value of the angle between the semantic vectors of the user question and the transaction, the higher the cosine similarity, the more similar the semantics of the user question and the transaction are. Therefore, the transactions returned to the user are close to the user question, making it easier for the user to select the transaction they need to query.

[0093] In some embodiments, step S14 above includes:

[0094] C1. Based on the aforementioned target transaction, obtain the relevant clauses in the aforementioned legal knowledge graph that are related to the aforementioned target transaction, and thus obtain the target clauses.

[0095] Specifically, clause nodes in the regulatory knowledge graph are selected, and the coded representation of each clause is calculated to correspond to the coded representation of the target transaction. Then, a relationship is determined between the clauses and the target transaction to identify the target clauses that are related to the target transaction. The relationship between the clauses in the regulatory knowledge graph and the target transaction is calculated using the following formula:

[0096]

[0097] Where score(h,r,t) represents the association value between the above clause and the above target transaction, and h, r, and t represent the head entity, relation, and tail entity of the transaction triple, respectively, that is, the target transaction, the association between the target transaction and the corresponding clause, and the clause. sigmoid is an S-shaped growth curve used as the activation function of a neural network, and its value ranges between (0,1). affair v senterce v base These are the encoded representations of the aforementioned target transaction, the aforementioned clause, and the relationship between the aforementioned transaction and the aforementioned clause. A correlation score less than 0.5 indicates that there is no correlation between the aforementioned target transaction and the aforementioned clause; conversely, a score greater than 0.5 indicates that there is a correlation between the aforementioned transaction and the aforementioned clause.

[0098] C2. Determine the candidate set of answers for the above target transaction based on the above target clauses.

[0099] In this embodiment, based on the target transaction selected by the user, the clauses in the legal knowledge graph that are related to the target transaction are calculated. Since a correlation value greater than or equal to 0.5 indicates that there is a correlation between the target transaction and the clause, clauses with a weak or no correlation with the target transaction are removed, resulting in target clauses that are closely related to the target transaction. This determines the candidate set of answers, reduces the number of clauses in the candidate set that are not closely related to the target transaction, and thus reduces the amount of computation when calculating the answer to the target transaction.

[0100] In some embodiments, step S15 above includes:

[0101] D1. Convert the vectors of the above target terms and the above user questions into vector representations in the same vector space.

[0102] Specifically, since user questions are vectorized based on Sentence-BERT, while clauses in the regulatory knowledge graph are vectorized through graph neural networks, their vector representations are not in the same vector space. Directly calculating their relevance will not yield accurate results. Therefore, before calculating the relevance between the user questions and the target clauses, the vector representations of the user questions and the target clauses are transformed into the same vector space for representation.

[0103] The following transformation models are used to convert the vector representations of user questions and target terms into vector representations in the same space:

[0104] e c-q =σ(W q ·v q+b q )

[0105] e c-s =σ(W s ·v s +b s )

[0106] Among them, v q v s The original vector representations of the user question and the target clause are respectively, e c-q e c-s These are the vector representations of the user question and the target clause after transformation, respectively, in the same space. σ is a non-linear activation function, such as sigmoid, tanh, etc., and W... q b q W s b s Here, W represents the transformation parameters of the transformation model, and b represents the offset.

[0107] D2. Calculate the relevance between the target terms and the user questions by using a pre-established association model.

[0108] Specifically, based on the vector representations of the aforementioned user questions and the aforementioned target terms within the same vector space, the degree of relevance between the aforementioned user questions and the aforementioned target terms is calculated using the following association model:

[0109]

[0110] Where p(s) describes the degree of relevance between the aforementioned user issues and the aforementioned target terms;

[0111] The sigmoid function, with its S-shaped growth curve, is used as an activation function in neural networks. Its value ranges from (0,1) and it can be used for binary classification. Generally, if p(s) is greater than or equal to 0.5, it is considered to belong to class "1"; otherwise, it is considered to belong to class "0".

[0112] To associate model parameters, Let be a vector, used to interact with vector e. c-s e c-q After concatenation, a dot product is performed to obtain a real-valued scalar. This is the offset, which can be any real number (generally 0) during model initialization. The values ​​are all determined during the training of the association model.

[0113] D3. Return the target clauses with a relevance greater than the preset threshold as the answer to the user.

[0114] Specifically, based on the calculated relevance between the user question and the target terms, the target terms whose relevance p(s) is greater than the preset sigmoid function threshold are returned to the user as the answer. The relevance can be described numerically, or categorized as 1 or 0 (relevant and irrelevant) based on the relevance value. For example, if a user question has six target terms, a, b, c, d, e, and f, after converting the vector representations of the user question and these six target terms into vector representations in the same space, the relevance between the user question and each target term is calculated. Target terms a and e with a relevance greater than the preset sigmoid function threshold are then returned to the user as the answer.

[0115] In this embodiment, since the user question and the target clause obtained from the regulatory knowledge graph are not vector representations in the same vector space, the result obtained by directly calculating the relevance based on their vector representations is inaccurate. Therefore, after converting them into vector representations in the same vector space through a transformation model, the relevance is calculated based on the association model. Since the relevance between the user question and the target clause describes the correlation between the user question and the target clause, the target clause with a relevance greater than a preset threshold is taken as the answer, and the clause that is more consistent with the user question is returned as the answer.

[0116] It should be understood that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0117] Example 2:

[0118] Corresponding to the intelligent question-answering method described in the above embodiments, Figure 3 A structural block diagram of the intelligent question-answering device provided in the embodiments of this application is shown. For ease of explanation, only the parts related to the embodiments of this application are shown.

[0119] Reference Figure 3 The device includes: a keyword acquisition module 31, a transaction set acquisition module 32, a target transaction acquisition module 33, a candidate answer acquisition module 34, and an answer acquisition module 35. Among them,

[0120] The keyword acquisition module 31 is used to identify the same business keywords as preset business keywords from user questions to obtain target keywords. The preset business keywords are predefined keywords corresponding to legal business.

[0121] The transaction set acquisition module 32 is used to match the corresponding transactions according to the target keywords and return the target transaction set. The transactions are pre-generated statements that include the business keywords. The target transaction set is used to store the transactions corresponding to the target keywords.

[0122] The target transaction acquisition module 33 is used to determine the target transaction based on the selection instruction issued by the user in the above-mentioned target transaction set.

[0123] The candidate answer acquisition module 34 is used to determine the candidate answer set based on the target transaction by establishing a legal knowledge graph. The legal knowledge graph describes the relationship between the target transaction and the clauses, and the candidate answer set is used to store the clauses corresponding to the target transaction.

[0124] The answer acquisition module 35 is used to return the terms in the above answer candidate set that are more relevant to the above user question than a preset threshold as answers to the user.

[0125] In this embodiment, by obtaining the target keywords from the user's question, matching the corresponding transactions based on the target keywords, and returning a set of target transactions for the user to choose from, since business keywords are predefined based on keywords corresponding to legal business, and transactions are statements including business keywords, the returned transactions are all related to the user's question and include the target keywords. This provides accurate and relevant transactions so that the user can select the transaction they need to query, reducing unnecessary subsequent queries and thus improving query efficiency. The transaction selected by the user is taken as the target transaction. A legal knowledge graph is used to obtain clauses related to the target transaction as a candidate set of answers. Clauses with a relevance greater than a preset threshold to the user's question are returned as answers to the user. Because the legal knowledge graph is built based on transactions and clauses, and directly uses clauses as answers, the returned answers are standardized and authoritative. Furthermore, the clauses returned to the user are more relevant to the user's question and more referential, allowing the user to quickly and accurately find the required legal clauses.

[0126] In some embodiments, the above-described intelligent question-answering device further includes:

[0127] The legal knowledge graph construction module is used to build legal knowledge graphs.

[0128] In some embodiments, the above-mentioned regulatory knowledge graph construction module includes:

[0129] The transaction generation unit is used to generate transactions based on preset business keywords and their corresponding business attributes.

[0130] The clause extraction unit is used to extract all clauses from the set of laws and regulations.

[0131] The association unit is used to associate the above transactions with the corresponding terms.

[0132] The triplet unit is used to generate transaction triples based on the above transactions, the above clauses, and the relationship between the above transactions and the above clauses.

[0133] The building unit is used to construct a regulatory knowledge graph based on the above transaction triples using a graph neural network.

[0134] In some embodiments, the transaction generation unit specifically includes:

[0135] The business keyword acquisition unit is used to acquire all business keywords related to legal services.

[0136] The candidate transaction acquisition unit is used to generate candidate transactions according to the aforementioned business keywords and their corresponding business attributes, based on a preset transaction script template.

[0137] The computing unit is used to vectorize the above candidate transactions to obtain the semantic vectors of the above candidate transactions.

[0138] The transaction filtering unit is used to cluster the semantic vectors of the above candidate transactions using a clustering algorithm, and generate the final transaction based on the clustering results.

[0139] In some embodiments, the transaction generation unit further includes:

[0140] The transaction constraint unit is used to generate transactions with constraint attributes by adding constraint conditions to the transaction statement template.

[0141] In some embodiments, the transaction generation unit further includes:

[0142] The manual adjustment unit is used to manually adjust the final transaction to remove any remaining unreasonable transactions.

[0143] In some embodiments, the above-mentioned building unit specifically includes:

[0144] The precoding unit is used to precode the above transaction triples using BERT.

[0145] The encoding unit is used to input the pre-encoded transaction triples into the graph neural network for further encoding to obtain the encoded representation of the transaction triples.

[0146] The graph construction unit is used to construct a regulatory knowledge graph based on the transactions, clauses, and the relationships between the transactions and clauses in the above transaction triples.

[0147] In some embodiments, the keyword acquisition unit further includes:

[0148] The abbreviation replacement unit is used to obtain the abbreviation of the business keywords in the user's question, and then obtain the target keyword based on the abbreviation.

[0149] In some embodiments, the transaction set acquisition module 32 includes:

[0150] The transaction matching unit is used to match transactions containing the target keywords based on the target keywords mentioned above, and obtain the matching results.

[0151] The similarity calculation unit is used to vectorize the user question and the transactions in the matching results, and to calculate the cosine similarity between the user question and each transaction in the matching results in turn.

[0152] The target transaction set unit is used to return the target transaction set based on the cosine similarity mentioned above.

[0153] In some embodiments, the above-mentioned candidate answer acquisition module 34 includes:

[0154] The target clause acquisition unit is used to obtain the clauses in the above-mentioned legal knowledge graph that are related to the above-mentioned target transaction, and thus obtain the target clauses.

[0155] The candidate answer acquisition unit is used to determine the candidate set of answers for the aforementioned target transaction based on the aforementioned target terms.

[0156] In some embodiments, the answer acquisition module 35 includes:

[0157] The transformation unit is used to convert the vectors of the aforementioned target terms and the aforementioned user questions into vector representations in the same vector space.

[0158] The association model unit is used to calculate the relevance between the aforementioned target terms and the aforementioned user questions using a pre-established association model.

[0159] The answer retrieval unit is used to return the target clauses with a relevance greater than a preset threshold as answers to the user.

[0160] It should be noted that the information interaction and execution process between the above-mentioned devices / units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, and they will not be repeated here.

[0161] Example 3:

[0162] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 4 As shown, the electronic device 4 of this embodiment includes: at least one processor 40 ( Figure 4 The diagram shows only one processor, a memory 41, and a computer program 42 stored in the memory 41 and executable on the at least one processor 40. When the processor 40 executes the computer program 42, it implements the steps of any of the above-described method embodiments, for example... Figure 1 Steps S11 to S15 are shown. Alternatively, when the processor 40 executes the computer program 42, it implements the functions of each module / unit in the above-described devices, such as... Figure 3 The functions of modules 31 to 35 are shown.

[0163] For example, the computer program 42 can be divided into one or more modules / units, which are stored in the memory 41 and executed by the processor 40 to complete this application. The one or more modules / units can be a series of computer program instruction segments capable of performing specific functions, which describe the execution process of the computer program 42 in the electronic device 4. For example, the computer program 42 can be divided into a keyword acquisition module 31, a transaction set acquisition module 32, a target transaction acquisition module 33, a candidate answer acquisition module 34, and an answer acquisition module 35, with the specific functions of each module as follows:

[0164] The keyword acquisition module 31 is used to identify the same business keywords as preset business keywords from user questions to obtain target keywords. The preset business keywords are predefined keywords corresponding to legal business.

[0165] The transaction set acquisition module 32 is used to match the corresponding transactions according to the target keywords and return the target transaction set. The transactions are pre-generated statements that include the business keywords. The target transaction set is used to store the transactions corresponding to the target keywords.

[0166] The target transaction acquisition module 33 is used to determine the target transaction based on the selection instruction issued by the user in the above-mentioned target transaction set.

[0167] The candidate answer acquisition module 34 is used to determine the candidate answer set based on the target transaction by establishing a legal knowledge graph. The legal knowledge graph describes the relationship between the target transaction and the clauses, and the candidate answer set is used to store the clauses corresponding to the target transaction.

[0168] The answer acquisition module 35 is used to return the terms in the above answer candidate set that are more relevant to the above user question than a preset threshold as answers to the user.

[0169] The electronic device 4 can be a desktop computer, laptop, handheld computer, cloud server, or other computing device. This electronic device may include, but is not limited to, a processor 40 and a memory 41. Those skilled in the art will understand that... Figure 4 This is merely an example of electronic device 4 and does not constitute a limitation on electronic device 4. It may include more or fewer components than shown, or combine certain components, or different components. For example, it may also include input / output devices, network access devices, etc.

[0170] The processor 40 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0171] In some embodiments, the memory 41 may be an internal storage unit of the electronic device 4, such as a hard disk or memory of the electronic device 4. In other embodiments, the memory 41 may be an external storage device of the electronic device 4, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the electronic device 4. Furthermore, the memory 41 may include both internal and external storage units of the electronic device 4. The memory 41 is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of the computer program. The memory 41 can also be used to temporarily store data that has been output or will be output.

[0172] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.

[0173] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.

[0174] This application provides a computer program product that, when run on an electronic device, enables the electronic device to perform the steps described in the various method embodiments above.

[0175] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable medium can include at least: any entity or device capable of carrying computer program code to a photographic device / electronic device, a recording medium, a computer memory, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.

[0176] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.

[0177] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0178] In the embodiments provided in this application, it should be understood that the disclosed apparatus / network devices and methods can be implemented in other ways. For example, the apparatus / network device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical, mechanical, or other forms.

[0179] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0180] The above-described embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. An intelligent question-answering method, characterized in that, include: The target keywords are obtained by identifying the same business keywords as the preset business keywords from the user questions. The preset business keywords are predefined keywords corresponding to legal business. Match the corresponding transactions based on the target keywords, and return a target transaction set. The transactions are pre-generated statements that include the business keywords, and the target transaction set is used to store the transactions corresponding to the target keywords. The target transaction is determined based on the selection instruction issued by the user in the target transaction set; Based on the target transaction, a set of candidate answers is determined by establishing a regulatory knowledge graph, wherein the regulatory knowledge graph describes the relationship between the transaction and the clauses, and the set of candidate answers is used to store the clauses corresponding to the target transaction; The options in the candidate answer set that are more relevant to the user's question than a preset threshold will be returned to the user as the answer. The regulatory knowledge graph is established in the following way: Transaction is generated based on preset business keywords and their corresponding business attributes; Extract all clauses from the legal and regulatory collection; Associate the transaction with the corresponding terms; Generate a transaction triple based on the transaction, the terms, and the relationship between the transaction and the terms; Based on graph neural networks, a regulatory knowledge graph is constructed according to the transaction triples.

2. The intelligent question-answering method as described in claim 1, characterized in that, The step of generating transactions based on preset business keywords and their corresponding business attributes includes: Obtain all business keywords for legal services; Based on each of the aforementioned business keywords and their corresponding business attributes, candidate transactions are generated according to a preset transaction script template. The candidate transactions are vectorized to obtain the semantic vectors of the candidate transactions; The semantic vectors of the candidate transactions are clustered using a clustering algorithm, and the final transactions are generated based on the clustering results.

3. The intelligent question-answering method as described in claim 1, characterized in that, The construction of a regulatory knowledge graph based on the transaction triples, using a graph neural network, includes: The transaction triples are pre-encoded using the BERT language representation model; The pre-encoded transaction triples are input into a graph neural network for further encoding to obtain the encoded representation of the transaction triples. A regulatory knowledge graph is constructed based on the transactions, clauses, and the relationships between the transactions and clauses in the transaction triples.

4. The intelligent question-answering method as described in claim 3, characterized in that, The step of determining the candidate set of answers based on the target transaction using the established regulatory knowledge graph includes: Based on the target transaction, obtain the relevant clauses in the regulatory knowledge graph that are related to the target transaction to obtain the target clause. The following formula is used to calculate whether there is a relationship between the clauses in the regulatory knowledge graph and the target transaction: score(h,r,t) distmult =sigmoid(∑(v affair *v base *v senterce )) Wherein, sigmoid is an S-shaped growth curve, used as the activation function of the neural network, v affair v senterce v base The target transaction, the clause, and the relationship between the transaction and the clause are encoded representations, respectively. When the value of score(h,r,t) is less than 0.5, it indicates that there is no relationship between the target transaction and the clause; otherwise, it indicates that there is a relationship between the transaction and the clause. Determine the candidate set of answers for the target transaction based on the target terms.

5. The intelligent question-answering method as described in claim 4, characterized in that, Returning target terms from the candidate answer set that are more relevant to the user's question than a preset threshold as answers to the user, including: Convert the target terms and the user questions into vector representations in the same vector space; The relevance between the target terms and the user's question is calculated using a pre-established association model. The target clause whose relevance is greater than a preset threshold will be returned to the user as the answer.

6. The intelligent question-answering method as described in any one of claims 1 to 5, characterized in that, The step of matching the corresponding transactions based on the target keyword and returning the target transaction set includes: Based on the target keyword, transactions containing the target keyword are matched to obtain the matching result; The user question and the transactions in the matching results are vectorized, and the cosine similarity between the user question and each transaction in the matching results is calculated in turn. The target transaction set is returned based on the cosine similarity. The target transaction set stores transactions whose cosine similarity is greater than a preset similarity threshold.

7. An intelligent question-and-answer device, characterized in that, include: The keyword acquisition module identifies target keywords by finding business keywords that are the same as preset business keywords from user questions. The preset business keywords are predefined keywords that correspond to legal business. The transaction set acquisition module is used to match the corresponding transactions according to the target keyword and return the target transaction set. The transaction is a pre-generated statement that includes the business keyword. The target transaction set is used to store the transactions corresponding to the target keyword. The target transaction acquisition module is used to determine the target transaction based on the selection instruction issued by the user in the target transaction set; The candidate answer acquisition module is used to determine a set of candidate answers based on the target transaction through an established legal knowledge graph, wherein the legal knowledge graph describes the relationship between the transaction and the clauses, and the set of candidate answers is used to store the clauses corresponding to the target transaction; The answer acquisition module is used to return the terms in the answer candidate set that are more relevant to the user's question than a preset threshold as answers to the user. The regulatory knowledge graph construction module includes: The transaction generation unit is used to generate transactions based on preset business keywords and their corresponding business attributes. The clause extraction unit is used to extract all clauses from the set of laws and regulations. An association unit is used to associate the transaction with the corresponding terms; The triplet unit is used to generate a transaction triplet based on the transaction, the terms, and the association between the transaction and the terms; The construction unit is used to construct a regulatory knowledge graph based on the transaction triples using a graph neural network.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method as described in any one of claims 1 to 6.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Knowledge graph driving type law intelligent consultation system

    CN110765257A

  • Industrial question and answer method, device, system and equipment and storage medium

    CN112749266A