A query rewriting method, electronic device, storage medium and program product

CN122925619APending Publication Date: 2026-10-16BEIJING CO WHEELS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510405483.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-01
Publication Date
2026-10-16

AI Technical Summary

Technical Problem

[0003]在实际应用中,用户输入的查询(即query)往往是不完整或含糊的,这会导致检索结果质量下降;因此,查询改写成为提升RAG系统性能的关键环节

Benefits of technology

[0013]本申请实施例的技术方案,通过获取用户的待查询问题;根据所述待查询问题进行事件召回,确定所述待查询问题对应的第一召回事件;根据所述待查询问题和所述第一召回事件进行问题改写,得到目标问题,优化查询改写过程,提高查询改写有效性,提升检索性能,解决无法准确进行检索的问题;通过对待查询问题进行事件召回,确定其对应的第一召回事件,通过第一召回事件对事件要素进行准确描述,捕捉与问题相关的事件信息,基于第一召回事件对待查询问题进行有效改写,将相关的事件信息融入至查询改写过程,得到目标问题,改写后的目标问题可以准确对问题进行描述,以提高问答结果的准确性。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122925619A_ABST
    Figure CN122925619A_ABST
Patent Text Reader

Abstract

The application discloses a query rewriting method, an electronic device, a storage medium and a program product; the method comprises the following steps: obtaining a to-be-queried question of a user; performing event recall according to the to-be-queried question, and determining a first recalled event corresponding to the to-be-queried question; performing question rewriting according to the to-be-queried question and the first recalled event, and obtaining a target question, so that the query rewriting process is optimized, the query rewriting effectiveness is improved, the retrieval performance is improved, and the problem that the retrieval cannot be accurately performed is solved; through the event recall on the to-be-queried question, the first recalled event corresponding to the to-be-queried question is determined, the event elements are accurately described through the first recalled event, the event information related to the question is captured, the to-be-queried question is effectively rewritten based on the first recalled event, the related event information is integrated into the query rewriting process, the target question is obtained, and the rewritten target question can accurately describe the question, so that the accuracy of the question and answer result is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a query rewriting method, electronic device, storage medium, and program product. Background Technology

[0002] With the development of Artificial Intelligence (AI) technology, knowledge question answering using Large Language Models (LLMs) has become an effective data search method. While LLMs incorporate a large amount of knowledge during training, they face the challenge of knowledge updating, as the model cannot automatically acquire new information that emerges after training. Retrieval-Augmented Generation (RAG) serves as a solution, enhancing the model's output by dynamically retrieving external knowledge during inference. However, the effectiveness of RAG systems largely depends on the accuracy of the retrieval phase.

[0003] In practical applications, user-input queries are often incomplete or ambiguous, leading to a decline in the quality of search results. Therefore, query rewriting becomes a crucial step in improving the performance of RAG systems. In real-world scenarios, user queries are frequently closely related to specific events, but traditional semantic-level rewriting cannot effectively capture the contextual information associated with these events. Consequently, rewriting user queries is ineffective, and accurate retrieval cannot be achieved based on the rewritten query. Therefore, how to effectively rewrite queries remains a problem to be solved. Summary of the Invention

[0004] This application provides a query rewriting method, electronic device, storage medium, and program product that optimize query rewriting and improve retrieval performance.

[0005] According to one aspect of this application, a query rewriting method is provided, comprising: obtaining a user's query question;

[0006] Based on the query question, an event recall is performed to determine the first recall event corresponding to the query question;

[0007] The target question is obtained by rewriting the question based on the question to be queried and the first recall event.

[0008] According to another aspect of this application, an electronic device is provided, the electronic device comprising:

[0009] At least one processor, and a memory communicatively connected to said at least one processor;

[0010] The memory stores a computer program that can be executed by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the query rewrite method described in any embodiment of this application.

[0011] According to another aspect of this application, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the query-rewrite method described in any embodiment of this application.

[0012] According to another aspect of this application, a computer program product is provided, the computer program product including a computer program that, when executed by a processor, implements the query rewrite method described in any embodiment of this application.

[0013] The technical solution of this application embodiment obtains the user's query question; performs event recall based on the query question to determine the first recall event corresponding to the query question; rewrites the query question based on the query question and the first recall event to obtain the target question, optimizes the query rewriting process, improves the effectiveness of query rewriting, enhances retrieval performance, and solves the problem of inaccurate retrieval; by performing event recall on the query question to determine its corresponding first recall event, accurately describes the event elements through the first recall event, captures event information related to the question, effectively rewrites the query question based on the first recall event, integrates the relevant event information into the query rewriting process, and obtains the target question. The rewritten target question can accurately describe the problem, thereby improving the accuracy of the question-and-answer results.

[0014] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of this application, nor is it intended to limit the scope of this application. Other features of this application will become readily apparent from the following description. Attached Figure Description

[0015] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0016] Figure 1 This is a flowchart of a query rewriting method provided according to Embodiment 1 of this application;

[0017] Figure 2 This is a flowchart of a query rewriting method provided according to Embodiment 2 of this application;

[0018] Figure 3 This is an example diagram of a periodic event provided according to Embodiment 2 of this application;

[0019] Figure 4 This is an example diagram of another periodic event provided according to Embodiment 2 of this application;

[0020] Figure 5 This is an example diagram of a long-term event provided according to Embodiment 2 of this application;

[0021] Figure 6 This is a flowchart of a query rewriting method provided according to Embodiment 3 of this application;

[0022] Figure 7 This is an example diagram of a query-rewritten question-and-answer implementation provided in Embodiment 3 of this application;

[0023] Figure 8 This is a schematic diagram of a query rewrite device according to Embodiment 4 of this application;

[0024] Figure 9 This is a schematic diagram of the structure of an electronic device that implements the question-and-answer result display method of the embodiments of this application. Detailed Implementation

[0025] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present application, and not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative effort should fall within the scope of protection of the present application.

[0026] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0027] Example 1

