Intelligent question and answer method and system based on chemical safety knowledge graph

By building a knowledge graph in the field of chemical safety and developing an intelligent question-and-answer system, the problem of chemical safety knowledge data silos has been solved, and the effect of users quickly obtaining professional knowledge is achieved.

CN119862281APending Publication Date: 2025-04-22CHINA PETROLEUM & CHEMICAL CORP +1
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202311372025.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-10-20
Publication Date
2025-04-22

AI Technical Summary

Technical Problem

It is difficult for users in the field of chemical safety to obtain efficient and accurate feedback on problem, mainly because there are data silos, platforms heterogeneous and data dispersed in the existing technology.

Method used

Using intelligent question-answer methods and systems based on chemical safety knowledge graphs, we collect user's question information, perform text information processing and question analysis, generate query language, and query target objects in the pre-constructed chemical safety knowledge graph, and finally generate and push answer information to the user.

Benefits of technology

It realizes rapid Q&A in the field of chemical safety technology, solves the problem of difficulty in obtaining professional knowledge suggestions by users, and improves the efficiency and accuracy of knowledge query.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119862281A_ABST
    Figure CN119862281A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides an intelligent question answering method and system based on a chemical safety knowledge graph, and belongs to the technical field of chemical safety. The method comprises the following steps: collecting question information of a user, and processing the question information into text information; performing question parsing on the text information to obtain a query language; based on the query language, performing target object query in a pre-constructed chemical safety knowledge graph; and based on the queried target object, generating and pushing answer information to the user side. According to the scheme, quick questioning and answering of professional knowledge in the technical field of chemical safety are achieved, and the problem that it is difficult for users to obtain professional knowledge suggestions in the technical field of chemical safety at present is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of chemical safety technology, and in particular to an intelligent question-answering method based on a chemical safety knowledge graph and an intelligent question-answering system based on a chemical safety knowledge graph. Background Art

[0002] In the field of chemical safety, with the continuous advancement of information construction, a large amount of industry data has been accumulated in the field of chemical safety. However, since these data are scattered in various servers, IT systems, and even personal computers, the platform heterogeneity and data dispersion are very obvious, forming data islands. Therefore, when users want to learn or consult chemical safety related knowledge, it is often difficult to obtain efficient and accurate problem feedback based on the existing chemical safety knowledge management solutions.

[0003] Intelligent question-answering systems are also called automatic question-answering robots, chatbots, automatic question-answering systems, expert question-answering systems, human-computer dialogue systems, etc. in related research. Early domestic question-answering systems used text as data and were constructed through question analysis, document set preprocessing, candidate document selection, candidate document analysis, answer extraction, and answer generation. In recent years, question-answering systems use knowledge bases as knowledge sources. The new structure cancels the document-related system and replaces it with a knowledge base-related structure - professional knowledge graph for representation and query. In recent years, domestic research on intelligent question-answering based on professional knowledge graphs has mostly focused on professional service fields: such as hotels, shopping malls, etc. However, there is no corresponding intelligent question-answering solution for the field of chemical safety. To address this problem, it is necessary to propose an intelligent question-answering solution suitable for the field of chemical safety. Summary of the invention

[0004] The purpose of the embodiments of the present invention is to provide an intelligent question-answering method and system based on a chemical safety knowledge graph, so as to at least solve the problem that it is difficult for users in the current field of chemical safety technology to obtain professional knowledge advice.

[0005] In order to achieve the above-mentioned objectives, the first aspect of the present invention provides an intelligent question-answering method based on a chemical safety knowledge graph, the method comprising: collecting user question information and processing the question information into text information; parsing the text information to obtain a query language; based on the query language, querying a target object in a pre-built chemical safety knowledge graph; based on the queried target object, generating and pushing answer information to the user end.

[0006] Optionally, the user's question information is: text question information, voice question information or image question information.

[0007] Optionally, processing the question information into text information includes: if the question information is text question information, using the text question information as processed text information; if the question information is voice question information, recognizing the voice question information based on a voice recognition model, and generating text information based on the recognition result as processed text information; if the question information is image question information, judging whether there is a text image in the question image, selecting a corresponding image recognition model to perform question image recognition based on the judgment result, and generating text information based on the recognition result as processed text information.

[0008] Optionally, the selecting a corresponding image recognition model based on the judgment result to perform problem image recognition includes: if there is only a text image in the problem image, performing problem image recognition based on an OCR algorithm; if there is only a non-text image in the problem image, performing problem image recognition based on a pre-built image feature extraction model; if the problem image contains both a text image and a non-text image, performing problem image recognition based on an OCR algorithm and a pre-built image feature extraction model, respectively.

[0009] Optionally, the question parsing of the text information to obtain the query language includes: judging whether the text information has a matching preset question classification item based on a preset classification template; if a matching preset question classification item exists, generating the query language based on the corresponding preset question classification item; if no matching preset question classification item exists, generating the query language based on the preset question template sentence pattern.

