Question answer determination method and device and electronic equipment

By combining internal databases and external knowledge bases, using semantic vectors and keyword matching technology, and generative language model analysis, we solve the problems of low retrieval efficiency and inaccurate semantic matching in traditional question-answering systems, and achieve efficient and accurate answer generation.

CN120632023APending Publication Date: 2025-09-12CHINA TELECOM CORP LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202510697621.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-27
Publication Date
2025-09-12

AI Technical Summary

Technical Problem

Traditional question-answering systems have problems with low retrieval efficiency and inaccurate semantic matching, especially when dealing with complex or emerging dual-carbon domain knowledge, making it difficult to provide accurate and timely answers.

Method used

By obtaining the questions input by the user, combining the internal database and external knowledge base, using semantic vectors and keyword matching technology, we can determine the candidate phrases with the highest degree of relevance, and use the generative language model to analyze and generate answers.

Benefits of technology

It achieves efficient and accurate knowledge retrieval, improves the accuracy and coverage of the question-answering system in the dual-carbon field, and ensures the timeliness and quality of answers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120632023A_ABST
    Figure CN120632023A_ABST
Patent Text Reader

Abstract

The invention discloses a question answer determination method and device and electronic equipment. The method comprises the steps that a to-be-retrieved question input by a target object is obtained, a target document associated with the to-be-retrieved question is obtained, and the target document comprises an internal document in an internal database and real-time knowledge in an external knowledge base; determining a first semantic vector and a first keyword corresponding to the to-be-retrieved question, and determining a second semantic vector and a second keyword corresponding to the target document; according to the first semantic vector, the second semantic vector, the first keyword and the second keyword, determining a candidate phrase with the highest association degree with the to-be-retrieved question from the target document; and analyzing the candidate phrases by adopting a generative language model to obtain an answer to the to-be-retrieved question. According to the method and the device, the technical problems of low retrieval efficiency and inaccurate semantic matching in problem retrieval in related technologies are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and more specifically, to a method, device, and electronic device for determining answers to questions. Background Art

[0002] With the intensification of global climate change and the growing awareness of environmental protection, "low-carbon economy" has become an important issue in the global economic situation. Therefore, it is crucial to understand the relevant knowledge.

[0003] Relying on the development of artificial intelligence technology, intelligent question-answering systems have been widely used in multiple industries. By building an intelligent question-answering system for carbon-dioxide knowledge, users can quickly provide basic answers, bringing great convenience. However, traditional question-answering systems have technical issues such as low retrieval efficiency and inaccurate semantic matching.

[0004] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0005] The embodiments of the present application provide a method, device, and electronic device for determining the answer to a question, so as to at least solve the technical problems of low retrieval efficiency and inaccurate semantic matching in question retrieval in related technologies.

[0006] According to one aspect of an embodiment of the present application, a method for determining an answer to a question is provided, comprising: obtaining a question to be retrieved input by a target object, and obtaining a target document associated with the question to be retrieved, wherein the target document includes an internal document in an internal database and real-time knowledge in an external knowledge base; determining a first semantic vector and a first keyword corresponding to the question to be retrieved, and determining a second semantic vector and a second keyword corresponding to the target document; determining a candidate phrase with the highest degree of relevance to the question to be retrieved from the target document based on the first semantic vector, the second semantic vector, the first keyword, and the second keyword; and analyzing the candidate phrases using a generative language model to obtain an answer to the question to be retrieved.

[0007] Optionally, obtaining a target document associated with the question to be retrieved includes: extracting a first key entity in the question to be retrieved; determining an internal document from an internal database based on the first key entity; extracting a second key entity corresponding to the internal document; determining real-time knowledge from an external knowledge base based on the first key entity and the second key entity; and determining a target document based on the internal document and the real-time knowledge.

[0008] Optionally, determining the first semantic vector and first keyword corresponding to the question to be retrieved, and determining the second semantic vector and second keyword corresponding to the target document, includes: performing word segmentation processing on the question to be retrieved to obtain a first phrase set; encoding each phrase in the first phrase set to obtain a first semantic vector; determining the first keyword from the first phrase set; performing word segmentation processing on the target document to obtain a second phrase set; encoding each phrase in the second phrase set to obtain a second semantic vector; and determining the second keyword from the second phrase set.

[0009] Optionally, determining a candidate phrase with the highest degree of relevance to the question to be retrieved from the target document includes: determining the semantic similarity between the first semantic vector and the second semantic vector; determining the keyword matching degree between the first keyword and the second keyword; determining the relevance score between the question to be retrieved and the phrase in the target document based on the semantic similarity and the keyword matching degree; and determining the phrase with the highest relevance score as the candidate phrase.

[0010] Optionally, determining the association score between the question to be retrieved and the phrase in the target document includes: determining a first weight corresponding to the semantic similarity, and determining a second weight corresponding to the keyword matching degree; determining a first score based on the semantic similarity and the first weight; determining a second score based on the keyword matching degree and the second weight; and determining the association score based on the first score and the second score.

[0011] Optionally, the method further includes: determining a special token corresponding to the question to be retrieved, wherein the special token is used to represent context information of the question to be retrieved; fusing the context information and the candidate phrases to obtain fused information; and inputting the fused information into a generative language model.

[0012] Optionally, the method also includes: detecting the update status of the external knowledge base; when detecting that the external knowledge base has been updated, obtaining new documents in the external knowledge base; identifying key phrases and entities of the new documents, and converting the key phrases and entities into vector representations; and adding the vector representations to the existing phrase index library.

