Answer generation method and device, equipment and storage medium
By building a knowledge graph in a vertical field question and answer system and using a large language model to process input problems, obtaining the graph index to generate answers, the problems of inaccurate answers and large equipment burden in the vertical field question and answer system are solved, and more efficient answers are achieved Generate and process.
Patent Information
- Application Number
- CN202411005943.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-25
- Publication Date
- 2024-12-17
AI Technical Summary
The vertical field question-and-answer system has problems in semantic understanding and knowledge graph matching, resulting in inaccurate or irrelevant answer generation and a large burden on the device to process data.
The knowledge graph is constructed by building a knowledge graph based on the original documents of the vertical field, and using a large language model to process the input problem, obtain the knowledge graph index to obtain answers, and output the answers in combination with the data in the knowledge graph.
It improves the accuracy of answers and the processing efficiency of the equipment, solves the problem of insufficient semantic understanding and generalization capabilities, and reduces the burden of data processing.
Smart Images

Figure CN119150932A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of data processing technology, and specifically relates to an answer generation method, device, equipment and storage medium. Background Art
[0002] Currently, the question-and-answer system can help users quickly obtain information in various fields, including common sense, science, technology, culture, etc., and can share knowledge by answering questions.
[0003] For question-answering systems in vertical fields, the answers corresponding to the input questions are generally found in the knowledge graph. Since the semantics of the input questions are inconsistent with the knowledge graph, even if the answers corresponding to the input questions exist in the knowledge graph, it may be impossible to output the corresponding answers to the questions. Summary of the invention
[0004] The present application proposes an answer generation method, apparatus, device and storage medium, which can solve the technical problems that the loading time of files is too long when the current function is implemented, and it will cause a relatively large data processing burden on the device where the platform is located.
[0005] The first embodiment of the present application proposes an answer generation method, which is applied to a question-answering system in a vertical field, including:
[0006] Building a knowledge graph based on original documents in the vertical field;
[0007] Using a large language model to process the input question, and obtaining a graph index corresponding to the knowledge graph for the input question;
[0008] Obtain a first answer corresponding to the graph index in the knowledge graph.
[0009] The embodiment of the second aspect of the present application provides an answer generation device, which is applied to a question-answering system in a vertical field, including:
[0010] A construction module, used to construct a knowledge graph based on original documents in the vertical field;
[0011] An acquisition module, used to process the input question using a large language model, and obtain a graph index corresponding to the knowledge graph for the input question;
[0012] The acquisition module is also used to obtain a first answer corresponding to the graph index in the knowledge graph.
[0013] An embodiment of the third aspect of the present application provides a computing device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first aspect above.
[0014] An embodiment of the fourth aspect of the present application provides a computer-readable storage medium on which a computer program is stored, and the program is executed by a processor to implement the method described in the first aspect above.
[0015] The technical solution provided in the embodiments of the present application has at least the following technical effects or advantages:
[0016] In an embodiment of the present application, the embodiment of the application is applied to a question-answering system in a vertical field. First, a knowledge graph is constructed based on original documents in the vertical field; a large language model is used to process input questions to obtain a graph index corresponding to the knowledge graph for the input question; and a first answer corresponding to the graph index is obtained in the knowledge graph. The embodiment of the present application constructs a knowledge graph based on original documents in a vertical field, and a large language model is used to process input questions to obtain a graph index corresponding to the knowledge graph for the input question, so that the graph index corresponding to the knowledge graph can be used to obtain the answer to the input question in the knowledge graph, and the corresponding data in the knowledge graph can be used to output the answer to the input question.
[0017] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become apparent from the description below, or will be learned through the practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS
[0018] By reading the detailed description of the preferred embodiment below, various other advantages and benefits will become clear to those of ordinary skill in the art. The accompanying drawings are only used for the purpose of illustrating the preferred embodiment and are not considered to be limitations of the present application. In addition, the same reference symbols are used to represent the same components throughout the accompanying drawings.
[0019] In the attached picture:
[0020] Figure 1 A flow chart of an answer generation method provided by an embodiment of the present application is shown;
[0021] Figure 2 A flowchart of another answer generation method provided by an embodiment of the present application is shown;
[0022] Figure 3 A schematic diagram showing the structure of an answer generation device provided by an embodiment of the present application is shown;
[0023] Figure 4A schematic diagram of the structure of a computing device provided by an embodiment of the present application is shown;
[0024] Figure 5 A schematic diagram of a storage medium provided in an embodiment of the present application is shown. DETAILED DESCRIPTION
[0025] The exemplary embodiments of the present application will be described in more detail below with reference to the accompanying drawings. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments described herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to fully convey the scope of the present application to those skilled in the art.
[0026] It should be noted that, unless otherwise specified, the technical terms or scientific terms used in this application should have the common meanings understood by technicians in the field to which this application belongs.
[0027] Based on the above background technology, the current question-answering system can adopt a method that combines a knowledge base with a large language model, mainly using the results of question retrieval in the vector database, understanding and integrating them through the large language model, and obtaining the final answer. This kind of answer is generative, and the answers generated by the generative model may have uneven quality due to the context, question form, or insufficient model training data. Sometimes the generated answer may be inaccurate, vague, or irrelevant.
[0028] Currently, there is also a question-answering system based on knowledge graphs. If this type of question-answering system can understand the intention of the question more accurately, the returned answer will be more accurate. However, this method generally has poor semantic understanding of the question and insufficient understanding and generalization of the context, resulting in many cases being unable to understand the question well and query the graph to obtain an accurate answer.
[0029] Furthermore, in order to solve the problem of insufficient understanding of context and generalization ability, the relevant technology proposes a new type of native large language model question-answering system, that is, the model is trained through a knowledge graph, and the corresponding answers are output through the model. In the open field, since the data in the open field is relatively comprehensive, the answers output by the model are more accurate. However, in the vertical field, since the data in this field is updated relatively quickly, the process of training the model for the data in this field requires huge computing power and labor costs.
[0030] In order to solve the above technical problems, the present application proposes an answer generation method, device, equipment and storage medium, which are applied to a question-answering system in a vertical field, and the method includes: constructing a knowledge graph based on original documents in the vertical field; processing the input question using a large language model to obtain a graph index corresponding to the knowledge graph for the input question; and obtaining a first answer corresponding to the graph index in the knowledge graph. The embodiment of the present application constructs a knowledge graph based on original documents in a vertical field, and processes the input question using a large language model to obtain a graph index corresponding to the knowledge graph for the input question, so that the answer to the input question can be obtained in the knowledge graph using the graph index corresponding to the knowledge graph, and the answer corresponding to the input question can be output using the corresponding data in the knowledge graph.
[0031] The answer generation method or interface generation method of the present application can be executed by a computing device, and the computing device can be a server, such as one server, multiple servers, a server cluster, a cloud computing platform, etc. Optionally, the computing device can also be a terminal device, such as a mobile phone, a tablet computer, a game console, a portable computer, a desktop computer, an advertising machine, an all-in-one machine, etc. The present application does not limit the device type and number of the computing device.
[0032] The following describes an answer generation method proposed according to an embodiment of the present application in conjunction with the accompanying drawings. The method is applied to a question-answering system in a vertical field.
[0033] See also Figure 1 , the method specifically comprises the following steps:
[0034] S101. Build a knowledge graph based on original documents in vertical fields.
[0035] Vertical fields usually refer to specific or specialized industries or fields, where the knowledge, skills, tools and terminology may be unfamiliar or difficult for non-professionals to understand. These fields usually have deep professionalism and specific application scenarios, such as healthcare, law and aviation.
[0036] Original documents are real, original data sources under specific topics, and they can be used for tasks such as information retrieval, natural language processing, and text analysis. That is, original documents record data corresponding to vertical fields.
[0037] Knowledge graph is a semantic network structure used to represent knowledge. It helps machines understand and reason about knowledge by representing entities, concepts and their relationships in the form of graphs. The construction of knowledge graphs is based on large-scale structured and semi-structured data. Semantic tags and ontologies are usually used to annotate entities and relationships to support machine automated reasoning and information extraction.
[0038] Knowledge graphs generally include keywords, tags, and graph triples, where keywords are short words or phrases used to describe a concept or entity. In a knowledge graph, keywords can help identify the subject or attribute of an entity or concept for easy retrieval and understanding; tags are usually formal or informal names for entities or concepts, used to uniquely identify and recognize specific entities or concepts in a knowledge graph; graph triples are the most basic form of expression in a knowledge graph, consisting of a subject, a predicate, and an object. It represents the relationship between two entities. It is usually expressed in the form of (Subject, Predicate, Object), where Subject is an entity or concept, Predicate is an attribute or relationship type that describes the relationship between Subject and Object, and Object is another entity or concept.
[0039] In some embodiments, building a knowledge graph based on original documents in vertical fields includes:
[0040] The original document is parsed to obtain multiple graph triples of the original document and labels and keywords corresponding to each of the multiple graph triples, where each graph triple is used to describe the relationship between different objects; a knowledge graph is constructed based on the multiple graph triples and labels and keywords corresponding to each of the multiple graph triples.
[0041] In some embodiments, the process of parsing the original document may be implemented as follows:
[0042] Text segmentation: Use natural language processing tools or regular expressions to segment the original document into paragraphs or sentences. This can be achieved by detecting punctuation marks such as line breaks, periods, question marks, etc.
[0043] Heading and tag recognition: Identify headings, subheadings, or other tags in a document, which often indicate different parts of the document structure.
[0044] Keyword extraction: Use keyword extraction techniques to identify key topics or keywords for each section in a document, which helps understand the focus and organizational structure of the document content.
[0045] Semantic analysis: Semantic analysis and text understanding techniques are used to understand the logical relationship between paragraphs and the semantic structure of the text, thereby helping to parse the various parts of the document more accurately.
[0046] Machine Learning and Pattern Recognition: Automatically identify and categorize different sections or paragraphs in a document using machine learning models and pattern recognition algorithms based on the characteristics and context of the text.
[0047] Information retrieval and filtering: Use information retrieval techniques and filtering methods to screen and locate specific chapters or paragraphs in documents to meet user needs and queries.
[0048] Furthermore, the parsed document is subjected to keyword extraction and labeling processing to obtain at least one keyword corresponding to the original document, at least one label corresponding to each keyword, and at least one graph triple corresponding to each label. The at least one keyword, at least one label corresponding to each keyword, and at least one graph triple corresponding to each label are stored correspondingly to form a knowledge graph.
[0049] For example, when describing the entity "apple" in the knowledge graph, keywords such as "fruit", "technology company", etc. may be used. A node named "apple" may have the label "Apple", and the graph triple (Apple, manufacturing, iPhone) means "Apple manufactures iPhone".
[0050] In some embodiments, there may be semi-structured data in vertical fields. Therefore, the semi-structured data may also be extracted to obtain keywords, tags, and graph triplets in the semi-structured data.
[0051] Semi-structured data refers to a data type between structured data (such as table data in relational databases) and unstructured data (such as text, images, etc.). It has a certain structure, but it does not fully conform to the traditional table format, nor does it have a clear data model or organizational form like completely unstructured data. Semi-structured data can store data corresponding to vertical fields.
[0052] S102. Use a large language model to perform semantic understanding on the input question and obtain the graph index corresponding to the knowledge graph for the input question.
[0053] Large language models can be penAI's GPT series (such as GPT-3), Google's BERT, Facebook's RoBERTa, etc.
[0054] The spectrum index can include keywords and tags.
[0055] In some embodiments, a large language model is used to process the input question to obtain a graph index corresponding to the knowledge graph of the input question, including: using the large language model to perform semantic conversion on the input question according to the knowledge graph to obtain the target input question; extracting the target keywords and target labels of the target input question to form a graph index for the target input question.
[0056] Among them, large language models are natural language processing models with a large number of parameters and complex structures. These models can process and generate natural language text, that is, they can understand the semantics of speech or text and generate natural language text that conforms to the knowledge graph structure.
[0057] In some embodiments, corresponding keywords and tags can be extracted from the language text output by the large language model. For example, if the natural language text is "Who is the manufacturer of Apple mobile phones?", the corresponding keyword is "technology company" and the tag is "Apple".
[0058] S103. Obtain a first answer corresponding to the graph index in the knowledge graph.
[0059] In some embodiments, obtaining a first answer corresponding to a graph index in a knowledge graph includes: determining at least one keyword corresponding to a target keyword in the knowledge graph; determining at least one tag corresponding to a target tag in at least one keyword; and determining a first answer to an input question based on graph triples corresponding to at least one tag according to the semantics of the target input question.
[0060] As can be seen from the above, the knowledge graph includes the data structure of keywords, tags and graph triplets. Therefore, you can query the keyword corresponding to the graph index in the knowledge graph, and query the tag corresponding to the graph index among the multiple tags corresponding to the keyword to obtain multiple graph triplets corresponding to the tag.
[0061] Further, a target graph triple is determined from multiple graph triples based on the intent corresponding to the natural language text corresponding to the input question. For example, if the intent is to determine the manufacturer of the iPhone from the natural language text "Who is the manufacturer of the iPhone?", then the target graph triple (Apple, manufacturing, iPhone) is determined from multiple graph triples corresponding to the label "Apple", and the corresponding first answer is output: Apple Inc. manufactures iPhones.
[0062] Furthermore, when the data in the knowledge graph is updated, the original document of the updated data can be parsed, and the corresponding keywords, tags, and corresponding graph triples can be extracted to update the knowledge graph and ensure real-time updating of the knowledge graph.
[0063] The embodiment of the present application provides an answer generation method, which is applied to a question-answering system in a vertical field, and the method includes: constructing a knowledge graph based on original documents in the vertical field; processing the input question using a large language model to obtain a graph index corresponding to the knowledge graph for the input question; and obtaining a first answer corresponding to the graph index in the knowledge graph. The embodiment of the present application constructs a knowledge graph based on original documents in the vertical field, and processes the input question using a large language model to obtain a graph index corresponding to the knowledge graph for the input question, so that the answer to the input question can be obtained in the knowledge graph using the graph index corresponding to the knowledge graph, and the answer corresponding to the input question can be output using the corresponding data in the knowledge graph.
[0064] In some embodiments, the method also includes: constructing a document vector database based on original documents in a vertical field; performing vector processing on an input question to obtain question vector data; querying the document vector database for at least one document vector data corresponding to the question vector data; and inputting at least one document vector data and question vector data into a large language model to obtain a second answer to the input question.
[0065] It is understandable that when the input question cannot find the corresponding first answer in the above knowledge graph, in order to avoid being unable to output the answer, a large language model can be used to output a generative answer.
[0066] Specifically, the original document may be parsed to obtain more fine-grained document chapters or paragraphs.
[0067] The method of parsing the original document is the same as above and will not be repeated here.
[0068] In some embodiments, a large language model can generally only recognize vector data. Therefore, after parsing the original document, the parsed document needs to be vector processed to obtain document vector data, and the document vector data is stored in a persistent vector database.
[0069] In order to obtain the answer corresponding to the input question, the same vector processing can be performed on the input question to obtain question vector data.
[0070] Furthermore, at least one document vector data corresponding to the question vector data may be queried in the document vector database.
[0071] Specifically, the similarity between the question vector data and each document vector data in the document vector database can be determined based on a similarity measurement method, wherein the similarity measurement method can be Euclidean distance, cosine similarity, Manhattan distance, etc. If the document vector database has a large amount of data, an index structure can be used to speed up the similarity query process.
[0072] Furthermore, in order to improve the accuracy of the output answer, at least one document vector data and question vector data may be input into a large language model so that the large language model can specifically obtain a second answer corresponding to the question vector data based on the context of at least one document vector data.
[0073] In some embodiments, the method further comprises:
[0074] A target answer to the input question is determined based on the first answer and the second answer.
[0075] In some embodiments, a target answer to an input question is determined based on a first answer and a second answer, including: if the first answer exists, determining the first answer as the target answer to the input question; or, determining the target answer based on the similarity of the first answer and the second answer to the input question respectively; if the first answer does not exist, determining the second answer as the target answer.
[0076] In some embodiments, the generated answer may be inaccurate, that is, the second answer may be inaccurate. Therefore, if the first answer exists, the first answer can be determined as the target answer to the input question. Only if the first answer does not exist, the second answer can be determined as the target answer to the input question.
[0077] In some embodiments, a target answer can also be determined based on the first answer and the second answer, and the similarities between the first answer and the second answer and the input question can be determined, wherein the similarities between the first answer and the second answer and the input question can be determined based on similarity metrics such as Euclidean distance, cosine similarity, Manhattan distance, etc., and the answer with high similarity is determined as the target answer.
[0078] In some embodiments, the target answer may be determined based on the first answer and the second answer in such a manner that if the similarity between the two answers and the input question is greater than or equal to a preset similarity threshold, the first answer is determined as the target answer, and if the similarity between the two answers and the input question is less than the preset similarity threshold, the second answer is determined as the target answer. Alternatively, if the similarity between the two answers and the input question is greater than or equal to a preset similarity threshold, the second answer is determined as the target answer, and if the similarity between the two answers and the input question is less than the preset similarity threshold, the first answer is determined as the target answer. The preset similarity threshold may be flexibly set based on actual conditions.
[0079] In order to facilitate understanding of the above-mentioned answer generation method, the embodiment of the present application also provides a flow chart of the answer generation method, such as Figure 2 As shown, the method includes two question-answering systems, namely a question-answering system combining a vector database with a large language model and a question system combining a knowledge graph with a large language model.
[0080] Among them, the processing flow of the problem system combining knowledge graph with large language model includes:
[0081] S201. parse and process original documents in a vertical field or obtain semi-structured data in a vertical field.
[0082] S202: Build a knowledge graph based on the parsed original document or semi-structured data.
[0083] Specifically, after the original document or semi-structured data is parsed, multiple graph triples of the original document and labels and keywords corresponding to each of the multiple graph triples are extracted.
[0084] A knowledge graph is constructed based on multiple graph triples of the original document and the labels and keywords corresponding to the multiple graph triples.
[0085] S203. Use the large language model to perform semantic understanding on the input question and obtain the graph index corresponding to the knowledge graph for the input question.
[0086] The large language model is used to perform semantic conversion on the input question according to the knowledge graph to obtain the target input question; the target keywords and target labels of the target input question are extracted to form a graph index of the target input question.
[0087] S204. Obtain a first answer corresponding to the graph index in the knowledge graph.
[0088] Determine at least one keyword corresponding to the target keyword in the knowledge graph; determine at least one tag corresponding to the target tag in at least one keyword; and determine a first answer to the input question based on the graph triples corresponding to at least one tag according to the semantics of the target input question.
[0089] The processing flow of the question-answering system combining the vector database with a large language model includes:
[0090] S205: parse and process the original documents in the vertical field or obtain semi-structured data in the vertical field.
[0091] S206: Perform vector processing on the original document or semi-structured data after the parsing process to obtain a document vector database.
[0092] S207. Obtain at least one corresponding document vector data from a document vector database according to the input question.
[0093] S208: Input at least one document vector data and question vector data into the large language model to obtain a second answer to the input question.
[0094] S209: Determine a target answer to the input question based on the first answer and the second answer.
[0095] If there is a first answer, the first answer is determined as the target answer to the input question; alternatively, the target answer is determined based on the similarities of the first answer and the second answer to the input question respectively; if there is no first answer, the second answer is determined as the target answer.
[0096] The present application also provides an answer generation device, which is applied to a vertical field and is used to execute the answer generation method provided in any of the above embodiments. Figure 3 As shown, the device includes: a construction module 301 and an acquisition module 302.
[0097] A construction module 301 is used to construct a knowledge graph based on the original documents in the vertical field;
[0098] An acquisition module 302 is used to process the input question using a large language model to obtain a graph index corresponding to the knowledge graph for the input question;
[0099] The acquisition module 302 is also used to obtain a first answer corresponding to the graph index in the knowledge graph.
[0100] The embodiment of the present application provides an answer generation device, which is applied to a question-answering system in a vertical field. In the embodiment of the present application, a knowledge graph is first constructed based on the original documents in the vertical field; the input question is processed using a large language model to obtain the graph index corresponding to the knowledge graph for the input question; and the first answer corresponding to the graph index is obtained in the knowledge graph. The embodiment of the present application constructs a knowledge graph based on the original documents in the vertical field, and processes the input question using a large language model to obtain the graph index corresponding to the knowledge graph for the input question, so that the answer to the input question can be obtained in the knowledge graph using the graph index corresponding to the knowledge graph, and the answer corresponding to the input question can be output using the corresponding data in the knowledge graph.
[0101] In some embodiments, the construction module 301 is further used to: construct a document vector database based on the original documents in the vertical field;
[0102] A vector module, used for performing vector processing on the input question to obtain question vector data;
[0103] A query module, used for querying the document vector database for at least one document vector data corresponding to the question vector data;
[0104] An input module is used to input the at least one document vector data and the question vector data into the large language model to obtain a second answer to the input question.
[0105] In some embodiments, the above apparatus further includes a determination module, configured to:
[0106] A target answer to the input question is determined based on the first answer and the second answer.
[0107] In some embodiments, the determination module is specifically configured to:
[0108] If the first answer exists, determining the first answer as a target answer to the input question; or determining the target answer based on the similarities between the first answer and the second answer and the input question respectively;
[0109] In the absence of the first answer, the second answer is determined as the target answer.
[0110] In some embodiments, the construction module 301 is specifically used to:
[0111] Parsing the original document to obtain multiple graph triples of the original document and labels and keywords corresponding to each of the multiple graph triples, each graph triple being used to describe the relationship between different objects;
[0112] A knowledge graph is constructed based on the multiple graph triples and the labels and keywords corresponding to the multiple graph triples.
[0113] In some embodiments, the acquisition module 302 is specifically configured to:
[0114] Using a large language model to perform semantic conversion on the input question according to the knowledge graph to obtain a target input question;
[0115] Target keywords and target tags of the target input question are extracted to form a graph index of the target input question.
[0116] In some embodiments, the acquisition module 302 is further specifically configured to:
[0117] Determining at least one keyword corresponding to the target keyword in the knowledge graph;
[0118] Determining at least one tag corresponding to the target tag in the at least one keyword;
[0119] A first answer to the input question is determined according to the semantics of the target input question and based on the graph triples corresponding to the at least one label.
[0120] The present application also provides a computing device to execute the above-mentioned answer generation method. Figure 4 It shows a schematic diagram of a computing device provided by some embodiments of the present application. Figure 4 As shown, the computing device 7 includes: a processor 700, a memory 701, a bus 702 and a communication interface 703, and the processor 700, the communication interface 703 and the memory 701 are connected via the bus 702; the memory 701 stores a computer program that can be run on the processor 700, and when the processor 700 runs the computer program, it executes the answer generation method provided in any of the aforementioned embodiments of the present application.
[0121] The memory 701 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the device network element and at least one other network element is realized through at least one communication interface 703 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used.
[0122] The bus 702 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The memory 701 is used to store programs, and the processor 700 executes the program after receiving an execution instruction. The answer generation method disclosed in any implementation of the aforementioned embodiment of the present application may be applied to the processor 700, or implemented by the processor 700.
[0123] The processor 700 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 700. The above processor 700 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a readily available programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in the embodiments of the present application can be directly embodied as a hardware decoding processor to be executed, or the hardware and software modules in the decoding processor can be executed. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 701, and the processor 700 reads the information in the memory 701 and completes the steps of the above method in combination with its hardware.
[0124] The computing device provided in the embodiment of the present application and the answer generation method provided in the embodiment of the present application are based on the same inventive concept and have the same beneficial effects as the methods adopted, run or implemented therein.
[0125] The present application also provides a computer-readable storage medium corresponding to the answer generation method provided in the above embodiment. Figure 5 The computer-readable storage medium shown is a CD 30 on which a computer program (ie, a program product) is stored. When the computer program is run by a processor, it executes the answer generation method provided by any of the aforementioned implementations.
[0126] It should be noted that examples of computer-readable storage media may also include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other optical or magnetic storage media, which are not listed here one by one.
[0127] The computer-readable storage medium provided in the above-mentioned embodiments of the present application and the answer generation method provided in the embodiments of the present application are based on the same inventive concept and have the same beneficial effects as the method adopted, run or implemented by the application program stored therein.
[0128] It should be noted that:
[0129] In the description provided herein, a large number of specific details are described. However, it is understood that the embodiments of the present application can be practiced without these specific details. In some instances, well-known structures and technologies are not shown in detail so as not to obscure the understanding of this description.
[0130] Similarly, it should be understood that in order to streamline the present application and help understand one or more of the various inventive aspects, in the above description of the exemplary embodiments of the present application, the various features of the present application are sometimes grouped together into a single embodiment, figure, or description thereof. However, the disclosed method should not be interpreted as reflecting the following schematic diagram: the claimed application requires more features than the features clearly stated in each claim. More specifically, as reflected in the claims below, the inventive aspects are less than all the features of the single embodiment disclosed above. Therefore, the claims following the specific embodiment are hereby expressly incorporated into the specific embodiment, wherein each claim itself serves as a separate embodiment of the present application.
[0131] In addition, those skilled in the art will appreciate that, although some embodiments herein include certain features included in other embodiments but not other features, the combination of features of different embodiments is meant to be within the scope of the present application and form different embodiments. For example, in the claims below, any one of the claimed embodiments may be used in any combination.
[0132] The above are only preferred specific implementations of the present application, but the protection scope of the present application is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed in the present application should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for generating an answer, characterized in that: Question answering systems applied to vertical fields include: Building a knowledge graph based on original documents in the vertical field; Using a large language model to process the input question, and obtaining a graph index corresponding to the knowledge graph for the input question; Obtain a first answer corresponding to the graph index in the knowledge graph.
2. The method according to claim 1, characterized in that The method further comprises: Building a document vector database based on original documents in the vertical field; Performing vector processing on the input question to obtain question vector data; Querying the document vector database for at least one document vector data corresponding to the question vector data; The at least one document vector data and the question vector data are input into the large language model to obtain a second answer to the input question.
3. The method according to claim 2, characterized in that The method further comprises: A target answer to the input question is determined based on the first answer and the second answer.
4. The method according to claim 3, characterized in that The determining a target answer to the input question based on the first answer and the second answer comprises: If the first answer exists, determining the first answer as a target answer to the input question; or determining the target answer based on the similarities between the first answer and the second answer and the input question respectively; In the absence of the first answer, the second answer is determined as the target answer.
5. The method according to claim 1, characterized in that The constructing of the knowledge graph based on the original documents in the vertical field includes: Parsing the original document to obtain multiple graph triples of the original document and labels and keywords corresponding to each of the multiple graph triples, each graph triple being used to describe the relationship between different objects; A knowledge graph is constructed based on the multiple graph triples and the labels and keywords corresponding to the multiple graph triples.
6. The method according to claim 5, characterized in that The step of processing the input question using the large language model to obtain a graph index corresponding to the knowledge graph for the input question includes: Using a large language model to perform semantic conversion on the input question according to the knowledge graph to obtain a target input question; Target keywords and target tags of the target input question are extracted to form a graph index of the target input question.
7. The method according to claim 6, characterized in that Obtaining a first answer corresponding to the graph index in the knowledge graph includes: Determining at least one keyword corresponding to the target keyword in the knowledge graph; Determining at least one tag corresponding to the target tag in the at least one keyword; A first answer to the input question is determined according to the semantics of the target input question and based on the graph triples corresponding to the at least one label.
8. An answer generation device, characterized in that: Question answering systems applied to vertical fields include: A construction module, used to construct a knowledge graph based on original documents in the vertical field; An acquisition module, used to process the input question using a large language model, and obtain a graph index corresponding to the knowledge graph for the input question; The acquisition module is also used to obtain a first answer corresponding to the graph index in the knowledge graph.
9. A computing device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: The processor runs the computer program to implement the method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: The program is executed by a processor to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Intelligent question and answer system and intelligent terminal
CN110019838A
Question response method and device based on large language model
CN117235226A
Question and answer method and device, storage medium and computing equipment
CN118035409A
Large language model question and answer method and device based on cervical vertebra disease knowledge graph
CN118377875A
Cited By
LLM model-based text analysis method and device, medium and equipment
CN120929610A