[0010] Optionally, the preset classification template is: a combination of any one or more of a preset feature word path, a preset feature order, a preset field, a preset dictionary and a preset question word.

[0011] Optionally, the method further includes: constructing a chemical safety knowledge graph, including: collecting basic chemical safety data and preprocessing the basic chemical safety data; classifying the preprocessed basic chemical safety data to obtain multiple data sets; converting the multiple data sets into a graph data model; generating chemical safety knowledge question-answer pair data based on the graph data model, and representing the question-answer pair data based on a heterogeneous graph, expressed as:

[0012] G QA =(V,E,I);

[0013] Among them, V is the set of all nodes in the graph data model; E is the set of all edges in the graph data model; I is the characteristic vector matrix of all nodes in the graph data model; based on the question-answer data component knowledge entities, a chemical safety knowledge graph is formed.

[0014] Optionally, the preprocessing of the chemical safety basic data includes: data standardization processing, redundant data filtering processing and incomplete data filling processing.

[0015] Optionally, converting the multiple data sets into a graph data model includes: encoding the chemical safety knowledge in the multiple data sets, expressed as:

[0016] G K ={V,E,Δ}

[0017] Among them, V is the set of all nodes in the graph data model; E is the set of all edges between two entity nodes in V; Δ is the set of relationship types; the encoded chemical safety knowledge is re-encoded based on the relational graph convolutional network to obtain the graph data model.

[0018] Optionally, the encoded chemical safety knowledge is re-encoded based on the relational graph convolutional network to obtain a graph data model, which is expressed as:

[0019]

[0020] Among them, |Δ| is the number of relations; |M| is the number of nodes; L is the number of convolutional layers of the relation graph.

[0021] Optionally, based on the query language, performing a target object query in a pre-built chemical safety knowledge graph includes: passing in the query language, calling a build_entitydict function to return query information; and converting the query information into graph data model language data as the target object.

[0022] Optionally, the generating and pushing answer information to the user end based on the query target object includes: rewriting the query target based on the named entity in the question information to obtain the answer information; and transmitting the answer information to the user end.

[0023] The second aspect of the present invention provides an intelligent question-answering system based on a chemical safety knowledge graph, the system comprising: a collection unit, used to collect user question information and process the question information into text information; a parsing unit, used to parse the text information to obtain a query language; a query unit, used to perform a target object query in a pre-built chemical safety knowledge graph based on the query language; and a push unit, used to generate and push answer information to the user end based on the queried target object.

[0024] A third aspect of the present invention provides a computer-readable storage medium, which stores instructions that, when executed on a computer, enable the computer to execute the above-mentioned intelligent question-answering method based on the chemical safety knowledge graph.

[0025] A fourth aspect of the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned intelligent question-answering method based on a chemical safety knowledge graph when executing the computer program.

[0026] Through the above technical solution, the solution of the present invention parses the user's question information, first processes it into text information, and then generates a query language based on the text information. In order to solve the problem of data islands in existing chemical safety knowledge, data integration is performed to generate a chemical safety knowledge graph, and query target queries adapted to the question information are performed based on the query language and the chemical safety knowledge graph. Then, corresponding answer feedback information is generated based on user habits or sensitive information, and rapid question and answer of professional knowledge in the field of chemical safety technology is realized, solving the problem that it is difficult for users in the field of chemical safety technology to obtain professional knowledge suggestions.

[0027] Other features and advantages of the embodiments of the present invention will be described in detail in the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS

[0028] The accompanying drawings are used to provide a further understanding of the embodiments of the present invention and constitute a part of the specification. Together with the following specific embodiments, they are used to explain the embodiments of the present invention, but do not constitute a limitation on the embodiments of the present invention. In the accompanying drawings:

[0029] Figure 1 It is a flowchart of the steps of an intelligent question-answering method based on a chemical safety knowledge graph provided by one embodiment of the present invention;

[0030] Figure 2 It is a system structure diagram of an intelligent question-answering system based on a chemical safety knowledge graph provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0031] The specific implementation of the present invention is described in detail below in conjunction with the accompanying drawings. It should be understood that the specific implementation described here is only used to illustrate and explain the present invention, and is not used to limit the present invention.

[0032] Intelligent question-answering systems are also called automatic question-answering robots, chatbots, automatic question-answering systems, expert question-answering systems, human-computer dialogue systems, etc. In related research, the early domestic question-answering systems used text as data and were constructed through question analysis, document set preprocessing, candidate document selection, candidate document analysis, answer extraction, and answer generation. In recent years, question-answering systems use knowledge bases as knowledge sources. The new structure cancels the document-related system and replaces it with a knowledge base-related structure - professional knowledge graph for representation and query.