[0013] According to another aspect of an embodiment of the present application, a device for determining an answer to a question is also provided, including: an acquisition module for acquiring a question to be retrieved input by a target object, and acquiring a target document associated with the question to be retrieved, wherein the target document includes an internal document in an internal database and real-time knowledge in an external knowledge base; a first determination module for determining a first semantic vector and a first keyword corresponding to the question to be retrieved, and determining a second semantic vector and a second keyword corresponding to the target document; a second determination module for determining a candidate phrase with the highest degree of association with the question to be retrieved from the target document based on the first semantic vector, the second semantic vector, the first keyword and the second keyword; and an analysis module for analyzing the candidate phrases using a generative language model to obtain an answer to the question to be retrieved.

[0014] According to another aspect of the embodiments of the present application, an electronic device is also provided, including: a memory for storing program instructions; a processor, connected to the memory, for executing program instructions to implement the following functions: obtaining a question to be retrieved input by a target object, and obtaining a target document associated with the question to be retrieved, wherein the target document includes an internal document in an internal database and real-time knowledge in an external knowledge base; determining a first semantic vector and a first keyword corresponding to the question to be retrieved, and determining a second semantic vector and a second keyword corresponding to the target document; determining a candidate phrase with the highest degree of correlation with the question to be retrieved from the target document based on the first semantic vector, the second semantic vector, the first keyword and the second keyword; and analyzing the candidate phrase using a generative language model to obtain an answer to the question to be retrieved.

[0015] According to another aspect of an embodiment of the present application, a non-volatile storage medium is provided, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the method for determining the answer to the above question by running the computer program.

[0016] According to another aspect of the embodiments of the present application, a computer program product is provided, including computer instructions, which implement the method for determining the answer to the above question when executed by a processor.

[0017] In an embodiment of the present application, a question to be retrieved input by a target object is obtained, and a target document associated with the question to be retrieved is obtained, wherein the target document includes an internal document in an internal database and real-time knowledge in an external knowledge base; a first semantic vector and a first keyword corresponding to the question to be retrieved are determined, and a second semantic vector and a second keyword corresponding to the target document are determined; based on the first semantic vector, the second semantic vector, the first keyword and the second keyword, a candidate phrase with the highest degree of relevance to the question to be retrieved is determined from the target document; a generative language model is used to analyze the candidate phrases to obtain an answer to the question to be retrieved, thereby achieving the purpose of accurate matching and efficient retrieval, thereby achieving the technical effect of effectively improving the accuracy and coverage of questions and answers, and further solving the technical problems of low retrieval efficiency and inaccurate semantic matching in question retrieval in related technologies. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0019] Figure 1 is a hardware structure block diagram of a computer terminal for implementing a method for determining an answer to a question according to an embodiment of the present application;

[0020] Figure 2 is a flow chart of a method for determining an answer to a question according to an embodiment of the present application;

[0021] Figure 3 It is a structural diagram of a device for determining an answer to a question according to an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to enable those skilled in the art to better understand the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of this application.

[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in a sequence other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0024] The information collected in the embodiments of the present application is information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of the relevant data comply with the relevant laws, regulations and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good morals, and provide corresponding operation entrances for users to choose to authorize or reject the automated decision results; if the user chooses to reject, the expert decision-making process will be entered.

[0025] First, some nouns or terms that appear in the process of explaining the embodiments of this application are subject to the following explanations:

[0026] Dual carbon: This is the abbreviation for carbon peaking and carbon neutrality. Carbon peaking refers to the process in which carbon emissions reach a peak, then cease growth and gradually decline. Carbon neutrality means that within a specific timeframe, the future carbon emissions of each entity will be equal to the carbon absorbed.

[0027] Large Language Model (LLM): A language model consisting of an artificial neural network with many parameters (typically billions of weights or more), trained on a large amount of unlabeled text using self-supervised learning or semi-supervised learning.

[0028] RAG, or Retrieval Augmented Generation, optimizes the output of large language models to reference authoritative knowledge bases beyond the training data source before generating a response. Large language models (LLMs) are trained with massive amounts of data, using billions of parameters to generate original output for tasks such as answering questions, translating languages, and completing sentences. Building on the already powerful capabilities of LLMs, RAG extends them to access internal knowledge bases for specific domains or organizations, all without retraining the model. This is a cost-effective way to improve LLM output, keeping it relevant, accurate, and useful in a variety of contexts.

[0029] Knowledge Recall: In question-answering systems, knowledge recall refers to the process of retrieving relevant information or documents from a pre-established knowledge base based on a user's question. This process typically involves using retrieval algorithms or techniques, such as vector search, keyword matching, and semantic matching, to filter relevant information from a large knowledge base. The goal of knowledge recall is to improve the accuracy and coverage of the question-answering system, ensuring that users receive answers that meet their needs.

[0030] Prompt Learning: A machine learning method that aims to assist models in learning tasks by associating task objectives with corresponding prompt words or phrases. This method allows the model to better understand the semantics and context of the task, thereby improving its performance and effectiveness.

[0031] Prompt engineering: is a concept in artificial intelligence, specifically natural language processing (NLP). In prompt engineering, the description of the task is embedded in the input. For example, instead of implicitly giving the model certain parameters, the input is directly in the form of a question. Prompt engineering typically works by converting one or more tasks into a prompt-based dataset and training a language model through so-called "prompt-based learning". Prompt engineering can start from a large "frozen" pre-trained language model, where only the representation of the prompt is learned, which is so-called "prefix-tuning" or "prompt tuning".