[0028] Figure 1This is a flowchart illustrating a query rewriting method provided in Embodiment 1 of this application. This embodiment is applicable to situations requiring accurate and effective query rewriting. The method can be executed by a query rewriting device, which can be implemented in hardware and / or software and can be configured in an electronic device. Figure 1 As shown, the method includes:

[0029] S101. Obtain the user's query question.

[0030] In this embodiment, the query question can be understood as the question that needs to be queried, such as in which year the first Olympic Games were held, or who won the first gold medal at the Beijing Olympics in which event, and so on.

[0031] The query question can be manually entered by the user, for example, through a physical keyboard or virtual keyboard in the corresponding data input window, and this execution entity acquires the user's input query question. Alternatively, the user can input relevant information through voice, body movements, etc., and this execution entity determines the user's query question by acquiring the user's input information, processing and parsing it accordingly; for example, by collecting the user's voice through a voice sensor, the user can directly output the query question through voice, or by wearing a dedicated device (e.g., an EEG cap) to output brain-computer interface commands to indicate the query question, or by collecting the user's eye movement data through an eye-tracking device, the user can indicate the query question through changes in eye movements, and so on.

[0032] S102. Based on the query question, perform event recall and determine the first recall event corresponding to the query question.

[0033] In this embodiment, the first recall event can be understood as an event selected from different events that has a certain correlation with the query question. For example, the first recall event is the Tokyo Olympics, which includes information such as the event time and location. The number of first recall events can be one, multiple, or zero. The number of first recall events can be preset. For example, if the number of first recall events is preset to one, the event with the best matching effect is selected as the first recall event during event recall. Alternatively, the number of first recall events is not limited. During event recall, events that meet certain requirements are selected as the first recall events. In this case, any event that meets the requirements can be used as the first recall event. The number of first recall events is determined according to the actual situation each time a query is performed, and it is not unique.

[0034] Different events are pre-collected, and the semantic information contained in the query question is analyzed. Based on the semantic information contained in the query question and the information of the events, events that match the semantic information contained in the query question are identified. For example, the similarity between the semantic information of the query question and the information of the events can be calculated. Similarity can be calculated according to the whole text, long text segmentation, short text segmentation, etc., and the similarity can be word similarity, text similarity, vector similarity (i.e., text converted into vectors), etc. Events that match the query question are determined based on the magnitude of the similarity. Events that match the query question are used as the first recall events.

[0035] S103. Rewrite the question based on the question to be queried and the first recall event to obtain the target question.

[0036] In this embodiment, the target problem can be understood as the problem obtained by rewriting the query problem.

[0037] The process involves analyzing the query question and the first recall event. The first recall event provides corresponding event information, which may include important details such as time and location, offering a basis and reference for question rewriting. Based on the reference information provided by the first recall event, the query question is rewritten to obtain the target question. Question rewriting can be achieved through neural network models, predefined rules, etc. The target question, obtained through question rewriting, accurately describes the problem because it incorporates relevant information from the first recall event. Based on the target question, a new question-and-answer session can be conducted to obtain an accurate answer.

[0038] For example, the query question and the first recall event are input into the rewriting model to rewrite the question, resulting in the target question. The rewriting model can be understood as a pre-trained large language model, a type of large-scale language model based on deep learning, trained on massive amounts of text data, capable of understanding and generating human language. Training samples are collected beforehand for model training to obtain the rewriting model; the rewriting model can be trained offline using LLM technology; the trained rewriting model can rewrite the question based on the input question and event, and output the rewritten question. The query question and the first recall event are used as input to the model, fed into the rewriting model. The rewriting model rewrites the question based on the knowledge learned during training and outputs the rewritten question. The question output by the rewriting model is taken as the target question.

[0039] The query rewriting method provided in this application embodiment obtains a user's query question; performs event recall based on the query question to determine a first recall event corresponding to the query question; rewrites the query question based on the query question and the first recall event to obtain a target question, optimizing the query rewriting process, improving query rewriting effectiveness, enhancing retrieval performance, and solving the problem of inaccurate retrieval; by performing event recall on the query question to determine its corresponding first recall event, accurately describing event elements through the first recall event, capturing event information related to the question, and effectively rewriting the query question based on the first recall event, integrating relevant event information into the query rewriting process to obtain the target question, the rewritten target question can accurately describe the problem, thereby improving the accuracy of question-and-answer results.

[0040] Example 2

[0041] Figure 2 This is a flowchart illustrating a query rewriting method provided in Embodiment 2 of this application. This embodiment is a refinement based on the above embodiments. Figure 2 As shown, the method includes:

[0042] S201. Obtain the user's query question.

[0043] S202. Vectorize the query problem to obtain the query vector.

[0044] In this embodiment, the query vector can be understood as a vector with query requirements. The query vector can be a multi-dimensional vector. In general, in order to accurately describe the information, the query vector is a high-dimensional vector.

[0045] The query is vectorized according to a predetermined vectorization method, converting the query from text into a vector, and the resulting vector is used as the query vector. Vectorization methods can include the Bag of Words (BoW) model, Term Frequency-Inverse Document Frequency (TF-IDF), etc.

[0046] S203. Query the event database according to the query vector to determine the first recall candidate event.

[0047] In this embodiment, the event library can be understood as a database formed based on different events. The event library can directly store different events, or it can store vectors formed by different events. A vector can use a set of ordered values ​​to represent some information, such as a feature vector or an embedding vector, etc. The first recall candidate event can be understood as an event recalled from the event library. This event can be used as a candidate event to determine the first recall event.

[0048] The query is performed on the event database based on the query vector. If the database stores events, these events are vectorized, and the similarity between the query vector and the vectors of each event is calculated. The first batch of candidate events for recall is determined based on this similarity. For example, events with similarity above a certain threshold can be selected as the first batch of candidate events, or the ten most similar events can be selected. If the database stores vectors corresponding to events, the similarity between the query vector and the vectors of each event is directly calculated, and the first batch of candidate events for recall is determined based on this similarity. The method for determining the first batch of candidate events based on similarity can be found in the description above. Alternatively, events can be stored in one database, and the corresponding vectors can be stored in another database. A correspondence between events and vectors can be established, and the similarity between the query vector and each vector can be calculated. Vectors with higher similarity are selected based on the magnitude of the similarity. Based on the correspondence between vectors and events, the event database is queried to determine the events corresponding to the vectors with higher similarity, and these events are selected as the first batch of candidate events for recall.

