General quality characteristic intelligent question-answering method based on knowledge graph and large language model
By constructing an intelligent question-answering system based on knowledge graphs and large language models, the problems of insufficient generalization ability and low accuracy in the general quality characteristics of traditional question-answering systems are solved, achieving efficient and accurate question-answering capabilities, improving information acquisition efficiency and intelligent application of the system.
Patent Information
- Application Number
- CN202510633208.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-16
- Publication Date
- 2025-11-07
AI Technical Summary
Traditional rule-based question-answering systems lack generalization ability in general quality characteristics and lack large-scale question-answering labeled corpora, resulting in substandard overall accuracy and an inability to effectively cope with complex and ever-changing question-answering scenarios.
We employ an intelligent question-answering method based on knowledge graphs and large language models. By constructing a general quality characteristic knowledge graph and a lightweight large language model, we obtain answers to user questions. We then use pre-built question-answers to perform semantic parsing on the database and model, enabling accurate responses in complex and ever-changing scenarios.
It improves the overall accuracy of the question-and-answer system, enabling it to better handle complex and ever-changing question-and-answer scenarios, enhances the efficiency of information acquisition for practitioners, and meets the needs of information integration and intelligent application in the field of general quality characteristics.
Smart Images

Figure CN120910185A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application belongs to the technical field of general quality characteristics, and particularly relates to a general quality characteristic intelligent question answering method based on a knowledge graph and a large language model. BACKGROUND
[0002] General quality characteristics include reliability, safety, maintainability, testability, supportability and environmental adaptability. These quality characteristics are interrelated and jointly affect the quality of products. In the development process of weapon equipment or products, these characteristics need to be fully considered to ensure that the products can meet the use requirements and have a high quality level.
[0003] As one of important means of data management, information extraction and knowledge representation, the knowledge graph simulates the human cognitive system by expressing information in the form of a graph, which not only helps to intuitively present the relationship between knowledge, but also provides an important basis for the application of machine learning, natural language processing and other fields, so that the computer has a deeper and more comprehensive understanding of information, which is convenient for processing.
[0004] Intelligent question answering is an important research direction in the field of artificial intelligence and belongs to an important field of natural language processing. Its goal is to design and develop systems that can analyze, understand and answer natural language questions posed by users. The goal of these systems is not only to return text related to the question, but more importantly to provide concise, accurate and direct answers.
[0005] At present, in the traditional rule-based question answering system, expert-specified rules are generally relied on to realize semantic analysis of user questions. Such analysis method has the following disadvantages: (1) the generalization ability is not strong, and it cannot well cope with complex and variable question answering scenarios; (2) there is a lack of large-scale question answering annotated corpus in the field of general quality characteristic knowledge, so the training effect of the semantic analysis method based on deep neural network is not ideal; (3) the comprehensive accuracy of the question answering system cannot reach the practical standard. SUMMARY
[0006] In order to overcome the problems in the related art, the present application provides a general quality characteristic intelligent question answering method based on a knowledge graph and a large language model.
[0007] According to a first aspect of an embodiment of the present application, a general quality characteristic intelligent question answering method based on a knowledge graph and a large language model is provided, comprising:
[0008] obtaining a user question;
[0009] judging whether an answer corresponding to the user question can be obtained from a pre-constructed general quality characteristic knowledge graph based on a pre-constructed general quality characteristic common question and answer pair database;
[0010] If the answer corresponding to the user question can be obtained from the pre-constructed general quality characteristic knowledge graph, the answer corresponding to the user question is obtained by using the pre-constructed general quality characteristic knowledge graph, and the answer corresponding to the user question is obtained from the pre-established lightweight large language model; otherwise, the answer corresponding to the user question is obtained from the pre-established lightweight large language model.
[0011] According to a second aspect of the embodiment of the present application, a general quality characteristic intelligent question and answer device based on a knowledge graph and a large language model is provided, comprising:
[0012] a question obtaining unit configured to obtain a user question;
[0013] a judgment unit configured to judge whether the answer corresponding to the user question can be obtained from the pre-constructed general quality characteristic knowledge graph based on a pre-constructed general quality characteristic common question and answer pair database;
[0014] an answer obtaining unit configured to, if the answer corresponding to the user question can be obtained from the pre-constructed general quality characteristic knowledge graph, obtain the answer corresponding to the user question by using the pre-constructed general quality characteristic knowledge graph, and obtain the answer corresponding to the user question from the pre-established lightweight large language model; otherwise, obtain the answer corresponding to the user question from the pre-established lightweight large language model.
[0015] According to a third aspect of the embodiment of the present application, an electronic device is provided, comprising at least one processor and a memory; the memory and the processor are connected through a bus;
[0016] the memory is configured to store one or more programs;
[0017] when the one or more programs are executed by the at least one processor, the general quality characteristic intelligent question and answer method based on the knowledge graph and the large language model is implemented.
[0018] According to a fourth aspect of the embodiment of the present application, a readable storage medium having an execution program stored thereon is provided, and when the execution program is executed, the general quality characteristic intelligent question and answer method based on the knowledge graph and the large language model is implemented.
[0019] The technical solution provided by the present application has the following beneficial effects:
[0020] The application provides a general quality characteristic intelligent question and answer method based on a knowledge graph and a large language model. BRIEF DESCRIPTION OF DRAWINGS
[0021] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings needed to be used in the embodiments or the prior art description. Obviously, the drawings in the following description only some embodiments of the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.
[0022] Figure 1 is a flow chart of a general quality characteristic intelligent question and answer method based on a knowledge graph and a large language model provided by an embodiment of the present application;
[0023] Figure 2 is a flow chart of a general quality characteristic intelligent question and answer method based on a knowledge graph and a large language model provided by an embodiment of the present application;
[0024] Figure 3 is a structural block diagram of a general quality characteristic intelligent question and answer device based on a knowledge graph and a large language model provided by an embodiment of the present application;
[0025] Figure 4 is a structural block diagram of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solutions and advantages of the present application more clear, the technical solutions of the present application will be described clearly and completely below with reference to the drawings. Obviously, the following embodiments are only some of the embodiments of the present application, not all. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0027] Embodiment one
[0028] To solve the technical problems of scattered storage of general quality characteristic knowledge, lack of systematic management of general quality characteristic knowledge, low efficiency of traditional information retrieval method, and inability of user question and answer to respond in real time, the present application provides a general quality characteristic intelligent question and answer method based on knowledge graph and large language model. The method constructs a general quality characteristic knowledge base platform based on knowledge graph technology, enhances the generalization ability of the question and answer method through pre-training language model, and provides a new idea and way for information integration and intelligent application in the field of general quality characteristics. Specifically, as shown in the figure, the method comprises the following steps: Figure 1
[0029] Step 21: obtaining a user question;
[0030] Step 22: judging whether the answer corresponding to the user question can be obtained from the pre-constructed general quality characteristic knowledge graph based on the pre-constructed general quality characteristic common question and answer pair database;
[0031] Step 23: if the answer corresponding to the user question can be obtained from the pre-constructed general quality characteristic knowledge graph, obtaining the answer corresponding to the user question from the pre-constructed general quality characteristic knowledge graph and obtaining the answer corresponding to the user question from the pre-established lightweight large language model; otherwise, obtaining the answer corresponding to the user question from the pre-established lightweight large language model.
[0032] Further, the method further comprises step 11: constructing a general quality characteristic common question and answer pair database; specifically, step 11 comprises:
[0033] Step 111: collecting questions and answers related to general quality characteristics;
[0034] Step 112: pre-processing and standardizing the questions and answers to obtain processed questions and processed answers;
[0035] It should be noted that the "pre-processing and standardization" involved in the embodiments of the present application is well known to those skilled in the art, and therefore the specific implementation mode is not described in detail;
[0036] Step 113: selecting questions in the processed questions that are greater than or equal to a first frequency threshold as high-frequency questions;
[0037] Step 114: determining the category of the high-frequency questions, and storing the high-frequency questions and the corresponding processed answers to the sub-database of the corresponding category;
[0038] Step 115: the sub-databases of various categories constitute the general quality characteristic common question and answer pair database.
[0039] Further, step 22 comprises:
[0040] Step 221: using a Chinese word segmentation tool to perform word segmentation processing on the questions in the general quality characteristic common question and answer pair database, and performing stop word removal operation on the questions after word segmentation processing to obtain processed questions;
[0041] Step 222: using a Word2Vec word vector model to convert each word in the processed question into a vector representation to obtain the word vector of each word in the processed question;
[0042] Step 223: adding the word vectors of all words in the processed question, and performing normalization operation on the added word vector to obtain the complete question vector corresponding to the processed question;
[0043] Step 224: using a Word2Vec word vector model to convert the user question into a vector representation;
[0044] Step 225: using a cosine similarity calculation method to calculate the similarity between the vector representation of the user question and the question vectors in the general quality characteristic common question and answer pair database;
[0045] It should be noted that the "cosine similarity calculation method" involved in the embodiments of the present application is well known to those skilled in the art, and therefore the specific implementation mode is not described in detail;
[0046] Step 226: if the similarity between the vector representation of the user question and the question vectors in the general quality characteristic common question and answer pair database is greater than or equal to the fourth similarity threshold, the answer corresponding to the user question can be obtained from the pre-constructed general quality characteristic knowledge graph.
[0047] Further, the method further comprises step 12: establishing a lightweight large language model; specifically, step 12 comprises:
[0048] Step 121: filling the entities in the pre-constructed general quality characteristic knowledge graph into the large language model prompt template to obtain a lightweight large language model fine-tuned by general quality characteristic professional knowledge.
[0049] Further, the step of using the pre-constructed general quality characteristic knowledge graph to obtain the answer corresponding to the user question in step 23 comprises:
[0050] Step 231: using a pre-constructed general quality characteristic question intent recognition model to identify the question intent of the user question;
[0051] Step 232: using a pre-constructed general quality characteristic question named entity recognition model to identify the subject entity of the user question;
[0052] Step 233: generating a query triple by using the question intention of the user question and the subject entity of the user question, and filling the query triple into a query sentence template to obtain a user query sentence;
[0053] Step 234: obtaining an answer corresponding to the user question from a pre-constructed general quality characteristic knowledge graph according to the user query sentence.
[0054] Further, step 231 comprises:
[0055] Step 2311: converting the user question into a vector representation by using a Word2Vec word vector model;
[0056] Step 2312: inputting the user question converted into the vector representation into a general quality characteristic question intention recognition model to obtain an intention category of the user question, the intention category of the user question being a question intention of the user question.
[0057] Further, step 232 comprises:
[0058] Step 2321: converting the user question into a vector representation by using a Word2Vec word vector model;
[0059] Step 2322: inputting the user question converted into the vector representation into a general quality characteristic question named entity recognition model to obtain an entity of the user question;
[0060] Step 2323: calculating a cosine similarity between each entity in a pre-constructed general quality characteristic entity dictionary and the entity of the user question by using a cosine similarity calculation method, the each entity being of the same intention category as the user question;
[0061] Step 2324: selecting an entity in the pre-constructed general quality characteristic entity dictionary corresponding to the maximum cosine similarity as a subject entity of the user question.
[0062] Further, the method further comprises step 13: constructing a general quality characteristic question intention recognition model; specifically, step 13 comprises:
[0063] Step 131: crawling topic data related to the general quality characteristic field by using a crawler technology, the topic data comprising a plurality of questions;
[0064] Step 132: classifying the topic data to obtain an intention category of each question in the topic data, and constructing a small-scale general quality characteristic question intention recognition data set by using each question in the topic data and the corresponding intention category;
[0065] In some embodiments, the topic data can be manually classified, but is not limited thereto.
[0066] Step 133: using the entities in the pre-constructed general quality characteristic knowledge graph, and adopting entity replacement, sentence structure transformation and synonym replacement method to expand the small-scale general quality characteristic question intention recognition data set, to obtain an expanded data set;
[0067] It should be noted that the "entity replacement, sentence structure transformation and synonym replacement method" involved in the embodiments of the present application is well known to those skilled in the art, and therefore the specific implementation mode is not described in detail;
[0068] Step 134: dividing the expanded data set into an initial training set and an initial test set, and randomly shuffling the question sentences in the initial training set and the initial test set, respectively, to obtain a third training set and a third test set;
[0069] Step 135: using a Word2Vec word vector model to convert the question sentences in the third training set and the third test set into vector representations;
[0070] Step 136: using the vector representations of the questions in the third training set and their corresponding intent categories to train the Text-CNN model, to obtain a trained Text-CNN model;
[0071] Step 137: using the vector representations of the questions in the third test set and their corresponding intent categories to verify the trained Text-CNN model, if the verification result meets a third preset condition, the trained Text-CNN model is a general quality characteristic question intention recognition model; otherwise, adjust the hyperparameters of the Text-CNN model, and retrain the Text-CNN model after adjusting the hyperparameters until the verification result meets the third preset condition.
[0072] It should be noted that the present application does not limit the "third preset condition", which can be set by those skilled in the art according to experimental data, actual needs and expert experience, etc. For example, assuming that the third preset condition is that the recognition accuracy of the trained Text-CNN model is greater than or equal to 98%, then using the vector representations of the questions in the third test set and their corresponding intent categories to verify the trained Text-CNN model, the verification result is the recognition accuracy of the trained Text-CNN model, that is, if the verification result meets the third preset condition, the trained Text-CNN model is a general quality characteristic question intention recognition model; otherwise, adjust the hyperparameters of the Text-CNN model, and retrain the Text-CNN model after adjusting the hyperparameters until the verification result meets the third preset condition
[0073] Specifically, the intent categories include: general quality characteristic concept definition class Definitions, general quality characteristic design element Feature, general quality characteristic work scope Include, general quality characteristic work basis Reason, general quality characteristic work requirements Requirements, and general quality characteristic work method Method.
[0074] Further, the method further comprises: step 14: constructing a general quality characteristic knowledge graph; specifically, step 14 comprises:
[0075] Step 141: generating a general quality characteristic corpus dataset according to the text information of the collected general quality characteristic related literature, and constructing a knowledge graph ontology layer using the general quality characteristic corpus dataset;
[0076] Step 142: based on the knowledge graph ontology layer, performing entity extraction and relationship extraction on the general quality characteristic corpus dataset to obtain structured general quality characteristic triple data, and using the structured general quality characteristic triple data to construct a knowledge graph data layer;
[0077] Step 143: using the knowledge graph ontology layer and the knowledge graph data layer to construct an initial knowledge graph;
[0078] Step 144: knowledge fusion is performed on the initial knowledge graph to obtain a general quality characteristic knowledge graph.
[0079] Further, in step 141, the general quality characteristic corpus dataset is generated according to the text information of the collected general quality characteristic related literature, comprising:
[0080] Step 1411: performing a preprocessing operation on the text information, and eliminating redundant information in the text information to generate a general quality characteristic corpus dataset.
[0081] Further, in step 141, the general quality characteristic corpus dataset is used to construct the knowledge graph ontology layer, comprising:
[0082] Step 1412: based on a plurality of preset angles, defining entity types, relationship types and attributes in the general quality characteristic corpus dataset using a large model to generate a knowledge graph ontology mode layer.
[0083] Specifically, the preset angles include at least the following six angles: scene, reuse, thing, contact, constraint, and evaluation.
[0084] Further, in step 142, based on the knowledge graph ontology layer, the general quality characteristic corpus dataset is subjected to entity extraction and relationship extraction to obtain structured general quality characteristic triple data, comprising:
[0085] Step 1421: based on the knowledge graph ontology layer, performing entity extraction on the general quality characteristic corpus dataset by using a pre-constructed general quality characteristic question named entity recognition model, and performing relation extraction on the general quality characteristic corpus dataset by using a pre-constructed general quality characteristic relation extraction model, to obtain entities in the general quality characteristic corpus dataset and relations between the entities;
[0086] Step 1422: the entities in the general quality characteristic corpus dataset and the relations between the entities are structured triple data of the general quality characteristics.
[0087] Further, the method further includes: step 15 of establishing a general quality characteristic question named entity recognition model; specifically, step 15 includes:
[0088] Step 151: based on a pre-constructed general quality characteristic entity dictionary, performing entity annotation on the general quality characteristic text sentence corpus dataset by using a BIO annotation method;
[0089] Step 152: dividing the general quality characteristic text sentence corpus dataset after the entity annotation into a first training set and a first test set;
[0090] Step 153: training a BERT-BiLSTM-CRF model by using the first training set, to obtain a trained BERT-BiLSTM-CRF model;
[0091] Step 154: verifying the trained BERT-BiLSTM-CRF model by using the first test set, and calculating a first accuracy, a first recall rate, and a first harmonic mean;
[0092] Step 155: if the first accuracy, the first recall rate, and the first harmonic mean satisfy a first preset condition, the trained BERT-BiLSTM-CRF model is the general quality characteristic question named entity recognition model; otherwise, performing targeted optimization training on the BERT-BiLSTM-CRF model according to entities with an error frequency greater than or equal to a second frequency threshold, until the first accuracy, the first recall rate, and the first harmonic mean satisfy the first preset condition.
[0093] Further, the method further includes: step 16 of constructing a general quality characteristic relation extraction model; specifically, step 16 includes:
[0094] Step 161: performing relation annotation on each entity in the general quality characteristic text sentence corpus dataset after the entity annotation by using an annotation tool, to obtain a general quality characteristic text sentence corpus dataset after the relation annotation;
[0095] Step 162: format conversion is performed on the general quality characteristic text sentence corpus data set after relationship annotation to generate a relationship extraction data set in an input format conforming to the BERT-CASREL model;
[0096] Step 163: the relationship extraction data set is divided into a second training set and a second test set;
[0097] Step 164: the BERT model is used as the encoder of the BERT-CASREL model, the CASREL model is used as the decoder of the BERT-CASREL model, and the second training set is used to train the BERT-CASREL model to obtain a trained BERT-CASREL model;
[0098] Step 165: the second test set is used to verify the trained BERT-CASREL model, and the second accuracy, the second recall rate and the second harmonic mean are calculated;
[0099] Step 166: if the second accuracy, the second recall rate and the second harmonic mean satisfy a second preset condition, the trained BERT-CASREL model is a general quality characteristic relationship extraction model; otherwise, the hyperparameters of the BERT-CASREL model are adjusted, and the BERT-CASREL model after the adjustment of the hyperparameters is retrained until the second accuracy, the second recall rate and the second harmonic mean satisfy the second preset condition.
[0100] In some embodiments, the BERT-CASREL model can also be adjusted by increasing the model complexity or using a regularization method, but is not limited thereto, and the BERT-CASREL model after the adjustment is retrained.
[0101] Further, step 144 includes:
[0102] Step 1441: the similarity of entity names of each entity type in the knowledge graph ontology layer is calculated, and when the similarity of entity names between two entity types is greater than or equal to a first similarity threshold, the two entity types are fused to obtain a fused knowledge graph ontology layer;
[0103] Step 1442: the similarity of entity names and the similarity of attributes between entities in the knowledge graph data layer are calculated, and when the similarity of entity names between two entities is greater than or equal to a second similarity threshold or the similarity of attributes between two entities is greater than or equal to a third similarity threshold, the two entities are fused to obtain a fused knowledge graph data layer;
[0104] Step 1443: the fused knowledge graph ontology layer and the fused knowledge graph data layer constitute a general quality characteristic knowledge graph.
[0105] To further illustrate the above-mentioned general quality characteristic intelligent question and answer method based on knowledge graph and large language model, the present application provides a specific example, as shown in Figure 2 The method comprises the following steps:
[0106] Step 31: Collect, gather and integrate the knowledge scattered in the general quality characteristic text to establish a knowledge graph ontology layer;
[0107] Step 32: Based on step 31, use a natural language processing model to perform entity extraction and relationship extraction on the text information according to the concepts and attributes in the ontology layer to form structured triple data of general quality characteristics;
[0108] Step 33: Based on the triple data in step 32, construct a knowledge graph data layer, and use the knowledge graph ontology layer and the knowledge graph data layer to construct a general quality characteristic knowledge graph;
[0109] Step 34: Perform knowledge fusion on the general quality characteristic knowledge graph in step 33, fuse the knowledge graph ontology layer using the similarity of the ontology entity names in the knowledge graph ontology layer, and then fuse the knowledge graph data layer using the similarity of the entity names and attributes;
[0110] Step 35: Construct a general quality characteristic question intention recognition model, which can automatically learn and extract feature representations in the question, perform feature pattern recognition, capture intention features in the general quality characteristic question, and efficiently and accurately complete the intention recognition task;
[0111] Step 36: Construct a general quality characteristic common question and answer pair database, and use a question similarity method to determine whether to extract answers from the general quality characteristic knowledge graph for answering;
[0112] Step 37: Construct a general quality characteristic question named entity recognition model to extract the subject entity in the question;
[0113] Step 38: If the entity matches (i.e., the answer can be extracted from the general quality characteristic knowledge graph for answering), use the recognized question intention and subject entity information to construct a Cypher query statement to search for answers in the general quality characteristic knowledge graph, and complete the answer to the common question;
[0114] Step 39: Fill the recognized entity into the prompt word template in the large language model and input it into the lightweight large language model fine-tuned by professional knowledge to obtain the answer;
[0115] Step 40: The system then performs comparison and analysis, and comprehensively evaluates the answers from the knowledge graph query and the large model reasoning; if there is a corresponding answer in the general quality characteristic knowledge graph, the system will display the answers of both; if there is no corresponding answer in the general quality characteristic knowledge graph, i.e. the entity does not match, the knowledge graph fails to retrieve relevant knowledge, then only the answer generated by the lightweight large language model is provided for the user to refer to.
[0116] Further, step 31 includes:
[0117] Step 311: Data acquisition: collect and organize all general quality characteristic related literature and electronic textbooks, etc. as text information of general quality characteristic related literature;
[0118] Step 312: Data processing: use scripts to pre-process the text information (de-duplication, remove noise, modify wrong characters, format conversion, etc.), eliminate redundant information, and form a general quality characteristic corpus dataset;
[0119] Step 313: Determine the ontology layer of the knowledge graph: use the language understanding, generation and reasoning capabilities of the large model to guide the ontology layer design from the perspectives of scene, reuse, things, connection, constraint and evaluation, use the large model to support the rapid sorting of general quality characteristic knowledge, assist experts in analyzing and understanding the general quality characteristic knowledge framework, automatically summarize the key concepts, terms and theories of general characteristic field knowledge, generate knowledge descriptions with appropriate granularity at different levels of abstraction according to the context, form the ontology layer of the knowledge graph, specifically including:
[0120] A. Scene: use the large model to quickly sort the general quality characteristic knowledge, information and knowledge range that need to be aligned, and organize the business scenario list;
[0121] B. Reuse: use existing general quality characteristic knowledge, terms, and standards to perfect the basic ontology and domain ontology;
[0122] C. Things: use the powerful knowledge understanding and reasoning capabilities of the large model to comprehensively sort general quality characteristic knowledge concepts, define general quality characteristic entity types and attribute lists for each entity type;
[0123] D. Connection: use the large model to understand entity types and combine entity type pairs, and design possible relationship names and possible attribute lists;
[0124] E. Constraint: the large model provides rationalization constraint suggestions for entity types, relationship types and attributes, including value types, ranges, logic, permissions, etc.
[0125] F. Evaluation: Evaluate whether the knowledge graph ontology layer meets the scenario requirements in a human-machine collaborative manner, with scenario coverage, function satisfaction, effect evaluation, standardization, complexity, readability, and scalability as indicators. Automatically generate evaluation indicators using large models, or convene relevant experts to evaluate the designed knowledge graph ontology layer.
[0126] Further, step 32 includes:
[0127] Data layer construction: Under the constraints of the schema layer, the general quality characteristic knowledge is extracted using a deep learning-based knowledge extraction method (including: general quality characteristic question named entity recognition model and general quality characteristic relationship extraction model), entities and relationships are extracted, general quality characteristic triples are constructed, and manual inspection and verification are performed to ensure the quality of the triples. At the same time, according to the extracted triples, the schema layer of the knowledge graph is further improved and expanded;
[0128] The steps of entity recognition are:
[0129] a) Construct a general quality characteristic entity dictionary;
[0130] b) Based on the BIO annotation method, annotate the entity: perform word segmentation on the general quality characteristic corpus dataset, annotate the general quality characteristic corpus dataset based on the general quality characteristic entity dictionary combined with the experience of domain experts to assist in annotation review, use Python code to convert the annotation results, generate a named entity recognition dataset based on the BIO method, and count the annotated entity data. According to the 8:2 ratio, divide it into training set and test set;
[0131] c) Based on the BERT-BiLSTM-CRF model, improve the entity dictionary: use the annotated general quality characteristic corpus dataset to train the model;
[0132] The steps of model training are:
[0133] i. Parameter setting: adopt PyTorch framework to build, set model training iteration times epoch, batch size batch_size and BiLSTM hidden layer dimension parameters, etc.;
[0134] ii. Evaluation indicators: use accuracy P, recall rate R and F1 value these three indicators to evaluate the performance of the model, the calculation method of each indicator is as follows;
[0135]
[0136] In the above formula, TP is the number of general quality characteristic entities or relationships identified accurately, FP is the number of general quality characteristic entities or relationships identified incorrectly, and FN is the number of general quality characteristic entities or relationships existing in the data set but not identified. The accuracy rate represents the proportion of actual positive samples among the samples predicted as positive by the model, and measures the prediction accuracy of the model for positive samples, which can reflect the accurate prediction ability of the model. The recall rate refers to the proportion of positive samples correctly predicted by the model, which measures the identification ability of the model for positive samples and reflects the comprehensive identification ability of the model. The F1 value is the harmonic mean of the accuracy rate and the recall rate, which considers the accuracy and comprehensiveness of the model, and is a comprehensive evaluation index used to evaluate the overall performance of the model. The training effect of the model can be comprehensively and accurately evaluated through the three indexes;
[0137] iii. Model comparison: Select LSTM model, LSTM-CRF model, BiLSTM-CRF model and Bert-BiLSTM-CRF model to compare the entity recognition task, and select the model with better effect in the field of entity recognition;
[0138] The general quality characteristic knowledge entity data set is divided into training set and test set according to the ratio of 8:2, and is input into LSTM model, LSTM-CRF model, BiLSTM-CRF and Bert-BiLSTM-CRF model for experiment. The experimental results show that the BERT-BiLSTM-CRF model after training has the highest F1 index value in the general quality characteristic knowledge field entity recognition task, and shows good recognition effect. The BERT-BiLSTM-CRF model has rich semantic representation of BERT, deep feature extraction of bidirectional LSTM and label relationship optimization of CRF, and performs better in the named entity recognition task in the field of general quality characteristic knowledge;
[0139] d) Model application: Apply the trained Bert-BiLSTM-CRF model to the general quality characteristic corpus to obtain entities, and assist with manual verification, and obtain the general quality characteristic question named entity recognition model after successful verification;
[0140] In some embodiments, the process of manual verification includes: defining the standards of various entity types, identifying the rules, determining the sampling ratio according to the data volume and quality requirements, arranging 2-3 test personnel to independently check the same batch of results, checking whether the entity boundary is correct, the entity type is correct, and the context is correct; establishing an error classification system (including misidentification, missed identification, boundary error), calculating the proportion of each type of error, statistically analyzing the accuracy rate test, recall rate test, and consistency evaluation, discussing and determining the inconsistent cases, finding out the systematic problems, feeding back the results to the model training process, and optimizing the high-frequency error types;
[0141] The steps of relationship extraction are:
[0142] a) Relationship extraction dataset annotation: based on the completion of entity annotation, the entity relationship annotation function in the open source annotation tool (such as the spirit annotation assistant) is used to perform relationship annotation on the general quality characteristic dataset;
[0143] b) Relationship extraction dataset acquisition: based on the completion of entity relationship annotation, the annotation results are converted to generate a relationship extraction dataset in accordance with the model input format, and the training set and the test set are divided according to the ratio of 8:2;
[0144] c) Model selection: using BERT-CASREL as the relationship extraction model, using BERT model as the encoder of the model, and using CASREL model as the decoder for relationship extraction, the model is trained using the annotated general quality characteristic relationship extraction data;
[0145] The steps of model training are:
[0146] i. Parameter setting: using PyTorch framework to build, setting the model training iteration times epoch, batch size batch_size and other parameters;
[0147] ii. Evaluation index: using accuracy P, recall rate R and F1 value to evaluate the performance of the model, and the calculation formulas of the indexes are as follows:
[0148]
[0149] In the formula, TP represents the number of general quality characteristic entities or relationships identified accurately, FP represents the number of general quality characteristic entities or relationships identified incorrectly, and FN represents the number of general quality characteristic entities or relationships existing in the data set but not identified. The accuracy rate represents the proportion of positive samples that are actually positive in the model prediction, measures the prediction accuracy of the model for positive samples, and can reflect the accurate prediction ability of the model. The recall rate refers to the proportion of positive samples that can be correctly predicted by the model, measures the identification ability of the model for positive samples, and reflects the comprehensive identification ability of the model. The F1 value is the harmonic mean of the accuracy rate and the recall rate, which comprehensively considers the accuracy and comprehensiveness of the model, and is a comprehensive evaluation index used to evaluate the overall performance of the model. The training effect of the model can be comprehensively and accurately evaluated through the three indexes;
[0150] iii. Model comparison: Select BERT-CNN model, BERT-RNN model and BERT-LSTM model to conduct comparative experiments on relationship identification tasks, and select a model with better relationship identification effect in this field;
[0151] The general quality characteristic knowledge entity data set is divided into a training set and a test set according to an 8:2 ratio, and is input into the BERT-CNN model, the BERT-RNN model and the BERT-LSTM model for experiments. The experimental results show that the BERT-LSTM model after training has the highest overall F1 index value in the general quality characteristic knowledge field entity identification task, and shows good relationship extraction effect;
[0152] d) Model application: Apply the trained BERT-CASREL model to the remaining corpus of general quality characteristics to obtain relationships, and assist with manual verification, and obtain a general quality characteristic relationship extraction model after successful verification;
[0153] In some embodiments, the process of manual verification includes: clearly defining the semantic boundaries and judgment criteria of each relationship type, stratified sampling according to relationship type, focusing on confidence relationship inspection, inspecting entity pairs (whether two entities are correctly identified), relationship existence (whether there is any relationship between entities), relationship type (whether the specific relationship type is correct), checking whether the relationship judgment is consistent with the context, whether the relationship direction is correct, and generating an error type distribution graph according to the relationship precision, relationship recall, type accuracy, and direction accuracy statistical analysis to identify model defects.
[0154] Further, in actual application, the general quality characteristic knowledge graph is constructed, including:
[0155] 1) Preparation of CSV files: First, create corresponding CSV files for each category of general quality characteristics entities, such as security, reliability, maintainability, testability, supportability, and environmental adaptability. Then, store all general quality characteristics triples in a CSV file. Finally, place all prepared CSV files in the import folder under the Neo4j installation path;
[0156] 2) Create nodes: Create various entity nodes according to the create node statement;
[0157] LOAD CSV WITH HEADERS FROM "file: / / / GeneralQualityCharacteristics.csv" AS row
[0158] CREATE(:GeneralQualityCharacteristics{name:row.name})
[0159] 3) Create relationships: Create various relationships according to the create relationship statement;
[0160] Create relationships according to the create relationship statement. For example, to create the "contains" relationship between general quality characteristics knowledge nodes, the "contains" relationship statement between general quality characteristics knowledge nodes is as follows:
[0161] LOAD CSV WITH HEADERS FROM "file: / / / Contain.csv" AS row
[0162] MATCH(p1:GeneralQualityCharacteristics{name:row.Entity1})
[0163] MATCH(p2:GeneralQualityCharacteristics{name:row.Entity2})
[0164] CREATE(p1)-[:Contain]->(p2)
[0165] 4) Import general quality characteristics triples data into Neo4j graph database through LOAD CSV method to realize the visual display of general quality characteristics knowledge graph.
[0166] Further, step 34 includes:
[0167] Ontology alignment: the ontology layer of the knowledge graph is a general quality characteristic domain ontology knowledge model, and the general quality characteristic domain ontology knowledge model is taken as a benchmark. The concepts in the general quality characteristic domain ontology knowledge model are traversed, and the corresponding similarity is calculated with all ontologies (i.e., entity types) of other general quality characteristic domain ontology knowledge models. If the similarity is greater than or equal to the ontology similarity threshold (i.e., the first similarity threshold), the two concepts are merged into the same concept, and the semantic link corresponding to the concept is established between the two ontology knowledge models, so as to obtain the fused knowledge graph ontology layer;
[0168] The similarity prox(M, N) of the concepts M and N of the ontology is defined as:
[0169]
[0170] wherein P MN is the parent class shared by M and N, depth(x) is the depth of x in the class structure, and dom(x) is the attribute domain of x.
[0171] When M and N are discrete numerical values, dom(M) is the number of elements in the value domain of the concept M, dom(N) is the number of elements in the value domain of the concept N, and dom(M)∩dom(N) is the number of elements in the union set of the value domains of the concept M and the concept N.
[0172] When M and N are strings, dom(M) is the number of characters in the string of the concept M, dom(N) is the number of characters in the string of the concept N, and dom(M)∩dom(N) represents the number of identical characters of the concept M and the concept N.
[0173] Entity alignment: that is, different entity expressions are directed to one objective knowledge element for instance layer fusion. Considering the characteristics of the general quality characteristic domain, the different entity designations are often explicitly embodied in engineering manuals and other documents. It is considered to establish an entity mapping dictionary library, and the entity link is established through dictionary matching. The matching methods include complete matching and fuzzy matching. The fuzzy matching can adopt a string similarity calculation method based on an edit distance. If the similarity is greater than or equal to the entity similarity threshold, the two concepts are merged into the same concept. The edit distance lev A,B (a, b) is:
[0174]
[0175] wherein a and b are the string lengths, i is the first i characters of the string A, j is the first j characters of the string B,
[0176] lev A,B(i,j) is the edit distance between the first i characters of a and the first j characters of b (i.e. the minimum number of operations (insert, delete or replace characters) to convert characters a to characters b), lev a,b (i,j-1) is the edit distance between the first i characters of a and the first j-1 characters of b, lev a,b (i-1,j) is the edit distance between the first i-1 characters of a and the first j characters of b, lev a,b (i-1,j-1) is the edit distance between the first i-1 characters of a and the first j-1 characters of b, a i is the i-th character of a, b j is the j-th character of b.
[0177] Further, step 35 comprises:
[0178] 1) Basic problem intent recognition dataset construction: a large number of question data containing many question sentences related to the field of general quality characteristics are crawled from the Internet by using crawler technology, the crawled data are manually screened, the question intent is classified according to query relationship and object, and the question intent is classified into intent relationship category and intent object category, the intent relationship category represents the key relationship between the entities that need to be queried to answer the user's question, the intent object category represents the ontology type that the user wants the answer, and different intent relationship categories correspond to different intent object categories, that is, different query paths, and a small-scale question intent recognition dataset of general quality characteristics is constructed based on this;
[0179] 2) Dataset expansion: based on the constructed small-scale general quality characteristic question intent recognition dataset and extracted general quality characteristic entities, the dataset is expanded by using entity replacement, sentence structure transformation and synonym replacement, etc. to increase the sample number of the dataset, improve the diversity and coverage of the data, and make the text classification model better adapt to the complexity of user questioning;
[0180] 3) Divide the dataset: the question sentences of each category are respectively allocated to the training set and the test set according to the ratio of 8:2, which are used for model training, testing and performance evaluation, and the order of the question sentences in the training set and the test set is randomly disturbed; the intent category of the question sentence can be divided into Definitions, Feature, Include, Reason, Requirements and Method based on the defined relationship between the general quality characteristic entities;
[0181] 4) Word vector generation: the preprocessed question sentences are input into the Word2Vec word vector model to obtain the vector representation of the question sentences;
[0182] 5) Intention recognition: the generated question vector is input into the Text-CNN model to perform intention recognition of the general quality characteristic question;
[0183] 6) Model training: training the Word2Vec model word vector, inputting the vector representation of the general quality characteristic question into the Text-CNN model, comparing the recognition effects of different models, and adjusting the model parameters to make the model performance optimal;
[0184] Specifically, the process of Word2Vec model word vector training is as follows: taking the question in the general quality characteristic question data set as the training data, after performing word segmentation on the sentence, the Skip-gram model is selected to train the word vector, which is suitable for processing rare words in professional fields although the training speed is slow. In order to fully capture the context information of the words while controlling the computational complexity, the training window size of the model is set to 6, and the word vector dimension is determined to be 100. After training, the output is a 100-dimensional vector in word units;
[0185] Model recognition effect comparison experiment: In order to verify the effectiveness of the intention recognition model in this paper in the general quality characteristic field question, under the condition of Word2Vec word vector, the Text-RNN model based on recurrent neural network text classification model, the FastText model based on word-level text classification model and the Text-CNN model are selected for comparison experiment. Considering that the general quality characteristic field question is usually relatively short text and the semantic and context information of the whole question needs to be considered, the Text-CNN model and the Text-RNN model are more suitable than the FastText model, and the F1 value of the Text-CNN model is higher in the comparison experiment and performs better. Therefore, the Text-CNN model is selected as the main model for intention recognition task;
[0186] Text-CNN model parameter experiment: under the condition that other parameters remain unchanged, by changing the values of three important hyperparameters of model convolution kernel size, learning rate and iteration number, the influence of them on the intention recognition effect of the model is observed, so as to determine the appropriate combination of learning rate, iteration number and convolution kernel size.
[0187] Further, the general quality characteristic common question and answer pair database constructed in step 36 includes:
[0188] 1) Data collection: collecting related questions and answers from different channels such as general quality characteristic professional books, general quality characteristic Q&A forums, etc.;
[0189] 2) Data preprocessing: performing preprocessing work such as denoising, normalization, etc. on the collected data, such as deleting duplicate question and answer pairs, standardizing similar questions, etc.;
[0190] 3) Data selection: the selection of high-frequency questions by the frequency of statistical problems in the general quality characteristics Q&A forum;
[0191] 4) Data classification: store the preprocessed Q&A pair data into the corresponding category sub-database, and the data category of the Q&A pair is consistent with the intent category of the general quality characteristics question;
[0192] 5) Data storage: store the common Q&A pairs of general quality characteristics into the MySQL database.
[0193] Further, step 36 utilizes the question similarity method to determine whether to extract answers from the knowledge graph for answering, including:
[0194] 1) Data preprocessing: use Chinese word segmentation tool jieba, etc. to perform word segmentation processing on the questions in the general quality characteristics common Q&A pair database, convert the questions into a set of words, and perform stop word removal operation, etc. on the questions;
[0195] 2) Constructing question representation: convert each question in the general quality characteristics common Q&A pair database into a vector representation that can express the semantic of the question. Use the Word2Vec model to obtain the word vector representation of each word after word segmentation, add all the word vectors in the question, and perform normalization operation on the result, thereby obtaining the complete question vector, which is used to represent the position of the question in the vector space;
[0196] 3) Similarity calculation: use the cosine similarity calculation formula to calculate the similarity between the input question vector and the question vector in the general quality characteristics common Q&A pair database;
[0197] 4) Similarity screening: set a similarity threshold to judge the similarity between the input question and the questions in the database. If the similarity exceeds the threshold, query the answer from the knowledge graph; otherwise, fill the entity into the prompt template of the large language model, and input it into the lightweight large language model fine-tuned by the general quality characteristics professional knowledge to obtain the answer.
[0198] Further, step 37 includes:
[0199] 1) Use the Word2Vec model to perform vector representation of the general quality characteristics question;
[0200] 2) Use the question vector representation generated during intent recognition as input, and use the general quality characteristics question named entity recognition model to recognize the named entity;
[0201] 3) Cosine similarity calculation: After the model identifies the entity, calculate the cosine similarity between the identified entity and all entities in the corresponding category dictionary, according to the experience of threshold selection when aligning entities, combined with the general quality characteristic professional dictionary to calculate the character edit distance between entities, select the entity with the highest similarity as the output entity (i.e. the theme entity), to realize the alignment with the entities in the general quality characteristic knowledge graph.
[0202] Further, if the entity matches in step 38, the recognized question intent and theme entity information are used to construct a Cypher query statement, and the answer is retrieved in the general quality characteristic knowledge graph to complete the answer to common questions, including:
[0203] 1) Identify the intent of the question through the general quality characteristic question intent recognition model, and identify the theme entity in the question through the general quality characteristic question named entity recognition model;
[0204] 2) Generate a query triple, fill in the relevant information into the Cypher query statement template, and retrieve the general quality characteristic knowledge graph;
[0205] 3) Retrieve the candidate answer path, construct the answer template according to the relationship category, fill in the cyber statement query result into the answer template of the corresponding question category, and process it into a natural language answer to return to the user.
[0206] In order to further illustrate the above-mentioned general quality characteristic intelligent question and answer method based on knowledge graph and large language model, the present application also provides a specific example, as shown in Figure 2 The specific example includes the following steps:
[0207] Step (1), collect, gather and integrate the knowledge scattered in the general quality characteristic text, and establish the ontology layer of the knowledge graph.
[0208] In this embodiment, the specific steps of collecting, gathering and integrating the knowledge scattered in the general quality characteristic text are as follows: 1000 literatures and 50 electronic textbooks related to safety, reliability, maintainability, testability, supportability and environmental adaptability are classified and arranged, redundant information in the text is removed through Python script, a data set of general quality characteristic corpus is formed, and the knowledge graph mode layer is constructed by defining the general quality characteristic entities and the relationship between the entities.
[0209] The entity categories include general quality characteristic classification, model type, product level, project stage, and general quality characteristic items (such as project content). There are many entities of general quality characteristic items, such as safety, reliability, weapon model, system, scheme, reliability work item, safety work item, and the like. The model type also has its own attributes. For example, the weapon model has design parameters, and each parameter has its own interpretation and parameter value. The project content includes reliability design, reliability modeling, safety design, safety modeling, and the like. After the attributes are determined, the attributes of the model type, product level, project stage, and project content are summarized.
[0210] Through the definition process of the entity and the attribute, the relationship categories can be summarized and extracted. The first kind is the hierarchical relationship. For example, in the general quality characteristic item, the content of the reliability item is carried out, and the reliability item includes reliability design and reliability modeling, and thus can be named as the “composition” relationship. The second kind is the inclusion relationship. For example, the model product includes weapon model, space-air model, unmanned aerial vehicle model, and spaceflight model. The product level includes system, subsystem, and single machine. The project stage includes demonstration, scheme, positive sample, and trial sample. The weapon model includes xx model, and the like. The third kind is the connection relationship, such as the weapon model scheme stage and the spaceflight model reliability item. Similarly, there are other relationships between different entity categories.
[0211] Table 1: Example of attribute list of general quality characteristic knowledge entity
[0212]
[0213] In step (2), the natural language processing model is used to perform knowledge extraction on the text information according to the ontology layer, to form structured triple data of the general quality characteristic, and to construct a knowledge graph data layer based on the triple data.
[0214] In this embodiment, the knowledge extraction includes entity recognition and relationship extraction of the general quality characteristic.
[0215] The entity recognition in this case includes the following steps. The entity dictionary of the general quality characteristic is constructed, and the annotation is checked in combination with the experience of the field experts. The Python code is used to convert the annotation results to generate the named entity recognition data set based on the BIO method. The annotated entity data is counted, and the training set and the test set are divided in the ratio of 8:2. The word embedding method based on the BERT pre-training language model is used in combination with the BiLSTM-CRF model to train the label end to end. The BERT-BiLSTM-CRF model is trained by using the annotated general quality characteristic entity data, to realize the automatic recognition of the general quality characteristic named entity.
[0216] Taking the BERT-BiLSTM-CRF model as an example, the steps of model training are as follows: the PyTorch framework is built, the parameters such as the number of model training iterations epoch, the batch size batch_size and the BiLSTM hidden layer dimension are set, and the three indexes of accuracy P, recall R and F1 value are used to evaluate the performance of the model.
[0217] Table 2 Parameter settings of Bert-BiLSTM-CRF model
[0218]
[0219] The LSTM model, the LSTM-CRF model, the BiLSTM-CRF model and the Bert-BiLSTM-CRF model are selected for comparative experiments on the entity recognition task, and the named entity recognition results of each model are shown in Table 3. Finally, the BERT-BiLSTM-CRF model is selected, and the trained Bert-BiLSTM-CRF model is applied to the general quality characteristics corpus to obtain entities, and manual verification is supplemented.
[0220] Table 3 Named entity recognition results
[0221]
[0222]
[0223] The steps of relation extraction in the present case are as follows: on the basis of completing entity annotation, the entity relationship annotation function in the open source annotation tool (Spirit Annotation Assistant) is used to annotate the general quality characteristics data set, and the annotation results are converted to generate a relation extraction data set in accordance with the input format of the model. The training set and the test set are divided in accordance with the ratio of 8:2.
[0224] The BERT-CASREL is used as a relation extraction model, the BERT model is used as the encoder of the model, and the CASREL model is used as the decoder for relation extraction. The model is trained using the annotated general quality characteristics relation extraction data, the PyTorch framework is built, the parameters such as the number of model training iterations epoch and the batch size batch_size are set, and the three indexes of accuracy P, recall R and F1 value are used to evaluate the performance of the model. Table 4 shows examples of part of the extraction results of the BERT-CASREL model. Finally, the trained BERT-CASREL model is applied to the general quality characteristics corpus to obtain relations, and manual verification is supplemented.
[0225] Table 4 Examples of part of the relation extraction results of the BERT-CASREL model
[0226] Relationship Type Accuracy (%) Recall (%) F1 Value (%) Level 98.32 92.01 93.18 Composition 96.43 93.56 95.16 Include 97.96 98.45 98.03
[0227] Step (3), constructing a general quality characteristic knowledge graph using the knowledge graph ontology layer and the knowledge graph data layer.
[0228] In this embodiment, the steps of constructing the knowledge graph are:
[0229] 1) Prepare CSV files: first, create corresponding CSV files for general quality characteristic entities according to categories, then store all general quality characteristic triples in a CSV file, and finally place all prepared CSV files in the import folder under the Neo4j installation path;
[0230] 2) Create nodes: create various entity nodes according to the create node statement;
[0231] 3) Create relationships: create various relationships according to the create relationship statement;
[0232] 4) Import general quality characteristic triple data into the Neo4j graph database through the LOADCSV method to realize the visual display of the general quality characteristic knowledge graph.
[0233] Step (4), knowledge fusion of the general quality characteristic knowledge graph, using the similarity of ontology entity names to fuse the ontology layer, and then using the similarity of entity names and attributes to fuse the knowledge graph data layer.
[0234] In this embodiment, the steps of knowledge fusion of the general quality characteristic knowledge graph are as follows: using the entity alignment method based on cosine similarity and manual selection, merging redundant entities, first, after simple deduplication of all entities extracted from different data sources, a general quality characteristic entity dictionary is initially constructed, then the Word2Vec model is used to represent the entities as vectors, then the cosine similarity is used to calculate the similarity between each pair of entities, and a similarity score value is obtained. After referring to the setting value in the reference and multiple trial matching, the similarity threshold is set to 0.8. If the similarity is higher than the threshold, it is considered that the two entities are similar, and the entities exceeding the threshold are extracted to construct a sub-dictionary, then the cycle is performed until there is no similarity between entities exceeding the threshold, then the cycle is stopped, then all sub-dictionaries are extracted, then manual selection is performed according to the standard, entities with the same semantics but different expressions are unified into a standard entity expression form, and finally the standard entity expression form is used to replace entities with the same meaning in the general quality characteristic triples, ensuring the consistency of entities in the triples
[0235] After entity alignment, the present study obtained 1892 triples and 2786 entities. The general quality characteristic knowledge graph was fused with the ontology entity name similarity, and then the data layer was fused according to the similarity of the name, attribute and attribute value of the corresponding data layer.
[0236] Step (5), a general quality characteristic question intention recognition model is constructed, which can automatically learn and extract feature representations in the question, and perform feature pattern recognition to capture the intention features in the general quality characteristic question, and efficiently and accurately complete the intention recognition task.
[0237] In the present embodiment, the steps of constructing the general quality characteristic question intention recognition model are:
[0238] 1) Basic question intention recognition dataset construction: a large amount of question data containing many general quality characteristic related questions is crawled from the Internet by using the crawler technology. The crawled data is manually screened, and the selected questions are labeled with corresponding intention labels. A small-scale question intention recognition dataset containing 786 labeled general quality characteristic questions is manually constructed, and the specific information and related examples are shown in Table 5.
[0239] Table 5 General quality characteristic question intention recognition small-scale dataset distribution
[0240] Question and Answer Intent Category Label Example Number Definitions 0 What is the definition of reliability? 162 Feature 1 What are the safety design influencing factors? 89 Include 2 What are the parts of reliability modeling? 73 Reason 3 Why is there a need for integrated logistics support? 67 Requirements 4 What are the ORU management requirements? 92 Method 5 How is single-unit reliability evaluated? 96 … … … …
[0241] 2) Dataset expansion: based on the manually constructed small-scale general quality characteristic question intention recognition dataset and the extracted general quality characteristic entities, the dataset is expanded by using entity replacement, sentence structure transformation, synonym replacement and other methods, the sample number of the dataset is increased, the diversity and coverage of the data are improved, and the text classification model can better adapt to the complexity of user questioning;
[0242] 3) Divide the dataset: the question of each category is respectively allocated to the training set and the test set according to the ratio of 8:2, which is used for model training, testing and performance evaluation, and the order of the questions in the training set and the test set is randomly disturbed;
[0243] 4) Word vector generation: the preprocessed question is input into the Word2Vec word vector model to obtain the vector representation of the question. The Word2Vec model can convert text into high-dimensional vector representation through unsupervised learning, and these vectors can capture the semantic relationship between words, so that semantically similar words are closer in the vector space.
[0244] 5) Intention recognition: the generated question vector is used as the input of the Text-CNN model to perform general quality characteristic question intention recognition;
[0245] 6) Model training:
[0246] With PyCharm as the development tool and Python 3.6 as the development language, a general quality characteristic intention recognition model is built by using the TensorFlow deep learning framework, and the model is trained and the effect is evaluated. The Adam optimizer is used to optimize the parameters, and the P, R and F1 values are used to evaluate the training effect of the general quality characteristic intention recognition model.
[0247] The Word2Vec model word vector is trained, the training window size of the model is set to 6, and the word vector dimension is determined to be 100. After training, the output is a 100-dimensional vector in word units. The vector representation of the general quality characteristic question is used as the input of the Text-CNN model. By changing the values of the three important hyperparameters of the model convolution kernel size, learning rate and iteration number, the influence of the model intention recognition effect is observed, and the appropriate learning rate, iteration number and convolution kernel size combination is determined to make the model performance reach the optimal level.
[0248] Step (6), build a general quality characteristic common question and answer pair database, and use the question similarity method to determine whether to extract the answer from it to answer.
[0249] In this embodiment, the steps of building a general quality characteristic common question and answer pair database are:
[0250] 1) Data collection: Collect relevant questions and answers from different channels such as general quality characteristic professional books, general quality characteristic question and answer forums, etc.
[0251] 2) Data preprocessing: Perform preprocessing work such as denoising, normalization, etc. on the collected data, such as deleting duplicate question and answer pairs, standardizing similar questions, etc.
[0252] 3) Data selection: Select high-frequency questions by methods such as counting the frequency of questions in general quality characteristic question and answer forums;
[0253] 4) Data classification: Store the preprocessed question and answer pair data into the corresponding category sub-database, as shown in Table 6;
[0254] Table 6 General quality characteristic common question and answer pair data set categories and examples
[0255]
[0256] 5) Data storage: Store the general quality characteristic common question and answer pair classification into the MySQL database, and the specific storage method is as follows:
[0257] a) Connect to the MySQL database management system and create a general quality characteristic common FAQ pair database using the CREATE DATABASE statement, the SQL statement is as follows:
[0258] CREATE DATABASE GQC_FAQ_pairs;
[0259] b) Use the CREATE TABLE statement to create a table containing a question column and an answer column for each type of question and answer pair to store question and answer pair data, for example, create a Definition type question and answer pair table, the SQL statement for creating the Definition type question and answer pair table is as follows:
[0260] USE GQC_FAQ_pairs;
[0261] CREATE TABLE Definition(
[0262] question VARCHAR(387),
[0263] answer VARCHAR(1000) );
[0265] c) After creating a table for each type of question and answer pair, use the INSERT INTO statement to batch insert question and answer pairs into the question column and the answer column of the corresponding table, for example, insert data into the Definition type question and answer pair table, the SQL statement for batch inserting data into the Definition type question and answer pair table is as follows:
[0266] USE GQC_FAQ_pairs;
[0267] INSERTINTO Definition(question,answer)VALUES
[0268] In this embodiment, the step of determining whether to extract an answer from a knowledge graph for answering by using a question similarity method is:
[0269] 1) Data preprocessing: use the Chinese word segmentation tool jieba to perform word segmentation processing on the questions in the general quality characteristic common FAQ pair database, convert the questions into a set of words, and perform stop word removal operation on the questions, etc.
[0270] 2) Constructing question representation: converting each question in the common question and answer pair database of general quality characteristics into a vector representation that can express the semantic of the question. Using the Word2Vec model to obtain the word vector representation of each word after segmentation, adding all the word vectors in the question, and normalizing the result to obtain the complete question vector, which is used to represent the position of the question in the vector space;
[0271] 3) Similarity calculation: using the cosine similarity calculation formula to calculate the similarity between the question vector input by the user and the question vector in the common question and answer pair database of general quality characteristics;
[0272] 4) Similarity screening: set a similarity threshold to judge the similarity between the input question and the questions in the database. If the similarity exceeds the threshold, query the answer from the knowledge graph; otherwise, input the question into the large language model fine-tuned by the professional to obtain the answer.
[0273] Step (7), constructing a general quality characteristic question named entity recognition model to extract the theme entity in the question.
[0274] In this embodiment, the general quality characteristic question named entity recognition model is constructed to extract the theme entity in the question, which includes:
[0275] 1) Using the Word2Vec model to perform vector representation of the general quality characteristic question;
[0276] 2) Taking the question vector representation generated during intent recognition training as input, and using the BiLSTM+CRF-based model to recognize the named entity;
[0277] 3) Cosine similarity calculation: after the model recognizes the entity, calculate the cosine similarity between the recognized entity and all entities in the corresponding category dictionary, and according to the experience of threshold selection during entity alignment, set the standard threshold to 0.8, and select the entity with the highest similarity as the output entity to realize the alignment with the entity in the general quality characteristic knowledge graph.
[0278] Step (8), if the entity matches (i.e. the answer can be extracted from the general quality characteristic knowledge graph to answer), use the recognized question intent and theme entity information to construct a Cypher query statement to retrieve the answer in the general quality characteristic knowledge graph, and complete the answer to the common question.
[0279] In this embodiment, if the entity matches, the recognized question intent and theme entity information are used to construct a Cypher query statement to retrieve the answer in the general quality characteristic knowledge graph, and the step of completing the answer to the common question is:
[0280] 1) Identify the intent of the problem through the general quality characteristic intent recognition method, and identify the subject entity in the question through the general quality characteristic question named entity recognition method;
[0281] 2) Generate query triples, fill in the Cypher query statement template, and retrieve the general quality characteristic knowledge graph;
[0282] 3) Splice the retrieved data into the answer template of the corresponding problem category, and process it into a natural language answer to return to the user.
[0283] Step (9), fill the recognized entity into the prompt word template in the large language model, and input it into the lightweight large language model fine-tuned with professional knowledge to obtain the answer.
[0284] In this embodiment, the input question is returned to the corresponding entity set and the corresponding intent classification after the model is trained. For entities, first align with the dictionary in the knowledge base. Then, for each type of query intent, a corresponding Cypher query template and a large model prompt template are developed for entity filling. Considering the excellent performance of ChatGLM3-6B model in the competition of parameter scale not exceeding 10B basic model, combined with its flexibility and open source attributes, it is decided to use it as the basis for fine-tuning the language model. At the same time, since the advantage of LoRA fine-tuning technology is to learn a smaller scale of parameter matrix to approach the update of the original model weight, reducing the demand for video memory in the fine-tuning process, therefore, LoRA method is selected for fine-tuning.
[0285] Step (10), the system then compares and analyzes the answers from knowledge graph query and large model reasoning; if there is a corresponding answer in the general quality characteristic knowledge graph, the system will display the answers of both; if there is no corresponding answer in the general quality characteristic knowledge graph, i.e. the entity does not match, the knowledge graph fails to retrieve related knowledge, then only the answer generated by the lightweight large language model is provided for the user to refer to.
[0286] In this embodiment, there are two routes for returning answers, knowledge base question and answer return answer and large model question and answer return answer. When the knowledge base fails to retrieve related knowledge, the page only returns the result of the large model response. When the knowledge base retrieves the answer to the corresponding problem, the common several return forms are processed to make the returned content better meet the corresponding requirements. For query entity class, the attributes of the entity itself and the associated attribute names are directly returned; for statistical class query, the number of entities that meet the conditions is designed to be returned; for distributed problems, the system is designed to display the distribution of related content in the form of a graph / table, and the involved entities are introduced respectively.
[0287] The application provides a general quality characteristic intelligent question and answer method based on a knowledge graph and a large language model, constructs a general quality characteristic knowledge base platform with a double-track efficient question and answer mechanism based on a knowledge graph technology and a large language model, meets the information retrieval needs of users in the general quality characteristic field, improves the information acquisition efficiency of practitioners, and provides a new idea and approach for information integration and intelligent application in the general quality characteristic field.
[0288] Embodiment two
[0289] The application also provides a general quality characteristic intelligent question and answer device based on a knowledge graph and a large language model, as shown in the accompanying drawings, comprising: Figure 3
[0290] An inquiry obtaining unit is configured to obtain a user inquiry;
[0291] A judgment unit is configured to judge whether an answer corresponding to the user inquiry can be obtained from a pre-constructed general quality characteristic knowledge graph based on a pre-constructed general quality characteristic common question and answer pair database;
[0292] An answer obtaining unit is configured to obtain an answer corresponding to the user inquiry from a pre-established lightweight large language model if the answer corresponding to the user inquiry cannot be obtained from the pre-constructed general quality characteristic knowledge graph, or to obtain an answer corresponding to the user inquiry from the pre-constructed general quality characteristic knowledge graph and from the pre-established lightweight large language model if the answer corresponding to the user inquiry can be obtained from the pre-constructed general quality characteristic knowledge graph.
[0293] Further, the device further comprises a first construction unit configured to construct the general quality characteristic common question and answer pair database, and the first construction unit comprises:
[0294] A collection subunit is configured to collect questions and answers related to general quality characteristics;
[0295] A first processing subunit is configured to pre-process and standardize the questions and answers to obtain processed questions and answers;
[0296] A selection subunit is configured to select questions with a frequency greater than or equal to a first frequency threshold in the processed questions as high-frequency questions;
[0297] A determination subunit is configured to determine the categories of the high-frequency questions and store the high-frequency questions and corresponding processed answers in a sub-database corresponding to the categories;
[0298] The sub-databases of the categories constitute the general quality characteristic common question and answer pair database.
[0299] Further, the judgment unit comprises:
[0300] The second processing subunit is configured to perform word segmentation processing on the questions in the general quality characteristic common question and answer pair database by using a Chinese word segmentation tool, and perform stop word removal on the questions after the word segmentation processing to obtain processed questions;
[0301] The first conversion subunit is configured to convert each word in the processed question into a vector representation by using a Word2Vec word vector model to obtain word vectors of each word in the processed question;
[0302] The first acquisition subunit is configured to add the word vectors of all words in the processed question, and perform normalization on the added word vectors to obtain a complete question vector corresponding to the processed question;
[0303] The second conversion subunit is configured to convert the user question into a vector representation by using a Word2Vec word vector model;
[0304] The calculation subunit is configured to calculate the similarity between the vector representation of the user question and each question vector in the general quality characteristic common question and answer pair database by using a cosine similarity calculation method;
[0305] The second acquisition subunit is configured to obtain the answer corresponding to the user question from the pre-constructed general quality characteristic knowledge graph if the similarity between the vector representation of the user question and each question vector in the general quality characteristic common question and answer pair database is greater than or equal to a fourth similarity threshold.
[0306] Further, the second construction unit is configured to construct a lightweight large language model, and the second construction unit includes:
[0307] The third acquisition subunit is configured to fill the entities in the pre-constructed general quality characteristic knowledge graph into the large language model prompt template to obtain the lightweight large language model fine-tuned by the general quality characteristic professional knowledge.
[0308] Further, the answer acquisition unit includes:
[0309] The first recognition subunit is configured to recognize the question intention of the user question by using a pre-constructed general quality characteristic question intention recognition model;
[0310] The second recognition subunit is configured to recognize the subject entity of the user question by using a pre-constructed general quality characteristic question named entity recognition model;
[0311] The fourth acquisition subunit is configured to generate a query triple by using the question intention of the user question and the subject entity of the user question, and fill the query triple into a query statement template to obtain a user query statement.
[0312] The fifth obtaining subunit is configured to obtain an answer corresponding to the user query sentence from the pre-constructed general quality characteristic knowledge graph according to the user query sentence.
[0313] Further, the first identification subunit comprises:
[0314] The first conversion module is configured to convert the user query sentence into a vector representation by using a Word2Vec word vector model.
[0315] The first obtaining module is configured to input the user query sentence converted into the vector representation into a general quality characteristic question intention recognition model to obtain an intention category of the user query sentence, the intention category of the user query sentence being a query intention of the user query sentence.
[0316] Further, the second identification subunit comprises:
[0317] The second conversion module is configured to convert the user query sentence into a vector representation by using a Word2Vec word vector model.
[0318] The second obtaining module is configured to input the user query sentence converted into the vector representation into a general quality characteristic query named entity recognition model to obtain an entity of the user query sentence.
[0319] The first calculation module is configured to calculate, by using a cosine similarity calculation method, a cosine similarity between each entity in a pre-constructed general quality characteristic entity dictionary and the entity of the user query sentence, the each entity having the same intention category as the user query sentence.
[0320] The selection module is configured to select, as a theme entity of the user query sentence, an entity in the pre-constructed general quality characteristic entity dictionary corresponding to the maximum cosine similarity.
[0321] Further, the method further comprises a third construction unit configured to construct a general quality characteristic question intention recognition model, the third construction unit comprising:
[0322] The crawling subunit is configured to crawl topic data related to the general quality characteristic field by using a crawler technology, the topic data comprising a plurality of query sentences.
[0323] The first construction subunit is configured to filter and classify the topic data to obtain an intention category of each query sentence in the topic data, and construct a small-scale general quality characteristic query intention recognition data set by using each query sentence in the topic data and the corresponding intention category.
[0324] The expansion subunit is configured to expand the small-scale general quality characteristic query intention recognition data set by using entities in the pre-constructed general quality characteristic knowledge graph and by using an entity replacement method, a sentence structure transformation method and a synonym replacement method to obtain an expanded data set.
[0325] The dividing sub-unit is configured to divide the expanded data set into an initial training set and an initial test set, and randomly shuffle the questions in the initial training set and the initial test set, respectively, to obtain a third training set and a third test set.
[0326] The converting sub-unit is configured to convert the questions in the third training set and the third test set into vector representations by using a Word2Vec word vector model.
[0327] The training sub-unit is configured to train a Text-CNN model by using the vector representations of the questions in the third training set and the corresponding intent categories, to obtain a trained Text-CNN model.
[0328] The verifying sub-unit is configured to verify the trained Text-CNN model by using the vector representations of the questions in the third test set and the corresponding intent categories, and if a verification result meets a third preset condition, the trained Text-CNN model is a general quality characteristic intent recognition model; otherwise, the hyperparameters of the Text-CNN model are adjusted, and the Text-CNN model with the adjusted hyperparameters is retrained until the verification result meets the third preset condition.
[0329] Further, the intent categories include: general quality characteristic concept definition class Definitions, general quality characteristic design element Feature, general quality characteristic work range Include, general quality characteristic work basis Reason, general quality characteristic work requirements Requirements, and general quality characteristic work method Method.
[0330] Further, the method further includes: a fourth constructing unit configured to construct a general quality characteristic knowledge graph; the fourth constructing unit includes:
[0331] The generating sub-unit is configured to generate a general quality characteristic corpus data set according to the text information of the collected general quality characteristic related literature, and construct a knowledge graph ontology layer by using the general quality characteristic corpus data set.
[0332] The extracting sub-unit is configured to perform entity extraction and relationship extraction on the general quality characteristic corpus data set based on the knowledge graph ontology layer, to obtain structured triple data of general quality characteristics, and construct a knowledge graph data layer by using the structured triple data of general quality characteristics.
[0333] The second constructing sub-unit is configured to construct an initial knowledge graph by using the knowledge graph ontology layer and the knowledge graph data layer.
[0334] The fusing sub-unit is configured to perform knowledge fusion on the initial knowledge graph, to obtain a general quality characteristic knowledge graph.
[0335] Further, the generating subunit comprises:
[0336] The first generating module is configured to perform a preprocessing operation on the text information, eliminate redundant information in the text information, and generate the general quality characteristic corpus dataset.
[0337] Further, the generating subunit further comprises:
[0338] The second generating module is configured to define entity types, relationship types and attributes in the general quality characteristic corpus dataset based on a plurality of preset angles, and generate a knowledge graph ontology schema layer.
[0339] Further, the preset angles comprise at least the following six angles: scene, reuse, thing, contact, constraint and evaluation.
[0340] Further, the extracting subunit comprises:
[0341] The extracting module is configured to perform entity extraction on the general quality characteristic corpus dataset based on the knowledge graph ontology layer by using a pre-constructed general quality characteristic question named entity recognition model, and perform relationship extraction on the general quality characteristic corpus dataset by using a pre-constructed general quality characteristic relationship extraction model, to obtain entities in the general quality characteristic corpus dataset and relationships between the entities.
[0342] The first determining module is configured to determine that the entities in the general quality characteristic corpus dataset and the relationships between the entities are structured general quality characteristic triple data.
[0343] Further, the method further comprises: a fifth constructing unit configured to construct a general quality characteristic question named entity recognition model; and the fifth constructing unit comprises:
[0344] The first labeling module is configured to perform entity labeling on the general quality characteristic text sentence corpus dataset based on a pre-constructed general quality characteristic entity dictionary by using a BIO labeling method.
[0345] The first dividing module is configured to divide the general quality characteristic text sentence corpus dataset after the entity labeling into a first training set and a first test set.
[0346] The first training module is configured to train the BERT-BiLSTM-CRF model by using the first training set, to obtain a trained BERT-BiLSTM-CRF model.
[0347] The first verifying module is configured to verify the trained BERT-BiLSTM-CRF model by using the first test set, and calculate a first accuracy, a first recall rate and a first harmonic mean.
[0348] The second determining module is configured to: if the first accuracy rate, the first recall rate and the first harmonic mean satisfy a first preset condition, the trained BERT-BiLSTM-CRF model is a general quality characteristic question sentence named entity recognition model; otherwise, the BERT-BiLSTM-CRF model is trained in a targeted manner according to the entity whose error frequency is greater than or equal to a second frequency threshold until the first accuracy rate, the first recall rate and the first harmonic mean satisfy the first preset condition.
[0349] Further, the sixth constructing unit is further configured to construct a general quality characteristic relation extraction model, and the sixth constructing unit comprises:
[0350] The second labeling module is configured to use a labeling tool to label relations of each entity in the general quality characteristic text sentence corpus data set after the entity labeling, to obtain a general quality characteristic text sentence corpus data set after the relation labeling;
[0351] The third generating module is configured to perform format conversion on the general quality characteristic text sentence corpus data set after the relation labeling, to generate a relation extraction data set in an input format of the BERT-CASREL model;
[0352] The second dividing module is configured to divide the relation extraction data set into a second training set and a second test set;
[0353] The second training module is configured to use the BERT model as an encoder of the BERT-CASREL model, use the CASREL model as a decoder of the BERT-CASREL model, and train the BERT-CASREL model by using the second training set, to obtain a trained BERT-CASREL model;
[0354] The second verifying module is configured to verify the trained BERT-CASREL model by using the second test set, and calculate a second accuracy rate, a second recall rate and a second harmonic mean;
[0355] The third determining module is configured to: if the second accuracy rate, the second recall rate and the second harmonic mean satisfy a second preset condition, the trained BERT-CASREL model is a general quality characteristic relation extraction model; otherwise, adjust hyperparameters of the BERT-CASREL model, and retrain the BERT-CASREL model after the hyperparameters are adjusted until the second accuracy rate, the second recall rate and the second harmonic mean satisfy the second preset condition.
[0356] Further, the fusion subunit comprises:
[0357] The second calculation module is configured to calculate the entity name similarity of each entity type in the knowledge graph ontology layer, and fuse two entity types when the entity name similarity between the two entity types is greater than or equal to a first similarity threshold, to obtain a fused knowledge graph ontology layer.
[0358] The third calculation module is configured to calculate the entity name similarity and attribute similarity between each entity in the knowledge graph data layer, and fuse two entities when the entity name similarity between the two entities is greater than or equal to a second similarity threshold or the attribute similarity between the two entities is greater than or equal to a third similarity threshold, to obtain a fused knowledge graph data layer.
[0359] The third acquisition module is configured to construct a general quality characteristic knowledge graph from the fused knowledge graph ontology layer and the fused knowledge graph data layer.
[0360] It can be understood that the device embodiments provided above correspond to the method embodiments described above, and the specific contents can be mutually referred to, which will not be described here in detail.
[0361] It can be understood that the same or similar parts in the above embodiments can be mutually referred to, and the contents not described in detail in some embodiments can be referred to the same or similar contents in other embodiments.
[0362] Embodiment Three
[0363] As shown in Figure 4 The electronic device in this embodiment can include a processor, a memory, a transceiver component, etc. The memory, the processor and the transceiver component are connected through a bus; the memory can be used to store an execution program, and the exemplary execution program can include instructions; the processor is used to execute the instructions stored in the memory. The memory can also be used to store data, which can be called and / or modified when the instructions are executed.
[0364] The processor can be a central processing unit (CPU), and can also be other general-purpose processors, a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, and the like, which are a computing core and a control core of the terminal, and are suitable for implementing one or more instructions, and are suitable for loading and executing one or more instructions in the storage medium to implement a corresponding method flow or a corresponding function, so as to implement the steps of the general quality characteristic intelligent question and answer method based on the knowledge graph and the large language model in the above embodiment.
[0365] Embodiment four
[0366] Based on the same inventive concept, the application also provides a readable storage medium, specifically an electronic device readable storage medium (Memory). The electronic device readable storage medium is a memory device in the electronic device, and is used to store programs and data. It can be understood that the storage medium herein can include a built-in storage medium in the electronic device, and of course can also include an expansion storage medium supported by the electronic device. The storage medium provides a storage space, and the storage space stores an operating system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor are also stored in the storage space, and the instructions can be one or more execution programs (including program codes). It should be noted that the storage medium herein can be a high-speed RAM memory, or a non-volatile memory such as at least one disk memory. The processor loads and executes one or more instructions stored in the storage medium, and the steps of the general quality characteristic intelligent question and answer method based on the knowledge graph and the large language model in the above embodiment can be implemented.
[0367] Those skilled in the art should understand that the embodiments of the application can be provided as a method, a system, or a computer program product. Therefore, the application can adopt a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Moreover, the application can adopt the form of a computer program product implemented on one or more computer usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer usable program codes.
[0368] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks
[0369] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks
[0370] The computer program instructions can also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer-implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart block or blocks. Figure 1 one or more flow or blocks Figure 1 one or more flow or blocks
[0371] Finally, it should be noted that the above-mentioned embodiments are merely used to illustrate the technical solutions of the present application, rather than limit the technical solutions of the present application. Although the present application is described in detail with reference to the above embodiments, those skilled in the art should understand that the specific embodiments of the present application can be modified or replaced, and any modification or replacement without departing from the spirit and scope of the present application should be covered in the protection scope of the claims of the present application.
Claims
1. A general quality characteristic intelligent question and answer method based on a knowledge graph and a large language model, characterized by, The method comprises the following steps: acquiring a user question; determining whether an answer corresponding to the user question can be obtained from a pre-constructed general quality characteristic knowledge graph based on a pre-constructed general quality characteristic common question and answer pair database; if the answer corresponding to the user question can be obtained from the pre-constructed general quality characteristic knowledge graph, obtaining the answer corresponding to the user question from the pre-constructed general quality characteristic knowledge graph and from a pre-established lightweight large language model; otherwise, obtaining the answer corresponding to the user question from the pre-established lightweight large language model.
2. The method of claim 1, wherein, The construction process of the general quality characteristic common question and answer pair database comprises the following steps: collecting questions and answers related to general quality characteristics; performing preprocessing and standardization processing on the questions and answers to obtain processed questions and processed answers; selecting questions equal to or greater than a first frequency threshold in the processed questions as high-frequency questions; determining the categories of the high-frequency questions, and storing the high-frequency questions and corresponding processed answers in a sub-database of the corresponding category; the sub-databases of the categories constitute the general quality characteristic common question and answer pair database.
3. The method of claim 1, wherein, The determination of whether the answer corresponding to the user question can be obtained from the pre-constructed general quality characteristic knowledge graph based on the pre-constructed general quality characteristic common question and answer pair database comprises the following steps: performing word segmentation processing on the questions in the general quality characteristic common question and answer pair database by using a Chinese word segmentation tool, and performing stop word removal processing on the questions after the word segmentation processing to obtain processed questions; using a Word2Vec word vector model to convert each word in the processed questions into a vector representation to obtain word vectors of each word in the processed questions; adding the word vectors of all words in the processed questions, and performing normalization processing on the added word vectors to obtain a complete question vector corresponding to the processed questions; using the Word2Vec word vector model to convert the user question into a vector representation; using a cosine similarity calculation method to calculate the similarity between the vector representation of the user question and each question vector in the general quality characteristic common question and answer pair database; if the similarity between the vector representation of the user question and each question vector in the general quality characteristic common question and answer pair database is greater than or equal to a fourth similarity threshold, the answer corresponding to the user question can be obtained from the pre-constructed general quality characteristic knowledge graph.
4. The method of claim 1, wherein, The establishment process of the lightweight large language model comprises the following steps: filling entities in the pre-constructed general quality characteristic knowledge graph into a large language model prompt template to obtain the lightweight large language model fine-tuned by general quality characteristic professional knowledge.
5. The method of claim 1, wherein, The method for obtaining the answer corresponding to the user question from the pre-constructed general quality characteristic knowledge graph comprises the following steps: using a pre-constructed general quality characteristic question intent recognition model to identify the question intent of the user question; using a pre-constructed general quality characteristic question named entity recognition model to identify the subject entity of the user question; A query triple is generated by using the question intention of the user question and the subject entity of the user question, and the query triple is filled into a query sentence template to obtain a user query sentence; According to the user query sentence, an answer corresponding to the user question is obtained from a pre-constructed general quality characteristic knowledge graph.
6. The method of claim 5, wherein, The question intention of the user question is identified by using a pre-constructed general quality characteristic question intention recognition model, and the question intention of the user question is obtained. The user question is converted into a vector representation by using a Word2Vec word vector model; The user question converted into the vector representation is input into the general quality characteristic question intention recognition model to obtain an intention category of the user question, and the intention category of the user question is the question intention of the user question.
7. The method of claim 5, wherein, The subject entity of the user question is identified by using a pre-constructed general quality characteristic question named entity recognition model, and the subject entity of the user question is obtained. Cosine similarity between each entity in a pre-constructed general quality characteristic entity dictionary and the entity of the user question is calculated by using a cosine similarity calculation method. The entity in the pre-constructed general quality characteristic entity dictionary corresponding to the maximum cosine similarity is selected as the subject entity of the user question. The construction process of the general quality characteristic question intention recognition model includes: Question data related to the general quality characteristic field is crawled by using a crawler technology, and the question data includes a plurality of questions; 8. The method of claim 5, wherein, The question data is screened and classified to obtain an intention category of each question in the question data, and a small-scale general quality characteristic question intention recognition data set is constructed by using each question in the question data and the corresponding intention category; The small-scale general quality characteristic question intention recognition data set is expanded by using entities in the pre-constructed general quality characteristic knowledge graph and by using entity replacement, sentence structure transformation and synonym replacement methods to obtain an expanded data set; The expanded data set is divided into an initial training set and an initial test set, and the questions in the initial training set and the initial test set are randomly shuffled in sequence to obtain a third training set and a third test set; The questions in the third training set and the third test set are converted into vector representations by using a Word2Vec word vector model; The Text-CNN model is trained by using the vector representations of the questions in the third training set and the corresponding intention categories to obtain a trained Text-CNN model; and The answer corresponding to the user question is obtained from the pre-constructed general quality characteristic knowledge graph according to the user query sentence. The trained Text-CNN model is verified by using the vector representation of the question in the third test set and the corresponding intent category, and if the verification result meets the third preset condition, the trained Text-CNN model is the general quality characteristic problem intent recognition model; otherwise, the hyperparameters of the Text-CNN model are adjusted, and the Text-CNN model after adjusting the hyperparameters is retrained until the verification result meets the third preset condition.
9. The method of claim 8, wherein, The intent category includes: general quality characteristic concept definition class Definitions, general quality characteristic design element Feature, general quality characteristic work range Include, general quality characteristic work basis Reason, general quality characteristic work requirement Requirements, and general quality characteristic work method Method.
10. The method according to claim 5 or 8, characterized in that, The construction process of the general quality characteristic knowledge graph includes: According to the text information of the collected general quality characteristic related literature, a general quality characteristic corpus data set is generated, and the general quality characteristic corpus data set is used to construct a knowledge graph ontology layer; Based on the knowledge graph ontology layer, entity extraction and relation extraction are performed on the general quality characteristic corpus data set to obtain structured general quality characteristic triple data, and the structured general quality characteristic triple data is used to construct a knowledge graph data layer; An initial knowledge graph is constructed using the knowledge graph ontology layer and the knowledge graph data layer; The initial knowledge graph is fused to obtain a general quality characteristic knowledge graph.
11. The method of claim 10, wherein, The text information is preprocessed and redundant information in the text information is removed to generate the general quality characteristic corpus data set. The knowledge graph ontology layer is constructed using the general quality characteristic corpus data set, including:
12. The method of claim 10, wherein, Based on multiple preset angles, the entity types, relationship types and attributes in the general quality characteristic corpus data set are defined using a large model to generate a knowledge graph ontology mode layer. The preset angles include at least the following six angles: scene, reuse, thing, contact, constraint and evaluation.
13. The method of claim 12, wherein, Based on the knowledge graph ontology layer, the general quality characteristic corpus data set is subjected to entity extraction and relation extraction to obtain structured general quality characteristic triple data, including:
14. The method of claim 10, wherein, Based on the knowledge graph ontology layer, the general quality characteristic corpus data set is subjected to entity extraction and relation extraction to obtain structured general quality characteristic triple data, including: The entity and the relationship between entities in the general quality characteristic corpus data set are the structured general quality characteristic triple data. The construction process of the general quality characteristic question named entity recognition model includes:
15. The method according to claim 5 or 14, characterized in that, Based on a pre-constructed general quality characteristic entity dictionary, a BIO labeling method is used to perform entity labeling on a general quality characteristic text sentence corpus dataset; The general quality characteristic text sentence corpus dataset after entity labeling is divided into a first training set and a first test set; The first training set is used to train a BERT-BiLSTM-CRF model, and a trained BERT-BiLSTM-CRF model is obtained; The first test set is used to verify the trained BERT-BiLSTM-CRF model, and a first accuracy, a first recall rate, and a first harmonic mean are calculated; If the first accuracy, the first recall rate, and the first harmonic mean meet a first preset condition, the trained BERT-BiLSTM-CRF model is a general quality characteristic question named entity recognition model; otherwise, according to entities with an error frequency greater than or equal to a second frequency threshold, the BERT-BiLSTM-CRF model is trained and optimized, until the first accuracy, the first recall rate, and the first harmonic mean meet the first preset condition.
16. The method of claim 14, wherein, The construction process of the general quality characteristic relation extraction model includes: Using a labeling tool, each entity in the general quality characteristic text sentence corpus dataset after entity labeling is relation labeled to obtain a general quality characteristic text sentence corpus dataset after relation labeling; The general quality characteristic text sentence corpus dataset after relation labeling is format converted to generate a relation extraction dataset in an input format of a BERT-CASREL model; The relation extraction dataset is divided into a second training set and a second test set; A BERT model is used as an encoder of the BERT-CASREL model, a CASREL model is used as a decoder of the BERT-CASREL model, and the second training set is used to train the BERT-CASREL model to obtain a trained BERT-CASREL model; The second test set is used to verify the trained BERT-CASREL model, and a second accuracy, a second recall rate, and a second harmonic mean are calculated; If the second accuracy, the second recall rate, and the second harmonic mean meet a second preset condition, the trained BERT-CASREL model is a general quality characteristic relation extraction model; otherwise, the hyperparameters of the BERT-CASREL model are adjusted, and the BERT-CASREL model after adjusting the hyperparameters is retrained until the second accuracy, the second recall rate, and the second harmonic mean meet the second preset condition.
17. The method of claim 10, wherein, The knowledge fusion on the initial knowledge graph to obtain a general quality characteristic knowledge graph includes: The similarity of entity names of each entity type in the knowledge graph ontology layer is calculated, and when the similarity of entity names between two entity types is greater than or equal to a first similarity threshold, the two entity types are fused to obtain a fused knowledge graph ontology layer; The entity name similarity and the attribute similarity between each entity in the knowledge graph data layer are calculated, and when there is entity name similarity between two entities greater than or equal to a second similarity threshold or attribute similarity between the two entities greater than or equal to a third similarity threshold, the two entities are fused to obtain a fused knowledge graph data layer; The fused knowledge graph ontology layer and the fused knowledge graph data layer constitute the general quality characteristic knowledge graph.
18. A general quality characteristic intelligent question and answer device based on a knowledge graph and a large language model, characterized by, Comprise: a question obtaining unit configured to obtain a user question; a judgment unit configured to judge whether an answer corresponding to the user question can be obtained from a pre-constructed general quality characteristic knowledge graph based on a pre-constructed general quality characteristic common question and answer pair database; an answer obtaining unit configured to, if the answer corresponding to the user question can be obtained from the pre-constructed general quality characteristic knowledge graph, obtain the answer corresponding to the user question from the pre-constructed general quality characteristic knowledge graph and from a pre-established lightweight large language model, and otherwise, obtain the answer corresponding to the user question from the pre-established lightweight large language model.
19. An electronic device, comprising: Comprise: at least one processor and a memory; the memory and the processor are connected through a bus; the memory is configured to store one or more programs; when the one or more programs are executed by the at least one processor, the general quality characteristic intelligent question and answer method based on a knowledge graph and a large language model is realized as claimed in any one of claims 1 to 17.
20. A readable storage medium, characterized by, An execution program is stored thereon, and when the execution program is executed, the general quality characteristic intelligent question and answer method based on a knowledge graph and a large language model is realized as claimed in any one of claims 1 to 17.