[0032] Knowledge-enhanced phrase retrieval technology is a technique used to improve the quality of short text retrieval in question-answering systems. It combines information from external knowledge bases to semantically understand and enrich short texts, thereby improving the accuracy and relevance of retrieval results.

[0033] DensePhrases: is a method to improve the learning of dense phrase encoders without using sparse representations. This technique learns dense phrase representations through data augmentation and knowledge distillation, and further uses enhanced negative example training (considering both in-batch and pre-batch negative examples) and query-side tuning.

[0034] Traditional question-answering systems typically use a retrieval-based approach. This involves first building a knowledge base containing a large number of questions and answers. Then, when a user asks a question, the system performs keyword or semantic matching in the knowledge base, finds relevant answers, and returns them to the user. However, currently used intelligent question-answering systems suffer from the following major issues:

[0035] 1. Limitations of knowledge bases: Traditional question-answering systems rely on pre-built knowledge bases, but these often fail to cover all domains and emerging knowledge, making them unable to answer some complex or newer questions. Building new databases also requires significant time and manpower.

[0036] 2. Limitations of keyword matching: The retrieval method based on keyword matching is limited by the accuracy and completeness of keywords, and is prone to problems such as low recall rate and inaccurate results.

[0037] 3. Insufficient semantic understanding: Traditional question-answering systems often lack a deep understanding of the semantics of questions and are unable to understand the implicit meaning and context of questions. Moreover, due to the lack of language processing capabilities, the quality of the answers is limited.

[0038] Knowledge in the field of dual carbon usually involves a large number of complex scientific principles, specific technical applications, etc. Traditional retrieval-based question answering is beginning to be unable to meet actual application needs. With the development of technology, more and more solutions have begun to use large language models for question answering systems. Although large language models have excellent language understanding and generation capabilities, when dealing with specific fields, they are prone to "hallucinations" or wrong answers due to lack of domain knowledge or insufficient training data coverage. Through retrieval-augmented generation (RAG) technology, external knowledge bases can be combined to improve the accuracy of the model in answering questions in specific fields. However, when dealing with short texts and complex nouns, existing RAG systems have problems with low retrieval efficiency and inaccurate semantic matching. When retrieving short texts, they may make false detections due to a lack of deep understanding of phrases, affecting the quality of the answer. In addition, general RAGs lack the ability to call external knowledge in real time, resulting in the lack of freshness and timeliness of the generated answers.

[0039] In order to solve the problems existing in the related art, the embodiment of the present application provides a method for determining the answer to a question, which can be run on Figure 1 In the computer terminal shown, the computer terminal is explained below.

[0040] The method for determining the answer to a question provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG1 shows a hardware structure block diagram of a computer terminal for implementing a method for determining the answer to a question. Figure 1As shown, the computer terminal 10 may include one or more (illustrated by 102a, 102b, ..., 102n in the figure) processors (the processor may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission module 106 for communication functions connected via a wired and / or wireless network. In addition, it may also include: a display, a keyboard, a cursor control device, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the I / O interface), a network interface, and a BUS bus. It will be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the above electronic device. Figure 1 More or fewer components than shown, or with Figure 1 Different configurations shown.

[0041] It should be noted that the one or more processors and / or other data processing circuits described above may generally be referred to herein as "data processing circuitry." The data processing circuitry may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. Furthermore, the data processing circuitry may be a single, independent processing module, or may be incorporated in whole or in part into any of the other components of the computer terminal 10. As described in the embodiments of the present application, the data processing circuitry serves as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0042] The memory 104 can be used to store software programs and modules of application software, such as the program instructions / data storage device corresponding to the method for determining the answer to the question in the embodiment of the present application. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, realizing the above-mentioned method for determining the answer to the question. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include a memory remotely located relative to the processor, and these remote memories may be connected to the computer terminal 10 via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0043] The transmission module 106 is configured to receive or transmit data via a network. A specific example of the aforementioned network may include a wireless network provided by the communications provider of the computer terminal 10. In one embodiment, the transmission module 106 includes a network interface controller (NIC), which can be connected to other network devices via a base station to enable communication with the Internet. In another embodiment, the transmission module 106 may be a radio frequency (RF) module, which is configured to communicate with the Internet wirelessly.

[0044] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 .

[0045] It should be noted that, in some optional embodiments, the above Figure 1 The computer terminal shown may include hardware elements (including circuits), software elements (including computer code stored on a computer-readable medium), or a combination of hardware elements and software elements. Figure 1 This is merely one example of a particular embodiment and is intended to illustrate the types of components that may be present in the computer terminal described above.

[0046] In the above-mentioned operating environment, an embodiment of the present application provides an embodiment of a method for determining the answer to a question. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0047] Figure 2 is a flow chart of a method for determining an answer to a question according to an embodiment of the present application, such as Figure 2 As shown, the method includes the following steps:

[0048] Step S202 , obtaining the question to be retrieved input by the target object, and obtaining the target document associated with the question to be retrieved, wherein the target document includes internal documents in the internal database and real-time knowledge in the external knowledge base.