[0049] S204. In response to the existence of a first recall candidate event that matches the query question in the first recall candidate event, the first recall candidate event that matches the query question is determined as the first recall event.

[0050] The analysis of whether each primary recall candidate event matches the query question can be performed using algorithms, rules, or other methods. If a primary recall candidate event matches the query question, it is designated as the primary recall event, and primary recall candidate events that do not match the query question are filtered out. If no primary recall candidate event matches the query question, processing stops, and the user is also notified that their question cannot be answered.

[0051] This application embodiment vectorizes the query question and further queries the event database to achieve event recall and improve recall accuracy; by determining whether there is a first recall candidate event that matches the query question in the first recall candidate event, the first recall candidate event is further filtered to remove unmatched or inaccurate recall results, further improving the accuracy of event recall.

[0052] S205. Rewrite the question based on the question to be queried and the first recall event to obtain the target question.

[0053] The query is rewritten based on the question to be queried and the first recall event to obtain the target question. By mining event-related information contained in the user's query, the query is rewritten based on the event database to make the user's intent clearer.

[0054] As an optional embodiment, this optional embodiment further optimizes the determination of whether there is a first recall candidate event that matches the query question in the first recall candidate event, including at least one of the following:

[0055] A1. Determine the first association information between each first recall candidate event and the query question according to the matching rules, and determine the first recall candidate event that matches the query question according to each first association information.

[0056] In this embodiment, the matching rule can be understood as a rule used to determine whether two pieces of information match. It can be preset, for example, the matching rule is whether there are the same keywords, the number of the same keywords, etc. The first association information can be used to characterize the relevance, degree of relevance, and other related information between the first recall candidate event and the query question; the first association information can be relevance, relevance score, or other information that can represent the degree of association.

[0057] Pre-set matching rules and perform relevance analysis on each primary recall candidate event and the query question based on these rules to determine the primary association information between each primary recall candidate event and the query question. For example, segment the primary recall candidate event and the query question into two groups of words. Analyze the words in these two groups to identify common keywords and count the number of common keywords. Use the number of common keywords as primary association information, or use the proportion of common keywords in the segmented words corresponding to the query question as primary association information, and so on. Analyze each primary association information and select the primary recall candidate events corresponding to the most relevant primary association information based on their degree of relevance. These are then used as primary recall candidate events matching the query question. For example, select the 10 most relevant primary association information items and determine the primary recall candidate events corresponding to these 10 items as primary recall candidate events matching the query question; or select the top 20% of the most relevant primary association information items and determine the primary recall candidate events corresponding to these 20% of items as primary recall candidate events matching the query question.

[0058] A2. For each first recall candidate event, a scoring model is used to score the relevance between the first recall candidate event and the query question to determine the second association information; based on each second association information, the first recall candidate event that matches the query question is determined.

[0059] In this embodiment, the scoring model can be understood as a pre-trained model, such as a deep neural network model, a large language model, etc. The second association information can be used to characterize the relevance, degree of relevance, and other related information between the first recall candidate event and the query question; the second association information can be relevance, relevance score, or other information that can represent the degree of relevance.

[0060] The scoring model is trained using pre-collected training samples. The trained model can then perform relevance scoring. For each first recall candidate event, the first recall candidate event and the query question are input into the scoring model for scoring. The scoring model uses the knowledge learned during training to score the relevance between the first recall candidate event and the query question, and outputs the scoring result. This output score is used as the second association information. Each piece of second association information is analyzed, and the first recall candidate events corresponding to the most relevant second association information are selected based on their degree of relevance. These are then used as the first recall candidate events matching the query question. For example, the top 10 most relevant second association information items can be selected, and the corresponding first recall candidate events can be determined as matching the query question. Alternatively, the top 20% most relevant second association information items can be selected, and the corresponding first recall candidate events can be determined as matching the query question, and so on. The selection method can be the same as or different from the selection method for the first association information.

[0061] This application embodiment can also combine the above two methods to determine the first recall candidate event matching the query question. For example, the first association information and the second association information are calculated respectively, and two sets of first recall candidate events matching the query question are selected respectively. The first recall candidate event that appears repeatedly in the two sets of first recall candidate events is taken as the final determined first recall candidate event matching the query question, and so on.

[0062] This application provides multiple methods to determine the first recall candidate event that matches the query question. By using matching rules or scoring models, the first recall candidate event that matches the query question can be accurately screened, ensuring the accuracy of event recall and thus ensuring the effectiveness of query rewriting.

[0063] As an optional embodiment, this optional embodiment further optimizes the steps for establishing the event library, including:

[0064] B1. Based on the event theme, conduct event mining to form thematic events. The event theme includes at least one of periodic events and long-term events.

[0065] In this embodiment, an event topic can be understood as information describing the core of an event. An event topic may also include topic attributes, used to describe relevant information about that topic. Event topics include periodic events and long-term events; periodic events can be understood as events that occur periodically, such as the Olympics or the National College Entrance Examination (Gaokao); long-term events can be understood as events that last for a relatively long period, which can mean that the duration of the event exceeds a set time threshold, such as 3 months, half a year, etc. A topical event can be understood as an event with a specific theme.

[0066] Different event themes can be pre-defined, allowing for event mining based on each theme, or different theme attributes can be set for event mining based on those attributes. Event mining can be achieved by scraping data from web pages or other data acquisition channels using data crawling tools. For each event theme, one or more events can be mined to obtain event information. This event information describes the event, such as location and time. Based on the mined event information, corresponding events are formed and marked as theme events. For example, if the event theme is the Olympics, event mining can obtain event information corresponding to each year's Olympics, and a corresponding theme event can be formed based on this information.

