Method for legal consultation based on complex context and related device
By combining deep neural network models and legal knowledge graphs, the problems of intent recognition and historical information utilization in complex contexts of intelligent consultation systems are solved, enabling more accurate legal consultation answers to be output.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TIANJIN HUIZHI XINGYUAN INFORMATION TECH CO LTD
- Filing Date
- 2021-11-23
- Publication Date
- 2026-04-28
AI Technical Summary
Existing intelligent consultation systems struggle to accurately identify the current dialogue intent and effectively utilize historical information when faced with complex user contexts and shifting intentions, resulting in inaccurate responses.
A pre-trained deep neural network model is used for semantic recognition, combined with a legal knowledge graph for subgraph search, to match recommended nodes and output legal consultation answers, taking into account historical and current information points.
It achieves accurate understanding of user intent and effective utilization of historical information in complex contexts, providing more accurate legal advice answers.
Smart Images

Figure CN113836273B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine learning technology, and in particular to a legal consultation method and related equipment based on complex contexts. Background Technology
[0002] With the advancement and development of artificial intelligence technology, intelligent consultation systems are gradually being applied to various service scenarios, such as intelligent customer service robots and police robots. Intelligent consultation systems provide a smart interaction channel for users and products; users can input their requests via text or voice, and the product will respond with corresponding content based on the user's intent.
[0003] Spoken language comprehension, a key module of intelligent consultation systems, extracts user intent and structured information that computers can recognize from spoken language input. Currently, deep learning models can efficiently complete spoken language comprehension tasks in an end-to-end manner, thereby improving the overall performance of intelligent consultation systems. In multi-turn dialogues between users and machines, historical information can provide richer details for the current conversation, helping the machine better understand user semantics. However, in real-world applications, user questions often involve shifts in context or intent. Accurately identifying the intent of the current dialogue and effectively filtering and utilizing relevant knowledge points from historical information is a crucial issue that intelligent consultation systems urgently need to address to provide more accurate answers. Existing intelligent consultation products lack mature solutions to these problems. Summary of the Invention
[0004] In view of this, the purpose of this application is to propose a legal consultation method and related equipment based on complex contexts.
[0005] To achieve the above objectives, this application provides a legal consultation method based on complex contexts, characterized by comprising:
[0006] In response to receiving multiple descriptions of related legal issues sequentially input by the user, a pre-trained deep neural network model is used to perform semantic recognition on each description, and extract the topic, intent and information points corresponding to each description;
[0007] Based on the topic and the intent, a subgraph search is performed in a legal knowledge graph pre-constructed based on legal knowledge-related documents to find recommended subgraphs associated with the topic and the intent;
[0008] Match all nodes in the recommendation subgraph with each knowledge point in the knowledge point set, and output at least one node that matches the knowledge point as a recommendation node.
[0009] In response to determining that the currently input description is the first time it has been input, the knowledge point set includes the information point corresponding to the currently input description.
[0010] In response to determining that the currently input description is not the first input description, the knowledge point set includes the information point corresponding to the currently input description, as well as the information points corresponding to all descriptions previously input and the topic;
[0011] The recommended node is matched with a pre-built set of answer mappings, and the legal answer related to the recommended node is output as the legal consultation answer related to the currently input description.
[0012] Based on the same inventive concept, this disclosure also provides a legal consultation device based on complex contexts, characterized in that it includes:
[0013] The semantic recognition module is configured to, in response to receiving multiple descriptions of related legal issues sequentially input by the user, perform semantic recognition on each of the descriptions using a pre-trained deep neural network model, and extract the topic, intent and information points corresponding to each of the descriptions;
[0014] The subgraph recommendation module is configured to perform a subgraph search in a legal knowledge graph pre-constructed based on legal knowledge-related documents, based on the topic and the intent, and to search for recommended subgraphs associated with the topic and the intent;
[0015] The node recommendation module is configured to match all nodes in the recommendation subgraph with each knowledge point in the knowledge point set, and output at least one node that matches the knowledge point as a recommended node.
[0016] In response to determining that the currently input description is the first time it has been input, the knowledge point set includes the information point corresponding to the currently input description.
[0017] In response to determining that the currently input description is not the first input description, the knowledge point set includes the information point corresponding to the currently input description, as well as the information points corresponding to all descriptions previously input and the topic;
[0018] The answer recommendation module is configured to match the recommended node with a pre-built set of answer mappings and output legal answers related to the recommended node as legal consultation answers related to the currently input description.
[0019] Based on the same inventive concept, this disclosure also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method described above when executing the computer program.
[0020] Based on the same inventive concept, this disclosure also provides a non-transitory computer-readable storage medium that stores computer instructions for causing a computer to perform the method described above.
[0021] As described above, this application provides a legal consultation method and related equipment based on complex contexts. Utilizing technologies such as semantic understanding and speech generation in deep learning, it proposes an intelligent consultation method for complex contexts in legal consultations. This method can accurately understand the user's consultation intent in complex contexts by combining historical consultation content. Based on multi-category classification and multi-label classification models within a deep learning framework, it obtains the intent and information points of each user's question. By filtering historical dialogues and identifying knowledge points related to the current intent, it integrates the current topic, intent, and information points to achieve a precise semantic understanding of the user's consultation. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in this application or related technologies, the drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a flowchart illustrating a legal consultation method based on complex context, as exemplified in this application.
[0024] Figure 2 This is a schematic diagram of the recommendation sub-diagram corresponding to the first round of legal Q&A in an embodiment of this application;
[0025] Figure 3 This is a schematic diagram of the recommendation sub-diagram corresponding to the second round of legal Q&A in an embodiment of this application;
[0026] Figure 4 This is a schematic diagram of the recommendation sub-diagram corresponding to the third round of legal Q&A in this application embodiment;
[0027] Figure 5 This is a schematic diagram of the recommendation sub-diagram corresponding to the fourth round of legal Q&A in this application embodiment;
[0028] Figure 6 This is a schematic diagram of the structure of a legal consultation device based on complex context according to an embodiment of this application;
[0029] Figure 7 This is a schematic diagram of the structure of an electronic device according to an embodiment of this application. Detailed Implementation
[0030] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with specific embodiments and the accompanying drawings.
[0031] It should be noted that, unless otherwise defined, the technical or scientific terms used in the embodiments of this application should have the ordinary meaning understood by one of ordinary skill in the art to which this application pertains. The terms "first," "second," and similar terms used in the embodiments of this application do not indicate any order, quantity, or importance, but are merely used to distinguish different components. Terms such as "comprising" or "including" mean that the element or object preceding the word encompasses the elements or objects listed after the word and their equivalents, without excluding other elements or objects. Terms such as "connected" or "linked" are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. Terms such as "upper," "lower," "left," and "right" are only used to indicate relative positional relationships; when the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0032] The embodiments of this application will be described in detail below with reference to the accompanying drawings.
[0033] This application provides a legal consultation method based on complex contexts, referencing... Figure 1 The method includes the following steps:
[0034] Step S101: In response to receiving multiple descriptions of related legal issues sequentially input by the user, perform semantic recognition on each description using a pre-trained deep neural network model, and extract the topic, intent, and information points corresponding to each description.
[0035] Specifically, users often ask multiple rounds of questions when seeking legal advice. These questions may be interconnected, and when answering later rounds of user-entered legal questions, it's necessary to consider relevant information from earlier questions as a supplement to the recommended answers. First, semantic recognition and parsing are required for each round of user-entered legal questions to extract the theme, intent, and key information points. The theme indicates the main legal area and direction of the inquiry, the intent indicates the problem the user wants to solve through this round of questioning, and the key information points represent the legal keywords included in the question.
[0036] Step S102: Based on the topic and the intent, perform a subgraph search in the legal knowledge graph pre-constructed based on legal knowledge-related documents to find recommended subgraphs associated with the topic and the intent.
[0037] Specifically, the above steps yield the theme and intent of the legal issues in this round. The theme and intent are corresponding nodes in a pre-constructed legal knowledge graph. Therefore, node matching can be performed directly in the legal knowledge graph based on the theme and intent to obtain a sub-graph associated with the theme and intent.
[0038] Step S103: Match all nodes in the recommended subgraph with each knowledge point in the knowledge point set, and output at least one node that is identical to the knowledge point as a recommended node.
[0039] In response to determining that the currently input description is the first time it has been input, the knowledge point set includes the information point corresponding to the currently input description.
[0040] In response to determining that the currently input description is not the first input description, the knowledge point set includes the information point corresponding to the currently input description, as well as the information points and the topic corresponding to all descriptions previously input before the currently input description.
[0041] Specifically, the sub-graph obtained through topic and intent search is matched with each knowledge point in the knowledge point set. Each node in the sub-graph is filtered, and finally only the node that is completely identical to the knowledge point is retained as the recommended node output. The recommended node is at least one.
[0042] If the current legal question is the first legal question to be entered, the knowledge point set only contains information points extracted from the current legal question. If the current legal question is not the first legal question to be entered, relevant information from previous rounds of legal questions needs to be considered to supplement the knowledge point set. Therefore, the knowledge point set not only includes information points extracted from the current legal question, but also historical information points and historical themes extracted from all previous legal questions.
[0043] In this embodiment, historical intent is not used as a knowledge point for a new round of legal issues in order to avoid over-considering historical information. This is because the intent of the current legal issue may differ greatly from the historical intent, and the historical intent may cause a deviation in the understanding of the intent of the current legal issue. Therefore, only historical themes and historical information points are retained in the historical information.
[0044] Step S104: Match the recommended node with the pre-built answer mapping set, and output the legal answer related to the recommended node as the legal consultation answer related to the currently input description.
[0045] Specifically, the answer associated with the recommended node is found in a pre-constructed answer mapping set and output as the recommended answer. This answer mapping set is constructed based on legal knowledge-related documents. It is built by summarizing and organizing existing laws, regulations, and legal Q&As, and combining suggestions from legal experts to construct a topic, intent, and information point-answer mapping set. Each topic, intent, and information point has a corresponding legal answer in this answer mapping set. The recommended node is matched with the answer mapping set, and the legal answer associated with the recommended node is output as the legal consultation answer.
[0046] In some embodiments, in response to determining that the legal question is in speech form, the legal question is converted into plain text form by a speech recognition module. If the legal question entered by the user is in plain text form, the legal question is directly input into a pre-trained deep neural network model for semantic recognition.
[0047] Specifically, the speech recognition method in the speech recognition module of this embodiment includes speech feature extraction, acoustic modeling, CTC decoding, and text conversion. Speech feature extraction involves windowing and framing the input speech signal of the legal question to extract speech features and obtain a two-dimensional spectrogram. The horizontal axis of the spectrogram represents time, and the vertical axis represents frequency. The pixel values corresponding to time and frequency reflect the energy at that time and frequency; darker colors indicate greater voiceprint intensity and a stronger impact on human perception. The acoustic modeling and CTC decoding process involves inputting the spectrogram obtained from feature extraction into a deep convolutional neural network (VGG, Visual Geometry Group). This network model has strong expressive power, can observe long-term historical and future information, and exhibits excellent robustness. The sound representation output by the VGG network is used as input to the CTC decoding process to decode the sound signal into a sequence of Chinese Pinyin. The text conversion process involves inputting the obtained Chinese Pinyin sequence into a maximum entropy hidden Markov model based on a probabilistic graph, ultimately converting the Chinese Pinyin sequence into Chinese text.
[0048] In some embodiments, the step of performing semantic parsing on each description using a pre-trained deep neural network model to extract the topic, intent, and information points corresponding to each description includes:
[0049] The description is semantically identified using a multi-class classification model, and the topic and intent corresponding to the description are extracted respectively.
[0050] The description is semantically identified using a multi-label classification model, and the information points corresponding to the description are extracted.
[0051] Specifically, the multi-class classification model outputs only one topic and one intent as the topic and intent described, while the multi-label classification model can output multiple information points.
[0052] In some embodiments, the step of performing semantic recognition on the description using a multi-class classification model to extract the topic and intent corresponding to the description includes:
[0053] The description is segmented using the jieba word segmentation algorithm;
[0054] The segmented description is input into the pre-trained model BERT, which then outputs a set of word vectors corresponding to the description.
[0055] Based on the pre-built set of topic tags and set of intent tags, the topic tag vector corresponding to each topic tag in the set of topic tags and the intent tag vector corresponding to each intent tag in the set of intent tags are obtained by the pre-trained model Bert.
[0056] Based on the word vector set and all the topic tag vectors, the topic weight coefficient corresponding to each word vector in the word vector set is obtained by similarity calculation.
[0057] Based on the word vector set and all the intent tag vectors, the intent weight coefficient corresponding to each word vector in the word vector set is obtained by similarity calculation;
[0058] The topic weight coefficient and the intent weight coefficient are normalized by using the Softmax function to obtain normalized topic weight coefficient and normalized intent weight coefficient.
[0059] The topic sentence vector corresponding to the description is obtained based on the word vector set and the normalized topic weight coefficients.
[0060] The intention sentence vector corresponding to the description is obtained based on the word vector set and the normalized intention weight coefficient.
[0061] Based on the topic sentence vector, the topic score vector corresponding to the description is calculated using the Softmax function. The topic tag corresponding to the highest score in the topic score vector is taken as the topic of the description.
[0062] Based on the intent sentence vector, the intent score vector corresponding to the description is calculated using the Softmax function, and the intent label corresponding to the highest score in the intent score vector is taken as the intent of the description.
[0063] Specifically, the extraction methods for the topic and the intent described in this embodiment are the same. The topic extraction process is explained in detail below:
[0064] The description of the legal question input by the user is segmented into words using the jieba segmentation algorithm. The segmented description is then input into a Bert-Chinese pre-trained model for encoding to obtain the word vector embeddings of the description. , (i=1, 2, …, n) represents the word vector corresponding to each word in the description, and n represents the number of words in the description. Similarly, Bert-Chinese is used to embed each topic tag in the pre-constructed topic tag set based on legal knowledge-related documents, resulting in the initial vector representation of the topic tag set. I j (j=1, 2, …, M) represents the topic tag vector corresponding to each topic tag, where M represents the number of topic tags. For a given word embedding (i=1, 2, …, n), calculate the cosine similarity between the word embedding and each topic tag vector, and take the maximum value:
[0065]
[0066] in, This serves as the weight coefficient for the i-th word in the description. The obtained weight coefficients are then normalized using the Softmax function to obtain the normalized weight coefficients:
[0067]
[0068] The description is then re-represented using weighted word vectors as the following vector sequence:
[0069]
[0070] The weighted average yields the sentence vector representation of the description:
[0071]
[0072] The Softmax function is applied to perform multi-class classification on the sentence vector representation of the description, resulting in score vectors corresponding to all topic tags in the topic tag set.
[0073]
[0074] Here, C is the coefficient matrix, and vector b is the bias term. The topic label with the highest score in the subvector P is taken as the topic output of the description.
[0075] The method for extracting the intent described is the same as that for extracting the topic, and will not be repeated here.
[0076] In some embodiments, the step of performing semantic recognition on the description using a multi-label classification model and extracting the information points corresponding to the description includes:
[0077] The description is segmented using the jieba word segmentation algorithm;
[0078] The segmented description is input into the pre-trained model BERT, which then outputs a set of word vectors corresponding to the description.
[0079] Based on a pre-built set of information point labels, the information point label vector corresponding to each information point label in the set of information point labels is obtained through the pre-trained model Bert.
[0080] Based on the word vector set and all the information point label vectors, the information point weight coefficient corresponding to each word vector in the word vector set is obtained by similarity calculation.
[0081] The information point weight coefficients are normalized using the Softmax function to obtain normalized information point weight coefficients.
[0082] The information point sentence vector corresponding to the description is obtained based on the word vector set and the normalized information point weight coefficients.
[0083] Based on the information point sentence vector, the information point score vector corresponding to the description is calculated using the Sigmoid function. The information point labels corresponding to the scores in the information point score vector that exceed a preset score threshold are taken as the information points of the description.
[0084] Specifically, similar to the steps in the topic extraction section above, the sentence vector representation of the description is obtained through the Bert-Chinese pre-trained model:
[0085]
[0086] The Sigmoid function is applied to perform multi-label classification on the sentence vector representation of the description, resulting in a score vector corresponding to all information point labels in the information point label set.
[0087]
[0088] Here, C is the coefficient matrix, and vector b is the bias term. The information point labels corresponding to scores exceeding a preset score threshold in the information point score vector are used as the described information points. In this embodiment, the score threshold is set to 0.5, that is, all information point labels with scores exceeding 0.5 are returned as the described information points.
[0089] In some embodiments, the step of performing a subgraph search in a legal knowledge graph pre-constructed based on legal knowledge-related documents, according to the topic and the intent, to search for subgraphs associated with the topic and the intent, includes:
[0090] Based on the topic, a subgraph search is performed in the legal knowledge graph to obtain the first subgraph with the topic as the root node;
[0091] A search is performed in the first subgraph according to the intent, and a second subgraph with the intent as the root node is obtained as the recommended subgraph.
[0092] Specifically, the node corresponding to the topic is the node above the node corresponding to the intent. Typically, a search is first performed in the legal knowledge graph based on the topic to find a first subgraph with the same node as the topic as the root node. Then, the intent is used to perform further search and matching in the first subgraph to output a second subgraph with the same node as the intent as the root node as the recommended subgraph.
[0093] In some embodiments, in response to determining that the currently input description is not the first input description, the knowledge point set includes the information points corresponding to the currently input description, as well as the information points corresponding to all descriptions previously input and the topic.
[0094] Before matching all nodes in the recommended subgraph with each knowledge point in the knowledge point set and outputting at least one node identical to the knowledge point as a recommended node, the method further includes: removing duplicate knowledge points from the knowledge point set.
[0095] Specifically, if the description currently input is not the description input for the first time, it is necessary to consider the topics and information points of the legal issues input in previous rounds. However, there may be overlap between historical topics and information points and current information points. These overlapping knowledge points need to be removed first, and then the knowledge points are searched and matched with the recommended subgraph to reduce the search and matching time and workload.
[0096] The following is a specific multi-round legal Q&A dialogue scenario to illustrate the legal consultation method provided in this application:
[0097] Question 1: My husband has accumulated huge gambling debts and often beats me when he's drunk. What should I do?
[0098] Answer 1: [Domestic Violence - Response Measures] When you experience domestic violence, you should pay attention to the following to minimize harm: 1. Stay away from places where sharp objects are stored…; 2. Seek medical attention promptly…; 3. Seek help from the local women's federation or neighborhood office in a timely manner; 4. Apply for a personal safety protection order from the court.
[0099] Question 2: I want a divorce.
[0100] Answer 2: [Divorce - Methods of Divorce (Domestic Violence)] If your spouse is abusive and you wish to divorce, you can first try to reach an agreement with them. If your spouse disagrees or you have disputes regarding property or child custody, you can collect evidence of domestic violence and choose to file for divorce through litigation. When a couple divorces, if one party provides evidence of domestic violence, and the court determines that domestic violence did occur, they will generally grant the divorce. [Divorce - Methods of Divorce (Gambling)] If one party gambles, the court may not necessarily grant a divorce. However, if one party has a history of gambling and continues to gamble despite admonitions, the court may grant a divorce after mediation fails. However, if it is only occasional small-scale gambling with relatives and friends, it does not constitute "gambling addiction" as a legal ground for divorce.
[0101] Question 3: Will I need to pay off my husband's debts after the divorce?
[0102] Answer 3: [Joint Debts of Spouses (Gambling Debts)] Debts incurred by one spouse through gambling are considered debts incurred in that spouse's personal name and are the sole responsibility of that spouse. The other spouse is not liable for repayment. Furthermore, gambling debts are illegal debts and are not protected by law.
[0103] Question 4: How is property divided after a divorce?
[0104] Answer 4: [Handling of Marital Property in Divorce (Domestic Violence)] When dividing property in a divorce due to domestic violence, the principle of protecting the innocent party is applied. The victim has the right to claim damages in accordance with Article 46, Paragraph 3 of the Marriage Law, but this does not involve the division of marital property. Whether or not compensation will be awarded, and how much, still needs to be determined by the court.
[0105] refer to Figure 2 In the first round of Q&A, the user's question was about "domestic violence." The question format "What to do?" combined with the topic indicates the user's intent was "coping measures." Additional information included "gambling debts" and "gambling." By mapping the question's topic and intent to the corresponding node in the graph, the answer to the question under that node can be returned to the user.
[0106] refer to Figure 3In the second round of Q&A, the user's question was about "divorce." The question format "want to..." combined with the topic indicates the user's intent was to inquire about "divorce methods." While this round didn't involve any additional knowledge points, it required integration with the topics and information extracted from the previous round. In this round, the topics and information from previous rounds were used as supplementary information to further clarify the topic and intent. Therefore, the supplementary information points included "domestic violence," "gambling debts," and "gambling." In the legal Q&A knowledge graph, with the topic "divorce" as the central node, the intent was used to locate the subgraph with "divorce methods" as the root node. The three information points were then matched with all leaf nodes in the subgraph, resulting in two leaf nodes, "domestic violence" and "gambling." These were then linked to the corresponding question answers, and the answers were returned.
[0107] refer to Figure 4 In the third round of Q&A, the user's question was about "joint marital debts," with the additional information point being "divorce." Previous rounds' additional information points included "domestic violence," "gambling debts," "gambling," and "divorce." The legal knowledge graph was used to match each additional information point with all child nodes in the subgraph rooted at "joint marital debts," ultimately finding the child node "gambling debts." The answer corresponding to this node was then returned.
[0108] refer to Figure 5 In the fourth round of Q&A, the user asked about "the handling of joint property in divorce". Similarly, by combining the information from the previous rounds, the question can be matched with the "domestic violence" sub-node under the topic node, and the corresponding answer can be returned.
[0109] To better demonstrate the advantages of this invention, the following dialogue is a response given without considering historical dialogue information:
[0110] Question 1: My husband has accumulated huge gambling debts and often beats me when he's drunk. What should I do?
[0111] Answer 1: When you experience domestic violence, you should pay attention to the following to minimize harm: 1. Stay away from places where sharp objects are stored…; 2. Seek medical attention promptly…; 3. Seek help from the local women's federation or neighborhood office in a timely manner; 4. Apply to the court for a personal safety protection order.
[0112] Question 2: I want a divorce.
[0113] A2: If you want a quick divorce, you can choose "amicable divorce." Amicable divorce usually takes 1-2 days. However, the prerequisite for amicable divorce is that you and your spouse must first agree on child custody and property division. If you and your spouse have disputes regarding child custody or property division, you can choose "litigation divorce," but this will take longer, generally 3-6 months.
[0114] Question 3: Will I need to pay off my husband's debts after the divorce?
[0115] Answer 3: After a divorce, debts incurred by one party fall into the following categories: 1) Debts incurred by the other party after your divorce are their personal debts, and you are not liable for them; 2) Debts incurred by one party during the marriage and used for the common life of the couple are considered joint debts and must be repaid jointly; 3)…
[0116] Question 4: How is property divided after a divorce?
[0117] Answer 4: In the event of a divorce, marital property is to be handled by agreement between you and your spouse. If no agreement can be reached, the court will make a judgment based on the specific circumstances of the property, taking into account the interests of the children and the wife. In practice, the court will generally divide marital property equally, half for each spouse, but depending on the specific circumstances, the specific handling may have different emphases.
[0118] As can be seen from the above dialogues, apart from the accurate answers in the first round, the subsequent rounds only considered the semantic information of the current round itself, ignoring the relevant knowledge points from previous conversations. Consequently, the answers returned to the user were not what the user truly needed. For example, in the fourth round, the user's underlying intention was to obtain legal support regarding "being favored in the division of property during a divorce after experiencing domestic violence." However, the answer only extracted the topic of "divorce property division," ultimately providing only general advice on divorce property division without considering the information about the woman experiencing domestic violence.
[0119] It should be noted that the method in this embodiment can be executed by a single device, such as a computer or server. The method can also be applied in a distributed scenario, where multiple devices cooperate to complete the task. In such a distributed scenario, one of these devices may execute only one or more steps of the method in this embodiment, and the multiple devices will interact with each other to complete the method described.
[0120] It should be noted that the above description describes some embodiments of this application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in a different order than that shown in the above embodiments and still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0121] Based on the same inventive concept, and corresponding to any of the above embodiments, this application also provides a legal consultation device based on complex contexts.
[0122] refer to Figure 6 The legal consultation device based on complex context includes:
[0123] The semantic recognition module 601 is configured to, in response to receiving multiple descriptions of related legal issues sequentially input by a user, perform semantic recognition on each of the descriptions using a pre-trained deep neural network model, and extract the topic, intent and information points corresponding to each of the descriptions;
[0124] The subgraph recommendation module 602 is configured to perform a subgraph search in a legal knowledge graph pre-constructed based on legal knowledge-related documents, according to the topic and the intent, and to search for recommended subgraphs associated with the topic and the intent;
[0125] The node recommendation module 603 is configured to match all nodes in the recommendation subgraph with each knowledge point in the knowledge point set, and output at least one node that is identical to the knowledge point as a recommended node.
[0126] In response to determining that the currently input description is the first time it has been input, the knowledge point set includes the information point corresponding to the currently input description.
[0127] In response to determining that the currently input description is not the first input description, the knowledge point set includes the information point corresponding to the currently input description, as well as the information points corresponding to all descriptions previously input and the topic;
[0128] The answer recommendation module 604 is configured to match the recommended node with a pre-built set of answer mappings and output legal answers related to the recommended node as legal consultation answers related to the currently input description.
[0129] For ease of description, the above devices are described in terms of function, divided into various modules. Of course, in implementing this application, the functions of each module can be implemented in one or more software and / or hardware.
[0130] The apparatus described above is used to implement the corresponding legal consultation method based on complex context in any of the foregoing embodiments, and has the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0131] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also provides 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 program to implement the legal consultation method based on complex context described in any of the above embodiments.
[0132] Figure 7 This embodiment illustrates a more specific hardware structure of an electronic device. The device may include a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, memory 1020, input / output interface 1030, and communication interface 1040 are interconnected internally via the bus 1050.
[0133] The processor 1010 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0134] The memory 1020 can be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0135] The input / output interface 1030 is used to connect input / output modules to realize information input and output. Input / output modules can be configured as components within the device (not shown in the figure) or externally connected to the device to provide corresponding functions. Input devices may include keyboards, mice, touchscreens, microphones, various sensors, etc., while output devices may include displays, speakers, vibrators, indicator lights, etc.
[0136] The communication interface 1040 is used to connect a communication module (not shown in the figure) to enable communication between this device and other devices. The communication module can communicate via wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0137] Bus 1050 includes a pathway for transmitting information between various components of the device, such as processor 1010, memory 1020, input / output interface 1030, and communication interface 1040.
[0138] It should be noted that although the above-described device only shows the processor 1010, memory 1020, input / output interface 1030, communication interface 1040, and bus 1050, in specific implementations, the device may also include other components necessary for normal operation. Furthermore, those skilled in the art will understand that the above-described device may only include the components necessary for implementing the embodiments of this specification, and not necessarily all the components shown in the figures.
[0139] The electronic devices described above are used to implement the corresponding legal consultation methods based on complex contexts in any of the foregoing embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0140] Based on the same inventive concept, corresponding to the methods of any of the above embodiments, this application also provides a non-transitory computer-readable storage medium storing computer instructions for causing the computer to execute the legal consultation method based on complex context as described in any of the above embodiments.
[0141] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, magnetic magnetic disk storage or other magnetic storage devices, or any other non-transfer medium that can be used to store information accessible by a computing device.
[0142] The computer instructions stored in the storage medium of the above embodiments are used to cause the computer to execute the legal consultation method based on complex context as described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0143] Those skilled in the art should understand that the discussion of any of the above embodiments is merely exemplary and is not intended to imply that the scope of this application (including the claims) is limited to these examples; within the framework of this application, the technical features of the above embodiments or different embodiments can also be combined, the steps can be implemented in any order, and there are many other variations of different aspects of the embodiments of this application as described above, which are not provided in the details for the sake of brevity.
[0144] Additionally, to simplify the description and discussion, and to avoid obscuring the embodiments of this application, the well-known power / ground connections to integrated circuit (IC) chips and other components may or may not be shown in the provided drawings. Furthermore, the apparatus may be shown in block diagram form to avoid obscuring the embodiments of this application, and this also takes into account the fact that the details of the implementation of these block diagram apparatuses are highly dependent on the platform on which the embodiments of this application will be implemented (i.e., these details should be fully understood by those skilled in the art). While specific details (e.g., circuits) have been set forth to describe exemplary embodiments of this application, it will be apparent to those skilled in the art that the embodiments of this application can be implemented without these specific details or with variations thereof. Therefore, these descriptions should be considered illustrative rather than restrictive.
[0145] Although this application has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed.
[0146] The embodiments of this application are intended to cover all such substitutions, modifications, and variations that fall within the broad scope of the appended claims. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the embodiments of this application should be included within the protection scope of this application.
Claims
1. A legal consultation method based on complex contexts, characterized in that, include: In response to receiving multiple descriptions of related legal issues sequentially input by the user, a pre-trained deep neural network model is used to perform semantic recognition on each description, and extract the topic, intent and information points corresponding to each description; Based on the topic and the intent, a subgraph search is performed in a legal knowledge graph pre-constructed based on legal knowledge-related documents to find recommended subgraphs associated with the topic and the intent; Match all nodes in the recommendation subgraph with each knowledge point in the knowledge point set, and output at least one node that matches the knowledge point as a recommendation node. In response to determining that the currently input description is the first time it has been input, the knowledge point set includes the information point corresponding to the currently input description. In response to determining that the currently input description is not the first input description, the knowledge point set includes the information point corresponding to the currently input description, as well as the information points and the topic corresponding to all descriptions previously input before the currently input description. The recommended nodes are matched with a pre-built set of answer mappings, and the legal answers related to the recommended nodes are output as legal consultation answers related to the currently input description. Among these, the multiple descriptions are all different, and after the user receives the legal consultation answer related to the currently entered description, the user enters the next description.
2. The method according to claim 1, characterized in that, The step of performing semantic recognition on each description using a pre-trained deep neural network model to extract the topic, intent, and information points corresponding to each description includes: The description is semantically identified using a multi-class classification model, and the topic and intent corresponding to the description are extracted respectively. The description is semantically identified using a multi-label classification model, and the information points corresponding to the description are extracted.
3. The method according to claim 2, characterized in that, The step of performing semantic recognition on the description using a multi-class classification model, and extracting the topic and intent corresponding to the description respectively, includes: The description is segmented using the jieba word segmentation algorithm; The segmented description is input into the pre-trained model BERT, which then outputs a set of word vectors corresponding to the description. Based on the pre-built set of topic tags and set of intent tags, the topic tag vector corresponding to each topic tag in the set of topic tags and the intent tag vector corresponding to each intent tag in the set of intent tags are obtained by the pre-trained model Bert. Based on the word vector set and all the topic tag vectors, the topic weight coefficient corresponding to each word vector in the word vector set is obtained by similarity calculation. Based on the word vector set and all the intent tag vectors, the intent weight coefficient corresponding to each word vector in the word vector set is obtained by similarity calculation; The topic weight coefficient and the intent weight coefficient are normalized by using the Softmax function to obtain normalized topic weight coefficient and normalized intent weight coefficient. The topic sentence vector corresponding to the description is obtained based on the word vector set and the normalized topic weight coefficients. The intention sentence vector corresponding to the description is obtained based on the word vector set and the normalized intention weight coefficient. Based on the topic sentence vector, the topic score vector corresponding to the description is calculated using the Softmax function. The topic tag corresponding to the highest score in the topic score vector is taken as the topic of the description. Based on the intent sentence vector, the intent score vector corresponding to the description is calculated using the Softmax function, and the intent label corresponding to the highest score in the intent score vector is taken as the intent of the description.
4. The method according to claim 2, characterized in that, The step of performing semantic recognition on the description using a multi-label classification model and extracting the information points corresponding to the description includes: The description is segmented using the jieba word segmentation algorithm; The segmented description is input into the pre-trained model BERT, which then outputs a set of word vectors corresponding to the description. Based on a pre-built set of information point labels, the information point label vector corresponding to each information point label in the set of information point labels is obtained through the pre-trained model Bert. Based on the word vector set and all the information point label vectors, the information point weight coefficient corresponding to each word vector in the word vector set is obtained by similarity calculation. The information point weight coefficients are normalized using the Softmax function to obtain normalized information point weight coefficients. The information point sentence vector corresponding to the description is obtained based on the word vector set and the normalized information point weight coefficients. Based on the information point sentence vector, the information point score vector corresponding to the description is calculated using the Sigmoid function. The information point labels corresponding to the scores in the information point score vector that exceed a preset score threshold are taken as the information points of the description.
5. The method according to claim 1, characterized in that, The step of performing a subgraph search within a pre-constructed legal knowledge graph based on relevant legal documents, according to the topic and the intent, to find recommended subgraphs associated with the topic and the intent, includes: Based on the topic, a subgraph search is performed in the legal knowledge graph to obtain the first subgraph with the topic as the root node; A search is performed in the first subgraph according to the intent, and a second subgraph with the intent as the root node is obtained as the recommended subgraph.
6. The method according to claim 1, characterized in that, In response to determining that the currently input description is not the first input description, the knowledge point set includes the information points corresponding to the currently input description, the information points corresponding to all descriptions previously input and the topic. Before matching all nodes in the recommendation subgraph with each knowledge point in the knowledge point set and outputting at least one node identical to the knowledge point as a recommendation node, the method further includes: Duplicate knowledge points are removed from the set of knowledge points.
7. A legal consultation device based on complex contexts, characterized in that, include: The semantic recognition module is configured to, in response to receiving multiple descriptions of related legal issues sequentially input by the user, perform semantic recognition on each of the descriptions using a pre-trained deep neural network model, and extract the topic, intent and information points corresponding to each of the descriptions; The subgraph recommendation module is configured to perform a subgraph search in a legal knowledge graph pre-constructed based on legal knowledge-related documents, based on the topic and the intent, and to search for recommended subgraphs associated with the topic and the intent; The node recommendation module is configured to match all nodes in the recommendation subgraph with each knowledge point in the knowledge point set, and output at least one node that matches the knowledge point as a recommended node. In response to determining that the currently input description is the first time it has been input, the knowledge point set includes the information point corresponding to the currently input description. In response to determining that the currently input description is not the first input description, the knowledge point set includes the information point corresponding to the currently input description, as well as the information points and the topic corresponding to all descriptions previously input before the currently input description. The answer recommendation module is configured to match the recommended nodes with a pre-built set of answer mappings, and output legal answers related to the recommended nodes as legal consultation answers relevant to the currently input description. Among these, the multiple descriptions are all different, and after the user receives the legal consultation answer related to the currently entered description, the user enters the next description.
8. The apparatus according to claim 7, characterized in that, The semantic recognition module is specifically configured to perform semantic parsing on each description using a pre-trained deep neural network model, extracting the topic, intent, and information points corresponding to each description, including: The description is semantically identified using a multi-class classification model, and the topic and intent corresponding to the description are extracted respectively. The description is semantically identified using a multi-label classification model, and the information points corresponding to the description are extracted.
9. 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 program, it implements the method as described in any one of claims 1 to 6.
10. A non-transitory computer-readable storage medium storing computer instructions, characterized in that, The computer instructions are used to cause the computer to perform the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Content and graph neural network-based example recommendation method, device and storage medium
CN111538827A
Security event analysis report generation method and device, storage medium and equipment
CN111651751A
Audio signal processing method, device and system, electronic equipment and readable medium
CN112489639A
Inference type precise intelligent question-answering method based on legal knowledge graph
CN110377715A
Semantic search method and device based on case event knowledge graph and electronic equipment
CN112632225A