Question and answer method and device, electronic equipment and vehicle
By combining generative models and retrieval Q&A methods, integrating information from multiple sources to generate comprehensive answer texts, the problem of insufficient answer integrity and logic in existing Q&A methods is solved, and a richer and more logical Q&A effect is achieved.
Patent Information
- Application Number
- CN202411861573.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-04-29
Smart Images

Figure CN119903144A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of vehicle technology, and in particular to a question-answering method, device, electronic equipment and vehicle. Background Art
[0002] Retrieval-based QA systems search for answer fragments in a predefined document collection, while generative QA systems rely on generative models to directly generate natural language answers. Although these two question-answering methods have their own advantages, they also have limitations. Retrieval-based QA systems are limited by the content of the retrieved documents and may not be able to handle complex questions that require integrating multiple pieces of information. Generative QA systems may ignore factuality when generating diverse answers, resulting in the generated content being inconsistent with reality. Summary of the invention
[0003] In view of this, the purpose of the present application is to propose a question-answering method, device, electronic device and vehicle to overcome the technical problem that the answers obtained in the question-answering method are poor in completeness and logic.
[0004] Based on the above purpose, the present application provides a question-answering method, including: determining a question text associated with a user's question, determining an initial answer text corresponding to the question text through a generative model, inputting the question text into a generative model, processing the question text through the generative model, and outputting the initial answer text corresponding to the question text, wherein the generative model can integrate information from multiple sources based on understanding the question text, and generate a coherent and comprehensive answer text based on the information from multiple sources, which not only makes it better conform to the user's reading habits, but also enriches the content of the initial solution text, rather than giving a blunt and mechanical reply to the question text. A comprehensive answer text is obtained by means of a generative model, which broadens the content contained in the answer text corresponding to the question text, making the initial answer text richer. Based on the question text and the initial answer text, the associated data is retrieved in a pre-constructed database. When searching in the database, the search is not only based on the question text, but also based on the initial answer text, which is equivalent to increasing the search content, and more data strongly related to the question text can be retrieved in the database, so that the obtained associated data is more diversified and the omission of strongly related data is avoided. Based on the question text, the initial answer text and the associated data, the recommended answer text is determined by the generative model. The generative model can improve the correlation between the initial answer text and the associated data, avoid the separation between the initial answer text and the associated data, and obtain a recommended answer text with good completeness and logic and for the question text. The initial answer text in this application comes from generative question and answer, which can make the initial answer text richer. The associated data comes from retrieval question and answer, and more data strongly related to the question text can be retrieved through retrieval question and answer, so that the obtained associated data is more diversified. The initial answer text and the associated data are processed by the generative model. Since the data processed by the generative model uses two types of question and answer methods, it not only ensures the accuracy of the recommended answer text, but also ensures the comprehensiveness and richness of the recommended answer text. The question and answer method of this application has the advantages of both retrieval question and answer and generative question and answer. By reasonably setting the use order of the generative model and the database, accurate and comprehensive recommended answer texts are obtained based only on the question text, providing users with better question and answer services.
[0005] Optionally, the determining of the recommended answer text by the generative model based on the question text, the initial answer text and the associated data includes: parsing the question text to obtain key semantics, which can more concisely express the meaning of the question text, thereby achieving the purpose of simplifying the question text and making the subsequent generative model understand the question more accurately. Based on the key semantics, the difficulty level of the question text is determined; in response to determining that the difficulty level is greater than or equal to a predetermined difficulty level, the initial answer text and the supplementary data corresponding to the associated data are determined, and the recommended answer text is determined based on the key semantics, the initial answer text, the associated data and the supplementary data. Adding the difficulty level to the conditions for determining the recommended answer text can provide targeted answers for question texts with different difficulty levels. In the case where the difficulty of the question text is relatively high, supplementary data needs to be added, and the supplementary data comprehensively supplements the initial answer text and the associated data, so that the information to be integrated by the generative model is richer, thereby making the recommended text answer more accurate.
[0006] Optionally, the determining of the supplementary data corresponding to the initial answer text and the associated data, and determining the recommended answer text based on the key semantics, the initial answer text, the associated data and the supplementary data, includes: searching for the supplementary data in a search engine, and performing information extraction and natural language generation on the initial answer text, the associated data and the supplementary data based on the key semantics to obtain the recommended answer text, so that the recommended answer text has more depth, which not only makes the obtained recommended answer text complete and logical, but also improves the quality of the obtained recommended answer text.
[0007] Optionally, the associated data includes first associated data and second associated data; the retrieving associated data in a pre-constructed database based on the question text and the initial answer text includes: encoding the question text and the initial answer text respectively to obtain an encoded question text and an encoded initial answer text; retrieving the first associated data in the database according to the encoded question text; retrieving the second associated data in the database according to the encoded initial answer text. The associated data in this embodiment is not limited to the first associated data corresponding to the question text, but also includes the second associated data corresponding to the initial answer text, which expands the scope of the associated data, achieves the purpose of accurately finding data with a strong correlation with the question text and the initial answer text in the database, and ensures the comprehensiveness of the associated data.
[0008] Optionally, the step of retrieving the first associated data from the database according to the encoded question text and retrieving the second associated data from the database according to the encoded initial answer text includes: performing key information analysis on the encoded question text to obtain the first key information, and performing key information analysis on the encoded initial answer text to obtain the second key information; in response to determining that the first paragraph containing the first key information is retrieved from the database, determining the decoded first paragraph as the first associated data, and in response to determining that the second paragraph containing the second key information is retrieved from the database, determining the decoded second paragraph as the second associated data. By matching key information in the database, the key information is information containing the simplified encoded question text and the initial answer text without redundant information, and thus the key information can be accurately matched in the database, thereby achieving the purpose of accurately screening the first associated data and the second associated data.
[0009] Optionally, determining the question text associated with the user's question includes: receiving an initial question input by the user, and performing similar question expansion on the initial question to obtain the question text. By performing similarity expansion on the initial question, multiple questions strongly related to the initial question are obtained, and the initial question and the multiple questions are combined to form the question text, thereby achieving the purpose of expanding the initial question and making the obtained question text more comprehensive.
[0010] Optionally, the method for constructing the database includes: obtaining raw data, parsing the raw data to obtain multiple paragraphs, thereby improving the efficiency and accuracy of retrieval. For each paragraph, encoding the paragraph to obtain an encoded paragraph, and storing the encoded paragraph in the database, thereby ensuring the consistency of data storage in the database, improving retrieval efficiency, and reducing the storage space occupied by the paragraph in the database.
[0011] Based on the same inventive concept, the present application also provides a question-and-answer device, comprising: a first determination module, configured to determine a question text associated with a user's question, and to determine an initial answer text corresponding to the question text through a generative model; a retrieval module, configured to retrieve related data from a pre-constructed database based on the question text and the initial answer text; and a second determination module, configured to determine a recommended answer text through the generative model based on the question text, the initial answer text and the related data.
[0012] Based on the same inventive concept, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable by the processor, wherein the processor implements the method as described above when executing the computer program.
[0013] Based on the same inventive concept, the present application also provides a vehicle, which includes the electronic device.
[0014] As can be seen from the above, the question-answering method, device, electronic device and vehicle provided by the present application include determining a question text associated with a user's question, determining an initial answer text corresponding to the question text through a generative model, inputting the question text into a generative model, processing the question text through a generative model, and outputting an initial answer text corresponding to the question text. The generative model can integrate information from multiple sources on the basis of understanding the question text, and generate a coherent and comprehensive answer text based on information from multiple sources, which not only makes it better in line with the user's reading habits, but also enriches the content of the initial solution text, rather than giving a blunt and mechanical reply to the question text. A comprehensive answer text is obtained by means of a generative model, which broadens the content contained in the answer text corresponding to the question text, making the initial answer text richer. Based on the question text and the initial answer text, the associated data is retrieved in a pre-constructed database. When searching in the database, not only the search is based on the question text, but also the search is based on the initial answer text, which is equivalent to increasing the search content, and more data strongly related to the question text can be retrieved in the database, so that the associated data obtained is more diversified and the omission of strongly related data is avoided. Afterwards, based on the question text, the initial answer text and the associated data, the recommended answer text is determined by the generative model, and the initial answer text and the associated data are integrated by the generative model. The generative model can improve the relevance of the initial answer text and the associated data, avoid the separation between the initial answer text and the associated data, and obtain a recommended answer text with good perfection and logic and for the question text. The initial answer text in this application comes from generative question and answer, and the generative question and answer can make the initial answer text richer. The associated data comes from retrieval question and answer, and more data strongly related to the question text can be retrieved through retrieval question and answer, so that the obtained associated data is more diversified. The initial answer text and the associated data are processed by the generative model. Since the data processed by the generative model uses two types of question and answer methods, it not only ensures the accuracy of the recommended answer text, but also ensures the comprehensiveness and richness of the recommended answer text. The question and answer method of this application has the advantages of both retrieval question and answer and generative question and answer. By reasonably setting the use order of the generative model and the database, only based on the question text, accurate and comprehensive recommended answer text is obtained, providing users with better question and answer services. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the technical solutions in the present application or related technologies, the drawings required for use in the embodiments or related technical descriptions are briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0016] Figure 1 A flowchart of a question-and-answer method according to an embodiment of the present application;
[0017] Figure 2 A flowchart of a question-and-answer method according to another embodiment of the present application;
[0018] Figure 3 A schematic diagram of the structure of a question-answering device according to an embodiment of the present application;
[0019] Figure 4 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0020] In order to make the objectives, technical solutions and advantages of the present application more clearly understood, the present application is further described in detail below in combination with specific embodiments and with reference to the accompanying drawings.
[0021] It should be noted that, unless otherwise defined, the technical terms or scientific terms used in the embodiments of the present application should be the usual meanings understood by people with ordinary skills in the field to which the present application belongs. The "first", "second" and similar words used in the embodiments of the present application do not represent any order, quantity or importance, but are only used to distinguish different components. "Including" or "comprising" and similar words mean that the elements or objects appearing in front of the word cover the elements or objects listed after the word and their equivalents, without excluding other elements or objects. "Connect" or "connected" and similar words are not limited to physical or mechanical connections, but can include electrical connections, whether direct or indirect. "Up", "down", "left", "right" and the like are only used to indicate relative positional relationships. When the absolute position of the described object changes, the relative positional relationship may also change accordingly.
[0022] As mentioned in the background technology section, with the rapid development of artificial intelligence and natural language processing technologies, question-answering systems are increasingly being used in multiple fields such as intelligent customer service, search engines, and knowledge base systems. Traditional question-answering systems are mainly divided into two categories: retrieval-based question-answering systems and generation-based question-answering systems. Retrieval-based question-answering systems search for answer fragments in a predefined document collection, while generation-based question-answering systems rely on generative models to directly generate natural language answers.
[0023] Although both generation methods have their own advantages, they also have limitations. Retrieval-based question-answering systems are limited by the content of the retrieved documents and may not be able to handle complex questions that require integrating multiple pieces of information. Generation-based question-answering systems may ignore factuality when generating diverse answers, resulting in generated content that is inconsistent with reality.
[0024] In view of this, the present application embodiment proposes a question-answering method, referring to Figure 1 , including the following steps:
[0025] Step 101, determine the question text associated with the user's question, and determine the initial answer text corresponding to the question text through a generative model.
[0026] In this step, the question text associated with the user's question is determined. The question asked by the user may be not concise or incomplete. Therefore, the user's question needs to be further processed to obtain the question text associated with the user's question, so as to ensure the subsequent accurate answer to the question text. The initial answer text corresponding to the question text is determined by the generative model, wherein the generative model can be a large language model (LLM). LLM is a type of deep learning model trained with a large amount of text data, which aims to understand and generate human language. It is usually based on the Transformer architecture and learns the language pattern, grammar and semantics through pre-training and fine-tuning to perform a variety of natural language processing tasks, such as text classification, question answering, dialogue, etc. The initial answer text corresponding to the question text is determined by the generative model, the question text is input into the generative model, the question text is processed by the generative model, and the initial answer text corresponding to the question text is output. The generative model can integrate information from multiple sources based on the understanding of the question text, and generate a coherent and comprehensive answer text based on the information from multiple sources, which not only makes it better in line with the user's reading habits, but also enriches the content of the initial solution text, rather than giving a blunt and mechanical reply to the question text. With the help of the generative model, a comprehensive answer text is obtained, which broadens the content contained in the answer text corresponding to the question text and makes the initial answer text richer.
[0027] Step 102: Based on the question text and the initial answer text, retrieve related data from a pre-built database.
[0028] In this step, the question text and the initial answer text are used to search in a pre-constructed database to obtain related data. In the prior art, in a search-based answering system, only the questions asked by the user are used for searching. However, the questions asked by the user contain relatively little content, and comprehensive related data cannot be retrieved in the database. In order to solve the above problems, the present application uses the question text and the initial answer text to search in a pre-constructed database to obtain related data. Through the search, related data with high correlation with the question text and the initial answer text are obtained, wherein the related data contains the answer to the question text. In addition, the initial answer text is correlated with the question text, and it can be foreseen that the related data retrieved by using the initial answer text is also correlated with the related data retrieved by using the question text. Therefore, when the present application searches in the database, it not only searches based on the question text, but also searches based on the initial answer text, which is equivalent to increasing the search content, and more data strongly related to the question text can be retrieved in the database, so that the obtained related data is more diversified and the omission of strongly related data is avoided.
[0029] Step 103, based on the question text, the initial answer text and the associated data, determine the recommended answer text through the generative model.
[0030] In this step, the initial answer text is the answer preliminarily determined based on the question text using the generative model, and the associated data contains multiple information associated with the answer. Through the generative model, the user's question is clarified for the question text, and then the initial answer text and associated data are refined and summarized based on the user's question to determine the recommended text answer. The generative model can not only answer clear questions, but also integrate information across multiple documents or fragments, effectively integrate information from multiple sources and generate coherent answers, avoid information fragmentation, and improve the relevance between information. Exemplarily, the user asks "What is the most popular car model in 2023?" The generative model can give a detailed and structured answer based on the initial answer text and the retrieved associated data, rather than simply listing several key data retrieved. Since the initial answer text is the answer determined according to the generative model, the associated data is the information associated with the answer retrieved using the question text and the initial answer text. The question text, the initial answer text and the associated data are input into the generative model. The generative model integrates the initial answer text and the associated data on the basis of understanding the answer text. The generative model can improve the relevance of the initial answer text and the associated data, avoid the separation between the initial answer text and the associated data, and obtain a recommended answer text with good perfection and logic and for the question text. The initial answer text in this application comes from the generative question and answer, which can make the initial answer text richer. The associated data comes from the retrieval question and answer, and more data strongly related to the question text can be retrieved through the retrieval question and answer, so that the obtained associated data is more diversified. The initial answer text and the associated data are processed by the generative model. Since the data processed by the generative model uses two types of question and answer methods, it not only ensures the accuracy of the recommended answer text, but also ensures the comprehensiveness and richness of the recommended answer text. The question and answer method of this application has the advantages of both retrieval question and answer and generative question and answer. By reasonably setting the order of use of the generative model and the database, only based on the question text, accurate and comprehensive recommended answer texts are obtained, providing users with better question and answer services.
[0031] In another embodiment provided by the present application, after determining the recommended answer text, a satisfaction questionnaire corresponding to the recommended answer text is generated based on the recommended answer text and a predetermined template, the recommended answer text and the above-mentioned satisfaction questionnaire are sent to the user, and in response to receiving the above-mentioned satisfaction questionnaire sent by the user, the generative model is optimized based on the satisfaction questionnaire. In order to enable the generative model to input the answer text that satisfies the user, the recommended answer text is sent to the user, and at the same time, a satisfaction questionnaire on the recommended answer text can also be sent to the user. The satisfaction questionnaire is determined according to actual needs, and can not only be generated according to the recommended answer text and the predetermined template, but also a general satisfaction questionnaire can be pre-built. The generative model is continuously optimized through the satisfaction questionnaire fed back by the user, thereby improving user satisfaction.
[0032] Through the above scheme, the question text associated with the user's question is determined, and the initial answer text corresponding to the question text is determined through the generative model, which broadens the content contained in the answer text corresponding to the question text and makes the initial answer text richer. Based on the question text and the initial answer text, related data is retrieved from a pre-built database, making the obtained related data more diverse and avoiding the omission of strongly related data. Based on the question text, the initial answer text and the related data, the recommended answer text is determined through the generative model, which ensures both the accuracy of the recommended answer text and the comprehensiveness and richness of the recommended answer text.
[0033] The following embodiment explains in detail the method of determining the recommended answer text through a generative model based on the question text, the initial answer text and the associated data.
[0034] In some embodiments, determining the recommended answer text through the generative model based on the question text, the initial answer text and the associated data includes: parsing the question text to obtain key semantics; determining the difficulty level of the question text based on the key semantics; in response to determining that the difficulty level is greater than or equal to a predetermined difficulty level, determining supplementary data corresponding to the initial answer text and the associated data, and determining the recommended answer text based on the key semantics, the initial answer text, the associated data and the supplementary data.
[0035] In this embodiment, since the question text determined by the user's question may be colloquial, it is often not possible to concisely express the user's question. For example, the question text is "I want to know which model is the most popular under brand X". Therefore, it is necessary to simplify the question text, parse the question text, and obtain key semantics. The key semantics can express the meaning of the question text more concisely, so as to achieve the purpose of streamlining the question text, so that the subsequent generative model can understand the question more accurately. For example, the key semantics corresponding to the above question text can be "the most popular model under brand X". Based on the key semantics, the difficulty level of the question text is determined, and the question text is distinguished according to the difficulty level. For example, the open-ended question "Why is model Y of brand X popular with users" and the non-open-ended question "What is the launch date of model Y of brand X" are questions with different difficulty levels. The difficulty level is compared with the predetermined difficulty level. When the difficulty level is greater than or equal to the predetermined difficulty level, it means that the difficulty of the question text is relatively large. Only using the initial answer text and the associated data may not accurately determine the recommended answer to the question text, and the initial answer text and the associated data corresponding to the supplementary data need to be determined. Based on key semantics, initial text answers, associated data and supplementary data, the recommended answer text is determined. It should be noted that in response to determining that the difficulty level is less than the predetermined difficulty level, the recommended answer text is determined based on key semantics, initial answer text, and associated data. When the difficulty level is less than the predetermined difficulty level, it means that the difficulty of the question text is relatively small. At this time, the recommended answer text can be accurately determined through the initial answer text and associated data. Adding the difficulty level to the conditions for determining the recommended answer text can provide targeted answers for question texts with different difficulty levels. When the difficulty of the question text is relatively high, supplementary data must be added. The supplementary data comprehensively supplements the initial answer text and associated data, so that the information to be integrated in the generative model is richer, and the recommended text answer is more accurate.
[0036] The difficulty level is added to the conditions for determining the recommended answer text. When the difficulty level is greater than or equal to the predetermined difficulty level, the initial answer text and the supplementary data corresponding to the associated data need to be determined. Based on the key semantics, the initial answer text, the associated data and the supplementary data, the recommended answer text is determined together. The following embodiment specifically describes how to jointly determine the recommended answer text based on the above multiple conditions for determining the answer text.
[0037] In some embodiments, the determining of the supplementary data corresponding to the initial answer text and the associated data, based on the key semantics, the initial answer text, the associated data and the supplementary data, determines the recommended answer text, including: searching for the supplementary data in a search engine, and based on the key semantics, performing information extraction and natural language generation on the initial answer text, the associated data and the supplementary data to obtain the recommended answer text.
[0038] In this embodiment, when the difficulty level is greater than or equal to the predetermined difficulty level, it indicates that the difficulty of the question text is relatively difficult. In this case, the recommended answer text cannot be accurately determined only by the initial answer text and the associated data, and it is also necessary to search in the search engine to obtain the supplementary data corresponding to the initial answer text and the associated data. The search engine includes a large amount of information, and the supplementary information obtained in the search engine is more comprehensive. When the difficulty of the question text is greater than or equal to the predetermined difficulty level, based on the key semantics, the question asked in the question text is clarified, and a targeted answer is given to the question. Since the difficulty of the question text is relatively difficult at this time, in addition to information extraction and natural language generation for the initial answer text and the associated data, information extraction and natural language generation for the supplementary data are also added. Information extraction is performed on the initial answer text, associated data and supplementary data so as to accurately extract the key information in the initial answer text, associated data and supplementary data. However, the extracted key information cannot fully and logically express the answer. Therefore, it is also necessary to perform natural language processing on the extracted key information to convert the extracted key information into high-quality natural language text to obtain a recommended answer text, which makes the recommended answer text more in-depth, making the recommended answer text complete and logical, and improving the quality of the recommended answer text.
[0039] It should also be noted that in response to determining that the difficulty level is less than the predetermined difficulty level, based on key semantics, information extraction and natural language generation are performed on the initial answer text and associated data to obtain a recommended answer text. In the case where the difficulty level is less than the predetermined difficulty level, it indicates that the difficulty of the question text is relatively simple. Based on key semantics, the question asked in the question text is clarified, and a targeted answer is given to the question. Since the difficulty of the question text is relatively simple at this time, it indicates that the previously determined initial answer text and associated data can accurately determine the recommended answer text, and information extraction and natural language processing are performed on the initial answer text and associated data to obtain a high-quality recommended answer text. By extracting information and generating natural language from the initial answer text and associated data, the obtained recommended answer text is complete and logical.
[0040] Based on the key semantics, the generative model uses the initial answer text, associated data and / or supplementary data to determine the recommended answer text, wherein the associated data is the data retrieved from the database using the question text and the initial answer text. The following embodiment specifically describes how to retrieve the associated data from the database.
[0041] In some embodiments, the associated data includes first associated data and second associated data; the retrieving associated data in a pre-constructed database based on the question text and the initial answer text includes: encoding the question text and the initial answer text respectively to obtain an encoded question text and an encoded initial answer text; retrieving the first associated data from the database based on the encoded question text; and retrieving the second associated data from the database based on the encoded initial answer text.
[0042] In this embodiment, since the data in the database is stored in a coded form, the question text and the initial answer text are encoded respectively for consistency of data matching to obtain the coded question text and the coded initial answer text. According to the coded question text, the first associated data is retrieved in the database, and according to the coded initial answer text, the second associated data is retrieved in the database. The associated data in this embodiment is not limited to the first associated data corresponding to the question text, but also includes the second associated data corresponding to the initial answer text, which expands the scope of the associated data, achieves the purpose of accurately finding the data with strong association with the question text and the initial answer text in the database, and ensures the comprehensiveness of the associated data.
[0043] The first associated data corresponding to the question text and the second associated data corresponding to the initial answer text are retrieved from the database. How to obtain the first associated data and the second associated data is specifically described through the following embodiment.
[0044] In some embodiments, the retrieving the first associated data from the database according to the encoded question text; retrieving the second associated data from the database according to the encoded initial answer text includes: performing key information parsing on the encoded question text to obtain first key information, and performing key information parsing on the encoded initial answer text to obtain second key information; in response to determining that a first paragraph containing the first key information is retrieved from the database, determining the decoded first paragraph as the first associated data, and in response to determining that a second paragraph containing the second key information is retrieved from the database, determining the decoded second paragraph as the second associated data.
[0045] In this embodiment, the encoded question text and the initial answer text may contain redundant information. In order to eliminate the influence of the redundant information, the encoded question text is analyzed for key information to obtain the first key information, and the encoded initial answer text is analyzed for key information to obtain the second key information. The irrelevant information in the question text and the initial answer text is filtered to obtain key information. The first key information can reflect the keywords in the question text, and the second key information can reflect the keywords in the initial answer text. The first paragraph containing the first key information is retrieved from the database, indicating that the question text matches the first paragraph. Since the first paragraph is an encoded paragraph, the first paragraph needs to be decoded and the decoded first paragraph is determined as the first associated data. The second paragraph containing the second key information is retrieved from the database, indicating that the initial answer text matches the second paragraph. Since the second paragraph is an encoded paragraph, the second paragraph needs to be decoded and the decoded second paragraph is determined as the second associated data. By matching key information in the database, the key information includes the streamlined encoded question text and the initial answer text, without redundant information, and thus the key information can be accurately matched in the database, thereby achieving the purpose of accurately screening the first related data and the second related data.
[0046] By searching in the database, the first associated data corresponding to the question text and the second associated data corresponding to the initial answer text are obtained through key information matching, wherein the initial answer text is generated by the generative model using the question text. The following embodiment specifically describes how to determine the question text.
[0047] In some embodiments, determining the question text associated with the user's question includes: receiving an initial question input by the user, and expanding the initial question with similar questions to obtain the question text.
[0048] In this embodiment, an initial question input by a user is received, wherein the initial question can be input by voice or text. Since the initial question is relatively simple, the answer obtained when answering the initial question later may not be comprehensive. Therefore, the initial question is expanded by similar questions to obtain a question text. Exemplarily, when the initial question input by the user is "Which is the most popular car model under brand X", after similarity expansion of the initial question, the question text obtained is "Which is the most popular / most loved / most admired car model under brand X". By similarity expansion of the initial question, multiple questions that are strongly related to the initial question are obtained, and the initial question and the multiple questions are combined to form a question text, so as to achieve the purpose of expanding the initial question and make the obtained question text more comprehensive.
[0049] After determining the question text, it is necessary to process the question text based on database retrieval and generative model. The following embodiment specifically describes how to construct a database.
[0050] In some embodiments, the method for constructing the database includes: acquiring original data, parsing the original data to obtain multiple paragraphs; encoding each paragraph to obtain an encoded paragraph, and storing the encoded paragraph in the database.
[0051] In this embodiment, the original data is obtained. For example, when the present application is applied to vehicle-side question and answer, the original data can be knowledge related to the automotive industry. There are the following disadvantages in directly storing the original data in the database: on the one hand, when searching, the original data is relatively long and cannot be searched in a distributed manner, resulting in relatively low retrieval efficiency; on the other hand, the adjacent data in the original data may not be highly correlated, resulting in inaccurate retrieval. In order to solve the above problems, the original data is parsed to obtain multiple paragraphs, and the original data is split into multiple paragraphs, thereby improving the efficiency and accuracy of the retrieval. Each paragraph is encoded, and the encoded paragraphs are stored in the database. By encoding the paragraphs, the consistency of data storage in the database is ensured, the retrieval efficiency is improved, and the storage space occupied by the paragraphs in the database is reduced.
[0052] In another embodiment provided by the present application, in response to determining that the original data includes graph data, keywords corresponding to the graph data are extracted, and the graph data and its corresponding keywords are associated and stored. The original data is parsed to obtain multiple paragraphs, and in response to determining that the graph data exists in the paragraph, the graph data is replaced with keywords corresponding to the graph data. For each paragraph, the above paragraph is encoded, and the encoded paragraph is stored in a database. In the case where the original data has graph data, the keywords corresponding to the graph data are extracted, and the graph data and its corresponding keywords are associated and stored. When the original data is parsed, the graph data exists in the paragraph in the form of keywords. The paragraph is encoded, and the encoded paragraph is stored in the database, and the database comprehensively contains all the data in the original data, so that subsequent retrieval is more accurate and comprehensive. It should also be noted that, according to actual needs, multiple paragraphs in the original data can also be converted into knowledge graphs, and multiple paragraphs can be stored in the database in the form of knowledge graphs. It is also possible to import multiple paragraphs in the original data into a graph database, convert multiple paragraphs into data, and store them as graph data. For example, tools such as Apache Hop and GES plug-ins can be used for data conversion.
[0053] In another embodiment provided in the present application, Figure 2As shown, this embodiment is applied to vehicle-side question and answer, obtains the automobile industry knowledge base, encodes (embedding) the paragraphs in the automobile industry knowledge base, and obtains the automobile industry vector library. The specific process is: obtain the automobile industry knowledge base, parse the automobile industry knowledge base, obtain multiple knowledge, encode the knowledge for each knowledge, obtain the encoded knowledge, and store the encoded knowledge in the automobile industry vector library. After the automobile industry vector library is built, the initial question input by the user is accepted, and the initial question is expanded by similar questions to obtain the question text. The question text is input into the LMM. For example, the question text can be "Introduce the Y model of car under the X brand". LLM generates and outputs the initial answer text based on the question text. For example, the initial answer text can be "The Y model car is the first model under the Z platform pure electric architecture of the X brand car. Since its launch in 2020, it has won wide recognition in the market with its retro-futuristic aesthetic design and excellent performance." The question text and the initial answer text are used to search in the automobile vector database. First, the question text and the initial answer text are encoded, and the encoded question text and the initial answer text are used to search in the automobile vector database to obtain the associated data 1 and associated data 2 corresponding to the question text, and the associated data 3 and associated data 4 corresponding to the initial answer text. For example, associated data 1 can be "Y model car has obtained E-NCAP five-star safety certification, China Electric Vehicle Fire Safety Index five-star safety certification, etc., and its safety performance has been authoritatively recognized", associated data 2 can be "Y model car provides a range of 401km to 501km to meet the travel needs of different users. At the same time, multiple functions of the whole series are optimized to enhance the driving experience", associated data 3 can be "Y model car combines retro aesthetics with future design, and adds new car colors such as puppet white and smoke cold gray, with upgraded appearance and more attractive", and associated data 4 can be "X brand car's Z platform is a global intelligent and modular automobile manufacturing platform created by X brand car". Using LLM, the initial answer text and associated data 1-4 are refined and summarized for the question text. The specific process is: the question text is parsed to obtain key semantics, the difficulty level of the question text is determined based on the key semantics, and when the difficulty level of the question text is less than the predetermined difficulty level, the recommended answer text is determined for the initial answer text and the associated data based on the key semantics. It should be added that when the difficulty level of the question text is greater than or equal to the predetermined difficulty level, the supplementary data corresponding to the initial answer text and the associated data is determined, and the recommended answer text is determined based on the key semantics, the initial answer text, the associated data and the supplementary data.This embodiment provides diversified answers to the question text based on data from multiple sources. It is not limited to the splicing of search results, but flexibly expands the answers to obtain a more in-depth recommended answer text. For example, the recommended answer text may be "Model Y is the first model built under the Z platform of brand X. In terms of performance, it provides a range of 401km to 501km to meet the travel needs of different users. At the same time, its safety performance has also been authoritatively recognized. In terms of appearance, it combines retro aesthetics with future design and has a variety of colors, making it more attractive." After determining the question text, this embodiment processes the information at least including the question text in the order of generative model-database-generative model. By reasonably setting the order of using the generative model and the database, an accurate and comprehensive recommended answer text can be determined only through the question text, thereby optimizing the user's question-answering experience and improving the user's satisfaction.
[0054] It should be noted that the method of the embodiment of the present application can be performed by a single device, such as a computer or server. The method of this embodiment can also be applied to a distributed scenario and completed by multiple devices cooperating with each other. In the case of such a distributed scenario, one of the multiple devices can only perform one or more steps in the method of the embodiment of the present application, and the multiple devices will interact with each other to complete the described method.
[0055] It should be noted that the above describes some embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the above embodiments and still achieve the desired results. In addition, the processes depicted in the accompanying drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0056] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a question-and-answer device.
[0057] refer to Figure 3 , the question-answering device comprises:
[0058] The first determination module 10 is configured to determine a question text associated with a question asked by a user, and determine an initial answer text corresponding to the question text through a generative model.
[0059] The retrieval module 20 is configured to retrieve related data in a pre-constructed database based on the question text and the initial answer text.
[0060] The second determination module 30 is configured to determine the recommended answer text through the generative model based on the question text, the initial answer text and the associated data.
[0061] Through the above device, the question text associated with the user's question is determined, and the initial answer text corresponding to the question text is determined through the generative model, which broadens the content contained in the answer text corresponding to the question text and makes the initial answer text richer. Based on the question text and the initial answer text, related data is retrieved from a pre-constructed database, making the obtained related data more diverse and avoiding the omission of strongly related data. Based on the question text, the initial answer text and the related data, the recommended answer text is determined through the generative model, which ensures both the accuracy of the recommended answer text and the comprehensiveness and richness of the recommended answer text.
[0062] In some embodiments, the second determination module 30 is further configured to parse the question text to obtain key semantics; determine the difficulty level of the question text based on the key semantics; in response to determining that the difficulty level is greater than or equal to a predetermined difficulty level, determine the initial answer text and the supplementary data corresponding to the associated data, and determine the recommended answer text based on the key semantics, the initial answer text, the associated data and the supplementary data.
[0063] In some embodiments, the second determination module 30 is further configured to search in a search engine to obtain supplementary data corresponding to the question text and the initial answer text, and based on the key semantics, perform information extraction and natural language generation on the initial answer text, the associated data and the supplementary data to obtain the recommended answer text.
[0064] In some embodiments, the retrieval module 20 is further configured so that the associated data includes first associated data and second associated data; respectively encode the question text and the initial answer text to obtain an encoded question text and an encoded initial answer text; retrieve the first associated data from the database based on the encoded question text; and retrieve the second associated data from the database based on the encoded initial answer text.
[0065] In some embodiments, the retrieval module 20 is further configured to perform key information analysis on the encoded question text to obtain first key information, and to perform key information analysis on the encoded initial answer text to obtain second key information; in response to determining that a first paragraph containing the first key information is retrieved from the database, the decoded first paragraph is determined as the first associated data, and in response to determining that a second paragraph containing the second key information is retrieved from the database, the decoded second paragraph is determined as the second associated data.
[0066] In some embodiments, the first determination module 10 is further configured to receive an initial question input by the user, and perform similar question expansion on the initial question to obtain the question text.
[0067] In some embodiments, the retrieval module 20 is also configured as a method for constructing the database, including: acquiring original data, parsing the original data to obtain multiple paragraphs; for each paragraph, encoding the paragraph to obtain the encoded paragraph, and storing the encoded paragraph in the database.
[0068] For the convenience of description, the above device is described in terms of functions divided into various modules. Of course, when implementing the present application, the functions of each module can be implemented in the same or multiple software and / or hardware.
[0069] The device of the above embodiment is used to implement the corresponding question-and-answer method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0070] Based on the same inventive concept, corresponding to any of the above-mentioned embodiments and methods, the present application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the question-and-answer method as described in any of the above embodiments is implemented.
[0071] Figure 4 A more specific schematic diagram of the hardware structure of an electronic device provided in this embodiment is shown, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other through the bus 1050 in the device.
[0072] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this specification.
[0073] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented by software or firmware, the relevant program codes are stored in the memory 1020 and are called and executed by the processor 1010.
[0074] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0075] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0076] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0077] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present specification, and does not necessarily include all the components shown in the figure.
[0078] The electronic device of the above embodiment is used to implement the corresponding question-and-answer method in any of the above embodiments, and has the beneficial effects of the corresponding method embodiment, which will not be repeated here.
[0079] Based on the same inventive concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a non-transitory computer-readable storage medium, wherein the non-transitory computer-readable storage medium stores computer instructions, and the computer instructions are used to enable the computer to execute the question-and-answer method described in any of the above embodiments.
[0080] The computer-readable medium of this embodiment includes permanent and non-permanent, removable and non-removable media, and information storage can be implemented by any method or technology. Information can be computer-readable instructions, data structures, modules of programs, or other data. Examples of computer storage media 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 memory technology, read-only compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device.
[0081] The computer instructions stored in the storage medium of the above embodiment are used to enable the computer to execute the question-and-answer method described in any of the above embodiments, and have the beneficial effects of the corresponding method embodiments, which will not be repeated here.
[0082] Based on the same concept, corresponding to any of the above-mentioned embodiment methods, the present application also provides a computer program product, including computer program instructions. When the computer program instructions are run on a computer, the computer executes the question-and-answer method described in any of the above embodiments, which has the beneficial effects of the corresponding method embodiments and will not be repeated here.
[0083] It should be noted that the embodiments of the present application can be further described in the following manner:
[0084] It is understandable that before using the technical solutions of each embodiment of the present disclosure, the type, scope of use, usage scenarios, etc. of the personal information involved will be informed to the user in an appropriate manner, and the user's authorization will be obtained.
[0085] For example, in response to receiving an active request from a user, a prompt message is sent to the user to clearly remind the user that the operation requested to be performed will require obtaining and using the user's personal information. Thus, the user can independently choose whether to provide personal information to software or hardware such as an electronic device, application, server, or storage medium that performs the operation of the technical solution of the present disclosure according to the prompt message.
[0086] As an optional but non-limiting implementation, in response to receiving the user's active request, the prompt information may be sent to the user in the form of a pop-up window, in which the prompt information may be presented in text form. In addition, the pop-up window may also carry a selection control for the user to choose "agree" or "disagree" to provide personal information to the electronic device.
[0087] It is understandable that the above notification and the process of obtaining user authorization are merely illustrative and do not constitute a limitation on the implementation of the present disclosure. Other methods that meet relevant laws and regulations may also be applied to the implementation of the present disclosure.
[0088] A person skilled in the art should understand that the discussion of any of the above embodiments is merely illustrative and is not intended to imply that the scope of the present application is limited to these examples. In line with the concept of the present application, the technical features in the above embodiments or different embodiments may be combined, the steps may be implemented in any order, and there are many other variations of the different aspects of the embodiments of the present application as described above, which are not provided in detail for the sake of simplicity.
[0089] In addition, to simplify the description and discussion, and in order not to make the embodiments of the present application difficult to understand, the known power supply / ground connection with the integrated circuit (IC) chip and other components may or may not be shown in the provided drawings. In addition, the device can be shown in the form of a block diagram to avoid making the embodiments of the present application difficult to understand, and this also takes into account the fact that the details of the implementation of these block diagram devices are highly dependent on the platform to be implemented in the embodiments of the present application (that is, these details should be fully within the scope of understanding of those skilled in the art). In the case of elaborating specific details (e.g., circuits) to describe exemplary embodiments of the present application, it is obvious to those skilled in the art that the embodiments of the present application can be implemented without these specific details or when these specific details are changed. Therefore, these descriptions should be considered to be illustrative rather than restrictive.
[0090] Although the present application has been described in conjunction with specific embodiments of the present application, many replacements, modifications and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory architectures (e.g., dynamic RAM (DRAM)) may use the embodiments discussed.
[0091] The embodiments of the present application are intended to cover all such substitutions, modifications and variations that fall within the broad scope of the present application. Therefore, any omissions, modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the embodiments of the present application should be included in the protection scope of the present application.
Claims
1. A question-answering method, characterized in that: include: Determine a question text associated with the user's question, and determine an initial answer text corresponding to the question text through a generative model; Based on the question text and the initial answer text, retrieve related data from a pre-built database; Based on the question text, the initial answer text and the associated data, a recommended answer text is determined by the generative model.
2. The method according to claim 1, characterized in that The determining the recommended answer text by the generative model based on the question text, the initial answer text and the associated data includes: Parsing the question text to obtain key semantics; Based on the key semantics, determining the difficulty level of the question text; In response to determining that the difficulty level is greater than or equal to a predetermined difficulty level, the initial answer text and supplementary data corresponding to the associated data are determined, and the recommended answer text is determined based on the key semantics, the initial answer text, the associated data and the supplementary data.
3. The method according to claim 2, characterized in that The determining of the supplementary data corresponding to the initial answer text and the associated data, and determining the recommended answer text based on the key semantics, the initial answer text, the associated data and the supplementary data, comprises: The supplementary data is obtained by searching in a search engine, and based on the key semantics, information extraction and natural language generation are performed on the initial answer text, the associated data and the supplementary data to obtain the recommended answer text.
4. The method according to claim 1, characterized in that The associated data includes first associated data and second associated data; The retrieving related data from a pre-built database based on the question text and the initial answer text includes: Encoding the question text and the initial answer text respectively to obtain an encoded question text and an encoded initial answer text; According to the encoded question text, the first associated data is retrieved from the database; according to the encoded initial answer text, the second associated data is retrieved from the database.
5. The method according to claim 4, characterized in that The step of retrieving the first associated data from the database according to the encoded question text and retrieving the second associated data from the database according to the encoded initial answer text includes: Performing key information analysis on the encoded question text to obtain first key information, and performing key information analysis on the encoded initial answer text to obtain second key information; In response to determining that a first paragraph containing the first key information is retrieved from the database, the decoded first paragraph is determined as the first associated data, and in response to determining that a second paragraph containing the second key information is retrieved from the database, the decoded second paragraph is determined as the second associated data.
6. The method according to claim 1, characterized in that The step of determining the question text associated with the user's question comprises: An initial question input by the user is received, and similar questions are expanded on the initial question to obtain the question text.
7. The method according to claim 1, characterized in that The method for constructing the database includes: Acquire original data, and parse the original data to obtain multiple paragraphs; For each paragraph, the paragraph is encoded to obtain an encoded paragraph, and the encoded paragraph is stored in the database.
8. A question-answering device, characterized in that: include: A first determination module is configured to determine a question text associated with a user's question, and determine an initial answer text corresponding to the question text through a generative model; A retrieval module is configured to retrieve related data from a pre-built database based on the question text and the initial answer text; The second determination module is configured to determine the recommended answer text through the generative model based on the question text, the initial answer text and the associated data.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 7 is implemented.
10. A vehicle, characterized in that: Includes the device according to claim 8 or the electronic device according to claim 9.