[0067] B2. Extract and summarize events based on at least one data source to form sudden events.

[0068] In this embodiment, a sudden event can be understood as an event that is irregular and occurs randomly, such as an injury during a competition. The data source can be news, trending topics, or other sources from which data can be obtained. Different data sources are pre-set; these sources can be different applications, web pages, etc., for example, data can be scraped from a web page or an application. The data sources, their types, and the number can be pre-defined. Data is obtained from at least one pre-determined data source, and event information is extracted and summarized. The extraction and summarization of events can employ pre-set event extraction techniques, such as machine learning-based methods, deep learning-based methods, pattern matching-based methods, etc. Through extraction and summarization, event information corresponding to different events can be obtained, and a corresponding sudden event is formed based on the event information obtained for each event.

[0069] B3. Based on the event information of the emergency and the event information of the main event, determine the event correlation between the emergency and the main event.

[0070] Analyze the event information of both the emergency and the main event to determine if they are related. For example, the main event might be a sports meet, and the emergency might be an injury to a participant during an event. Or, the main event might be a film premiere, and the emergency might be an injury to the cast and crew due to an overly aggressive audience member throwing objects at them. By determining whether the emergency is related to the main event, the event relationship between the two can be established.

[0071] B4. Respond to related topic events of emergencies, attach the emergencies to topic events, and supplement the topic event information based on the event information of the emergencies.

[0072] If an emergency has related thematic events, meaning it's an event related to a thematic event, then in response to the existence of related thematic events, the emergency is attached to the related thematic event, establishing a relationship between the emergency and the thematic event. The event information of both the emergency and the thematic event is analyzed, and any missing information in the thematic event is supplemented based on the emergency's event information. For example, if the thematic event's event information lacks location information, but the emergency's event information includes location information, this location information is added to the thematic event's event information. If an emergency does not have any related thematic events, meaning it is not related to any thematic event, then this emergency can exist as an independent event.

[0073] For example, sudden events can be attached to periodic events or long-term events, while other events do not need to be attached and can exist independently as sudden events.

[0074] B5. Construct an event map based on each thematic event and each emergency to form an event database.

[0075] An event graph is constructed based on all identified thematic events, emergencies, and the relationships between events. This can be done using knowledge graph construction methods, such as treating thematic events and emergencies as nodes, the relationships between events as edges, and event information as attribute information. The resulting graph can be directly stored in an event database, or each thematic event and emergencies can be converted into vectors and stored in the event database along with the events; or the vectors can be stored separately in the event database, and so on. That is, in this embodiment, the event database can store different events, with the corresponding vectors stored separately; or, the event database can store both events and their corresponding vectors; or, the event database can store the vectors corresponding to events, while the events are stored separately in other databases, and so on. Here, events can be thematic events, emergencies, etc.

[0076] This application provides a method for constructing an event database. It involves mining themed events by setting event themes and mining sudden events through data sources to identify themed events and sudden events. By analyzing event information, it determines the correlation between sudden events and themed events, and then attaches sudden events to their corresponding themed events, thus establishing the relationship between themed events and facilitating event management and querying. Furthermore, it allows for the supplementation of themed event information with the event information of sudden events to avoid data loss. By constructing an event graph, an event database is formed, enabling effective event management and facilitating subsequent querying and use.

[0077] Optionally, the event information may include at least one of the following: time, location, participants, etc.

[0078] Event information can consist of at least one of time, location, and participants, describing the event, its location, and the people involved. Event information can also be customized by the user, added to or removed as needed. Describing events by time, location, and participants allows for more accurate event description and improves the accuracy of event recall.

[0079] For example, Figure 3 An example diagram of periodic events is provided, where there can be multiple corresponding topic events for the same topic; Figure 3 Taking a cyclical event with the theme of "XX Board of Directors Election" as an example, the theme attributes can be at least one of the following: time, progress, polls, candidates, outcome prediction, and support rate. For example, Figure 4 Another example diagram of a cyclical event is provided, where the theme attribute can be at least one of: time, location, medal standings, and opening ceremony. For example, Figure 5An example graph of long-term events is provided. Event clustering topics can be determined based on data mining, and breaking events can be determined based on trending searches.

[0080] The query rewriting method provided in this application solves the problem of inaccurate retrieval. By vectorizing the query question and then performing event recall, it effectively identifies event clues in the query. The event recall determines the corresponding first recall candidate event. The relevance between the first recall candidate event and the query question is judged by matching rules and scoring models. Based on the relevance, the first recall candidate events are further filtered to determine the matching first recall event, improving the accuracy of event recall. The first recall event accurately describes the event elements and captures event information related to the question. Based on the first recall event, the query question is effectively rewritten, and the relevant event information is integrated into the query rewriting process to obtain the target question. The rewritten target question can accurately describe the problem, thereby improving the accuracy of the question-and-answer results.

[0081] Example 3

[0082] Figure 6 This is a flowchart illustrating a query rewriting method provided in Embodiment 3 of this application. This embodiment is a refinement based on the above embodiments. Figure 6 As shown, the method includes:

[0083] S301. Obtain the user's query question.

[0084] S302. Based on the query question, perform event recall to determine the first recall event corresponding to the query question.

[0085] S303. Rewrite the question based on the question to be queried and the first recall event to obtain the target question.

[0086] S304. Based on the target problem, conduct event recall and determine the second recall event corresponding to the target problem.

[0087] In this embodiment, the second recall event can be understood as an event selected from different events that has a certain correlation with the target problem. For example, the second recall event is the Tokyo Olympics, which includes information such as the event's time and location. The number of second recall events can be one, multiple, or zero. The number of second recall events can be preset. For example, if the number of second recall events is preset to one, the event with the best matching effect is selected as the second recall event during event recall. Alternatively, the number of second recall events is not limited. During event recall, events that meet certain requirements are selected as second recall events. In this case, any event that meets the requirements can be used as a second recall event. The number of second recall events is determined based on the actual situation each time a query is performed, and it is not unique.

