Intelligent question answering method and device and readable storage medium
By applying the intelligent question-answering method of NLP and knowledge graph in the supply chain system, and using the entity-relationship joint extraction model and GPT model, the problem of insufficient operation training of the supply chain system is solved, fast and accurate question-answering results are achieved, and the user experience is improved. satisfaction and productivity, and reduced operating costs.
Patent Information
- Application Number
- CN202411052975.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-01
- Publication Date
- 2024-10-22
AI Technical Summary
The existing supply chain system operation training is insufficient, which causes employees to have to wait for a long time for manual customer service to answer various problems during actual operation, which affects work efficiency.
An intelligent question-answering method based on NLP and knowledge graph is adopted, and the knowledge graph is constructed through the entity-relationship joint extraction model and the attribute mapping model of the static attention mechanism. The GPT model is used to generate the question-answering results to improve the efficiency and accuracy of the question-answering.
It achieves fast and accurate Q&A results, improves user satisfaction and work efficiency, and reduces personnel investment and costs in the supply chain system operation department.
Smart Images

Figure CN118820439A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology, and in particular to an intelligent question-answering method, device, and readable storage medium. Background Art
[0002] Existing supply chain system operation training usually relies on online courses or offline teaching for a few short classes, which often results in inadequate training and insufficient understanding. After such training, employees usually encounter various problems that are difficult to solve when they enter the actual operation. In order to solve these problems, they usually need to seek help from manual customer service.
[0003] However, manual customer service has limited energy, and it usually takes more than ten to dozens of minutes to solve a problem in supply chain operations, which is a slow processing speed. Therefore, seeking help from manual customer service may take a long time to wait, affecting work progress.
[0004] Therefore, how to improve the efficiency of answering questions becomes a problem that needs to be solved. Summary of the invention
[0005] The technical problem to be solved by the present application is to provide an intelligent question answering method, device and readable storage medium to solve the problems existing in the prior art in view of the above-mentioned deficiencies in the prior art.
[0006] In a first aspect, the present application provides an intelligent question answering method, the method comprising:
[0007] S1. In response to obtaining a user question, the entities and relations in the user question are obtained through an entity-relationship joint extraction model;
[0008] S2. Matching entities and relationships in the user's question with the knowledge graph through an attribute mapping model based on a static attention mechanism to obtain a query result; wherein the knowledge graph is pre-constructed based on database information related to the question-answering content and historical question information;
[0009] S3. Based on the query results, generate question-answering results through the GPT model.
[0010] In some embodiments, in S2, the process of constructing the knowledge graph includes:
[0011] S01. Obtain database information and historical question information related to the question-answering content;
[0012] S02. Based on the database information and historical question information, a knowledge graph is semi-automatically constructed through an entity-relationship joint extraction model.
[0013] In some embodiments, in S02, the training process of the entity-relationship joint extraction model includes:
[0014] S02a, performing data cleaning and screening processing on the database information and historical problem information to obtain pre-processed data;
[0015] S02b, performing labeling processing on the pre-processed data to obtain labeled data;
[0016] S02c. Performing model training based on the preprocessed data and the labeled data to obtain the entity-relationship joint extraction model.
[0017] In some embodiments, the entity-relationship joint extraction model includes: a word embedding layer, a sequence layer, and a dependency layer;
[0018] The word embedding layer uses the BERT pre-training model to encode the input data and extract features to obtain word vectors and text sequences;
[0019] The sequence layer performs entity detection based on the word vector and the text sequence;
[0020] The dependency layer extracts relationships based on the entities obtained by the sequence layer.
[0021] In some embodiments, S1 includes:
[0022] Through the entity-relationship joint extraction model, entity recognition and relationship extraction are performed on the text information corresponding to the user question to obtain the entities and relationships in the user question.
[0023] In some embodiments, in S2, entities and relationships in the user question are matched with the knowledge graph to obtain query results, including:
[0024] Based on the entities and relations in the user's question, search in the knowledge graph to obtain multiple candidate answers;
[0025] The user question and the multiple candidate answers are scored for similarity, and the candidate answer with the highest score is used as the query result.
[0026] In some embodiments, performing similarity scoring on the plurality of candidate answers includes:
[0027] Obtaining vector representations of the user question and multiple candidate answers through a bidirectional LSTM deep network;
[0028] The similarity scores of the candidate answers and the user questions are scored by using the cosine similarity algorithm to obtain similarity score results of the candidate answers.
[0029] In a second aspect, the present application provides an intelligent question answering device, the device comprising:
[0030] An entity relationship extraction module, which is configured to obtain entities and relationships in the user's question through an entity-relationship joint extraction model in response to obtaining the user's question;
[0031] A knowledge graph matching module, which is configured to match entities and relationships in the user's question with the knowledge graph through an attribute mapping model based on a static attention mechanism to obtain a query result; wherein the knowledge graph is pre-constructed based on database information related to the question-answering content and historical question information;
[0032] A question-answering result generating module is configured to generate a question-answering result through a GPT model based on the query result.
[0033] In a third aspect, the present application provides an intelligent question-answering device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the intelligent question-answering method described in the first aspect above.
[0034] In a fourth aspect, the present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the intelligent question-answering method described in the first aspect above is implemented.
[0035] The intelligent question-answering method, device and readable storage medium provided by the present application are, specifically, in response to obtaining user questions, obtaining entities and relationships in the user questions through an entity-relationship joint extraction model; matching the entities and relationships in the user questions with the knowledge graph through an attribute mapping model based on a static attention mechanism to obtain query results; wherein the knowledge graph is pre-constructed based on database information related to the question-answering content and historical question information; based on the query results, generating the question-answering results through a GPT model. The present application provides an intelligent question-answering method for supply chain system operation based on NLP and knowledge graph, firstly collecting data on database information generated in the current operation of the supply chain system and common questions sorted out by manual customer service, and then semi-automatically constructing a knowledge graph using an entity detection and relationship extraction joint model, and using it as the knowledge base of the intelligent question-answering system; when the user asks a question to the system afterwards, the system first uses an entity-relationship extraction joint model to extract entities and relationships in the question text, and then uses an attribute mapping model based on a static attention mechanism to match the user query with entities and relationships in the knowledge graph to find the most relevant answer. Finally, according to the query results, easy-to-understand answers are automatically generated based on GPT, and the answer results are returned to the user in the form of a detailed description. This method realizes intelligent Q&A based on knowledge graph and NLP, which can provide easier-to-understand answer results while ensuring the efficiency of Q&A, thereby improving the work efficiency and satisfaction of users. At the same time, this method can reduce the personnel investment of the supply chain system operation department in the Q&A module, thereby improving efficiency and reducing costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0037] Figure 1 A flowchart of an intelligent question answering method provided in an embodiment of the present application;
[0038] Figure 2 A schematic diagram of an entity-relationship joint extraction model provided in an embodiment of the present application;
[0039] Figure 3 A schematic diagram of a BERT model provided in an embodiment of the present application;
[0040] Figure 4 A schematic diagram of the structure of an intelligent question-answering device provided in an embodiment of the present application;
[0041] Figure 5 A schematic diagram of the structure of another intelligent question-answering device provided in an embodiment of the present application.
[0042] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0043] In order to enable those skilled in the art to better understand the technical solution of the present application, the implementation mode of the present application will be further described in detail below with reference to the accompanying drawings.
[0044] It should be understood that the specific embodiments and drawings described herein are only used to explain the present application, rather than to limit the present application.
[0045] It can be understood that, in the absence of conflict, the various embodiments in the present application and the various features in the embodiments can be combined with each other.
[0046] It can be understood that, for the convenience of description, the drawings of the present application only show the parts related to the present application, while the parts unrelated to the present application are not shown in the drawings.
[0047] It can be understood that each unit and module involved in the embodiments of the present application may correspond to only one physical structure, or may be composed of multiple physical structures, or multiple units and modules may be integrated into one physical structure.
[0048] It can be understood that the terms "first", "second", etc. in the embodiments of the present application are used to distinguish different objects, or to distinguish different processing of the same object, rather than to describe a specific order of objects.
[0049] It is understandable that, in the absence of conflict, the functions and steps marked in the flowcharts and block diagrams of the present application may occur in an order different from that marked in the drawings.
[0050] It is understood that the flowcharts and block diagrams of the present application illustrate the possible architectures, functions, and operations of the systems, devices, equipment, and methods according to the various embodiments of the present application. Among them, each box in the flowchart or block diagram may represent a unit, module, program segment, code, which contains executable instructions for implementing the specified functions. Moreover, each box or combination of boxes in the block diagram and flowchart may be implemented by a hardware-based system that implements the specified functions, or by a combination of hardware and computer instructions.
[0051] It can be understood that the units and modules involved in the embodiments of the present application can be implemented by software or hardware, for example, the units and modules can be located in a processor.
[0052] Although solutions to existing supply chain operation problems are currently usually provided by manual customer service telephone answers or online answers, with the development of the times, intelligent customer service systems based on computer technology are gradually beginning to spread to supply chain systems.
[0053] Most of the current intelligent customer service systems are based on the idea of question answering, and are implemented using the logic of keywords + knowledge base + similarity matching. This type of intelligent customer service system first builds a question base by collecting common user questions, and configures answers for each question to form a knowledge base. Then, key feature words are extracted from the questions raised by the user, and then similarity matching is performed with the sentences in the corpus to retrieve, analyze and generate answers. Similarity matching can improve the generalization ability of finding answers to corresponding questions in the knowledge base, but this generalization is only applicable to questions with fixed keywords or questions with a small range of variation.
[0054] However, due to the complexity of the supply chain operating system and the numerous platforms, functions, and roles involved, simple similarity matching often results in inaccurate answers provided by intelligent customer service. Moreover, since the intelligent customer service at this time cannot meet the user's needs to solve the problem, users usually turn to manual customer service for help. Faced with this situation, manual customer service usually takes a long time to locate the problem and determine the solution, which not only increases the pressure on manual customer service, but also makes the time wasted by customers on solving supply chain operation problems doubled.
[0055] In addition, since the answers of these intelligent customer service are usually static texts set by humans and will not change in real time according to changes in questions, there will also be problems of lack of personalization and flexibility. These problems will lead to lower efficiency of users in using the supply chain system, which in turn leads to lower evaluation of the supply chain system.
[0056] In order to improve the efficiency of solving current supply chain system operation problems, this application proposes an intelligent question-answering method and system for supply chain system operation based on NLP (Natural Language Processing) and knowledge graph.
[0057] When it comes to answering questions about the operational steps of the supply chain system, the two most important aspects are problem understanding and problem answering.
[0058] First of all, question understanding is to ensure accurate understanding of the questions raised by users. In the supply chain system, various operation steps and specific situations are involved, so the key is to accurately interpret the keywords and contextual information in the questions. BERT (Bidirectional Encoder Representations from Transformers) has the ability to calculate semantic similarity and process long texts, which enables it to deeply understand the questions, and by deeply understanding the questions, it can better grasp the needs and intentions of users.
[0059] Secondly, question answering is to give accurate answers to questions raised by users. In the supply chain system, question answering mainly involves specific operational steps, processes or solutions, including information about orders, budgets, approvals, and suppliers. Knowledge graphs are more suitable for handling problems based on structured knowledge, cross-domain integration, and reasoning, and can also help answer more complex questions through reasoning and matching. Therefore, for question answering in the supply chain system, the knowledge graph can be used as a structured data source, containing information about operational steps, processes or solutions for orders, budgets, approvals, and suppliers, and can provide entities, attributes, and relationships related to this information. In addition, unlike BERT, which is strong in semantic understanding but weak in text generation, the GPT (Generative Pre-Trained) model focuses more on text generation, so using it can help the question-answering system provide more natural and coherent answers.
[0060] The main ideas of this application are:
[0061] This application proposes a method for intelligent Q&A of supply chain system operation based on NLP and knowledge graph. This method uses a semi-automatic method to construct a knowledge graph based on the current supply chain system database, operation logs, and questions and answers compiled by manual customer service, and uses it as the knowledge base of the intelligent Q&A system; after receiving the customer's question, the BERT model is used to encode the question to better understand the question; then the knowledge graph is used to infer and match the answer, and then the GPT model is used to generate a natural language answer. Using this method, not only the efficiency and accuracy can be improved, but also the answers given by the intelligent Q&A system can be more humane. In addition, when there is a very small probability that the intelligent Q&A system cannot solve the user's problem, this system will use the GPT model to summarize the historical messages and display them to the manual customer service, which not only improves the efficiency of the manual customer service to locate the specific problem, but also greatly reduces the customer's waiting time, which helps to increase the praise rate of the supply chain system.
[0062] In summary, this application combines NLP with knowledge graphs to better realize intelligent Q&A of supply chain system operations. By using the BERT model to encode questions, fine-tuning the pre-trained model on specific tasks, and context awareness, the questions can be better understood. Through the knowledge graph, a structured data source can be obtained, and reasoning and matching can be achieved. GPT is conducive to the generation of natural and coherent answers, thereby achieving better answers to questions. Therefore, the intelligent Q&A system for supply chain system operations based on NLP and knowledge graphs can achieve higher Q&A efficiency and user satisfaction.
[0063] In addition, before describing the embodiments of the present application, the terms involved in the embodiments of the present application are explained:
[0064] (1) BERT model
[0065] The BERT model is a pre-trained language representation model based on the Transformer model. Its core idea is to use large-scale unlabeled text data for pre-training through unsupervised learning to obtain rich language representation. The BERT model can be applied to natural language processing fields such as text classification, named entity detection, question-answering systems, machine translation, and text generation. In question-answering systems, BERT's applications include reading comprehension and question answering. In reading comprehension tasks, BERT understands the article by learning the relationship and logic between words in the context, and then finds the correct answer based on the question. Compared with traditional rule-based or template-based question-answering systems, BERT has better performance in context understanding, so it can answer questions more accurately. In question answering tasks, BERT first needs to encode the question, then obtain some useful information from the pre-trained model, and finally generate answers based on this information. Since BERT can calculate semantic similarity and has good long text processing capabilities, it can better understand the question and consider the impact of the context when generating answers.
[0066] (2) Knowledge Graph
[0067] Knowledge graph is a structured knowledge representation method based on entities, attributes and relationships. It can better capture the relationships and attributes between entities by organizing information into nodes and edges. This makes knowledge graph more efficient in dealing with problems that require information exchange between multiple related entities. Knowledge graph can integrate knowledge from different fields and multiple sources to form a unified knowledge base. Through cross-domain knowledge integration, knowledge graph can provide more comprehensive and diverse information to better solve problems. Knowledge graph can fill in the gaps and omissions of knowledge through reasoning, further enriching the answers to questions. By analyzing the relationships and attributes between entities, knowledge graph can perform logical reasoning and provide more accurate answers.
[0068] (3)GPT
[0069] GPT is a generative pre-trained model based on the unidirectional Transformer architecture. It has achieved remarkable results in the field of natural language generation, is widely used in various text generation tasks, and has achieved excellent performance on multiple evaluation benchmarks. With the continuous expansion of the model scale and the continuous improvement of technology, the application prospects of the GPT model in the field of natural language processing are very broad.
[0070] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0071] The present application provides an intelligent question-answering method, the working process of which can be implemented by electronic devices, such as computers, handheld smart terminals, etc. For the convenience of explanation, the embodiments of the present application are described with the method execution subject being a computer.
[0072] The present application provides an intelligent question-answering method, which can be applied to fields where there is a need for question answering, such as answering questions about supply chain system operations, etc. The present application does not make any specific limitations on this.
[0073] Figure 1 A schematic diagram of the intelligent question answering method provided in the embodiment of the present application, such as Figure 1 As shown, the present application provides an intelligent question answering method, which includes S1-S3, as follows:
[0074] S1. In response to obtaining a user question, the entities and relations in the user question are obtained through an entity-relationship joint extraction model;
[0075] Among them, user questions are questions raised by users that need to be answered, such as questions users have about the operation of the supply chain system.
[0076] In some embodiments, S1 includes: performing entity recognition and relationship extraction on the text information corresponding to the user question through an entity-relationship joint extraction model to obtain entities and relationships in the user question.
[0077] S2. Matching entities and relationships in the user's question with the knowledge graph through an attribute mapping model based on a static attention mechanism to obtain a query result; wherein the knowledge graph is pre-constructed based on database information related to the question-answering content and historical question information;
[0078] In some embodiments, in S2, the process of constructing the knowledge graph includes:
[0079] S01. Obtain database information and historical question information related to the question-answering content;
[0080] S02. Based on the database information and historical question information, a knowledge graph is semi-automatically constructed through an entity-relationship joint extraction model.
[0081] The entity-relationship joint extraction model is obtained by pre-training, and the training process of the entity-relationship joint extraction model includes:
[0082] S02a, performing data cleaning and screening processing on the database information and historical problem information to obtain pre-processed data;
[0083] S02b, performing labeling processing on the pre-processed data to obtain labeled data;
[0084] S02c. Performing model training based on the preprocessed data and the labeled data to obtain the entity-relationship joint extraction model.
[0085] Specifically, taking the operation of the supply chain system as an example, first, collect system operation logs, problem solving records, and frequently asked questions manuals compiled by manual customer service and other data in the supply chain system database as the professional knowledge basis for building the knowledge graph.
[0086] Secondly, since the amount of data collected in the supply chain system is small, it is difficult to provide data support for semi-automatic construction of knowledge graphs. Therefore, in this application, the Chinese entity relationship dataset DuIE 2.0 from the Institute of Computing Technology of the Chinese Academy of Sciences was also collected for model pre-training, which includes a training set of 170,000 data, a validation set of 20,000 data, and a test set of 20,000 data.
[0087] After collecting the above data, for the 50,000+ pieces of original professional knowledge data collected in this supply chain system, it is necessary to first clean and filter them to filter out irrelevant data, and then label them.
[0088] This patent uses manual labeling + model extraction to achieve data labeling, and the manually labeled part of the data is used for model training, and the model automatically extracts entities and relationships in the remaining data.
[0089] Specifically, we first manually annotated some of the cleaned original professional knowledge data and obtained nearly 10,000 data points, which were used to tune the subsequent entity-relationship joint extraction pre-training model. After training, we obtained that the manual annotations required included entity annotation, attribute annotation, relationship annotation, question classification annotation, and answer annotation. Based on the collected data, we trained the entity-relationship joint extraction model.
[0090] Figure 2 A schematic diagram of an entity-relationship joint extraction model provided in an embodiment of the present application, Figure 3 A schematic diagram of the BERT model provided in the embodiment of the present application, such as Figure 2 as well as Figure 3 As shown, the present application adopts the BERT-BiLSTM-RNN-CRF model structure to train an entity-relationship joint extraction model, and the entity-relationship joint extraction model includes: a word embedding layer, a sequence layer, and a dependency layer; wherein the word embedding layer uses the BERT pre-trained model to encode and extract features of the input data to obtain word vectors and text sequences; the sequence layer performs entity detection based on the word vectors and text sequences; and the dependency layer performs relationship extraction based on the entities obtained in the sequence layer.
[0091] First, the word embedding layer uses the BERT pre-trained model to encode the dataset to obtain word embedding vectors.
[0092] For the input text sequence, we first perform word segmentation to obtain the word segmentation text sequence, and then perform full-word masking on some words in the word segmentation sequence. Full-word masking means that in order to be more suitable for the habit of Chinese word segmentation, if part of the text of a complete word is masked, then the other parts belonging to the word will also be masked.
[0093] The next processing completed in the embedding layer is: add a special token [CLS] at the beginning of the sequence, and use the token [SEP] to separate sentences. At this stage, the output Embedding of each word in the sequence consists of three parts: TokenEmbedding, Segment Embedding, and Position Embedding. Subsequently, the sequence vector is input into the bidirectional Transformer for feature extraction, and finally a semantic feature vector is obtained. The key to the Transformer is the self-attention mechanism, which captures the degree of association between words in the same sentence by adjusting the weight coefficient matrix, and then obtains the representation information of each word. The formula is as follows:
[0094]
[0095] Among them, (Q, K, V) refers to the text matrix, dk Refers to the Embedding in the embedding layer, K T Represents the transpose of the matrix K. In the BERT model, the text matrix is projected through multiple linear transformations, and the final Attention results are concatenated. The formula is as follows:
[0096] MultiHead(Q,K,V)=Concat(head1,head2,...,head n )W O
[0097] head i =Attention(QWi i Q ,KW i K ,VWi i V )
[0098] Among them, head is the calculation result of the attention mechanism, and W is the weight matrix.
[0099] Then the word vector and text sequence are input to the sequence layer for processing. The sequence layer consists of a bidirectional LSTM and two layers of forward feedback layers. Its output is the BILOU annotation of the word. Entity detection is achieved through the annotation information. t , the vector formula for calculating the LSTM unit at t is as follows:
[0100] i t =σ(W (i) x t +U (i) h t-1 +b (i) )
[0101] f t =σ(W (f) x t +U (f) h t-1 +b (f) )
[0102] o t =σ(W (o) x t +U (o) h t-1 +b (o) )
[0103] u t =tanh(σ(W (u) x t +U (u) h y-1 +b(u) ))
[0104] c t =i t ⊙u t +f t ⊙c t-1
[0105] h t =o t ⊙tanh(c t )
[0106] Among them, i t refers to the input gate, f t Refers to the forget gate, o t refers to the output gate, u t refers to the candidate memory, c t refers to the memory unit, h t refers to the hidden state; h t-1 and c t-1 refers to the hidden state and memory unit of the previous layer, and W, U, and b refer to the weights.
[0107] Since the LSTM of the sequence layer is bidirectional, that is, both the forward LSTM and the backward LSTM are used for each sequence, the outputs at the same time need to be merged. The formula is:
[0108]
[0109] Then, in the dependency layer, the relationship extraction is realized based on the entities obtained in the sequence layer. The dependency layer is composed of LSTM-RNN layers with a bidirectional tree structure. Bidirectional means from top to bottom and from bottom to top. This design facilitates each node to integrate the information from the root node and the leaf node, which is conducive to relationship extraction. This LSTM-RNN layer can share the weights of the same type of child nodes. Therefore, in this layer, for an n-dimensional input vector x t , the vector formula for calculating the LSTM unit at t and the C(t) child node is as follows:
[0110]
[0111] h t =o t ⊙tanh(c t )
[0112] The meaning of each parameter is the same as that in the sequence layer.
[0113] The sequence layer is superimposed with the embedding layer, and the two subtasks of entity detection and relation extraction can share the information of the sequence layer and the word embedding layer. In this way, the two subtasks can be trained at the same time, and after the decoding of the entire model is completed, the shared parameters are updated through the back propagation algorithm to achieve information interaction.
[0114] In addition, this application uses the CRF layer to add constraints to make up for the shortcoming of BiLSTM that it is not good at handling the dependency relationship between adjacent tags, so as to improve the accuracy of entity detection. Its core formula is:
[0115]
[0116] Among them, Z is the normalization factor at time t+1, G represents the transfer matrix of adjacent positions, and H represents the emission matrix, that is, the probability of predicting y by x.
[0117] After the model structure is built, the DuIE 2.0 dataset is first used to pre-train the model, which is conducive to the model learning the general features of Chinese entity relationship extraction. In this pre-training process, the training set and test set are used to train and test the model to ensure the excellent performance of the model on DuIE2.0. A 15% manually annotated supply chain professional knowledge dataset and the DuIE2.0 validation set are randomly selected to form a validation set to evaluate the model. The recall rate R, precision rate P and F1 value are used to judge the performance of the model. After evaluation, the F1 value of the pre-trained model can reach 88.40%. Then, the weights of the pre-trained model are used as initial parameters to continue training the pre-trained model on the manually annotated supply chain professional knowledge dataset. In this process, all weights of the pre-trained model are updated to make the model more suitable for the characteristics of this supply chain intelligent question-answering system. After fine-tuning, the accuracy of the model can reach 90.55%.
[0118] After the entity-relationship joint extraction model is obtained through the above training process, it is used to realize the automatic joint extraction of entities and relationships of the original professional knowledge data: first, the text data is input into the embedding layer to obtain the word segmentation vector that integrates the dual features of semantics and grammar; then the word segmentation vector and the text data are input into the sequence layer together, and the category of the text fragment is determined based on the word segmentation vector and the text data, and the fragment identified as an entity is determined as an entity fragment; finally, the entity fragment, the word segmentation vector and the text data are input into the dependency layer to obtain the relationship category between each entity fragment, thereby realizing the relationship extraction of the text data. Finally, the entity-relationship joint extraction model trained according to this application obtains the entity relationship triples that are most critical for constructing the knowledge graph.
[0119] After obtaining the candidate triples, we first use the deduplication method to perform preliminary screening, and then select multiple supply chain system operations to form an expert group to manually screen these triples to confirm the correctness of the candidates, resolve potential ambiguities, and combine related triples to form a more complete semantic network. Finally, we use the graph database Neo4j to store and manage entities, relationships, and the connections between them, thereby forming a structured data map to facilitate subsequent knowledge reasoning and application.
[0120] In addition, as new text data is continuously generated, the trained entity-relationship joint extraction model can be used regularly to process the new data, thereby continuously updating and improving the knowledge graph. This continuous update mechanism ensures the timeliness and practicality of the knowledge graph, enabling the intelligent question-answering system to continuously adapt to new application scenarios and user needs.
[0121] In summary, by training the entity-relationship joint extraction model, powerful tools and resources are provided for the construction and subsequent update and maintenance of the knowledge graph, as well as the establishment of an intelligent question-answering system. This not only accelerates the creation process of the knowledge graph, but also improves the accuracy and completeness of the knowledge graph.
[0122] In some embodiments, in S2, entities and relationships in the user question are matched with the knowledge graph to obtain query results, including:
[0123] Based on the entities and relations in the user's question, search in the knowledge graph to obtain multiple candidate answers;
[0124] The user question and the multiple candidate answers are scored for similarity, and the candidate answer with the highest score is used as the query result.
[0125] In some embodiments, performing similarity scoring on the plurality of candidate answers includes:
[0126] Obtaining vector representations of the user question and multiple candidate answers through a bidirectional LSTM deep network;
[0127] The similarity scores of the candidate answers and the user questions are scored by using the cosine similarity algorithm to obtain similarity score results of the candidate answers.
[0128] Specifically, taking the supply chain system operation as an example, based on the supply chain system operation knowledge graph, the entities and relationships obtained by the entity-relationship extraction module are used to search and reason in the knowledge graph to obtain candidate answers in the knowledge graph, and then a bidirectional long short-term memory (LSTM) deep network is used to obtain the vector representation of the question and answer, and then the cosine similarity score is used to select the answers with the highest similarity to the question. The formula is:
[0129]
[0130] Among them, X1 and X2 represent two vectors respectively.
[0131] S3. Based on the query results, generate question-answering results through the GPT model.
[0132] In this step, the input candidate answers are converted into natural language answers, and finally the natural answers are presented to the user.
[0133] The core of this step is the fine-tuned GPT pre-trained model: the GPT2 model is fine-tuned by collecting, extracting and processing triple-text data sets in the semi-automatic knowledge graph construction stage, and a more suitable answer generation model for supply chain operation Q&A is obtained, so that the GPT2 model can learn how to generate natural language text based on given entities, attributes and relationships, so as to be more professional and accurate when answering questions, and finally obtain an answer generation model that is more suitable for supply chain system Q&A. In addition, using the characteristics of GPT, when the intelligent Q&A system cannot answer the customer's question, the unanswerable processing module will use the fine-tuned GPT2 model to summarize the real-time dialogue between the system and the user and forward it to the manual customer service, so that the manual customer service can understand the user's questions more quickly, thereby helping to improve the efficiency of manual customer service in answering questions.
[0134] The present application provides a method for intelligent Q&A of supply chain system operation based on NLP and knowledge graph. First, the database information generated in the operation of the current supply chain system and the common questions sorted out by manual customer service are collected, and then the knowledge graph is semi-automatically constructed using the entity detection and relationship extraction joint model, which is used as the knowledge base of the intelligent Q&A system; when the user asks a question to the system, the system first uses the entity-relationship extraction joint model to extract the entities and relationships in the question text, and then uses the attribute mapping model based on the static attention mechanism to match the user query with the entities and relationships in the knowledge graph to find the most relevant answer. Finally, according to the query results, easy-to-understand answers are automatically generated based on GPT, and the Q&A results are returned to the user in the form of a detailed description. This method realizes intelligent Q&A based on knowledge graph and NLP, which can provide easier-to-understand Q&A results while ensuring the efficiency of Q&A, thereby improving the work efficiency and satisfaction of users. At the same time, this method can reduce the personnel investment of the supply chain system operation department in the Q&A module, thereby improving efficiency and reducing costs.
[0135] It should be understood that, although the various steps in the flowcharts in the above-described embodiments are sequentially displayed according to the indications of the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and they can be executed in other orders. Moreover, at least a portion of the steps in the figure may include a plurality of sub-steps or a plurality of stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and their execution order is not necessarily to be carried out sequentially, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0136] Figure 4 A schematic diagram of an intelligent question-answering device provided in an embodiment of the present application, such as Figure 4 As shown, the present application provides an intelligent question-answering device, the device comprising:
[0137] An entity relationship extraction module 11, which is configured to obtain entities and relationships in the user's question through an entity-relationship joint extraction model in response to obtaining the user's question;
[0138] A knowledge graph matching module 12, which is configured to match entities and relationships in the user's question with the knowledge graph through an attribute mapping model based on a static attention mechanism to obtain a query result; wherein the knowledge graph is pre-constructed based on database information related to the question-answering content and historical question information;
[0139] The question answering result generating module 13 is configured to generate a question answering result through a GPT model based on the query result.
[0140] Regarding the limitation of the intelligent question-answering device, reference may be made to the limitation of the intelligent question-answering method in the above-mentioned embodiments of the present application, which will not be elaborated in this embodiment.
[0141] Figure 5 Another schematic diagram of the intelligent question answering device provided in the embodiment of the present application is as follows Figure 5 As shown, in some embodiments, the present application provides an intelligent question answering device, including a memory 22 and a processor 21, the memory stores a computer program, and the processor is configured to run the computer program to execute the intelligent question answering method in the above embodiments of the present application.
[0142] The memory is connected to the processor, the memory may be a flash memory or a read-only memory or other memory, and the processor may be a central processing unit or a single-chip microcomputer.
[0143] In some embodiments, the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the intelligent question-answering method in the above-mentioned embodiments of the present application is implemented.
[0144] The computer-readable storage medium includes volatile or non-volatile, removable or non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, computer program modules or other data). Computer-readable storage media include, but are not limited to, RAM (Random Access Memory), ROM (Read-Only Memory), EEPROM (Electrically Erasable Programmable read only memory), flash memory or other memory technology, CD-ROM (Compact Disc Read-Only Memory), digital versatile disk (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to store the desired information and can be accessed by a computer.
[0145] It is to be understood that the above embodiments are merely exemplary embodiments used to illustrate the principles of the present application, but the present application is not limited thereto. For those skilled in the art, various modifications and improvements can be made without departing from the spirit and substance of the present application, and these modifications and improvements are also considered to be within the scope of protection of the present application.
Claims
1. An intelligent question answering method, characterized in that: The method comprises: S1. In response to obtaining a user question, the entities and relations in the user question are obtained through an entity-relationship joint extraction model; S2. Matching entities and relationships in the user's question with the knowledge graph through an attribute mapping model based on a static attention mechanism to obtain a query result; wherein the knowledge graph is pre-constructed based on database information related to the question-answering content and historical question information; S3. Based on the query results, generate question-answering results through the GPT model.
2. The intelligent question answering method according to claim 1, characterized in that: In S2, the construction process of the knowledge graph includes: S01. Obtain database information and historical question information related to the question-answering content; S02. Based on the database information and historical question information, a knowledge graph is semi-automatically constructed through an entity-relationship joint extraction model.
3. The intelligent question answering method according to claim 2, characterized in that: In S02, the training process of the entity-relationship joint extraction model includes: S02a, performing data cleaning and screening processing on the database information and historical problem information to obtain pre-processed data; S02b, performing labeling processing on the pre-processed data to obtain labeled data; S02c. Performing model training based on the preprocessed data and the labeled data to obtain the entity-relationship joint extraction model.
4. The intelligent question answering method according to claim 3, characterized in that: The entity-relationship joint extraction model includes: a word embedding layer, a sequence layer and a dependency layer; The word embedding layer uses the BERT pre-training model to encode the input data and extract features to obtain word vectors and text sequences; The sequence layer performs entity detection based on the word vector and the text sequence; The dependency layer extracts relationships based on the entities obtained by the sequence layer.
5. The intelligent question answering method according to claim 1, characterized in that: S1, including: Through the entity-relationship joint extraction model, entity recognition and relationship extraction are performed on the text information corresponding to the user question to obtain the entities and relationships in the user question.
6. The intelligent question answering method according to claim 1, characterized in that: In S2, the entities and relations in the user question are matched with the knowledge graph to obtain query results, including: Based on the entities and relations in the user's question, search in the knowledge graph to obtain multiple candidate answers; The user question and the multiple candidate answers are scored for similarity, and the candidate answer with the highest score is used as the query result.
7. The intelligent question answering method according to claim 6, characterized in that: The multiple candidate answers are scored for similarity, including: Obtaining vector representations of the user question and multiple candidate answers through a bidirectional LSTM deep network; The similarity scores of the candidate answers and the user questions are scored by using the cosine similarity algorithm to obtain similarity score results of the candidate answers.
8. An intelligent question-answering device, characterized in that: The device comprises: An entity relationship extraction module, which is configured to obtain entities and relationships in the user's question through an entity-relationship joint extraction model in response to obtaining the user's question; A knowledge graph matching module, which is configured to match entities and relationships in the user's question with the knowledge graph through an attribute mapping model based on a static attention mechanism to obtain a query result; wherein the knowledge graph is pre-constructed based on database information related to the question-answering content and historical question information; A question-answering result generating module is configured to generate a question-answering result through a GPT model based on the query result.
9. An intelligent question-answering device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to implement the intelligent question answering method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the intelligent question-answering method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Text matching method and device, computer equipment and storage medium
CN115168609A
Intelligent question and answer method and device, electronic equipment and storage medium
CN117932022A
Financial question answering method, device, equipment, system, medium and product
CN118113852A
Knowledge graph question and answer method and device and storage medium
CN118170894A
Cited By
LLM-based knowledge graph generation type auxiliary teaching question answering method and system
CN119669530A