[0049] In the above step S202, for example, the user (i.e., the target object) submits a knowledge query about the dual carbon field to the system through the system interface or API interface, such as asking "What is the latest carbon neutrality policy?", which is the question to be retrieved. The system will first look for information related to the question in the internal database. The internal database is a knowledge base in the dual carbon field pre-built by the system, which contains a large number of documents, research materials, policy documents, etc. These internal documents are processed and indexed, and the system can locate the document fragments most relevant to the question through keyword matching, semantic retrieval, etc. In addition to the internal database, the system will also obtain the latest information from the external knowledge base in real time to ensure the timeliness and accuracy of the answer. External knowledge bases may include but are not limited to real-time news, academic papers, professional reports, etc. These knowledge sources usually contain the latest policy trends, scientific research results and technical application cases. Through the API interface or crawler technology, the system can automatically extract information from these knowledge sources and supplement it to the search results.

[0050] Step S204 : determining a first semantic vector and a first keyword corresponding to the query to be searched, and determining a second semantic vector and a second keyword corresponding to the target document.

[0051] In the above step S204, when the user inputs a question to be retrieved, the system first converts the question into a mathematical vector, namely the first semantic vector, through a query encoder (for example, a model based on DensePhrases). The first semantic vector not only contains the literal information of the question, but also contains the deep semantics of the question, such as the context, intention and theme of the question. Through semantic representation, the system can understand the true meaning of the question, not just the superficial keyword matching. At the same time, the system will also extract the first keyword in the question. The first keyword is usually the core element of the question, such as the entity name, professional terminology, etc. in the question. Keyword extraction usually uses natural language processing technology, such as named entity recognition (NER) and word frequency analysis, to determine the most important words in the question, which will be used in subsequent retrieval and matching processes.

[0052] The system will obtain target documents related to the question to be retrieved from internal databases and external knowledge bases. The target documents may contain a large amount of information. The system needs to extract meaningful phrases and entities from each document through preprocessing steps such as word segmentation, part-of-speech tagging, and phrase recognition to prepare for subsequent semantic representation and keyword extraction. The phrase encoder (also based on DensePhrases or other semantic representation models) encodes the phrases in the target document and generates a mathematical vector representation of each phrase, namely the second semantic vector. These vectors can capture the semantic information of the fragment, including the meaning of the phrase, the context, and the relationship with the document as a whole, providing semantic support for subsequent matching and retrieval. The second keyword extracted from the target document refers to the important vocabulary in the document that corresponds to the keyword of the question. Keyword extraction helps the system understand the key information of the document, so as to match and retrieve more accurately.

[0053] Step S206 : determining, from the target document, a candidate phrase that is most relevant to the query based on the first semantic vector, the second semantic vector, the first keyword, and the second keyword.

[0054] In step S206, a method such as cosine similarity is used to calculate the similarity between the first semantic vector of the user question and the second semantic vector of each phrase in the target document, thereby capturing the deep semantic relationship between the question and the document fragment. The first keyword of the user question is matched with the second keyword in the target document to improve the accuracy of the retrieval. Combining the scores of semantic similarity and keyword matching, a comprehensive evaluation is performed on each phrase in the target document to determine its degree of relevance to the user question. Based on the results of the above relevance evaluation, the system selects the candidate phrase with the highest degree of relevance from the target document, which can be one or more candidate phrases.

[0055] Step S208: Analyze the candidate phrases using a generative language model to obtain an answer to the question to be retrieved.

[0056] In the above step S208, the system calls a pre-trained generative language model (such as a Transformer-based model). The generative language model takes candidate phrases as input and integrates the contextual information and semantic relationships of these phrases. The model analyzes the meaning of each phrase and tries to understand the role they play in the overall document. Based on the in-depth understanding of the candidate phrases, the generative language model generates a coherent text answer that meets the user's question through a decoding process. After the answer is generated, the system may also perform additional optimization steps, such as grammar checking, spelling correction, logical reasoning, etc., to ensure the quality of the generated answer. Finally, the optimized answer will be presented to the user as a direct response to the user's question.

[0057] Through the above steps S202 to S208, the goals of accurate matching and efficient retrieval are achieved, thereby achieving the technical effect of effectively improving the accuracy and coverage of questions and answers, and further solving the technical problems of low retrieval efficiency and inaccurate semantic matching in question retrieval in related technologies. The following is an explanation.

[0058] In step S202 of the method for determining the answer to the above question, a target document associated with the question to be retrieved is obtained, including: extracting the first key entity in the question to be retrieved; determining the internal document from the internal database based on the first key entity; extracting the second key entity corresponding to the internal document; determining the real-time knowledge from the external knowledge base based on the first key entity and the second key entity; and determining the target document based on the internal document and the real-time knowledge.

[0059] In an embodiment of the present application, the system performs natural language processing (NLP) on the question to be searched entered by the user, and uses entity recognition technology to extract the first key entity in the question. The first key entity may include, for example, a specific policy name, technical term, place name, institution name, or other nouns related to the dual carbon field. Based on the extracted first key entity, the system retrieves relevant internal documents from the internal database. The internal database is a dual carbon knowledge base pre-built by the system, which contains a large number of policy documents, research reports, technical documents, etc. Through keyword matching or semantic similarity calculation, the system will determine the internal document most relevant to the first key entity. After the internal document is determined, the system will further perform entity recognition on the internal document and extract the second key entity therein. Based on the combination of the first key entity and the second key entity, the system can map to an external knowledge base through an entity connector and call the latest real-time information from the external knowledge base. The external knowledge base may include, for example, news, announcements, academic papers, industry reports, etc., which can provide more real-time and extensive background knowledge than the internal database. Through API interfaces or crawler technology, the system can automatically retrieve the latest knowledge related to the entity to ensure the timeliness and completeness of the answer. Finally, the system will comprehensively construct the target document based on internal documents and real-time knowledge. By using real-time external knowledge and entity recognition, the performance and effectiveness of traditional question-answering systems in vertical applications can be significantly improved.