[0088] Different events are pre-collected and can be processed and stored in an event database. The semantic information contained in the target question is analyzed. Based on the semantic information of the target question and the information of the events, events matching the semantic information of the target question are determined. For example, the similarity between the semantic information of the target question and the information of the events is calculated, and events matching the target question are determined based on the magnitude of the similarity. Events matching the target question are used as second recall events. The recall process for the second recall event can be implemented in the same way as the recall process for the first recall event; for details, please refer to the implementation process of the first recall event, which will not be elaborated here.

[0089] S305. Based on the second recall event and the material library, conduct question and answer exercises to generate the answer to the target question.

[0090] In this embodiment, the media library can be understood as a database that stores news data. The media library may include news data obtained from different channels, such as officially released news data, or news data obtained from different applications, and so on. The media library can be established before querying and rewriting. It is formed by collecting different news data and storing it in the database.

[0091] The material library is searched based on the second recall event to identify news data that matches the second recall event. This news data is then used as the answer to the target question. Alternatively, the news data can be further organized and analyzed to generate a corresponding answer, which is the answer to the target question.

[0092] In this embodiment, the target question is used to recall the event again, and a second recall event is determined. Based on the second recall event and the material library, question answering is implemented and the corresponding answer is generated. Since the target question used in this application is a rewritten question, it can describe the question more accurately than the original question, so the generated answer is more accurate.

[0093] As an optional embodiment, this optional embodiment further optimizes the event recall based on the target question and the determination of the second recall event corresponding to the target question, including: vectorizing the target question to obtain a target vector; querying the event database based on the target vector to determine the second recall candidate event; and in response to the existence of a second recall candidate event that matches the target question among the second recall candidate events, determining the second recall candidate event that matches the target question as the second recall event.

[0094] In this embodiment, the target vector can be understood as a set of vectors obtained by vectorizing the target problem; the second recall candidate event can be understood as an event recalled from the event database, which can be used as a candidate event to determine the second recall event.

[0095] The event database is queried based on the target vector. If the database stores events, these events are vectorized, and the similarity between the target vector and each event vector is calculated. Secondary recall candidate events are determined based on this similarity. For example, events with similarity above a certain threshold can be selected as secondary recall candidate events, or the ten most similar events can be selected, and so on. If the database stores event-to-event vectors, the similarity between the target vector and each event vector is directly calculated, and secondary recall candidate events are determined based on this similarity. The method for determining secondary recall candidate events based on similarity can be referenced above. Alternatively, events can be stored in one database, and the corresponding vectors can be stored in another database. A correspondence between events and vectors can be established, the similarity between the target vector and each vector is calculated, and vectors with higher similarity are determined. Based on the vector-event correspondence, the event database is queried to determine the events corresponding to the vectors with higher similarity, and these events are selected as secondary recall candidate events. The analysis of whether each secondary recall candidate event matches the target question can be performed using algorithms, rules, or other methods. If a secondary recall candidate event matches the target question, it is confirmed as a secondary recall event, and secondary recall candidate events that do not match the target question are filtered out. If no secondary recall candidate event matches the target question, processing stops, and the user is also notified that their question cannot be answered.

[0096] As an optional embodiment, this optional embodiment further optimizes the determination of whether there is a second recall candidate event matching the target problem among the second recall candidate events, including at least one of the following:

[0097] Based on the matching rules, determine the third association information between each second recall candidate event and the target question, and based on each third association information, determine the second recall candidate event that matches the target question.

[0098] For each second recall candidate event, a scoring model is used to score the relevance between the second recall candidate event and the target question to determine the fourth association information; based on each fourth association information, a second recall candidate event matching the target question is determined.

[0099] In this embodiment, both the third and fourth association information can be used to characterize the correlation, degree of correlation, and other related information between the second recall candidate event and the target question. The third and fourth association information can be correlation, correlation score, or other information that can represent the degree of correlation. The process for determining the third association information is the same as the process for determining the first association information; refer to the relevant description of the process for determining the first association information. The process for determining the fourth association information is the same as the process for determining the second association information; refer to the relevant description of the process for determining the second association information, and will not be repeated here. The implementation principle for determining whether there is a second recall candidate event that matches the target question can be referred to the implementation process for determining whether there is a first recall candidate event that matches the query question; and will not be repeated here.

[0100] As an optional embodiment, this optional embodiment further optimizes the question-and-answer process based on the second recall event and the material library to generate the answer to the target question, including:

[0101] C1. Determine the event identifier and event information for the second recall event.

[0102] In this embodiment, an event identifier can be understood as information used to identify an event. Events of the same type can have the same event identifier; for example, events 1 and 2 are both events related to the Olympic Games, and their event identifiers are both 1. When storing events, the event identifier and event information are stored accordingly. After recalling the second recalled event, the event identifier and event information of the second recalled event can be directly determined.

[0103] C2. Based on the event identifier of the second recall event, query the material library to determine the first candidate news data.

[0104] In this embodiment, the first candidate news data can be understood as a type of news data used to generate answers to questions; the number of first candidate news data can be one or more, or it can be zero, indicating that no matching news data exists. Different news data are pre-stored in a media library, and each piece of news data is marked to determine its corresponding event identifier; after determining the event identifier of the second recall event, the event identifier of the second recall event is matched with the event identifiers of the news data stored in the media library, and the news data corresponding to the matching event identifier is taken as the first candidate news data.

[0105] C3. Based on the event information of the second recall event, filter the first candidate news data to determine the second candidate news data.

[0106] In this embodiment, the second candidate news data can be understood as a type of news data obtained by filtering the first candidate news data. Filtering conditions are determined based on the event information of the second recall event. For example, location, time, and other information are determined based on the event information of the second recall event and used as filtering conditions. The first candidate news data is then filtered using these filtering conditions to determine the second candidate news data that meets the filtering conditions. For example, news data occurring at the same location is selected as the second candidate news data, or news data including the same participants is selected as the second candidate news data.

[0107] As an optional embodiment, this optional embodiment further optimizes the first candidate news data by filtering the first candidate news data based on the event information of the second recall event and determining the second candidate news data, including:

[0108] C31. Determine the recall time range based on the event information of the second recall event.

[0109] In this embodiment, the recall time range can be understood as a time frame used to filter the time of the recalled events. The event information of the second recall event is analyzed to determine the time, and the recall time range is determined based on the time. For example, the length of the recall time range is predetermined, such as six months. Therefore, the recall time range is the six months preceding the time in the event information of the second recall event. For instance, if the time in the event information of the second recall event is August 3, 2024, then February 3, 2024 to August 3, 2024 is used as the recall time range.

[0110] C32. Filter the first candidate news data according to the recall time range to determine the second candidate news data.

[0111] For each first candidate news data, determine whether the occurrence time of the first candidate news data is within the recall time range. If so, retain this first candidate news data and record it as the second candidate news data; if not, delete this first candidate news data.

[0112] This application embodiment filters and selects first candidate news data by determining the recall time range, which can remove outdated news, ensure timeliness, keep up with current events, and provide users with reliable and effective answers.

[0113] C4. Remove duplicates from the second candidate news data to obtain the third candidate news data, and sort the third candidate news data according to the event information of the second recall event.

[0114] In this embodiment, the third candidate news data can be understood as a type of news data obtained by processing the second candidate news data. The second candidate news data is deduplicated, removing duplicate data, and the remaining news data is recorded as the third candidate news data. The third candidate news data is then sorted according to the time in the event information of the second recall event; for example, news data that occurred later is sorted first.

[0115] C5. Generate the answer to the target question based on the third candidate news data after sorting.

[0116] The third candidate news data after sorting is analyzed to extract important content and information. Based on the important content and information, the corresponding answer is generated, which is the answer to the target question.

[0117] This application embodiment queries the material library through event identifiers to determine the first candidate news data. Then, it further filters, deduplicates, and sorts the first candidate news data through event information to obtain the sorted third candidate news data. This achieves news data filtering, retains valid data, and improves data processing efficiency and accuracy.

[0118] As an optional embodiment, this optional embodiment further optimizes the generation of answers based on the sorted third candidate news data, including: inputting the sorted third candidate news data into the answer generation big model, and organizing and analyzing the third candidate news data through the answer generation big model to determine the answer.

[0119] In this embodiment, the answer generation model can be understood as a large language model used to generate answers. Training samples are collected in advance and trained on the large language model to obtain the answer generation model. The sorted third candidate news data is input into the answer generation model. Based on the knowledge learned during training, the answer generation model organizes and analyzes the third candidate news data, generates and outputs the answer. Organizing and analyzing the third candidate news data can involve identifying key points and essential information, removing useless and erroneous information, and simplifying the data to obtain accurate answers that are easy for users to view, reducing user viewing time and improving user experience. During the organization and analysis of the third candidate news data, the answer generation model can refer to the order of the third candidate news data; for example, the earlier the third candidate news data appears in the order, the more important it is. Through the answer generation model, news data can be organized and analyzed to regenerate answers, providing users with convenient answers, saving user time, and improving user experience.

[0120] As an optional embodiment, this optional embodiment further optimizes the construction steps of the material library, including:

[0121] D1. Obtain news data.

[0122] In this embodiment, news data can be understood as data describing current events, news, etc. News data can be obtained from data sources such as web pages and applications; for example, news data can be scraped from web pages using data scraping tools.

[0123] D2. Tag the news data and determine the event identifier corresponding to each news data.

[0124] Each news data point is individually tagged. News data of the same type can use the same tag. Tagging can be done manually, automatically by setting certain tagging rules, or a combination of manual and automated tagging, etc. The tagging determines the event identifier corresponding to each news data point.

[0125] D3. Create a material library based on news data and its corresponding event identifiers.

[0126] Store news data and the corresponding event identifiers in the media library.

[0127] This application embodiment identifies news data by tagging it, and stores the news data and its event identifiers in a material library to achieve centralized management of the news data and facilitate subsequent retrieval of the news data.

[0128] As an optional embodiment, this optional embodiment is further optimized by including:

[0129] E1. Search the media library based on the target event in the event library.

[0130] In this embodiment, the target event can be understood as an event, which can be any type of event such as a thematic event or a sudden event.

[0131] When the event library is updated, the newly added event can be used as the target event; alternatively, any event in the event library can be used as the target event. The media library can be searched based on the target event, for example, by searching the media library based on the target event's event identifier, or by determining the target event's attributes, theme, information, and other core information, and then searching the media library based on that core information, and so on.

[0132] E2. If no news data matching the target event is found, then a search for news data is performed based on the target event to determine the target news data corresponding to the target event.

[0133] In this embodiment, target news data can be understood as news data corresponding to a target event, and the number of target news data can be one or more. If no news data matching the target event is found in the media library, it is determined that the data in the media library is incomplete, and the media library can be supplemented according to the target event. News data is searched based on the target event, from web pages or other data sources, and news data matching the target event is taken as target news data.

[0134] E3. Mark the target news data and determine the event identifier corresponding to the target news data.

[0135] The target news data is tagged, and the event identifier corresponding to the target event is used as the event identifier corresponding to the target news data; or, if the target event has not yet generated an event identifier, the corresponding event identifier is generated based on the target event, and this event identifier is associated with both the target event and the target news data.

[0136] E4. Update the media library based on the target news data and its corresponding event identifiers.

[0137] The target news data and its corresponding event identifiers are stored in the media library to enable updates to the media library.

[0138] This application embodiment can determine the target news data corresponding to the target event by searching the news data when there is no matching news data for the target event in the event library, and update the media library by marking the target news data with an event identifier. This ensures that all events in the event library can be found in the media library with corresponding news data, avoiding the situation where questions cannot be answered due to the inability to find news data.

[0139] Optionally, the event information may include at least one of the following: time, location, participants, etc.