[0033] In recent years, most of the research on intelligent question-answering based on professional knowledge graphs in China has focused on professional service areas, such as hotels and shopping malls. In the field of chemical safety, with the continuous advancement of informatization, a large amount of industry data has been accumulated in the field of chemical safety. However, since these data are scattered in various servers, IT systems, and even personal computers, the platform heterogeneity and data dispersion are very obvious, forming data islands. How to quickly and accurately enable employees to obtain the knowledge they need for work has become an important part of whether an enterprise can establish a rapid response mechanism and operate quickly and at low cost.

[0034] The solution of the present invention integrates and gathers comprehensive and accurate professional data in the field of chemical safety, breaks down the data barriers between various systems, establishes a unified chemical safety knowledge graph, and builds a chemical safety intelligent question and answer system based on the knowledge graph to provide intelligent information service support for the grassroots and management levels of enterprises.

[0035] Figure 1 1 is a method flow chart of an intelligent question-answering method based on a chemical safety knowledge graph provided by an embodiment of the present invention. Figure 1 As shown, an embodiment of the present invention provides an intelligent question-answering method based on a chemical safety knowledge graph, the method comprising:

[0036] Step S10: Collect the user's question information and process the question information into text information.

[0037] Specifically, the user's question information is: text question information, voice question information or image question information. The processing of the question information into text information includes: if the question information is text question information, the text question information is used as processed text information; if the question information is voice question information, the voice question information is recognized based on a voice recognition model, and text information is generated based on the recognition result as processed text information; if the question information is image question information, whether there is a text image in the question image is judged, and based on the judgment result, a corresponding image recognition model is selected to recognize the question image, and text information is generated based on the recognition result as processed text information.

[0038] In the embodiments of the present invention, users may ask security questions in a variety of ways, the most common of which is based on voice input or direct text data. However, users often have special needs, such as inputting a data icon for professional knowledge consultation. In this way, the image information needs to be parsed. The solution of the present invention sets up a variety of question input schemes to meet the user needs in various scenarios.

[0039] Preferably, the selecting a corresponding image recognition model based on the judgment result to perform problem image recognition includes: if there is only a text image in the problem image, the problem image is recognized based on the OCR algorithm; if there is only a non-text image in the problem image, the problem image is recognized based on a pre-built image feature extraction model; if the problem image contains both a text image and a non-text image, the problem image is recognized based on the OCR algorithm and the pre-built image feature extraction model respectively.

[0040] In the embodiment of the present invention, text information recognition can be performed directly for both direct text information and voice information. For icon information, the corresponding recognition difficulty will increase. If there is a problem image, text image recognition can be performed based on the OCR algorithm to obtain recognized text. For non-text images, it is necessary to train a corresponding feature extraction model for image recognition. For example, if the bar graph of a certain indicator in a chart is significantly higher than other indicators, the feature can be identified through the corresponding trained feature extraction model, thereby inferring that the user's consultation object is the consequence information when the indicator is abnormal. Collect a large amount of historical icon information, and perform model training based on the upgraded network to obtain an image feature extraction model for the field of chemical safety technology.

[0041] Step S20: parsing the text information into questions to obtain query language.

[0042] Specifically, the text information is judged based on the preset classification template whether it belongs to a matching preset question classification item; if there is a matching preset question classification item, a query language is generated based on the corresponding preset question classification item; if there is no matching preset question classification item, a query language is generated based on the preset question template sentence.

[0043] In a possible implementation, for the analysis of question sentences, the solution of the present invention adopts a method based on template rules. First, the user input question is passed in, and the question sentence is classified. If there is no corresponding classification result, the template sentence is output. If there is a classification result, the domain words contained in the question sentence and the domain they belong to are obtained, and the entity types involved in the question sentence are collected; then classification is performed based on feature words to see whether the question sentence contains a certain domain feature word, and whether the domain is in the entity type (types) contained in the question sentence, so as to determine which type (question_types) the question sentence belongs to.

[0044] Preferably, the preset classification template is: a combination of any one or more of a preset feature word path, a preset feature order, a preset field, a preset dictionary and a preset question word.

[0045] Embodiment 1:

[0046] First, construct a class QuestionClassifier for question classification, and define member variables such as feature word path, feature word, domain actree, dictionary, and question word. In addition to entities, feature words also include domain words region_words composed of all entity words and deny_words. Constructing domain actree is achieved by calling the ahocorasick library of Python. At the same time, constructing entity construction {feature word: feature word corresponding type} dictionary.

[0047] Then, the iter() function of the ahocorasick library is used to match domain words, remove the shorter domain words with repeated strings, and return the longest domain word. The function is to filter the domain words contained in the question and return {domain words in the question: entity type corresponding to the word}.

[0048] After that, call the check_medical function to obtain the domain words and domains contained in the question, and collect the entity types involved in the question;