[0060] In step S204 of the method for determining the answer to the above question, the first semantic vector and the first keyword corresponding to the question to be retrieved, and the second semantic vector and the second keyword corresponding to the target document are determined, including: performing word segmentation processing on the question to be retrieved to obtain a first phrase set; encoding each phrase in the first phrase set to obtain a first semantic vector; determining the first keyword from the first phrase set; performing word segmentation processing on the target document to obtain a second phrase set; encoding each phrase in the second phrase set to obtain a second semantic vector; and determining the second keyword from the second phrase set.

[0061] In an embodiment of the present application, the system performs word segmentation on the question to be retrieved input by the user, splitting it into a series of words or phrases to form a first phrase set. Word segmentation is a basic step in natural language processing, which helps the system understand the basic components of the text. For each phrase in the first phrase set, the system uses a pre-trained phrase encoder (such as a DensePhrases model) to convert it into a mathematical vector, i.e., a first semantic vector. The first semantic vector carries the semantic information of the phrase, which helps the system to perform deeper semantic matching in the knowledge base. From the first phrase set, the system determines the key words or phrases, i.e., the first keywords, through keyword extraction technology (such as based on word frequency, TF-IDF or named entity recognition, etc.).

[0062] The system also performs word segmentation on the target document, breaking it down into a series of words or phrases to form a second set of phrases. For each phrase in the second set, the system also uses a phrase encoder to convert it into a mathematical vector, the second semantic vector. The generation of the second semantic vector ensures that the system can understand the deeper meaning of the phrases in the document. From the second set of phrases, the system uses keyword extraction technology to identify key words or phrases in the document, the second keywords.

[0063] In step S206 of the method for determining the answer to the above question, a candidate phrase with the highest degree of relevance to the question to be retrieved is determined from the target document, including: determining the semantic similarity between the first semantic vector and the second semantic vector; determining the keyword matching degree between the first keyword and the second keyword; determining the relevance score between the question to be retrieved and the phrase in the target document based on the semantic similarity and the keyword matching degree; and determining the phrase with the highest relevance score as the candidate phrase.

[0064] In this embodiment of the present application, the semantic similarity between the first semantic vector corresponding to the question to be retrieved and the second semantic vector of each phrase in the target document is calculated by cosine similarity. The closer the semantic similarity is to 1, the higher the semantic association between the two. For example, if the user's question to be retrieved involves "the advantages of carbon capture policy", then the system will compare the similarity between the first semantic vector of this question and all phrase vectors (i.e., second semantic vectors) related to carbon capture policy in the target document. The formula is as follows:

[0065]

[0066] Where Q represents the first semantic vector, D represents the second semantic vector, and Cosine_Similarity represents the semantic similarity.

[0067] The system will evaluate the degree of match between the first keyword and the second keyword of the phrase in the target document. Keyword matching can be calculated, for example, by directly comparing whether the keywords appear or not. If the keywords are fully matched, the matching degree is high; if they are partially matched or not matched, the matching degree is low. For example, "carbon peak" is the first keyword. If it appears in a document phrase (such as the second keyword), the keyword matching degree is high. The system will calculate a comprehensive relevance score for each phrase based on semantic similarity and keyword matching. Finally, the system will sort the relevance scores of all phrases and select the phrase with the highest score as the candidate phrase. The candidate phrase is considered to be the most relevant to the question to be retrieved entered by the user, and thus becomes the preferred reference information source when the system generates an answer.

[0068] Through this process, the system can effectively identify the phrases in the target document that are most relevant to the search question, taking into account not only the literal meaning of the phrases but also their semantic relevance, significantly improving the accuracy and efficiency of knowledge retrieval. This approach is particularly suitable for tackling complex problems or knowledge retrieval in specialized fields. It can filter truly relevant information from massive amounts of data, reduce the interference of irrelevant results, and provide users with high-quality answers.

[0069] In the above steps, determining the association score between the query to be retrieved and the phrase in the target document includes: determining a first weight corresponding to the semantic similarity, and determining a second weight corresponding to the keyword matching degree; determining a first score based on the semantic similarity and the first weight; determining a second score based on the keyword matching degree and the second weight; and determining an association score based on the first score and the second score.

[0070] In an embodiment of the present application, in order to balance the impact of semantic similarity and keyword matching on phrase relevance, the system determines two weights: the first weight (α) corresponds to semantic similarity, and the second weight (β) corresponds to keyword matching. These two weights reflect the importance the system places on semantic understanding and keyword matching in a specific context. They can be pre-set fixed values ​​or dynamically adjusted through machine learning. The system determines the first score based on the semantic similarity and the first weight (α). This calculation usually uses the weighted product method, that is, the semantic similarity is multiplied by the first weight. For example, if the semantic similarity of a phrase is 0.8 and the first weight is set to 0.6, then the first score is 0.8 multiplied by 0.6, which equals 0.48. Similarly, the system determines the second score based on the keyword matching and the second weight (β). The keyword matching reflects the consistency between the keywords in the phrase and the keywords in the question, and the second weight is used to adjust the importance of this factor in the overall evaluation. If a phrase completely matches the keywords in the question, the keyword matching is 1, and the second weight is 0.4, then the second score is 1 multiplied by 0.4, which equals 0.4. Finally, the system will determine the comprehensive relevance score between the phrase and the question based on the first score and the second score. This score is usually calculated by adding the first score and the second score or using a more complex integral formula. For example, in the example above, the phrase's first score is 0.48 and the second score is 0.4. The relevance score is 0.48 plus 0.4, which equals 0.88. The formula for the overall process can be summarized as follows:

[0071] Correlation score = α·Cosine_Similarity + β·Keyword_Match

[0072] Among them, Keyword_Match represents the matching degree of the above keywords.

[0073] In the above-mentioned method for determining the answer to the question, the method further includes: determining a special token corresponding to the question to be retrieved, wherein the special token is used to represent context information of the question to be retrieved; fusing the context information and the candidate phrases to obtain fused information; and inputting the fused information into a generative language model.

[0074] In an embodiment of the present application, a special token is a symbol used to carry additional information in natural language processing. They are generally used to mark special parts of questions or texts, such as entities, emotional colors, instructions, etc. In an embodiment of the present application, special tokens are used to represent the contextual information of the question to be retrieved, that is, the domain knowledge, time information, geographic location or other key parameters implicit in the question. After determining the special tokens, the system will fuse these special tokens with the candidate phrases selected from the target document to form fused information. The fused information contains the detailed content of the candidate phrases, as well as the contextual information of the question to be retrieved represented by the special tokens, such as key details such as time, place, and object. This fusion ensures that the model not only refers to the information of the candidate phrases themselves when generating answers, but also fully considers the background and context of the question, thereby improving the accuracy of the answer. Finally, the system passes the fused information as input to the generative language model.

[0075] In the method for determining the answer to the above question, the method also includes: detecting the update status of the external knowledge base; when detecting that the external knowledge base has been updated, obtaining new documents in the external knowledge base; identifying key phrases and entities of the new documents, and converting the key phrases and entities into vector representations; and adding the vector representations to the existing phrase index library.

[0076] In an embodiment of the present application, the system periodically or in real time detects the update status of the external knowledge base. For example, this can be achieved by setting up a monitoring mechanism, such as using API polling, RSS subscriptions, file change notifications, etc., to detect whether new documents or information have been added to the external knowledge base. When the system detects an update in the external knowledge base, it automatically crawls these newly added documents. For example, this involves using web crawler technology to download newly released files from a website, or directly obtaining updated information from a data source through an API interface. The system performs natural language processing on the acquired new documents, including word segmentation, phrase recognition, and entity recognition. This process aims to extract key information units from the document, such as policy names, technical terms, time, location, etc., for subsequent vectorization processing. For example, "carbon capture and storage technology" as an entity needs to be accurately identified from the new documents. A pre-trained model (such as a DensePhrases model) is used to convert the identified key phrases and entities into vector representations. Vectorization is a common data preprocessing step in machine learning, which converts text information into mathematical vectors for easy calculation and processing. For example, the DensePhrases model is used to convert the key phrase "carbon emission standards" into corresponding semantic vectors. The system adds the converted vector representations to the existing phrase index. The phrase index is a database containing a large number of phrase vectors that supports efficient phrase-level search. The newly added vector representations expand the index's content, improving the scope and precision of the system's search and ensuring that subsequent Q&A sessions reference the latest knowledge. This approach effectively addresses the issues of lagging knowledge base updates and insufficient information coverage in traditional Q&A systems, enhancing the system's practical value and user experience.

[0077] The method for determining answers to questions provided in the embodiments of this application first decomposes the question after the user asks it, specifically targeting uncertain or complex terms and phrases, and accurately extracting key phrases through phrase recognition technology. Next, the system integrates phrase vector embedding with external knowledge bases to enhance search breadth and support unified retrieval of multi-source knowledge, ensuring that the system can access high-quality information from different knowledge sources, thereby improving the accuracy, breadth, and coverage of the question-and-answer results.

[0078] In some other embodiments of the present application, the system can also combine information in various forms such as text, pictures and voice to understand and answer users' questions from different angles and perspectives. For example, users can ask questions through text descriptions, uploading pictures or voice input. The system can make comprehensive use of these different forms of information to understand the user's intentions and select appropriate knowledge sources to answer based on the characteristics of the questions. At the same time, the system can also present answers to users in various forms, such as text, tables, pictures, voice or video, to meet the different needs and preferences of users. This method can further enhance the intelligence level and user experience of the question-answering system, allowing users to obtain the required information more conveniently, and providing new possibilities for promoting the expansion of the knowledge question-answering system to more fields and application scenarios. The specific implementation process is as follows:

[0079] 1. User input in multiple modes: Users can enter questions using text, images, or voice. Example: A user uploads a picture of a wind turbine and asks about its power consumption.

[0080] 2. Multimodal Information Analysis: Image Analysis: Extracts device information from images using a large multimodal model and generates a description. Speech-to-Text: Translates user voice input into text.

[0081] 3. Multimodal Information Fusion and Query Generation: The system combines image descriptions, spoken text, and user text input into a complete query. This query is then embedded using the DensePhrases model and relevant phrases are retrieved from the index.

[0082] 4. Answer generation and presentation: The system generates answers based on the search results and returns them in various forms such as text, pictures or voice according to user needs.

