Abstract generation method, text recommendation method, and related devices
By vectorizing the query statement and candidate text, a text summary related to the query statement is generated, which solves the problem of low summary accuracy in the existing technology and achieves higher-precision summary generation.
Patent Information
- Application Number
- CN202310800205.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-30
- Publication Date
- 2026-11-06
- Estimated Expiration
- 2043-06-30
AI Technical Summary
The text summaries generated by existing technologies cannot meet user needs, especially in that they cannot cover content related to the user's query, resulting in low summary accuracy.
By vectorizing the query statement, shared feature vectors and feature vectors are generated. Combined with the relevance of candidate texts, a text summary related to the query statement is generated, thereby improving the accuracy of the summary generation.
The accuracy of text summarization has been improved, enabling the generated summaries to better meet user needs and incorporating information from user queries.
Smart Images

Figure CN117725200B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of natural language processing technology, specifically to a summary generation method, a text recommendation method, and related equipment. Background Technology
[0002] Currently, when generating text summaries for candidate texts (such as user-published notes, articles, manuscripts, etc.), natural language processing technology is often used to directly generate text summaries based on the notes, articles, manuscripts, etc. The text summaries generated in this way are high-level summaries of the notes, articles, or manuscripts, which generally cannot meet the needs of users. For example, if user A wants to find notes, articles, or manuscripts related to their input query on a certain application platform, then the text summaries corresponding to the query input by user A are matched, and the candidate texts corresponding to the successfully matched text summaries are recommended to user A.
[0003] However, the text summaries generated by the above method are high-level generalizations of the candidate texts and cannot cover all the content contained within them. Furthermore, while candidate texts generally contain content relevant to user A's query, the corresponding text summaries are often irrelevant to the query. In other words, the accuracy of the text summaries is low, preventing user A from finding the relevant candidate text and thus failing to meet user A's needs. Therefore, improving the accuracy of summary generation to better meet user requirements is an urgent problem to be solved. Summary of the Invention
[0004] This application provides a summary generation method, a text recommendation method, and related devices. When generating summaries of candidate texts, the user's query statement is incorporated, which improves the accuracy of summary generation and thus meets the user's needs.
[0005] In a first aspect, embodiments of this application provide an abstract generation method, the method comprising:
[0006] The first query statement is vectorized to obtain the first shared feature vector and the first feature vector. The first query statement is any query statement in the query statement set, which is determined by historical query statements and / or randomly generated query statements. The first shared feature vector is obtained by vectorizing the first keyword of the first query statement, and the first feature vector is obtained by vectorizing the text in the first query statement other than the first keyword.
[0007] For the first candidate text, based on the first keyword and the first candidate text, the second feature vector corresponding to the first candidate text is determined. The first candidate text is any one of the multiple candidate texts in the text library that includes the first keyword. The second feature vector is obtained by vectorizing the first text other than the first keyword in the first candidate text. The relevance between the first text and the first keyword is within a preset threshold range.
[0008] Based on the first feature vector, the first shared feature vector, and the second feature vector corresponding to each candidate text among multiple candidate texts, a first text summary corresponding to each candidate text is generated.
[0009] As can be seen, in this embodiment, the first query statement is first vectorized to obtain a first shared feature vector and a first feature vector. The first shared feature vector is obtained by vectorizing the first keyword of the first query statement, and the first feature vector is obtained by vectorizing the text in the first query statement excluding the first keyword. Then, for the first candidate text, based on the first keyword and the first candidate text, a second feature vector corresponding to the first candidate text is determined. The first candidate text is any one of multiple candidate texts in the text library that includes the first keyword, and the second feature vector is obtained by vectorizing the first text in the first candidate text excluding the first keyword. The relevance of the first keyword to the first keyword is within a preset threshold range. That is, based on the first keyword, multiple candidate texts are found from the text library, each candidate text including the first keyword. Then, based on the first keyword, the first text is determined from each candidate text. The relevance of the first text in each candidate text to the first keyword is within a preset threshold range. Then, the first text in each candidate text is vectorized to obtain the second feature vector corresponding to each candidate text. In simpler terms, since the second feature vector corresponding to each candidate text is the relevance of its relevance to the first keyword in the first query statement within a preset threshold range, and the vector corresponding to the first keyword is the first shared feature vector, it can also be further understood as the... The second feature vector is determined based on the first shared feature vector, meaning the relevance between the second feature vector and the first shared feature vector for each candidate text is within the aforementioned threshold range. Finally, based on the first feature vector, the first shared feature vector, and the second feature vector corresponding to each candidate text, a first text summary is generated for each candidate text. Since the second feature vector is determined based on the first shared feature vector, meaning the determination of the second feature vector in each candidate text incorporates the first shared feature vector from the first query statement, the relevance between the second feature vector and the first shared feature vector is within the threshold range. Then, based on the first feature vector, the first shared feature vector, and the second feature vector from the multiple candidate texts... The second feature vector corresponding to each candidate text is used to generate the first text summary corresponding to each candidate text. At this time, the first text summary corresponding to each candidate text is combined with the information of the first query statement. That is, the second feature vector in the candidate text is determined based on the first keyword in the first query statement. This makes the final text summary generated for each candidate text based on the first keyword in the first query statement and the first text in the candidate text that is related to the first keyword. In other words, the text summary is not a high-level summary of the candidate text, but a summary generated based on the first query statement. This makes the generated summary relevant to the query statement, improves the accuracy of the summary generation, and thus meets the user's needs.
[0010] Secondly, embodiments of this application provide a text recommendation method, which includes:
[0011] Receive the second query statement from the user;
[0012] Obtain the target query statement that matches the second query statement from the query statement set, wherein the query statement set is determined by historical query statements and / or randomly generated query statements;
[0013] Based on the second query statement and the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement, multiple target texts corresponding to the second query statement are determined from the multiple candidate texts corresponding to the target query statement, wherein the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement is determined by the summary generation method as described in the first aspect.
[0014] Recommend multiple target texts corresponding to the second query statement to the user.
[0015] As can be seen, in this embodiment, the second query statement is first received from the user terminal, that is, the second query statement input by the user is received from the user terminal; then, the target query statement matching the second query statement is obtained from the query statement set; then, based on the second query statement and the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement, multiple target texts corresponding to the second query statement are determined from the multiple candidate texts corresponding to the target query statement. The first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement is determined by the summary generation method as described in the first aspect. That is, the target query statement matching the second query statement is first determined from the query statement set, and then the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement is determined based on the summary generation method of the first aspect. Since the first text summary obtained at this time is generated from the candidate texts in combination with the target query statement, and the target query statement and the second query statement match, it can be understood that the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement is also generated in combination with the second query statement, thus incorporating the user's query requirements, improving the accuracy of summary generation, and ensuring that the finally determined multiple target texts meet the user's needs; finally, multiple target texts corresponding to the second query statement are recommended to the user terminal.
[0016] Thirdly, embodiments of this application provide a summary generation apparatus, which includes a vectorization unit, a determination unit, and a generation unit;
[0017] The vectorization unit is used to vectorize the first query statement to obtain the first shared feature vector and the first feature vector. The first query statement is any query statement in the query statement set, which is determined by historical query statements and / or randomly generated query statements. The first shared feature vector is obtained by vectorizing the first keyword of the first query statement, and the first feature vector is obtained by vectorizing the text in the first query statement other than the first keyword.
[0018] The determining unit is used to determine the second feature vector corresponding to the first candidate text based on the first keyword and the first candidate text. The first candidate text is any one of the multiple candidate texts in the text library that includes the first keyword. The second feature vector is obtained by vectorizing the first text other than the first keyword in the first candidate text. The relevance between the first text and the first keyword is within a preset threshold range.
[0019] A generation unit is configured to generate a first text summary corresponding to each candidate text based on a first feature vector, a first shared feature vector, and a second feature vector corresponding to each candidate text among multiple candidate texts. Fourthly, embodiments of this application provide a text recommendation apparatus, which includes a transceiver unit and a processing unit.
[0020] The transceiver unit is used to receive the second query statement from the user terminal;
[0021] A processing unit is configured to obtain a target query statement that matches the second query statement from a set of query statements, wherein the set of query statements is determined by historical query statements and / or randomly generated query statements;
[0022] The processing unit is configured to determine multiple target texts corresponding to the second query statement from multiple candidate texts corresponding to the target query statement based on the second query statement and the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement, wherein the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement is determined by the summary generation method as described in the first aspect.
[0023] The transceiver unit is used to recommend multiple target texts corresponding to the second query statement to the user.
[0024] Fifthly, embodiments of this application provide an electronic device, including: a processor and a memory, the processor being connected to the memory, the memory being used to store a computer program, and the processor being used to execute the computer program stored in the memory, so that the electronic device performs the methods as described in the first and second aspects.
[0025] Sixthly, embodiments of this application provide a computer-readable storage medium storing a computer program that causes a computer to perform the methods as described in the first and second aspects.
[0026] In a seventh aspect, embodiments of this application provide a computer program product, the computer program product including a non-transitory computer-readable storage medium storing a computer program, and a computer operable to perform the methods as described in the first and second aspects. Attached Figure Description
[0027] 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 some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0028] Figure 1 A flowchart illustrating an abstract generation method provided in an embodiment of this application;
[0029] Figure 2 This is a schematic diagram illustrating a process for training a pre-trained model to obtain a summary model, as provided in an embodiment of this application.
[0030] Figure 3 A schematic diagram of a text recommendation system provided in an embodiment of this application;
[0031] Figure 4 A schematic diagram of the interaction flow of a text recommendation method provided in an embodiment of this application;
[0032] Figure 5 A schematic diagram illustrating a text recommendation scenario based on summary generation, provided as an embodiment of this application;
[0033] Figure 6 A functional unit block diagram of an abstract generation device provided in an embodiment of this application;
[0034] Figure 7 A functional unit block diagram of a text recommendation device provided in this application embodiment;
[0035] Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0036] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0037] The terms "first," "second," "third," and "fourth," etc., used in the specification, claims, and drawings of this application are used to distinguish different objects, not to describe a specific order. 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 includes a series of steps or units is not limited to the listed steps or units, but may optionally include steps or units not listed, or may optionally include other steps or units inherent to these processes, methods, products, or apparatuses.
[0038] In this document, the term "embodiment" means that a particular feature, result, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0039] See Figure 1 , Figure 1 This is a flowchart illustrating an abstract generation method provided in an embodiment of this application. The method includes, but is not limited to, steps 101-103:
[0040] 101: Vectorize the first query statement to obtain the first shared feature vector and the first feature vector.
[0041] In the embodiments of this application, the first query statement is any query statement in the query statement set, which is determined by historical query statements and / or randomly generated query statements. The first shared feature vector is obtained by vectorizing the first keyword of the first query statement, and the first feature vector is obtained by vectorizing the text in the first query statement other than the first keyword. For example, for the first query statement, keyword recognition is performed to obtain the first keyword; then the first keyword is vectorized to obtain the first shared feature vector, and the text in the first query statement other than the first keyword is vectorized to obtain the first feature vector. For instance, if the first query statement is "the best coffee in Shenzhen," the first keyword of this first query statement can be "Shenzhen" and "coffee." Therefore, vectorizing "Shenzhen" and "coffee" yields the corresponding first shared feature vector, and vectorizing the text in the first query statement other than "Shenzhen" and "coffee" yields the corresponding first feature vector.
[0042] 102: For the first candidate text, based on the first keyword and the first candidate text, determine the second feature vector corresponding to the first candidate text.
[0043] In the embodiments of this application, the first candidate text is any one of the multiple candidate texts including the first keyword in the text library, such as notes, articles, manuscripts, etc. published by all users stored in the text library; the second feature vector is obtained by vectorizing the first text other than the first keyword in the first candidate text, and the relevance between the first text and the first keyword is within a preset threshold range.
[0044] For example, based on the above example, multiple candidate texts are found from the text library based on the first keyword (i.e., "Shenzhen" and "coffee"). That is, multiple texts in the text library are filtered based on the first keyword to obtain multiple candidate texts, and each candidate text includes the first keyword, that is, each candidate text includes "Shenzhen" and "coffee". Then, for any candidate text among the multiple candidate texts, i.e., the first candidate text, the first text is determined from the first candidate text based on the first keyword. The relevance between the first text and the first keyword is within a preset threshold range. This relevance can be understood as the percentage of the first text and the first keyword that are related, or in other words, the first text and the first keyword belong to the same domain and attribute. That is, the first text with a relevance to "Shenzhen" and "coffee" within the preset threshold range is found from the first candidate text. For example, the content of the first text may be about the specific location of a coffee shop in Shenzhen, the price, color, taste, etc. These examples have a certain relevance to "Shenzhen" and "coffee", and the relevance is within the preset threshold range. Then, the first text in the first candidate text is vectorized to obtain the second feature vector corresponding to the first candidate text.
[0045] In one optional embodiment of this application, a first prompt word can be pre-set. The first prompt word is used to prompt the identification of multiple candidate texts from the text library, or it can be understood as prompting the identification of multiple candidate texts from the text library that can answer the question of the first query statement. Then, the first prompt word is vectorized to obtain a first prompt vector, and the first query statement is vectorized to obtain a first shared feature vector and a first feature vector. Then, based on the prompting effect of the first prompt vector, multiple candidate texts can be selected from the text library based on the first keyword. Compared with the absence of the first prompt vector, the training data is reduced. That is, it is not necessary to generate a text summary from the first query statement and all texts in the text library. Only the first query statement and the multiple candidate texts corresponding to the first query statement need to be used to generate a text summary. This can then be applied to the training of summary models in scenarios with few samples.
[0046] 103: Based on the first feature vector, the first shared feature vector, and the second feature vector corresponding to each candidate text in the multiple candidate texts, generate a first text summary corresponding to each candidate text.
[0047] For example, the first feature vector and the second feature vector corresponding to each candidate text are concatenated to obtain the third feature vector corresponding to each candidate text; the first shared feature vector and the third feature vector corresponding to each candidate text are concatenated to obtain the fourth feature vector corresponding to each candidate text; the fourth feature vector corresponding to each candidate text is decoded to obtain the first text summary corresponding to each candidate text.
[0048] In an optional embodiment of this application, the summary generation method shown in the above embodiments is executed through a summary model; therefore, see [link to relevant documentation]. Figure 2 , Figure 2 This application provides a flowchart illustrating the process of training a pre-trained model to obtain a summary model, including but not limited to steps 201-204:
[0049] 201: Vectorize the query statement to be trained to obtain the second shared feature vector and the fifth feature vector.
[0050] In the embodiments of this application, the query statement to be trained is any query statement in the query statement set. The second shared feature vector is obtained by vectorizing the second keyword of the query statement to be trained, and the fifth feature vector is obtained by vectorizing the text in the query statement to be trained, excluding the second keyword. It should be noted that the explanation of the relevant principle of step 201 can refer to the relevant description of step 101, and will not be repeated here.
[0051] 202: For the first candidate text to be trained, based on the second keyword and the first candidate text to be trained, determine the sixth feature vector corresponding to the first candidate text to be trained.
[0052] In the embodiments of this application, the first candidate text to be trained is any one of the multiple candidate texts to be trained that include the second keyword in the text library. The sixth feature vector is obtained by vectorizing the second text other than the second keyword in the first candidate text to be trained. The relevance between the second text and the second keyword is within a preset threshold range. It should be noted that the explanation of the relevant principle of step 202 can refer to the relevant description of step 101, and will not be repeated here.
[0053] In one optional embodiment of this application, the pre-trained model includes an encoder. Before the encoder performs encoding, a second prompt word is pre-set. The second prompt word is used to prompt multiple candidate texts to be trained from the aforementioned text library, or it can be understood as prompting multiple candidate texts to be trained that can answer the question of the query statement to be trained from the aforementioned text library. Then, the second prompt word and the query statement to be trained are input into the pre-trained model. The encoder vectorizes the query statement to be trained to obtain a second shared feature vector and a fifth feature vector, and vectorizes the second prompt word to obtain a second prompt vector. Then, based on the prompting effect of the second prompt vector, it is possible to... Based on the second keyword, multiple candidate texts for training are selected from the text library. Compared to the method without the second cue vector, the amount of training data is reduced. That is, it is not necessary to generate text summaries from the query statement and all texts in the text library; only the query statement and its corresponding candidate texts are needed as training data. This allows for training the model with a small sample size. Then, based on the second keyword, the second text is determined from each candidate text. An encoder then vectorizes the second text in each candidate text to obtain the sixth feature vector for each candidate text. It should also be noted that the pre-trained model in this application can be a BERT model; this application does not impose any limitations on the pre-trained model.
[0054] 203: Based on the fifth feature vector, the second shared feature vector, and the sixth feature vector corresponding to each of the multiple candidate texts to be trained, generate a second text summary corresponding to each candidate text to be trained.
[0055] In one optional embodiment of this application, the pre-trained model further includes a decoder, specifically: concatenating the fifth feature vector with the sixth feature vector corresponding to each candidate text to be trained to obtain the seventh feature vector corresponding to each candidate text to be trained; concatenating the second shared feature vector with the seventh feature vector corresponding to each candidate text to be trained to obtain the eighth feature vector corresponding to each candidate text to be trained; and then decoding the eighth feature vector corresponding to each candidate text to be trained through the decoder to obtain the second text summary corresponding to each candidate text to be trained.
[0056] 204: Based on the labels corresponding to each candidate text to be trained and the second text summary corresponding to each candidate text to be trained, the pre-trained model is trained to obtain the summary model.
[0057] For example, based on the label corresponding to each candidate text to be trained and the second text summary corresponding to each candidate text to be trained, the loss is calculated, and the pre-trained model is trained based on the loss to obtain the text summary model. It should be noted that in the process of training the pre-trained model based on the loss in the embodiments of this application, only the parameters of the encoder and decoder in the pre-trained model need to be adjusted, which speeds up the training efficiency.
[0058] As can be seen, in this embodiment, the first query statement is first vectorized to obtain a first shared feature vector and a first feature vector. The first shared feature vector is obtained by vectorizing the first keyword of the first query statement, and the first feature vector is obtained by vectorizing the text in the first query statement excluding the first keyword. Then, for the first candidate text, based on the first keyword and the first candidate text, a second feature vector corresponding to the first candidate text is determined. The first candidate text is any one of multiple candidate texts in the text library that includes the first keyword, and the second feature vector is obtained by vectorizing the first text in the first candidate text excluding the first keyword. The relevance of the first keyword to the first keyword is within a preset threshold range. That is, based on the first keyword, multiple candidate texts are found from the text library, each candidate text including the first keyword. Then, based on the first keyword, the first text is determined from each candidate text. The relevance of the first text in each candidate text to the first keyword is within a preset threshold range. Then, the first text in each candidate text is vectorized to obtain the second feature vector corresponding to each candidate text. In simpler terms, since the second feature vector corresponding to each candidate text is the relevance of its relevance to the first keyword in the first query statement within a preset threshold range, and the vector corresponding to the first keyword is the first shared feature vector, it can also be further understood as the... The second feature vector is determined based on the first shared feature vector, meaning the relevance between the second feature vector and the first shared feature vector for each candidate text is within the aforementioned threshold range. Finally, based on the first feature vector, the first shared feature vector, and the second feature vector corresponding to each candidate text, a first text summary is generated for each candidate text. Since the second feature vector is determined based on the first shared feature vector, meaning the determination of the second feature vector in each candidate text incorporates the first shared feature vector from the first query statement, the relevance between the second feature vector and the first shared feature vector is within the threshold range. Then, based on the first feature vector, the first shared feature vector, and the second feature vector from the multiple candidate texts... The second feature vector corresponding to each candidate text is used to generate the first text summary corresponding to each candidate text. At this time, the first text summary corresponding to each candidate text is combined with the information of the first query statement. That is, the second feature vector in the candidate text is determined based on the first keyword in the first query statement. This makes the final text summary generated for each candidate text based on the first keyword in the first query statement and the first text in the candidate text that is related to the first keyword. In other words, the text summary is not a high-level summary of the candidate text, but a summary generated based on the first query statement. This makes the generated summary relevant to the query statement, improves the accuracy of the summary generation, and thus meets the user's needs.
[0059] based on Figure 1 and Figure 2 The illustrated embodiments are shown in the references. Figure 3 , Figure 3 This is a schematic diagram of a text recommendation system provided in an embodiment of this application. The system includes a user terminal 301 and a text recommendation device 302. The number of user terminals 301 can be one or more, and the form of the user terminal 301 can be a mobile phone, computer, tablet, etc. This application does not limit the number and form of the user terminal 301.
[0060] It should be noted that a target application is installed on the user terminal 301. When a user wants to query multiple target texts related to their input second query statement in the target application, such as multiple notes related to the second query statement, multiple target texts can be obtained based on the text recommendation method provided in this application embodiment. Specifically: the text recommendation device 302 receives the second query statement from the user terminal 301; the text recommendation device 302 obtains target query statements matching the second query statement from the query statement set, wherein the query statement set is determined by historical query statements and / or randomly generated query statements; the text recommendation device 302 determines multiple target texts corresponding to the second query statement from the multiple candidate texts corresponding to the target query statement based on the second query statement and the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement. The method for determining the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement can refer to... Figure 1 The embodiment illustrates a summary generation method; the text recommendation device 302 recommends multiple target texts corresponding to the second query statement to the user terminal 301.
[0061] As can be seen, in this embodiment, the text recommendation device 302 first receives the second query statement from the user terminal 301, that is, it receives the second query statement input by the user from the user terminal 301; then, the text recommendation device 302 obtains the target query statement that matches the second query statement from the query statement set; then, based on the second query statement and the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement, the text recommendation device 302 determines multiple target texts corresponding to the second query statement from the multiple candidate texts corresponding to the target query statement. In other words, the text recommendation device 302 first determines the target query statement that matches the second query statement from the query statement set, and then, based on... The first aspect of the summary generation method determines the first text summary of each candidate text among multiple candidate texts corresponding to the target query statement. Since the first text summary obtained at this time is generated based on the candidate texts in combination with the target query statement, and the target query statement and the second query statement match, it can be understood that the first text summary of each candidate text among multiple candidate texts corresponding to the target query statement is also generated based on the second query statement. This integrates the user's query requirements, improves the accuracy of summary generation, and makes the finally determined multiple target texts meet the user's needs. Finally, the text recommendation device 302 recommends multiple target texts corresponding to the second query statement to the user terminal.
[0062] based on Figures 1-3 The illustrated embodiments are shown in the references. Figure 4 , Figure 4 This application provides an embodiment of a text recommendation method with an interactive flow diagram. The method is applied to... Figure 3 The text recommendation device 302 shown includes, but is not limited to, steps 401-404:
[0063] 401: The text recommendation device receives a second query statement from the user.
[0064] For example, when a user wants to query multiple target texts related to a second query statement, such as multiple notes, the user can enter the second query statement in the target application on the user's device and then send the second query statement to the text recommendation device through the user's device.
[0065] 402: The text recommendation device obtains the target query statement that matches the second query statement from the set of query statements.
[0066] The query statement set is determined by historical query statements and / or randomly generated query statements.
[0067] 403: The text recommendation device determines multiple target texts corresponding to the second query statement from the multiple candidate texts corresponding to the target query statement based on the second query statement and the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement.
[0068] In the embodiments of this application, the first text summary of each candidate text among the multiple candidate texts corresponding to the target query statement can be determined with reference to the summary generation method shown in the above embodiments. For example, based on the second query statement and the first text summary of each candidate text, the similarity corresponding to each candidate text is determined; based on the similarity corresponding to each candidate text and a threshold, multiple target texts are determined, wherein each target text is a candidate text among the multiple candidate texts with a similarity greater than the threshold.
[0069] 404: The text recommendation device recommends multiple target texts corresponding to the second query statement to the user.
[0070] After obtaining multiple target texts corresponding to the second query statement, that is, after obtaining multiple target texts related to the second query statement, these multiple target texts can be recommended to the user.
[0071] In an optional embodiment of this application, step 404 may further include: the text recommendation device acquiring the popularity and similarity of each target text among multiple target texts, wherein the popularity may be the number of likes, reposts, collections, etc.; then the text recommendation device determining the priority level of each target text based on the popularity of each target text, the similarity of each target text, the weight coefficient corresponding to the popularity, and the weight coefficient corresponding to the similarity; the text recommendation device sorting the multiple target texts from high to low priority based on the priority level of each target text; finally, the text recommendation device sending the sorted multiple target texts to the user terminal. Accordingly, when the target application on the user terminal receives the sorted target texts, it can display the multiple target texts to the user according to the sorting method, such as high priority first and low priority last. Then, the user can more easily find the text that better meets their needs from the multiple target texts based on this sorting method, thereby satisfying the user's needs.
[0072] As can be seen, in this embodiment, the second query statement is first received from the user terminal, that is, the second query statement input by the user is received from the user terminal; then, the target query statement matching the second query statement is obtained from the query statement set; then, based on the second query statement and the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement, multiple target texts corresponding to the second query statement are determined from the multiple candidate texts corresponding to the target query statement. The first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement is determined by the summary generation method as described in the first aspect. That is, the target query statement matching the second query statement is first determined from the query statement set, and then the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement is determined based on the summary generation method of the first aspect. Since the first text summary obtained at this time is generated from the candidate texts in combination with the target query statement, and the target query statement and the second query statement match, it can be understood that the first text summary of each candidate text in the multiple candidate texts corresponding to the target query statement is also generated in combination with the second query statement, thus incorporating the user's query requirements, improving the accuracy of summary generation, and ensuring that the finally determined multiple target texts meet the user's needs; finally, multiple target texts corresponding to the second query statement are recommended to the user terminal.
[0073] based on Figures 1-4 The illustrated embodiments are shown in the references. Figure 5 , Figure 5 This illustration shows a scenario for text recommendation based on summary generation, provided in an embodiment of this application. The scenario includes a summary generation device 501, a text recommendation device 502, a user terminal 503, a query statement set 504, and a text library 505. The query statement set 504 is determined by historical query statements and / or randomly generated query statements. Figure 5 The query statement set 504 shown includes multiple query statements (i.e., query statement 1, query statement 2, ..., query statement m); Figure 5 The text library 505 shown stores multiple texts (i.e., text 1, text 2, ..., text n), and these multiple texts can be user-published notes, articles, manuscripts, etc.
[0074] First, the summary generation device 501 obtains query statement 1, query statement 2, ..., query statement m from the query statement set 504, and text 1, text 2, ..., text n from the text library 505. Then, for any query statement, such as query statement 1, the summary generation device 501 performs keyword recognition on query statement 1 to determine the first keyword corresponding to query statement 1. Then, the summary generation device 501 vectorizes the first keyword and the text in query statement 1 other than the first keyword, respectively, to obtain the first shared feature vector and the first feature vector corresponding to query statement 1. Then, based on the first keyword, the summary generation device 501 determines a candidate texts corresponding to query statement 1 from the text library 505. Each of these a candidate texts... The candidate texts include the first keyword corresponding to query statement 1. Then, the summary generation device 501, for each candidate text, determines a second feature vector based on the first keyword and each candidate text. The second feature vector for each candidate text is obtained by vectorizing the first text (excluding the first keyword) within each candidate text, and the relevance between the first text and the first keyword is within a preset threshold range. Then, the summary generation device 501 generates and can store a text summary corresponding to each candidate text based on the first shared feature vector, the first feature vector, and the second feature vector corresponding to each candidate text. Since a candidate texts corresponding to query statement 1 are determined from the text library 505, the text summary corresponding to these a candidate texts is the... Figure 5 The dashed arrows (the purpose of the dashed arrows is to facilitate understanding; they display the text summary generated by the summary generation device 501, not to indicate output) Figure 5The “a+b+c” text summaries shown can be generated by the summarization device 501 and directly stored locally; of course, the “a+b+c” text summaries can also be generated by the summarization device 501 without being stored locally, such as stored on a server. This application does not limit this, but will use the method of generating by the summarization device 501 and storing directly locally as an example for illustration. The “text summary 11, text summary 12, ..., text summary 1a” referred to here represent the a text summaries corresponding to query statement 1 and the a candidate texts. Similarly, based on the keywords corresponding to query statement 2, the summarization device 501 determines the b candidate texts corresponding to query statement 2 from the text library 505. Then, the summarization device 501 can similarly obtain “text summary 21, text summary 22, ..., text summary 2b”, which represent the b text summaries corresponding to query statement 2 and the b candidate texts. Similarly, based on the keywords corresponding to the query statement m, the summary generation device 501 determines c candidate texts corresponding to the query statement m from the text library 505. Then, the summary generation device 501 can obtain "text summary m1, text summary m2, ..., text summary mc", which represent the c text summaries corresponding to the query statement m and the c candidate texts.
[0075] Furthermore, when a user enters a second query in the search box of a target application on the user's device (503), that is... Figure 5 The "****" in the middle, and touch Figure 5 When the "Search" button is pressed, the user terminal 503 sends a second query statement to the text recommendation device 502. Then, based on the second query statement, the text recommendation device 502 obtains the target query statement that matches the second query statement from the query statement set 504. Then, based on the target query statement, the text recommendation device 502 obtains the text summary corresponding to each candidate text among the multiple candidate texts corresponding to the target query statement from the summary generation device 501. Then, based on the second query statement and the text summaries corresponding to each candidate text, the text recommendation device 502 determines multiple target texts corresponding to the second query statement. Then, the text recommendation device 502 sends the multiple target texts to the user terminal 503. At this time, the user terminal 503 can display the multiple target texts to the user terminal 503 in a preset arrangement.
[0076] See Figure 6 , Figure 6 This application provides a functional unit block diagram of a summary generation device 600, which includes: a vectorization unit 601, a determination unit 602, and a generation unit 603.
[0077] Vectorization unit 601 is used to vectorize the first query statement to obtain a first shared feature vector and a first feature vector. The first query statement is any query statement in the query statement set, which is determined by historical query statements and / or randomly generated query statements. The first shared feature vector is obtained by vectorizing the first keyword of the first query statement, and the first feature vector is obtained by vectorizing the text in the first query statement other than the first keyword.
[0078] The determining unit 602 is used to determine the second feature vector corresponding to the first candidate text based on the first keyword and the first candidate text. The first candidate text is any one of the multiple candidate texts in the text library that includes the first keyword. The second feature vector is obtained by vectorizing the first text other than the first keyword in the first candidate text. The relevance between the first text and the first keyword is within a preset threshold range.
[0079] The generation unit 603 is used to generate a first text summary corresponding to each candidate text based on a first feature vector, a first shared feature vector, and a second feature vector corresponding to each candidate text among multiple candidate texts.
[0080] In one embodiment of this application, in generating a first text summary corresponding to each candidate text based on a first feature vector, a first shared feature vector, and a second feature vector corresponding to each candidate text among multiple candidate texts, the generation unit 603 is specifically used for:
[0081] The first feature vector and the second feature vector corresponding to each candidate text are concatenated to obtain the third feature vector corresponding to each candidate text;
[0082] The first shared feature vector and the third feature vector corresponding to each candidate text are concatenated to obtain the fourth feature vector corresponding to each candidate text;
[0083] The fourth feature vector corresponding to each candidate text is decoded to obtain the first text summary corresponding to each candidate text.
[0084] In specific implementation, the vectorization unit 601, determination unit 602, and generation unit 603 described in this embodiment of the invention can execute this invention. Figure 1 and Figure 2 Other implementations described in the illustrated embodiments will not be repeated here.
[0085] See Figure 7 , Figure 7 The functional unit block diagram of a text recommendation device provided in this application embodiment includes: a transceiver unit 701 and a processing unit 702;
[0086] The transceiver unit 701 is used to receive the second query statement from the user terminal;
[0087] Processing unit 702 is configured to obtain a target query statement that matches the second query statement from a set of query statements, wherein the set of query statements is determined by historical query statements and / or randomly generated query statements;
[0088] The processing unit 702 is configured to determine multiple target texts corresponding to the second query statement based on the second query statement and the first text summary of each candidate text among multiple candidate texts corresponding to the target query statement. The first text summary of each candidate text among multiple candidate texts corresponding to the target query statement can be determined by referring to the summary generation method shown in the above embodiment.
[0089] The transceiver unit 701 is used to recommend multiple target texts corresponding to the second query statement to the user terminal.
[0090] In specific implementation, the transceiver unit 701 and processing unit 702 described in the embodiments of the present invention can execute the present invention. Figure 3 and Figure 4 Other implementations described in the illustrated embodiments will not be repeated here.
[0091] See Figure 8 , Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 8 As shown, the electronic device 800 includes a transceiver 801, a processor 802, and a memory 803. These are connected via a bus 804. The memory 803 stores computer programs and data, and can transfer data stored in the memory 803 to the processor 802.
[0092] Processor 802 is used to read the computer program in memory 803 and perform the following operations:
[0093] The first query statement is vectorized to obtain a first shared feature vector and a first feature vector. The first query statement is any query statement in the query statement set, which is determined by historical query statements and / or randomly generated query statements. The first shared feature vector is obtained by vectorizing the first keyword of the first query statement, and the first feature vector is obtained by vectorizing the text in the first query statement excluding the first keyword. For the first candidate text, based on the first keyword and the first candidate text, a second feature vector is determined corresponding to the first candidate text. The first candidate text is any candidate text in the text library that includes the first keyword. The second feature vector is obtained by vectorizing the first text in the first candidate text excluding the first keyword. The relevance between the first text and the first keyword is within a preset threshold range. Based on the first feature vector, the second feature vector is determined. A shared feature vector and a second feature vector corresponding to each candidate text in a plurality of candidate texts are used to generate a first text summary corresponding to each candidate text; alternatively, the following can be performed: controlling transceiver 801 to receive a second query statement from a user terminal; obtaining a target query statement matching the second query statement from a set of query statements, wherein the set of query statements is determined by historical query statements and / or randomly generated query statements; determining a plurality of target texts corresponding to the second query statement from the plurality of candidate texts corresponding to the target query statement based on the second query statement and the first text summary of each candidate text in the plurality of candidate texts corresponding to the target query statement, wherein the first text summary of each candidate text in the plurality of candidate texts corresponding to the target query statement is determined by the summary generation method as described in any one of claims 1-4; and controlling transceiver 801 to recommend the plurality of target texts corresponding to the second query statement to the user terminal.
[0094] In specific implementations, the processor 802, memory 803, and transceiver 801 described in the embodiments of the present invention can execute the functions provided by the present invention. Figures 1-4 The implementation methods described in the illustrated embodiments will not be repeated here.
[0095] It should be understood that the electronic devices mentioned in this application may include smartphones (such as Android phones, iOS phones, Windows Phones, etc.), tablet computers, PDAs, laptops, mobile internet devices (MIDs), or wearable devices. The above-mentioned electronic devices are merely examples and not exhaustive, and include, but are not limited to, the electronic devices described above. In practical applications, the above-mentioned electronic devices may also include: intelligent in-vehicle terminals, computer equipment, etc.
[0096] This application also provides a computer-readable storage medium storing a computer program that is executed by a processor to implement some or all of the steps of any of the summary generation methods and text recommendation methods described in the above method embodiments.
[0097] This application also provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program operable to cause a computer to perform some or all of the steps of any of the summary generation methods and text recommendation methods described in the above method embodiments.
[0098] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0099] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions in other embodiments.
[0100] In the several embodiments provided in this application, it should be understood that the disclosed apparatus can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between devices or units may be electrical or other forms.
[0101] The units described as separate components may or may not be physically separate. 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 network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0102] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software program module.
[0103] If the integrated unit is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, 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. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0104] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing related hardware. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0105] The embodiments of this application have been described in detail above. Specific examples have been used to illustrate the principles and implementation methods of this application. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.
Claims
1. A method for generating summaries, characterized in that, The method includes: The first query statement is vectorized to obtain a first shared feature vector and a first feature vector. The first query statement is any query statement in the query statement set, which is determined by historical query statements and / or randomly generated query statements. The first shared feature vector is obtained by vectorizing the first keyword of the first query statement, and the first feature vector is obtained by vectorizing the text in the first query statement other than the first keyword. For the first candidate text, based on the first keyword and the first candidate text, a second feature vector corresponding to the first candidate text is determined, wherein the first candidate text is any one of the multiple candidate texts in the text library that includes the first keyword, and the second feature vector is obtained by vectorizing the first text other than the first keyword in the first candidate text, and the relevance between the first text and the first keyword is within a preset threshold range. Based on the first feature vector, the first shared feature vector, and the second feature vector corresponding to each of the plurality of candidate texts, a first text summary corresponding to each candidate text is generated, including: The first feature vector and the second feature vector corresponding to each candidate text are concatenated to obtain the third feature vector corresponding to each candidate text; the first shared feature vector and the third feature vector corresponding to each candidate text are concatenated to obtain the fourth feature vector corresponding to each candidate text; the fourth feature vector corresponding to each candidate text is decoded to obtain the first text summary corresponding to each candidate text.
2. The method according to claim 1, characterized in that, The summary generation method is executed through a summary model, and the method further includes: The query statement to be trained is vectorized to obtain a second shared feature vector and a fifth feature vector. The query statement to be trained is any query statement in the query statement set. The second shared feature vector is obtained by vectorizing the second keyword of the query statement to be trained. The fifth feature vector is obtained by vectorizing the text in the query statement to be trained except for the second keyword. For the first candidate text to be trained, based on the second keyword and the first candidate text to be trained, a sixth feature vector corresponding to the first candidate text to be trained is determined. The first candidate text to be trained is any one of the multiple candidate texts to be trained that include the second keyword in the text library. The sixth feature vector is obtained by vectorizing the second text other than the second keyword in the first candidate text to be trained. The relevance between the second text and the second keyword is within the preset threshold range. Based on the fifth feature vector, the second shared feature vector, and the sixth feature vector corresponding to each of the plurality of candidate texts to be trained, a second text summary corresponding to each candidate text to be trained is generated; The pre-trained model is trained based on the tags corresponding to each candidate text to be trained and the second text summary corresponding to each candidate text to be trained, to obtain the summary model.
3. The method according to claim 2, characterized in that, The step of generating a second text summary corresponding to each training candidate text based on the fifth feature vector, the second shared feature vector, and the sixth feature vector corresponding to each of the plurality of training candidate texts includes: The fifth feature vector and the sixth feature vector corresponding to each candidate text to be trained are concatenated to obtain the seventh feature vector corresponding to each candidate text to be trained. The second shared feature vector and the seventh feature vector corresponding to each candidate text to be trained are concatenated to obtain the eighth feature vector corresponding to each candidate text to be trained. The eighth feature vector corresponding to each candidate text to be trained is decoded to obtain the second text summary corresponding to each candidate text to be trained.
4. A text recommendation method, characterized in that, The method includes: Receive the second query statement from the user; Obtain the target query statement that matches the second query statement from the query statement set, wherein the query statement set is determined by historical query statements and / or randomly generated query statements; Based on the second query statement and the first text summary of each candidate text in the plurality of candidate texts corresponding to the target query statement, a plurality of target texts corresponding to the second query statement are determined, wherein the first text summary of each candidate text in the plurality of candidate texts corresponding to the target query statement is determined by the summary generation method as described in any one of claims 1-3; The system recommends multiple target texts corresponding to the second query statement to the user client.
5. The method according to claim 4, characterized in that, The step of determining multiple target texts corresponding to the second query statement based on the second query statement and the first text summary of each candidate text among multiple candidate texts corresponding to the target query statement includes: Based on the second query statement and the first text summary of each candidate text, the similarity corresponding to each candidate text is determined; Based on the similarity and threshold corresponding to each candidate text, the plurality of target texts are determined, wherein each target text is a candidate text among the plurality of candidate texts whose similarity is greater than the threshold.
6. A summary generation apparatus, characterized in that, The summary generation device includes a vectorization unit, a determination unit, and a generation unit; The vectorization unit is used to vectorize the first query statement to obtain a first shared feature vector and a first feature vector. The first query statement is any query statement in the query statement set, which is determined by historical query statements and / or randomly generated query statements. The first shared feature vector is obtained by vectorizing the first keyword of the first query statement, and the first feature vector is obtained by vectorizing the text in the first query statement other than the first keyword. The determining unit is used to determine a second feature vector corresponding to the first candidate text based on the first keyword and the first candidate text. The first candidate text is any one of a plurality of candidate texts in the text library that includes the first keyword. The second feature vector is obtained by vectorizing the first text other than the first keyword in the first candidate text. The relevance between the first text and the first keyword is within a preset threshold range. The generation unit is configured to generate a first text summary corresponding to each candidate text based on the first feature vector, the first shared feature vector, and the second feature vector corresponding to each candidate text among the plurality of candidate texts, including: concatenating the first feature vector and the second feature vector corresponding to each candidate text to obtain a third feature vector corresponding to each candidate text; concatenating the first shared feature vector and the third feature vector corresponding to each candidate text to obtain a fourth feature vector corresponding to each candidate text; and decoding the fourth feature vector corresponding to each candidate text to obtain the first text summary corresponding to each candidate text.
7. A text recommendation device, characterized in that, The text recommendation device includes: a transceiver unit and a processing unit; The transceiver unit is used to receive the second query statement from the user terminal; The processing unit is configured to obtain a target query statement that matches the second query statement from a set of query statements, wherein the set of query statements is determined by historical query statements and / or randomly generated query statements; The processing unit is configured to determine multiple target texts corresponding to the second query statement based on the second query statement and the first text summary of each candidate text among multiple candidate texts corresponding to the target query statement, wherein the first text summary of each candidate text among multiple candidate texts corresponding to the target query statement is determined by the summary generation method as described in any one of claims 1-3; The transceiver unit is used to recommend multiple target texts corresponding to the second query statement to the user terminal.
8. An electronic device, characterized in that, include: A processor and a memory, the processor being connected to the memory for storing a computer program, the processor being configured to execute the computer program stored in the memory to cause the electronic device to perform the method as claimed in any one of claims 1-3 or the method as claimed in claim 4 or 5.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that is executed by a processor to implement the method as claimed in any one of claims 1-3 or the method as claimed in claim 4 or 5.
Citation Information
Patent Citations
User intention identification method and device, server and medium
CN111832305A
Natural language search system
US20070106499A1