[0049] Then, classification is performed based on feature words, that is, the check_word function is called to see whether the question contains a certain domain feature word, and whether the domain is in the entity type (types) of region_words contained in the question, so as to determine which type the question belongs to. If no relevant external query information is found, and there is a specific entity type, then the description information of the node is returned (question_types = ['info_desc']). Then the classification results are merged and assembled into a dictionary for return.

[0050] After question classification, the question needs to be parsed. First, pass in the question classification result to obtain the domain words and entity types in the question. Then call the build_entitydict function to return an entity_dict dictionary in the form of {'entity type':['domain word'],...}. For example: get args from the classification result {'args':{'Qingdao Refining':['company']},'question_types':['company_measures']} and return {'company':['Qingdao Refining'],'company_measures':['Qingdao Refining']}.

[0051] Then, for each question_type in ['question_types'] in the question classification return value, call the sql_transfer function to convert it into the Cypher language of neo4j. Finally, combine the converted sql query statements for each question_type.

[0052] Step S30: Based on the query language, query the target object in the pre-built chemical safety knowledge graph.

[0053] Specifically, the method further includes: constructing a chemical safety knowledge graph, including: collecting basic chemical safety data and preprocessing the basic chemical safety data; classifying the preprocessed basic chemical safety data to obtain multiple data sets; converting the multiple data sets into a graph data model; generating chemical safety knowledge question-answer pair data based on the graph data model, and representing the question-answer pair data based on a heterogeneous graph, which is represented as:

[0054] G QA =(V,E,I)

[0055] Among them, V is the set of all nodes in the graph data model; E is the set of all edges in the graph data model; I is the characteristic vector matrix of all nodes in the graph data model; based on the question-answer data component knowledge entities, a chemical safety knowledge graph is formed.

[0056] In one possible implementation, for structured data stored in chemical safety-related business systems such as risk identification methods, double-prevention risk lists, chemical safety knowledge, occupational health knowledge, and accident event knowledge, the relational data model is converted into a graph data model. At the same time, the structured data stored in the relational database is mapped to the graph database based on the principles of "row to node, table name to label, connection or foreign key is relationship". For unstructured data that is not saved in the system, a distributed representation knowledge base construction framework is used to first encode chemical knowledge to obtain knowledge representation. It is planned to adopt an adaptive knowledge graph modeling mechanism to create a multi-relational knowledge representation. Where V is the set of all entity nodes, E is the set of all edges between two entity nodes in V, is a set of relation types. Then, we further use the Relational Graph Convolutional Networks (R-GCN) to encode the knowledge graph G K .

[0057] Preferably, the preprocessing of the chemical safety basic data includes: data standardization processing, redundant data filtering processing and incomplete data filling processing.

[0058] In the embodiment of the present invention, the scheme of the present invention aims to solve the technical problem of data islands, and the significant feature of the technical problem of data islands is the data standard deviation. When the basic data of the scheme of the present invention is collated, the data needs to be processed in a unified standard to ensure the efficiency of subsequent data queries. When querying data based on a public database, there will inevitably be data missing and data redundancy, so missing data filling and redundant data filtering are required to ensure the cleanliness of the data and improve the overall efficiency of the knowledge graph.

[0059] Preferably, converting the multiple data sets into a graph data model includes: encoding the chemical safety knowledge in the multiple data sets, expressed as:

[0060] G K ={V,E,Δ}

[0061] Among them, V is the set of all nodes in the graph data model; E is the set of all edges between two entity nodes in V; Δ is the set of relationship types; the encoded chemical safety knowledge is re-encoded based on the relational graph convolutional network to obtain the graph data model.

[0062] Furthermore, the encoded chemical safety knowledge is re-encoded based on the relational graph convolutional network to obtain a graph data model, which is expressed as:

[0063]

[0064] Among them, |Δ| is the number of relations; |M| is the number of nodes; L is the number of convolutional layers of the relation graph.

[0065] Embodiment 2:

[0066] For the structured data stored in chemical safety-related business systems such as risk identification methods, double-prevention risk lists, chemical safety knowledge, occupational health knowledge, and accident event knowledge, the relational data model is converted into a graph data model, and the graph database is selected as the neo4j database. At the same time, according to the principles of "row to node, table name to label, connection or foreign key is relationship", the structured data stored in the relational database is mapped to the graph database.