[0083] Figure 3 is a structural diagram of a device for determining an answer to a question according to an embodiment of the present application, such as Figure 3 As shown, the device includes:

[0084] An acquisition module 30 is configured to acquire a question to be retrieved input by a target object and acquire a target document associated with the question to be retrieved, wherein the target document includes an internal document in an internal database and real-time knowledge in an external knowledge base;

[0085] A first determining module 32 is configured to determine a first semantic vector and a first keyword corresponding to the query to be searched, and a second semantic vector and a second keyword corresponding to the target document;

[0086] A second determining module 34 is configured to determine, from the target document, a candidate phrase that is most relevant to the query based on the first semantic vector, the second semantic vector, the first keyword, and the second keyword;

[0087] The analysis module 36 is used to analyze the candidate phrases using a generative language model to obtain answers to the questions to be retrieved.

[0088] Through the acquisition module, first determination module, second determination module and analysis module in the above-mentioned device for determining the answer to the question, the purpose of accurate matching and efficient retrieval is achieved, thereby realizing the technical effect of effectively improving the accuracy and coverage of questions and answers, and further solving the technical problems of low retrieval efficiency and inaccurate semantic matching in question retrieval in related technologies.

[0089] In the acquisition module in the device for determining the answer to the above-mentioned question, the acquisition module is also used to extract the first key entity in the question to be retrieved; determine the internal document from the internal database based on the first key entity; extract the second key entity corresponding to the internal document; determine the real-time knowledge from the external knowledge base based on the first key entity and the second key entity; and determine the target document based on the internal document and the real-time knowledge.

[0090] In the first determination module in the above-mentioned device for determining the answer to the question, the first determination module is also used to perform word segmentation processing on the search question to obtain a first phrase set; encode each phrase in the first phrase set to obtain a first semantic vector; determine the first keyword from the first phrase set; perform word segmentation processing on the target document to obtain a second phrase set; encode each phrase in the second phrase set to obtain a second semantic vector; and determine the second keyword from the second phrase set.

[0091] In the second determination module in the above-mentioned device for determining the answer to the question, the second determination module is also used to determine the semantic similarity between the first semantic vector and the second semantic vector; determine the keyword matching degree between the first keyword and the second keyword; determine the association score between the question to be retrieved and the phrase in the target document based on the semantic similarity and the keyword matching degree; and determine the phrase with the highest association score as the candidate phrase.

[0092] In the second determination module in the device for determining the answer to the above-mentioned question, the second determination module is also used to determine a first weight corresponding to the semantic similarity, and to determine a second weight corresponding to the keyword matching degree; determine a first score based on the semantic similarity and the first weight; determine a second score based on the keyword matching degree and the second weight; and determine a correlation score based on the first score and the second score.

[0093] The apparatus for determining the answer to the above-mentioned question also includes a processing module 38, which is further used to determine a special token corresponding to the question to be retrieved, wherein the special token is used to represent the context information of the question to be retrieved; fuse the context information and the candidate phrases to obtain fused information; and input the fused information into the generative language model.

[0094] In the processing module in the device for determining the answer to the above question, the processing module is also used to detect the update status of the external knowledge base; when an update of the external knowledge base is detected, obtain the new documents in the external knowledge base; identify the key phrases and entities of the new documents, and convert the key phrases and entities into vector representations; and add the vector representations to the existing phrase index library.

[0095] It should be noted that Figure 3 The apparatus for determining the answer to the question shown is used to perform Figure 2 The method for determining the answer to the question shown in the figure, therefore the relevant explanations in the above method for determining the answer to the question are also applicable to the device for determining the answer to the question, and will not be repeated here.

[0096] An embodiment of the present application also provides an electronic device, which includes a memory and a processor, wherein the memory is used to store program instructions; the processor is connected to the memory and is used to execute program instructions to implement the following functions: obtaining a question to be retrieved input by a target object, and obtaining a target document associated with the question to be retrieved, wherein the target document includes internal documents in an internal database and real-time knowledge in an external knowledge base; determining a first semantic vector and a first keyword corresponding to the question to be retrieved, and determining a second semantic vector and a second keyword corresponding to the target document; determining a candidate phrase with the highest degree of correlation with the question to be retrieved from the target document based on the first semantic vector, the second semantic vector, the first keyword and the second keyword; and analyzing the candidate phrases using a generative language model to obtain an answer to the question to be retrieved.

[0097] It should be noted that the above electronic equipment is used to perform Figure 2 The method for determining the answer to the question shown in the figure, therefore the relevant explanations in the method for determining the answer to the question above are also applicable to the electronic device and will not be repeated here.

[0098] An embodiment of the present application also provides a non-volatile storage medium, which includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the following method for determining the answer to the question by running the computer program: obtaining the question to be retrieved input by the target object, and obtaining the target document associated with the question to be retrieved, wherein the target document includes internal documents in an internal database and real-time knowledge in an external knowledge base; determining a first semantic vector and a first keyword corresponding to the question to be retrieved, and determining a second semantic vector and a second keyword corresponding to the target document; determining a candidate phrase with the highest degree of correlation with the question to be retrieved from the target document based on the first semantic vector, the second semantic vector, the first keyword and the second keyword; and using a generative language model to analyze the candidate phrase to obtain the answer to the question to be retrieved.

