Question and answer method, device and equipment based on graph database and storage medium
By performing problem similarity verification, keyword extraction and semantic analysis on users' natural language query, and using the big model to generate optimized graph database query statements, the problem of inaccurate natural language query conversion in the existing technology is solved, and the efficiency and accuracy of graph database query is improved.
Patent Information
- Application Number
- CN202510230329.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-28
- Publication Date
- 2025-06-13
AI Technical Summary
When processing natural language queries and retrieving information from graph databases, the prior art faces the challenge of accurately understanding user intentions and converting natural language queries into graph database query statements, resulting in inaccurate search results or no relevant content was retrieved.
By obtaining the user's target problem, the problem similarity verification is performed; if it fails, the keywords are extracted and semantic analysis is performed, and the optimized graph database query statement is generated using natural language and general language models to determine the target answer.
Improve the efficiency and accuracy of graph database query, and can more accurately understand user intentions and provide relevant information.
Smart Images

Figure CN120144831A_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present application relate to the field of computer technology, particularly to the field of artificial intelligence technology, and specifically to a question and answer method, device, equipment, and storage medium based on a graph database. Background Art
[0002] In the context of the rapid advancement of artificial intelligence technology, the technology of applying natural language for information retrieval has become a new research direction. When processing a large number of natural language queries and retrieving information from a graph database, only through an efficient query processing and result presentation mechanism can the user's need for quickly and accurately obtaining information be met.
[0003] In the existing technology, most systems adopt traditional database query methods, which usually require users to have a certain technical background to write structured query statements. However, with the development of natural language processing technology, some advanced systems have begun to be able to parse users' natural language queries and convert them into database query statements. In the process of processing natural language queries and generating graph database query statements, the existing technology usually faces some challenges, such as the system needs to accurately understand the intention of the user's query, including the entities, attributes, and relationships of the query; the system needs to be able to convert the user's natural language query into an effective graph database query language; but directly converting according to the user's natural language has poor accuracy, and the retrieval results are inaccurate or no relevant content is retrieved. Summary of the Invention
[0004] The present application provides a question and answer method, device, equipment, and storage medium based on a graph database to improve the efficiency and accuracy of graph database queries.
[0005] According to one aspect of the present application, a question and answer method based on a graph database is provided, and the method includes:
[0006] Obtain the target question of the user and perform a question similarity check on the target question with the question knowledge base;
[0007] In the case where it is recognized that the question similarity check fails, extract the target keywords of the target question to obtain the target keywords of the target question;
[0008] Based on a natural language large model, perform semantic analysis on the target question to obtain target semantic information;
[0009] Based on a general language large model, determine a graph database query statement according to the target keywords and the target semantic information, and determine the target answer of the target question from the target graph database according to the graph database query statement.
[0010] According to another aspect of the present application, a question-answering device based on a graph database is provided. The device includes:
[0011] A question verification module, configured to obtain a target question of a user and perform question similarity verification on the target question with a question knowledge base;
[0012] A keyword extraction module, configured to extract keywords from the target question to obtain target keywords of the target question when it is recognized that the question similarity verification fails;
[0013] A semantic analysis module, configured to perform semantic analysis on the target question based on a natural language large model to obtain target semantic information;
[0014] An answer determination module, configured to determine a graph database query statement based on a general language large model according to the target keywords and the target semantic information, and determine a target answer to the target question from a target graph database according to the graph database query statement.
[0015] According to another aspect of the present application, an electronic device is provided. The electronic device includes:
[0016] One or more processors;
[0017] A memory, configured to store one or more programs;
[0018] When the one or more programs are executed by the one or more processors, the one or more processors implement any one of the question-answering methods based on a graph database provided by the embodiments of the present application.
[0019] According to another aspect of the present application, a computer-readable storage medium is provided, on which a computer program is stored. When the program is executed by a processor, it implements any one of the question-answering methods based on a graph database provided by the embodiments of the present application.
[0020] According to another aspect of the present application, a computer program product is provided, including a computer program. When the computer program is executed by a processor, it implements any one of the question-answering methods based on a graph database provided by the embodiments of the present application.
[0021] This application obtains the target question of the user and performs a question similarity check between the target question and the question knowledge base; in the case where it is recognized that the question similarity check fails, keyword extraction is performed on the target question to obtain the target keywords of the target question; based on the large natural language model, semantic analysis is performed on the target question to obtain the target semantic information; based on the general language model, according to the target keywords and the target semantic information, a graph database query statement is determined, and according to the graph database query statement, the target answer to the target question is determined from the target graph database. The above technical solution can effectively improve the efficiency and accuracy of graph database queries by performing similarity checks, keyword extraction, and semantic analysis on questions and using the large model to generate an optimized graph database query statement. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 is a flowchart of a question and answer method based on a graph database according to Embodiment 1 of the present application;
[0023] Figure 2 is a flowchart of a question and answer method based on a graph database according to Embodiment 2 of the present application;
[0024] Figure 3 is a schematic structural diagram of a question and answer device based on a graph database according to Embodiment 3 of the present application;
[0025] Figure 4 is a schematic structural diagram of an electronic device for implementing the question and answer method based on a graph database of the embodiments of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0026] In order to enable those skilled in the art to better understand the solution of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.
[0027] It should be noted that in the description of the present application, the claims and the above-mentioned drawings, the terms "first", "second", etc. are used to distinguish similar objects, and do not necessarily describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present application described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device that includes a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or are inherent to these processes, methods, products or devices.
[0028] In addition, it should also be noted that in the technical solution of the present application, the processing of the collection, storage, use, processing, transmission, provision and disclosure of relevant data such as gear position data and available stiffness complies with the provisions of relevant laws and regulations and does not violate public order and good customs.
[0029] Embodiment 1
[0030] Figure 1 is a flowchart of a question-answering method based on a graph database according to Embodiment 1 of the present application. This embodiment is applicable to the situation of processing natural language queries and retrieving information from a graph database, and can be executed by a question-answering device based on a graph database. The question-answering device based on a graph database can be implemented in the form of hardware and / or software, and the question-answering device based on a graph database can be configured in a computer device, such as a server. As Figure 1 shown, the method includes:
[0031] S110. Obtain the target question of the user, and perform question similarity verification on the target question and the question knowledge base.
[0032] In this embodiment, the user refers to the person who asks questions in natural language. The target question refers to the specific question raised by the user, usually the content of a user query. The target question is a question in natural language form, and the goal of the system is to provide corresponding answers or information based on this question. Exemplarily, the target question can be a question related to the user manual of the target entity / software. It should be noted that the target question is usually a text in natural language form. The question knowledge base refers to a database containing a large number of questions. The purpose of this knowledge base is to help the system determine whether the target question raised by the user is similar to the existing questions and extract relevant information to give an answer. Question similarity verification refers to verifying whether the target question raised by the user and the questions in the knowledge base have the same or similar content by calculating the similarity between them. This is usually evaluated through a text similarity algorithm. The text similarity algorithm can be a cosine similarity algorithm, a Jaccard similarity algorithm, etc.
[0033] Optionally, the question similarity verification can be to calculate the similarity between the target question and the candidate questions in the question knowledge base to obtain the similarity value of the target question. If the similarity value meets the retrieval condition, it is determined that the question similarity verification passes. If the similarity value does not meet the retrieval condition, it is determined that the question similarity verification fails.
[0034] In this embodiment, the candidate question refers to other questions in the question knowledge base that are calculated for similarity with the target question. These questions can be any existing questions in the knowledge base and serve as comparison objects for the target question. Similarity calculation refers to the process of measuring the similarity degree between two questions (the target question and the candidate question) in terms of content, semantics, intention, etc. Usually, different algorithms (such as cosine similarity, Jaccard similarity, Manhattan distance, etc.) are used to calculate the similarity value between two texts. The similarity value refers to a number obtained through similarity calculation, indicating the similarity degree between the target question and the candidate question. Generally speaking, the range of the similarity value is from 0 to 1. The larger the value, the more similar the questions are, and the smaller the value, the greater the difference between the questions. The retrieval condition is a threshold set by the system to determine whether the similarity between two questions reaches a certain standard, and then decide whether the question similarity verification passes. Generally speaking, if the similarity value between the target question and the candidate question exceeds a certain preset threshold, it is determined that "the question similarity verification passes".
[0035] Exemplarily, if the similarity value is greater than or equal to 0.9, it is determined that the question similarity verification passes. If the similarity value is less than 0.9, it is determined that the question similarity verification fails.
[0036] S120. In the case where it is recognized that the question similarity verification fails, extract the target keywords of the target question.
[0037] In this embodiment, keyword extraction refers to identifying key words or phrases from the target question, and these keywords can usually well represent the core content of the question. The target keyword is the most important vocabulary extracted from the target question, usually a noun, verb or other representative information unit; these keywords represent the core content or theme of the target question and are usually used for further analysis and query.
[0038] In an alternative embodiment, when it is recognized that the question similarity verification passes, based on the general language large model, according to the target question, the target answer of the target question is determined from the target graph database.
[0039] It can be understood that by calculating the similarity with the predefined question knowledge base, the graph database query statement corresponding to the target question can be generated faster, and the answer to the target question can be quickly determined from the target graph database, improving the efficiency of graph database query.
[0040] S130. Based on the natural language large model, perform semantic analysis on the target question to obtain target semantic information.
[0041] In this embodiment, the natural language large model refers to a language model based on deep learning, and its training data comes from a large amount of text data; these models can understand and generate natural language text and have wide applications in tasks such as semantic analysis, text generation, and question answering systems. Semantic analysis refers to the process of understanding and parsing the meaning of natural language text; different from traditional syntactic analysis, semantic analysis focuses on the meaning in the text and helps the system understand the intention, context and relevance behind the question. The target semantic information is the abstract information obtained after performing in-depth semantic analysis on the target question; it contains the meaning, context of the question and its relationship with other concepts, usually involving word meaning, emotion, intention, etc.
[0042] Specifically, input the target question into the natural language large model, and the natural language large model performs semantic analysis on the target question to obtain target semantic information.
[0043] S140. Based on the general language large model, determine the graph database query statement according to the target keyword and the target semantic information, and determine the target answer of the target question from the target graph database according to the graph database query statement.
[0044] In this embodiment, the general language model refers to a natural language processing model with strong generality. It can not only understand texts in specific fields but also handle language tasks in multiple different fields. Such models are usually trained with large-scale datasets and have cross-domain knowledge and language processing capabilities. It should be noted that the general language model of this application specifically refers to GLM-4 (General Language Model-4). The graph database refers to a database that stores data in a graph structure, and the data is organized in the form of nodes (representing entities) and edges (representing the relationships between nodes). The graph database is particularly suitable for storing and querying data with complex relationships, such as social networks, knowledge graphs, etc. It should be noted that the graph database of this application specifically refers to the Neo4j graph database. The graph database query statement refers to the statement used to retrieve information from the graph database. In the graph database, the query statement is usually implemented through a graph query language, which can be Cypher (Cypher Query Language) or SPARQL (SPARQL Protocol and RDF Query Language). The target answer refers to the result of querying in the graph database according to the target question, which is the final answer obtained by the system based on the query statement generated from the question. The target answer can be a direct text response or relevant data or objects extracted from the graph database.
[0045] Exemplarily, the technical solution of this embodiment can be to receive the questions asked by the user in a natural language manner. First, the similarity between the question input by the user and the questions in the Q&A knowledge base is calculated. When the similarity is greater than 0.9, the corresponding Cypher statement of the question is directly returned. When the similarity is less than 0.9, the keywords and semantic information after semantic analysis are passed to the content retrieval module, and the large model dynamically constructs a Cypher query statement based on this information. The content retrieval module calls the Neo4j graph database to execute the generated Cypher query and retrieve the graph data related to the question.
[0046] In the embodiment of the present application, the target problem of the user is obtained, and the target problem is compared with the problem knowledge base for problem similarity verification; in the case where it is recognized that the problem similarity verification fails, keyword extraction is performed on the target problem to obtain the target keywords of the target problem; based on the large natural language model, semantic analysis is performed on the target problem to obtain the target semantic information; based on the large general language model, according to the target keywords and the target semantic information, a graph database query statement is determined, and according to the graph database query statement, the target answer of the target problem is determined from the target graph database. In the above technical solution, after performing similarity verification, keyword extraction, and semantic analysis on the problem, and using the large model to generate an optimized graph database query statement, the efficiency and accuracy of graph database query can be effectively improved.
[0047] Embodiment 2
[0048] Figure 2 FIG. is a flowchart of a question-answering method based on a graph database according to Embodiment 2 of the present application. On the basis of the technical solutions of the above embodiments, the step of "performing keyword extraction on the target problem to obtain the target keywords of the target problem" is refined into "performing word segmentation on the target problem to obtain the to-be-processed keywords of the target problem; filtering the to-be-processed keywords based on a regular expression to obtain the candidate keywords of the target problem; and determining the target keywords of the target problem according to the candidate keywords based on a keyword list". It should be noted that for the parts not detailed in the embodiments of the present application, reference may be made to the relevant descriptions of other embodiments. As Figure 2 shown, the method includes:
[0049] S210. Obtain the target problem of the user, and perform problem similarity verification on the target problem and the problem knowledge base.
[0050] S220. In the case where it is recognized that the problem similarity verification fails, perform word segmentation on the target problem to obtain the to-be-processed keywords of the target problem.
[0051] In this embodiment, word segmentation refers to the process of splitting continuous text into individual independent lexical units (such as words or phrases). The to-be-processed keywords refer to the preliminary keywords extracted from the target problem after word segmentation, and these keywords may include various different types of words, such as nouns, verbs, adjectives, etc., and may also include irrelevant words (such as stop words).
[0052] It can be understood that word segmentation is a preliminary stage before further analyzing the target problem, and it provides a basis for subsequent filtering and extracting candidate keywords.
[0053] S230. Filter the to-be-processed keywords based on a regular expression to obtain the candidate keywords of the target problem.
[0054] In this embodiment, a regular expression refers to a tool for describing string patterns, which can be used for operations such as searching, matching, and replacing in text; a regular expression defines the matching pattern of text through specific syntax rules; a regular expression is used to filter the keywords to be processed, usually for deleting irrelevant or unimportant words (such as stop words, meaningless characters, etc.), so as to obtain more accurate candidate keywords. Candidate keywords refer to a set of keywords that are screened out from the keywords to be processed after being filtered by the regular expression and may be of great significance to the target problem; these keywords will be further analyzed and evaluated in subsequent steps to determine the final target keywords.
[0055] It can be understood that the candidate keywords provide a preliminary set of core vocabulary for further analyzing the meaning and context of the target problem.
[0056] S240. Based on the keyword list, determine the target keywords of the target problem according to the candidate keywords.
[0057] In this embodiment, the keyword list refers to a set containing multiple potential keywords, and these keywords are of great significance in a specific field or task; they can be predefined or automatically extracted from the corpus. The target keywords refer to the set of keywords finally screened out from the candidate keywords, and they can most accurately represent the core content or meaning of the target problem.
[0058] Optionally, perform keyword similarity verification on the candidate keywords and the keywords in the keyword list; wherein, the keyword list is constructed according to the historical keywords of historical problems; determine the candidate keywords that pass the keyword similarity verification as the target keywords of the target problem.
[0059] In this embodiment, keyword similarity verification refers to evaluating the similarity between candidate keywords and known keywords in the keyword list through certain algorithms or technologies (such as calculation based on cosine similarity, calculation based on word vectors, calculation based on edit distance, etc.); the purpose is to judge whether the candidate keywords have sufficient similarity with the existing keywords in terms of semantics, spelling or other dimensions, so as to confirm which candidate keywords are valid and can represent the core content of the target problem.
[0060] S250. Based on the large natural language model, perform semantic analysis on the target problem to obtain target semantic information.
[0061] S260. Based on the large general language model, determine the graph database query statement according to the target keywords and the target semantic information, and determine the target answer of the target problem from the target graph database according to the graph database query statement.
[0062] Optionally, the general language large model can be trained based on historical question data and the user manual of the target entity / software; the historical question data can include historical questions, as well as the historical keywords, historical answers, and historical semantic information of the historical questions.
[0063] In this embodiment, the user manual of the target entity / software refers to a document that helps users understand and effectively use a specific entity or software. It usually includes detailed instructions on how to operate, set up, maintain, and solve problems, etc., with the aim of ensuring that users can use the product correctly and smoothly. Historical question data refers to various question data collected in similar systems or scenarios in the past; these data include the questions that users have asked, as well as the relevant information of these questions (such as answers, keywords, semantic information, etc.); historical question data provides valuable resources for training the general language large model, helping the model understand and summarize the characteristics of various types of questions, so as to improve the ability to understand and answer new questions. Historical questions refer to the questions that users have asked the system before; these questions can be past actual queries or the corpus used by the system during training. Historical keywords refer to the words or phrases with specific meanings extracted from historical questions, usually the part that indicates the core intention or key information in the question. Historical answers refer to the answers corresponding to historical questions, which can be provided by experts, the system, or users; historical answers not only include the direct responses to the questions, but also can include some additional information, such as explanations, reference materials, etc. Historical semantic information refers to information such as the implicit meaning, emotional color, intention, and context relationship of historical questions.
[0064] Further, after determining the target answer of the target question from the target graph database, update the question knowledge base and the graph database according to the target question and the target answer; update the general language large model according to the target question, the target answer, the target keywords, and the target semantic information.
[0065] Optionally, the update of the general language large model can be the modification of the prompt words of the general language large model.
[0066] In an optional implementation manner, in order to enable the general language large model to deeply understand the user's requirements and output the correct graph database query statement and target answer, prompt words can be set for the general language large model according to the historical question data, and the general language large model can be guided to output using these prompt words.
[0067] In this embodiment, the prompt word refers to the text or instruction provided to the model to guide the model to generate or answer.
[0068] It is understandable that by calling a large language model and instructing it through carefully designed prompts to achieve intelligent processing of specific tasks, it is possible to effectively guide the model to output content that meets the target requirements, thereby improving the user experience.
[0069] Exemplarily, the technical solution of this embodiment can be implemented through the following steps:
[0070] 1) The user inputs a question: What is the abbreviation of TechconNeosys?
[0071] 2) After judgment, if the answer is no, then step 3 is executed; if the answer is yes, then step 5 is executed;
[0072] 3) Preprocess the question and extract keywords, extracting "TechconNeosys" and "abbreviation";
[0073] 4) Call the large model to further perform semantic analysis;
[0074] 5) If the match is successful, directly return the corresponding Cypher statement:
[0075] MATCH(p:Product{name:'TechconNeosys'})RETURN p.abbreviation;
[0076] 6) Query and return the result in Neo4j according to the generated Cypher statement;
[0077] 7) Return the result: Neosys, and the large model generates the final output: The abbreviation of TechconNeosys is Neosys;
[0078] 8) According to the query question and answer situation, feedback to confirm whether to add it to the knowledge base;
[0079] 9) According to the query effect and the knowledge base, decide whether it is necessary to modify the prompt.
[0080] Exemplarily, the technical solution of this embodiment can also be implemented through the following steps:
[0081] 1) The user inputs a question: What are the steps to connect to the controller?
[0082] 2) Calculate the similarity between the question and the examples in the question bank, and the similarity is greater than 0.9;
[0083] 3) Directly return the Cypher statement corresponding to this question;
[0084] 4) Query and return the result in Neo4j according to the generated Cypher statement;
[0085] 5) The output content is: "The steps to connect to the controller are as follows: When using the Techcon Neosys series DCU for the first time, you need to first configure the high-speed or low-speed jumper and the RS-485 bias resistor switch of the NS-MCB controller, and connect a set of DCUs according to the requirements of Section 2.2. The connection order of the DCUs is:... (the remaining content is omitted here)".
[0086] In the embodiment of the present application, the target problem of the user is obtained, and the problem similarity check is performed between the target problem and the problem knowledge base; in the case where it is recognized that the problem similarity check fails, the target problem is segmented to obtain the keywords to be processed of the target problem; based on the regular expression, the keywords to be processed are filtered to obtain the candidate keywords of the target problem; based on the keyword list, the target keywords of the target problem are determined according to the candidate keywords; based on the natural language large model, semantic analysis is performed on the target problem to obtain the target semantic information; based on the general language large model, according to the target keywords and the target semantic information, the graph database query statement is determined, and according to the graph database query statement, the target answer of the target problem is determined from the target graph database. Through the above technical solutions, after performing similarity check, keyword extraction and semantic analysis on the problem, and using the large model to generate an optimized graph database query statement, the efficiency and accuracy of graph database query can be effectively improved.
[0087] Embodiment III
[0088] Figure 3 It is a structural schematic diagram of a question-answering device based on a graph database provided by Embodiment III of the present application, which is applicable to the situation of processing natural language queries and retrieving information from a graph database. The question-answering device based on the graph database can be implemented in the form of hardware and / or software, and the question-answering device based on the graph database can be configured in a computer device, such as a server. As Figure 3 shown, the device includes:
[0089] A problem verification module 310, configured to obtain the target problem of the user and perform a problem similarity check between the target problem and the problem knowledge base;
[0090] A keyword extraction module 320, configured to extract keywords from the target problem to obtain the target keywords of the target problem in the case where it is recognized that the problem similarity check fails;
[0091] A semantic analysis module 330, configured to perform semantic analysis on the target problem based on a natural language large model to obtain the target semantic information;
[0092] An answer determination module 340, configured to determine a graph database query statement based on a general language large model according to a target keyword and target semantic information, and determine a target answer to a target question from a target graph database according to the graph database query statement.
[0093] In the embodiment of the present application, a target question of a user is obtained, and the target question is subjected to question similarity verification with a question knowledge base; in the case where it is recognized that the question similarity verification fails, keyword extraction is performed on the target question to obtain a target keyword of the target question; semantic analysis is performed on the target question based on a natural language large model to obtain target semantic information; a graph database query statement is determined based on a general language large model according to the target keyword and the target semantic information, and a target answer to the target question is determined from the target graph database according to the graph database query statement. In the above technical solution, after performing similarity verification, keyword extraction, and semantic analysis on the question, and using the large model to generate an optimized graph database query statement, the efficiency and accuracy of graph database query can be effectively improved.
[0094] Optionally, the keyword extraction module 320 includes:
[0095] A question word segmentation unit, configured to perform word segmentation on the target question to obtain a to-be-processed keyword of the target question;
[0096] A keyword filtering unit, configured to filter the to-be-processed keyword based on a regular expression to obtain a candidate keyword of the target question;
[0097] A keyword matching unit, configured to determine a target keyword of the target question according to the candidate keyword based on a keyword list.
[0098] Optionally, the keyword matching unit is specifically configured to:
[0099] Perform keyword similarity verification on the candidate keyword and the keyword in the keyword list; wherein, the keyword list is constructed according to the historical keywords of historical questions;
[0100] Determine the candidate keyword that passes the keyword similarity verification as the target keyword of the target question.
[0101] Optionally, the question verification module 310 is specifically configured to:
[0102] Calculate the similarity between the target question and candidate questions in the question knowledge base to obtain a similarity value of the target question;
[0103] If the similarity value meets the retrieval condition, it is determined that the question similarity verification passes;
[0104] If the similarity value does not meet the retrieval condition, it is determined that the question similarity verification fails.
[0105] Optionally, the answer determination module 340 is further configured to:
[0106] When it is recognized that the question similarity verification passes, based on the general language large model, according to the target question, determine the target answer of the target question from the target graph database.
[0107] Optionally, the general language large model is trained according to historical question data; the historical question data includes historical questions, as well as historical keywords, historical answers, and historical semantic information of the historical questions; correspondingly, the device further includes a data update module; the data update module is configured to:
[0108] After determining the target answer of the target question from the target graph database, update the question knowledge base and the graph database according to the target question and the target answer;
[0109] Update the general language large model according to the target question, the target answer, the target keyword, and the target semantic information.
[0110] The question and answer device based on the graph database provided by the embodiments of the present application can execute the question and answer method based on the graph database provided by any embodiment of the present application, and has the corresponding functional modules and beneficial effects for executing each question and answer method based on the graph database.
[0111] According to the embodiments of the present application, the present application also provides an electronic device, a readable storage medium, and a computer program product.
[0112] Embodiment 4
[0113] Figure 4 It is a schematic structural diagram of an electronic device 410 for implementing the question and answer method based on the graph database of the embodiments of the present application. The electronic device is intended to represent various forms of digital computers, such as, laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as, personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are only examples and are not intended to limit the implementation of the present application described and / or claimed herein.
[0114] Such as Figure 4As shown, the electronic device 410 includes at least one processor 411 and a memory communicatively connected to the at least one processor 411, such as a read-only memory (ROM) 412, a random access memory (RAM) 413, etc. The memory stores a computer program executable by the at least one processor. The processor 411 can execute various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 412 or the computer program loaded from the storage unit 418 into the random access memory (RAM) 413. In the RAM 413, various programs and data required for the operation of the electronic device 410 can also be stored. The processor 411, the ROM 412, and the RAM 413 are connected to each other via a bus 414. An input / output (I / O) interface 415 is also connected to the bus 414.
[0115] Multiple components in the electronic device 410 are connected to the I / O interface 415, including: an input unit 416, such as a keyboard, a mouse, etc.; an output unit 417, such as various types of displays, speakers, etc.; a storage unit 418, such as a magnetic disk, an optical disc, etc.; and a communication unit 419, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 419 allows the electronic device 410 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.
[0116] The processor 411 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 411 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 411 executes the various methods and processes described above, such as the question-and-answer method based on a graph database.
[0117] In some embodiments, the question-and-answer method based on a graph database can be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as the storage unit 418. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 410 via the ROM 412 and / or the communication unit 419. When the computer program is loaded into the RAM 413 and executed by the processor 411, one or more steps of the question-and-answer method based on a graph database described above can be executed. Alternatively, in other embodiments, the processor 411 can be configured for the question-and-answer method based on a graph database by any other appropriate means (e.g., by means of firmware).
[0118] The various embodiments of the systems and techniques described above in this specification can be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems-on-chip (SOCs), complex programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include: being implemented in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be a special-purpose or general-purpose programmable processor that receives data and instructions from, and transmits data and instructions to, a storage system, at least one input device, and at least one output device.
[0119] The computer programs for implementing the methods of this application can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general purpose computer, special purpose computer, or other programmable graph database-based question answering device, such that the computer programs, when executed by the processor, cause the functions / operations specified in the flowchart and / or block diagram to be implemented. The computer programs can be executed entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine, or entirely on the remote machine or server.
[0120] In the context of this application, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0121] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the electronic device. Other kinds of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0122] The systems and techniques described herein can be implemented in a computing system including backend components (e.g., as a data server), or a computing system including middleware components (e.g., an application server), or a computing system including frontend components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system including any combination of such backend components, middleware components, or frontend components. The components of the system can be interconnected to each other by digital data communication in any form or medium (e.g., a communication network). Examples of communication networks include: local area network (LAN), wide area network (WAN), blockchain network, and the Internet.
[0123] The computing system can include a client and a server. The client and the server are generally far from each other and typically interact through a communication network. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or a cloud host, which is a host product in the cloud computing service system and solves the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.
[0124] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps recited in this application can be executed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of this application can be achieved, and this is not limited herein.
[0125] The above specific embodiments do not constitute a limitation on the protection scope of this application. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application shall be included within the protection scope of this application.
Claims
1. A question-answering method based on a graph database, characterized in that: include: Obtain the target question of the user, and perform a question similarity check between the target question and the question knowledge base; When it is identified that the question similarity check fails, performing keyword extraction on the target question to obtain target keywords for the target question; Based on the natural language big model, semantic analysis is performed on the target question to obtain target semantic information; Based on the general language big model, a graph database query statement is determined according to the target keywords and the target semantic information, and based on the graph database query statement, a target answer to the target question is determined from the target graph database.
2. The method according to claim 1, characterized in that Perform keyword extraction on the target question to obtain target keywords of the target question, including: Segmenting the target question to obtain keywords to be processed for the target question; Based on regular expressions, the keywords to be processed are filtered to obtain candidate keywords for the target question; Based on the keyword list, the target keyword of the target question is determined according to the candidate keywords.
3. The method according to claim 2, characterized in that Based on the keyword list, determining the target keyword of the target question according to the candidate keywords includes: Performing keyword similarity verification on the candidate keywords and keywords in the keyword list; wherein the keyword list is constructed based on historical keywords of historical questions; The candidate keywords that pass the keyword similarity check are determined as target keywords for the target question.
4. The method according to claim 1, characterized in that The target problem is checked against the problem knowledge base for similarity, including: Calculate the similarity between the target question and the candidate questions in the question knowledge base to obtain a similarity value of the target question; If the similarity value meets the search condition, it is determined that the question similarity check passes; If the similarity value does not satisfy the search condition, it is determined that the question similarity check has failed.
5. The method according to claim 1, characterized in that: The method further comprises: When it is identified that the question similarity check has passed, based on the universal language macro model and according to the target question, a target answer to the target question is determined from a target graph database.
6. The method according to claim 1, characterized in that The general language big model is trained based on historical question data; the historical question data includes historical questions, and historical keywords, historical answers and historical semantic information of the historical questions; accordingly, after determining the target answer of the target question from the target graph database, the method further includes: According to the target question and the target answer, the question knowledge base and the graph database are updated; The universal language macromodel is updated according to the target question, the target answer, the target keyword and the target semantic information.
7. A question-answering device based on a graph database, characterized in that: include: A question verification module is used to obtain the target question of the user and perform question similarity verification between the target question and the question knowledge base; A keyword extraction module, configured to extract keywords from the target question to obtain target keywords for the target question when it is identified that the question similarity check fails; A semantic analysis module, used to perform semantic analysis on the target question based on a natural language large model to obtain target semantic information; The answer determination module is used to determine the graph database query statement based on the universal language big model according to the target keywords and the target semantic information, and determine the target answer to the target question from the target graph database according to the graph database query statement.
8. An electronic device, characterized in that: include: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the question-answering method based on the graph database as described in any one of claims 1-6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the question-answering method based on a graph database as described in any one of claims 1 to 6 is implemented.
10. A computer program product, comprising a computer program, which, when executed by a processor, implements the question-answering method based on a graph database according to any one of claims 1 to 6.
Citation Information
Cited By
Data processing method, computing device, storage medium and program product
CN121029772A
Question and answer method
CN121144470A
Professional domain knowledge question answering method and device, electronic equipment and storage medium
CN121166728A
Question and answer interaction method, device and equipment based on large model and storage medium
CN121301547A