[0067] Then, for the question-answer data related to chemical knowledge, a question-answer network for chemical safety issues is constructed to represent and model the question-answer data, and the question-answer data is represented as a heterogeneous graph, denoted as G QA=(V,E,X), where V represents the set of all nodes in the graph, and E represents the set of all edges in the graph. X is the feature vector matrix of all nodes. A question-answer heterogeneous graph contains four types of nodes: (1) question nodes, (2) answer nodes, (3) high-frequency word nodes, and (4) entity nodes. For a question-answer text, identify the high-frequency words that appear in it as word nodes. Establish an edge between each word node and the corresponding question or answer node, and set the weight of the edge to 1. Then, use a sliding window of a fixed size to obtain the co-occurring word nodes. If two words appear in the same sliding window, an edge will be established between the two words, and the weight of the edge is set to 1. Finally, the knowledge extracted from the knowledge base is injected into the established question-answer heterogeneous graph to further enrich the representation information. Specifically, use each word node as a query to search for the most relevant entity from the knowledge base, add the entity as an entity node to the graph, and establish an edge between the word node and the entity node, and set the weight of the edge to 1. In addition, each node vi in ​​the question-answer heterogeneous graph is associated with a corresponding feature vector x. i ∈R 1×d X=[x 1 ;x 2 ;...;x n ]∈R n×d represents the node feature matrix, d is the dimension of the feature vector, and n is the number of all nodes in the heterogeneous graph. Therefore, a question-answer heterogeneous graph can be finally represented as G QA =(A,X), where A∈R n×n represents the adjacency matrix, A ij =1 indicates node v i and v j There is an edge between them, otherwise A ij =0.

[0068] For unstructured data texts such as chemical safety laws and regulations, employee training, etc., chemical knowledge is first encoded to obtain knowledge representation. Adopting an adaptive knowledge graph modeling mechanism, a multi-relational knowledge representation G is created. K ={V,E,Δ}. Where V is the set of all entity nodes, E is the set of all edges between two entity nodes in V, and Δ is the set of relationship types. Then we further use the relational graph convolutional network to encode the knowledge graph G. K , R-GCN is an extension of graph convolutional networks on multi-relational graphs.

[0069] Given a specific node vi, the following convolution operation is used to compute the representation of node vi at layer l:

[0070]

[0071] in The lth layer node v i The representation of c l is the number of output channels of the lth graph convolutional layer, Δ is the set of all relations in the knowledge graph, Represents node v i For the neighbors of relation r, c i,j is a normalization constant that can be determined by learning or defined artificially. and are parameter matrices respectively. Then the following formula is used to obtain the representation of the entire knowledge graph:

[0072]

[0073] in is by putting each line obtained by adding, |Δ| is the number of relations, |M| is the number of nodes, and |L| is the number of graph convolutional layers.

[0074] Finally, based on the existing data and with risk as the core, a knowledge graph was constructed that includes 11 categories of knowledge entities with a scale of approximately 118,000 and 10 categories of entity relationships with a scale of approximately 1.91 million. Table 1 of the number of entities is formed:

[0075] Entity Type Chinese meaning Number of entities ["Node"] node 20011 ["Unit"] unit 6420 ["Hazard"] Device 2424 ["Event"] Risk Events 108334 ["Measures"] Control measures 274717 ["Company"] company 439 ["Danger"] Hidden dangers 10123 ["Task"] Troubleshooting tasks 713370 ["Point"] Inspection Point 31622 ["Org"] Organization 6669 ["Risk"] Risk Level 2295

[0076] Table 1 Entity information

[0077] Preferably, the target object query is performed in a pre-built chemical safety knowledge graph based on the query language, including: passing in the query language, calling the build_entitydict function to return the query information; and converting the query information into graph data model language data as the target object.

[0078] Step S40: Generate and push answer information to the user end based on the target object of the query.

[0079] Specifically, based on the named entities in the question information, the query target is rewritten to obtain answer information; and the answer information is transmitted to the user end.

[0080] In a possible implementation, the current input question q and the knowledge base representation GK are used as input, and the final reasoning result I=(z 1 ,z 2 ,…,z f ,…,z L ), where f represents the number of steps of knowledge base reasoning, z fIt consists of a relation r and a corresponding entity e. Specifically, each step of reasoning will result in a new relation r, and based on the new relation r, a new entity e will be derived at the same time. The corresponding chemical safety knowledge base G in the answer generation process will be tracked K The named entities and relations in the knowledge graph will be returned to the user.

[0081] Embodiment three:

[0082] Using the results of the above SQL query, the knowledge graph is integrated with the named entities in the original question to rewrite the candidate answer template amax to generate a high-quality, highly credible, and more professional question answer text sequence. An end-to-end deep learning framework is used to generate answers. The framework mainly consists of the following five parts: question encoder, reasoning & explanation module, matching module, answer decoder and explanation decoder.

[0083] The question encoder encodes the current input question q into a hidden state q. The reasoning & explanation module is based on the vector representation kb∈G of the question hidden state q and the given knowledge base. K , and the final reasoning result I is obtained. The matching module takes the question hidden state q and the given question-answer pair vector representation sequence QA as input and finds the candidate answer template a max The answer decoder and explanation decoder use the attention mechanism to read the question hidden state q, the reasoning results I and a max , generate the answer text sequence Y a .