[0099] It should be noted that the above non-volatile storage medium is used to execute Figure 2 The method for determining the answer to the question shown in the figure, therefore the relevant explanations in the above method for determining the answer to the question are also applicable to the non-volatile storage medium and will not be repeated here.

[0100] An embodiment of the present application also provides a computer program product, including computer instructions, which, when executed by a processor, implement the steps of the method for determining the answer to the question in each embodiment of the present application.

[0101] An embodiment of the present application also provides a computer program, which, when executed by a processor, implements the steps of the method for determining the answer to the question in each embodiment of the present application.

[0102] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0103] In the above embodiments of the present application, the description of each embodiment has its own focus. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0104] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only exemplary. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0105] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0106] In addition, the functional units in the various embodiments of the present application may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0107] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk.

[0108] The above is only a preferred embodiment of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for determining an answer to a question, characterized in that: include: Obtaining a question to be retrieved input by a target object, and obtaining a target document associated with the question to be retrieved, wherein the target document includes an internal document in an internal database and real-time knowledge in an external knowledge base; Determining a first semantic vector and a first keyword corresponding to the question to be searched, and determining a second semantic vector and a second keyword corresponding to the target document; Determining, from the target document, a candidate phrase that has the highest degree of relevance to the question to be searched based on the first semantic vector, the second semantic vector, the first keyword, and the second keyword; A generative language model is used to analyze the candidate phrases to obtain an answer to the question to be retrieved.

2. The method according to claim 1, characterized in that Obtaining target documents associated with the query to be retrieved, including: Extracting the first key entity in the question to be retrieved; determining an internal document from an internal database based on the first key entity; Extracting a second key entity corresponding to the internal document; determining real-time knowledge from an external knowledge base based on the first key entity and the second key entity; The target document is determined according to the internal document and the real-time knowledge.

3. The method according to claim 1, characterized in that Determining a first semantic vector and a first keyword corresponding to the question to be searched, and determining a second semantic vector and a second keyword corresponding to the target document, includes: Performing word segmentation processing on the question to be searched to obtain a first phrase set; Encoding each phrase in the first phrase set to obtain the first semantic vector; determining the first keyword from the first phrase set; Performing word segmentation processing on the target document to obtain a second phrase set; Encoding each phrase in the second phrase set to obtain the second semantic vector; The second keyword is determined from the second phrase set.

4. The method according to claim 1, wherein Determining, from the target document, a candidate phrase that is most relevant to the question to be searched, including: determining a semantic similarity between the first semantic vector and the second semantic vector; determining a keyword matching degree between the first keyword and the second keyword; Determining a relevance score between the query to be searched and the phrases in the target document based on the semantic similarity and the keyword matching degree; The phrase with the highest relevance score is determined as the candidate phrase.

5. The method according to claim 4, characterized in that Determining a relevance score between the query to be searched and a phrase in the target document includes: Determining a first weight corresponding to the semantic similarity, and determining a second weight corresponding to the keyword matching degree; determining a first score based on the semantic similarity and the first weight; Determining a second score based on the keyword matching degree and the second weight; The association score is determined according to the first score and the second score.

6. The method according to claim 1, characterized in that The method further comprises: Determining a special token corresponding to the question to be retrieved, wherein the special token is used to represent context information of the question to be retrieved; fusing the context information and the candidate phrase to obtain fused information; The fusion information is input into the generative language model.

7. The method according to claim 1, characterized in that The method further comprises: Detecting the update status of the external knowledge base; When an update to the external knowledge base is detected, obtaining a new document in the external knowledge base; Identifying key phrases and entities of the newly added document, and converting the key phrases and entities into vector representations; The vector representation is added to the existing phrase index library.

8. A device for determining an answer to a question, characterized in that: include: An acquisition module, configured to acquire a question to be retrieved input by a target object, and acquire a target document associated with the question to be retrieved, wherein the target document includes an internal document in an internal database and real-time knowledge in an external knowledge base; A first determining module is configured to determine a first semantic vector and a first keyword corresponding to the query to be searched, and a second semantic vector and a second keyword corresponding to the target document; A second determining module is configured to determine, from the target document, a candidate phrase that is most relevant to the query to be searched based on the first semantic vector, the second semantic vector, the first keyword, and the second keyword; The analysis module is used to analyze the candidate phrases using a generative language model to obtain an answer to the question to be retrieved.

9. An electronic device, characterized in that: include: a memory for storing program instructions; A processor, connected to the memory, is used to execute program instructions that implement the following functions: obtaining a question to be retrieved input by a target object, and obtaining a target document associated with the question to be retrieved, wherein the target document includes an internal document in an internal database and real-time knowledge in an external knowledge base; determining a first semantic vector and a first keyword corresponding to the question to be retrieved, and determining a second semantic vector and a second keyword corresponding to the target document; determining a candidate phrase with the highest degree of association with the question to be retrieved from the target document based on the first semantic vector, the second semantic vector, the first keyword, and the second keyword; and analyzing the candidate phrase using a generative language model to obtain an answer to the question to be retrieved.

10. A non-volatile storage medium, characterized in that: The non-volatile storage medium includes a stored computer program, wherein the device where the non-volatile storage medium is located executes the method for determining the answer to the question as described in any one of claims 1 to 7 by running the computer program.

11. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the method for determining the answer to a question as claimed in any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Supplier analysis method, electronic device and computer program product

    CN121210634A

  • Double-flow recording traceability and answer presentation method based on asynchronous triggering and semantic anchor points

    CN121708917A