[0140] For example, Figure 7This document provides an example diagram of a query-rewritten question-and-answer implementation. An event library and a content library are pre-built. The event library can be divided into a breaking event library, a periodic event library, and a long-term event library. Breaking events in the breaking event library can be obtained from a hotspot library and other data sources. Breaking events are stored with their corresponding timelines and time points. Hotspot data in the hotspot library is collected and stored based on hotspot times. Periodic events in the periodic event library are mined based on periodic event themes, which can possess certain theme attributes. Periodic events are stored with their corresponding event attributes, timelines, and time points. Periodic events can also be mined based on their corresponding event attributes, timelines, and time points. Long-term events in the long-term event library are mined based on long-term event themes. Long-term events are stored with their corresponding clustering topics or other related events within the same period. Breaking events can be associated with periodic events in the periodic event library and long-term events in the long-term event library. News data can also be captured from the event library and stored in the content library. In the query-and-answer process, the user inputs a query (i.e., the question to be queried). Based on event recall, corresponding events are retrieved from the event database. These retrieved events can be judged based on relevance, which can be rule-based or model-based. The retrieved events are then used to rewrite the query, which can be done based on prompts. The rewritten question is then used for retrieval, and corresponding events are retrieved according to the recall strategy. News data is then retrieved from the content database based on these events. A ranking model is used to deduplicate and rank the retrieved news data. LLM (Local Management Model) then generates the answer based on the ranked news data.

[0141] The query rewriting method provided in this application solves the problem of inaccurate retrieval. By effectively rewriting the query question and incorporating relevant event information into the query rewriting process, a target question is obtained, which accurately describes the problem. Question-and-answer sessions using the rewritten target question improve the accuracy of the results. A media library is established to store news data, enabling centralized management and facilitating subsequent queries. During the question-and-answer process, the media library is queried to identify relevant first-candidate news data. This first-candidate news data is then filtered, deduplicated, and sorted based on event information to obtain sorted third-candidate news data, thus filtering the news data, retaining valid data, and improving data processing efficiency and accuracy. A large-scale answer generation model can organize and analyze the news data, regenerating answers for users, saving time and improving user experience. The method provided in this application yields high-quality question-and-answer results, improving overall retrieval performance.

[0142] Example 4

[0143] Figure 8 This is a schematic diagram of a query rewrite device provided in Embodiment 4 of this application. Figure 8 As shown, the device includes: a problem acquisition module 41, a first recall module 42, and a problem rewriting module 43.

[0144] Question retrieval module 41 is used to retrieve the questions that users want to query;

[0145] The first recall module 42 is used to recall events based on the query question and determine the first recall event corresponding to the query question.

[0146] The question rewriting module 43 is used to rewrite the question based on the question to be queried and the first recall event to obtain the target question.

[0147] The query rewriting device provided in this application embodiment obtains a user's query question; performs event recall based on the query question to determine a first recall event corresponding to the query question; rewrites the question based on the query question and the first recall event to obtain a target question, optimizing the query rewriting process, improving query rewriting effectiveness, enhancing retrieval performance, and solving the problem of inaccurate retrieval; by performing event recall on the query question to determine its corresponding first recall event, accurately describing event elements through the first recall event, capturing event information related to the question, and effectively rewriting the query question based on the first recall event, integrating relevant event information into the query rewriting process to obtain the target question, the rewritten target question can accurately describe the problem, thereby improving the accuracy of question-and-answer results.

[0148] Optionally, the first recall module 42 includes:

[0149] A vectorization unit is used to vectorize the query question to obtain a query vector;

[0150] The database query unit is used to query the event database according to the query vector to determine the first recall candidate event;

[0151] The first recall unit is configured to, in response to the existence of a first recall candidate event that matches the query question in the first recall candidate event, determine the first recall candidate event that matches the query question as the first recall event.

[0152] Optionally, the device further includes at least one of the following:

[0153] The first association information determination module is used to determine the first association information between each first recall candidate event and the query question according to the matching rules, and to determine the first recall candidate event that matches the query question according to each first association information.

[0154] The second association information determination unit is used to determine the second association information for each first recall candidate event by scoring the relevance between the first recall candidate event and the query question using a scoring model; and to determine the first recall candidate event that matches the query question based on each of the second association information.

[0155] Optionally, the device may also include:

[0156] The topic event determination module is used to mine events based on event topics to form topic events, wherein the event topics include at least one of periodic events and long-term events;

[0157] The emergency event identification module is used to extract and summarize events based on at least one data source to form emergency events.

[0158] The event association determination module is used to determine the event association between the sudden event and the topic event based on the event information of the sudden event and the event information of the topic event;

[0159] The information supplementation module is used to respond to a related topic event of the emergency, attach the emergency to the topic event, and supplement the event information of the topic event based on the event information of the emergency.

[0160] The event database determination module is used to construct an event graph based on each of the aforementioned thematic events and each of the aforementioned emergencies, thereby forming an event database.

[0161] Optionally, the device may also include:

[0162] The second recall module is used to recall events based on the target problem and determine the second recall event corresponding to the target problem.

[0163] The answer generation module is used to generate the answer to the target question by combining the second recall event with the material library.

[0164] Optional, the answer generation module includes:

[0165] An event identifier determination unit is used to determine the event identifier and event information of the second recall event;

[0166] The material library query unit is used to query the material library based on the event identifier of the second recall event to determine the first candidate news data;

[0167] The news filtering unit is used to filter the first candidate news data based on the event information of the second recall event to determine the second candidate news data;

[0168] The sorting unit is used to deduplicate the second candidate news data to obtain the third candidate news data, and sort the third candidate news data according to the event information of the second recall event.

[0169] The answer determination unit is used to generate the answer to the target question based on the sorted third candidate news data.

[0170] Optionally, the news filtering unit is specifically used to: determine the recall time range based on the event information of the second recall event; and filter the first candidate news data based on the recall time range to determine the second candidate news data.

[0171] Optionally, the device may also include:

[0172] The news data acquisition module is used to acquire news data;

[0173] The news data tagging module is used to tag the news data and determine the event identifier corresponding to each news data.

[0174] The media library construction module is used to form a media library based on the news data and its corresponding event identifiers.

[0175] Optionally, the device may also include:

[0176] The target event search module is used to search the material library based on target events in the event library;

[0177] The target news determination module is used to, in response to the failure to find news data matching the target event, search for news data based on the target event and determine the target news data corresponding to the target event.

[0178] The target news tagging module is used to tag the target news data and determine the event identifier corresponding to the target news data;

[0179] The update module is used to update the material library based on the target news data and its corresponding event identifier.

[0180] Optionally, the event information includes at least one of time, location, and participants.

[0181] The query rewriting apparatus provided in this application embodiment can execute the query rewriting method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects of the execution method.

[0182] Example 5

[0183] Figure 9 A schematic diagram of an electronic device 50 that can be used to implement embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0184] like Figure 9 As shown, the electronic device 50 includes at least one processor 51 and a memory, such as a read-only memory (ROM) 52 and a random access memory (RAM) 53, communicatively connected to the at least one processor 51. The memory stores computer programs executable by the at least one processor. The processor 51 can perform various appropriate actions and processes based on the computer program stored in the ROM 52 or loaded into the RAM 53 from storage unit 58. The RAM 53 can also store various programs and data required for the operation of the electronic device 50. The processor 51, ROM 52, and RAM 53 are interconnected via a bus 54. An input / output (I / O) interface 55 is also connected to the bus 54.

[0185] Multiple components in electronic device 50 are connected to I / O interface 55, including: input unit 56, such as keyboard, mouse, etc.; output unit 57, such as various types of monitors, speakers, etc.; storage unit 58, such as disk, optical disk, etc.; and communication unit 59, such as network card, modem, wireless transceiver, etc. Communication unit 59 allows electronic device 50 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0186] Processor 51 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 51 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 51 performs the various methods and processes described above, such as the query rewrite method.

[0187] In some embodiments, the query rewriting method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 58. In some embodiments, part or all of the computer program may be loaded and / or mounted on electronic device 50 via ROM 52 and / or communication unit 59. When the computer program is loaded into RAM 53 and executed by processor 51, one or more steps of the query rewriting method described above may be performed. Alternatively, in other embodiments, processor 51 may be configured to perform the query rewriting method by any other suitable means (e.g., by means of firmware).

[0188] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0189] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0190] This invention provides a computer program product, which includes a computer program that, when executed by a processor, implements the 55 method described in any embodiment of this invention.

[0191] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0192] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0193] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0194] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0195] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0196] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A query rewriting method, characterized in that, include: Retrieve the user's query question; Based on the query question, an event recall is performed to determine the first recall event corresponding to the query question; The target question is obtained by rewriting the question based on the question to be queried and the first recall event.

2. The method according to claim 1, characterized in that, The step of retrieving events based on the query question and determining the first retrieval event corresponding to the query question includes: The query question is vectorized to obtain the query vector; The event database is queried based on the query vector to determine the first recall candidate event; In response to the existence of a first recall candidate event that matches the query question in the first recall candidate event, the first recall candidate event that matches the query question is determined as the first recall event.

3. The method according to claim 2, characterized in that, After determining the first recall candidate event, the process also includes at least one of the following: Based on the matching rules, determine the first association information between each first recall candidate event and the query question, and based on each first association information, determine the first recall candidate event that matches the query question. For each of the first recall candidate events, a scoring model is used to score the relevance between the first recall candidate event and the query question to determine the second association information; Based on each of the second association information, a first recall candidate event matching the query question is determined.

4. The method according to claim 2 or 3, characterized in that, The steps for establishing the event database include: Events are mined based on event themes to form thematic events, where the event themes include at least one of periodic events and long-term events; Events are extracted and summarized based on at least one data source to form sudden events; Based on the event information of the emergency and the event information of the topic event, the event association between the emergency and the topic event is determined; In response to a related topic event of the emergency, the emergency event is attached to the topic event, and the event information of the topic event is supplemented according to the event information of the emergency event; An event graph is constructed based on each of the aforementioned thematic events and each of the aforementioned emergencies, forming an event database.

5. The method according to any one of claims 1-4, characterized in that, Also includes: Based on the target problem, an event recall is performed to determine the second recall event corresponding to the target problem; Based on the second recall event and the material library, questions and answers are generated to produce the answer to the target question.

6. The method according to claim 5, characterized in that, The step of generating the answer to the target question based on the second recall event and the material library includes: Determine the event identifier and event information of the second recall event; The first candidate news data is determined by querying the material library based on the event identifier of the second recall event; The first candidate news data is filtered based on the event information of the second recall event to determine the second candidate news data; The second candidate news data is deduplicated to obtain the third candidate news data, and the third candidate news data is sorted according to the event information of the second recall event; The answer to the target question is generated based on the sorted third candidate news data.

7. The method according to claim 6, characterized in that, The step of filtering the first candidate news data based on the event information of the second recall event to determine the second candidate news data includes: The recall time range is determined based on the event information of the second recall event; The first candidate news data is filtered according to the recall time range to determine the second candidate news data.

8. The method according to any one of claims 5-7, characterized in that, The steps for constructing the material library include: Obtain news data; The news data is labeled, and an event identifier is determined for each piece of news data; A material library is formed based on the news data and its corresponding event identifiers.

9. The method according to claim 8, characterized in that, Also includes: The material library is searched based on the target event in the event library; If no news data matching the target event is found, a search for news data is performed based on the target event to determine the target news data corresponding to the target event. The target news data is marked to determine the event identifier corresponding to the target news data; The material library is updated based on the target news data and its corresponding event identifiers.

10. The method according to any one of claims 4, 6-7, characterized in that, The event information includes at least one of time, location, and participants.

11. An electronic device, characterized in that, The electronic device includes: At least one processor, and a memory communicatively connected to said at least one processor; The memory stores a computer program that can be executed by the at least one processor, the computer program being executed by the at least one processor to enable the at least one processor to perform the query rewrite method according to any one of claims 1-10.

12. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions that, when executed by a processor, implement the query rewrite method according to any one of claims 1-10.

13. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the query rewrite method according to any one of claims 1-10.