[0084] At each decoder time step t, given the hidden states st, q, I and a of the decoder RNN max , using the following formula to generate the answer Y in a multi-mode hybrid approach a :

[0085]

[0086] Among them, gen, copy and entity represent the generation mode, copy mode and entity mode respectively, and Ps(·|·) represents the probability of selecting different modes (implemented using the softmax function). Represents generated from the vocabulary The probability of Represents copy from answer The probability of Represents the extraction of entities (relationships) from the reasoning results of the knowledge base probability.

[0087] Then the current input question q and the knowledge base representation G KAs input, output the final reasoning result I = (z 1 ,z 2 ,…,z f ,…,z L ), where f represents the number of steps of knowledge base reasoning, z f It consists of a relation r and a corresponding entity e. Specifically, each step of reasoning will result in a new relation r, and based on the new relation r, a new entity e will be derived at the same time.

[0088] In step f, we get the relationship With entity The probability of generation:

[0089]

[0090]

[0091] where q I is the embedding representation of question q, s I is the state of reasoning. I and I The update method is as follows:

[0092]

[0093]

[0094]

[0095] The above model will track the chemical safety knowledge base G corresponding to the answer generation process K The named entities and relations in the question will be returned to the user, and the subgraph of the knowledge graph where these named entities and relations are located will be returned to the user. At the same time, the answer_prettify function will be called according to the different ['question_type'] to combine the query results and the answer words, and finally return the final answer.

[0096] In the embodiment of the present invention, the scheme of the present invention utilizes the data of the existing system, and there is no need to collect historical question and answer data in advance, so the deployment is faster and has a better application scope. The present invention adopts an intelligent question and answer method that combines knowledge graph with question matching, which has better robustness and adaptability. The present invention is based on data such as chemical safety knowledge, risk identification methods, laws, regulations and standards, occupational health knowledge, accidents, abnormal operation handling, and intrinsic safety of devices, and the scope of question and answer is wider and more comprehensive.

[0097] Figure 2 : is a system structure diagram of an intelligent question-answering system based on a chemical safety knowledge graph provided by an embodiment of the present invention. Figure 2As shown, an embodiment of the present invention provides an intelligent question-answering system based on a chemical safety knowledge graph, the system comprising:

[0098] The collecting unit is used to collect the user's question information and process the question information into text information.

[0099] Specifically, the user's question information is: text question information, voice question information or image question information. The processing of the question information into text information includes: if the question information is text question information, the text question information is used as processed text information; if the question information is voice question information, the voice question information is recognized based on a voice recognition model, and text information is generated based on the recognition result as processed text information; if the question information is image question information, whether there is a text image in the question image is judged, and based on the judgment result, a corresponding image recognition model is selected to recognize the question image, and text information is generated based on the recognition result as processed text information.

[0100] In the embodiments of the present invention, users may ask security questions in a variety of ways, the most common of which is based on voice input or direct text data. However, users often have special needs, such as inputting a data icon for professional knowledge consultation. In this way, the image information needs to be parsed. The solution of the present invention sets up a variety of question input schemes to meet the user needs in various scenarios.

[0101] Preferably, the selecting a corresponding image recognition model based on the judgment result to perform problem image recognition includes: if there is only a text image in the problem image, the problem image is recognized based on the OCR algorithm; if there is only a non-text image in the problem image, the problem image is recognized based on a pre-built image feature extraction model; if the problem image contains both a text image and a non-text image, the problem image is recognized based on the OCR algorithm and the pre-built image feature extraction model respectively.

[0102] In the embodiment of the present invention, text information recognition can be performed directly for both direct text information and voice information. For icon information, the corresponding recognition difficulty will increase. If there is a problem image, text image recognition can be performed based on the OCR algorithm to obtain recognized text. For non-text images, it is necessary to train a corresponding feature extraction model for image recognition. For example, if the bar graph of a certain indicator in a chart is significantly higher than other indicators, the feature can be identified through the corresponding trained feature extraction model, thereby inferring that the user's consultation object is the consequence information when the indicator is abnormal. Collect a large amount of historical icon information, and perform model training based on the upgraded network to obtain an image feature extraction model for the field of chemical safety technology.

[0103] The parsing unit is used to parse the text information into questions to obtain a query language.

[0104] Specifically, the text information is judged based on the preset classification template whether it belongs to a matching preset question classification item; if there is a matching preset question classification item, a query language is generated based on the corresponding preset question classification item; if there is no matching preset question classification item, a query language is generated based on the preset question template sentence.

[0105] In a possible implementation, for the analysis of question sentences, the solution of the present invention adopts a method based on template rules. First, the user input question is passed in, and the question sentence is classified. If there is no corresponding classification result, the template sentence is output. If there is a classification result, the domain words contained in the question sentence and the domain they belong to are obtained, and the entity types involved in the question sentence are collected; then classification is performed based on feature words to see whether the question sentence contains a certain domain feature word, and whether the domain is in the entity type (types) contained in the question sentence, so as to determine which type (question_types) the question sentence belongs to.

[0106] Preferably, the preset classification template is: a combination of any one or more of a preset feature word path, a preset feature order, a preset field, a preset dictionary and a preset question word.

[0107] The query unit is used to perform target object query in a pre-built chemical safety knowledge graph based on the query language.

[0108] Specifically, the method further includes: constructing a chemical safety knowledge graph, including: collecting basic chemical safety data and preprocessing the basic chemical safety data; classifying the preprocessed basic chemical safety data to obtain multiple data sets; converting the multiple data sets into a graph data model; generating chemical safety knowledge question-answer pair data based on the graph data model, and representing the question-answer pair data based on a heterogeneous graph, which is represented as:

[0109] G QA =(V,E,X)

[0110] Among them, V is the set of all nodes in the graph data model; E is the set of all edges in the graph data model; X is the feature vector matrix of all nodes in the graph data model; based on the question-answer data component knowledge entities, a chemical safety knowledge graph is formed.

[0111] In one possible implementation, for structured data stored in chemical safety-related business systems such as risk identification methods, double-prevention risk lists, chemical safety knowledge, occupational health knowledge, and accident event knowledge, the relational data model is converted into a graph data model. At the same time, the structured data stored in the relational database is mapped to the graph database based on the principles of "row to node, table name to label, connection or foreign key is relationship". For unstructured data that is not saved in the system, a distributed representation knowledge base construction framework is used to first encode chemical knowledge to obtain knowledge representation. It is planned to adopt an adaptive knowledge graph modeling mechanism to create a multi-relational knowledge representation. Where V is the set of all entity nodes, E is the set of all edges between two entity nodes in V, is a set of relation types. Then, the relational graph convolutional network (R-GCN) is further used to encode the knowledge graph GK.

[0112] Preferably, the preprocessing of the chemical safety basic data includes: data standardization processing, redundant data filtering processing and incomplete data filling processing.

[0113] In the embodiment of the present invention, the scheme of the present invention aims to solve the technical problem of data islands, and the significant feature of the technical problem of data islands is the data standard deviation. When the basic data of the scheme of the present invention is collated, the data needs to be processed in a unified standard to ensure the efficiency of subsequent data queries. When querying data based on a public database, there will inevitably be data missing and data redundancy, so missing data filling and redundant data filtering are required to ensure the cleanliness of the data and improve the overall efficiency of the knowledge graph.

[0114] Preferably, converting the multiple data sets into a graph data model includes: encoding the chemical safety knowledge in the multiple data sets, expressed as:

[0115]

[0116] Where V is the set of all nodes in the graph data model; E is the set of all edges between two entity nodes in V; It is a collection of relationship types; based on the relational graph convolutional network, the encoded chemical safety knowledge is re-encoded to obtain a graph data model.

[0117] Furthermore, the encoded chemical safety knowledge is re-encoded based on the relational graph convolutional network to obtain a graph data model, which is expressed as:

[0118]

[0119] in, is the number of relations; |M| is the number of nodes; L is the number of convolutional layers of the relation graph.

[0120] The push unit is used to generate and push answer information to the user end based on the target object of the query.

[0121] Specifically, based on the named entities in the question information, the query target is rewritten to obtain answer information; and the answer information is transmitted to the user end.

[0122] In a possible implementation, the current input question q and the knowledge base representation GK are used as input, and the final reasoning result I=(z 1 ,z 2 ,…,z f ,…,z L ), where f represents the number of steps of knowledge base reasoning, z f It consists of a relation r and a corresponding entity e. Specifically, each step of reasoning will result in a new relation r, and based on the new relation r, a new entity e will be derived at the same time. The corresponding chemical safety knowledge base G in the answer generation process will be tracked K The named entities and relations in the knowledge graph will be returned to the user.

[0123] An embodiment of the present invention also provides a computer-readable storage medium, which stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned intelligent question-answering method based on the chemical safety knowledge graph.

[0124] An embodiment of the present invention also provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above-mentioned intelligent question-answering method based on the chemical safety knowledge graph when executing the computer program.

[0125] Those skilled in the art will understand that all or part of the steps in the method for implementing the above-mentioned embodiments can be completed by instructing the relevant hardware through a program, and the program is stored in a storage medium, including several instructions for making a single-chip microcomputer, a chip or a processor (processor) perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.

[0126] The optional embodiments of the present invention are described in detail above in conjunction with the accompanying drawings. However, the embodiments of the present invention are not limited to the specific details in the above embodiments. Within the technical concept of the embodiments of the present invention, the technical scheme of the embodiments of the present invention can be subjected to a variety of simple modifications, and these simple modifications all belong to the protection scope of the embodiments of the present invention. It should also be noted that the various specific technical features described in the above specific embodiments can be combined in any suitable manner without contradiction. In order to avoid unnecessary repetition, the embodiments of the present invention will not further describe various possible combinations.

[0127] In addition, various embodiments of the present invention may be arbitrarily combined, and as long as they do not violate the concept of the embodiments of the present invention, they should also be regarded as the contents disclosed in the embodiments of the present invention.

Claims

1. An intelligent question-answering method based on chemical safety knowledge graph, characterized in that: The method comprises: Collecting user's question information and processing the question information into text information; Performing question analysis on the text information to obtain a query language; Based on the query language, query the target object in the pre-built chemical safety knowledge graph; Based on the target object of the query, the answer information is generated and pushed to the user end.

2. The method according to claim 1, characterized in that The user's question information is: Text question information, voice question information or image question information.

3. The method according to claim 1, characterized in that The step of processing the question information into text information includes: If the question information is text question information, the text question information is used as the processed text information; If the question information is voice question information, the voice question information is recognized based on a voice recognition model, and text information is generated based on the recognition result as processed text information; If the question information is image question information, it is determined whether there is a text image in the question image, and based on the determination result, a corresponding image recognition model is selected to perform question image recognition, and text information is generated based on the recognition result as processed text information.

4. The method according to claim 3, characterized in that The selecting a corresponding image recognition model based on the judgment result to perform problem image recognition includes: If there is only a text image in the problem image, the problem image is recognized based on the OCR algorithm; If there are only non-text images in the problem image, the problem image is identified based on the pre-built image feature extraction model; If the problem image contains both text images and non-text images, the problem image is identified based on the OCR algorithm and the pre-built image feature extraction model respectively.

5. The method according to claim 1, characterized in that The step of parsing the text information to obtain a query language includes: Determine whether the text information has a matching preset question classification item based on a preset classification template; If there is a matching preset question classification item, a query language is generated based on the corresponding preset question classification item; If there is no matching preset question classification item, a query language is generated based on the preset question template sentence.

6. The method according to claim 5, characterized in that The preset classification template is: A combination of any one or more of the preset feature word path, preset feature times, preset fields, preset dictionaries and preset question words.

7. The method according to claim 1, characterized in that The method further comprises: Construct a chemical safety knowledge graph, including: Collecting basic chemical safety data and preprocessing the basic chemical safety data; Classify the pre-processed chemical safety basic data to obtain multiple data sets; Converting the plurality of data sets into a graph data model; The chemical safety knowledge question-answer data is generated based on the graph data model, and the question-answer data is represented based on the heterogeneous graph, which is expressed as: G QA =(V,E,I); Among them, V is the set of all nodes in the graph data model; E is the set of all edges in the graph data model; I is the feature vector matrix of all nodes in the graph data model; Based on the question-answer data, knowledge entities are constructed to form a chemical safety knowledge graph.

8. The method according to claim 7, characterized in that The preprocessing of the chemical safety basic data includes: Perform data standardization processing, redundant data filtering processing and incomplete data filling processing.

9. The method according to claim 7, characterized in that: The converting the multiple data sets into a graph data model comprises: The chemical safety knowledge in the multiple data sets is encoded and expressed as: G K ={V,E,Δ} Among them, V is the set of all nodes in the graph data model; E is the set of all edges between two entity nodes in V; Δ is the set of relation types; The encoded chemical safety knowledge is re-encoded based on the relational graph convolutional network to obtain the graph data model.

10. The method according to claim 9, characterized in that The encoded chemical safety knowledge is re-encoded based on the relational graph convolutional network to obtain a graph data model, which is expressed as: |Δ| where |Δ| is the number of relations; |M| is the number of nodes; L is the number of relational graph convolutional layers.

11. The method according to claim 1, characterized in that The query language is used to query the target object in the pre-built chemical safety knowledge graph, including: Pass in the query language and call the build_entitydict function to return the query information; The query information is converted into graph data model language data as a target object.

12. The method according to claim 1, characterized in that The generating and pushing answer information to the user terminal based on the target object of the query includes: Based on the named entities in the question information, rewrite the query target to obtain answer information; The answer information is transmitted to the user end.

13. An intelligent question-answering system based on chemical safety knowledge graph, characterized in that: The system comprises: A collection unit, used for collecting user's question information and processing the question information into text information; A parsing unit, used to parse the text information to obtain a query language; A query unit, used to query a target object in a pre-built chemical safety knowledge graph based on the query language; The push unit is used to generate and push answer information to the user end based on the target object of the query.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the intelligent question-answering method based on a chemical safety knowledge graph as described in any one of claims 1 to 12.

15. An electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, it implements the intelligent question-answering method based on the chemical safety knowledge graph as described in any one of claims 1 to 12.

Citation Information

Cited By

  • Multi-mode image searching method based on images

    CN120804355A