Text generation method and device, electronic equipment and computer program product

By introducing text filtering models into the generation system, including character matching, similarity matching and interdependence metric quantum models, the problems of information overload and unrelated information interference are solved, and more accurate and relevant text generation is achieved.

CN119848242APending Publication Date: 2025-04-18CHINA TELECOM CORP LTD TECHNOLOGY INNOVATION CENTER +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411910379.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-23
Publication Date
2025-04-18

AI Technical Summary

Technical Problem

Existing search-enhanced generation systems often face information overload and interference from irrelevant information when handling open domain question-and-answer tasks, resulting in inaccurate or context-free output from the generative model.

Method used

A text generation method is adopted to obtain the user's input text and obtain the relevant candidate text based on it. The candidate text is filtered using the character matching sub-model, the similarity matching sub-model and the interdependence metric quantum model to obtain the target matching text and generate the final output text.

Benefits of technology

By dynamically evaluating the relevance of text, accurately filtering irrelevant information, reducing information interference, significantly improving the accuracy and relevance of generated content, greatly improving the quality of generation, and reducing errors and information hallucinations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119848242A_ABST
    Figure CN119848242A_ABST
Patent Text Reader

Abstract

The invention relates to a text generation method and device, electronic equipment and a computer program product, and belongs to the technical field of natural language processing. The method comprises the steps of obtaining an input text of a user, and obtaining a candidate text related to the input text according to the input text; the input text and the candidate text are input into a text filtering model, and the text filtering model comprises a character matching sub-model, a similarity matching sub-model and an interdependence degree quantum model; filtering the candidate text through a sub-model in the text filtering model to obtain a filtering result corresponding to the sub-model; and obtaining a target matching text corresponding to the input text according to the filtering result of each sub-model, and generating an output text corresponding to the input text according to the target matching text. According to the method, irrelevant information is accurately filtered, so that information overload and interference can be reduced, and the text generation quality is greatly improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the technical field of natural language processing, and in particular, to a text generation method, a text generation device, an electronic device, and a computer program product. Background Art

[0002] Retrieval-enhanced generation systems are a key technology used in natural language processing to improve the performance of text generation tasks. In current retrieval-enhanced generation systems, when faced with knowledge-intensive language tasks such as open-domain question answering and fact verification, information overload and irrelevance problems often occur.

[0003] These systems usually rely on large-scale data retrieval, but due to the imperfection of the retrieval algorithm, they often retrieve information that is partially or completely irrelevant to the query, causing the generative model to produce inaccurate or context-irrelevant outputs. In addition, existing methods often lack effective filtering mechanisms when processing retrieved information, making the generated content vulnerable to interference information, thus affecting the overall generation quality.

[0004] In view of this, there is an urgent need in this field for a text generation method that can improve the accuracy of information filtering, reduce information interference, and optimize the results of text generation.

[0005] It should be noted that the information disclosed in the above background technology section is only used to enhance the understanding of the background of the present disclosure, and therefore may include information that does not constitute the prior art known to ordinary technicians in the field. Summary of the invention

[0006] The purpose of the present disclosure is to provide a text generation method, a text generation device, an electronic device and a computer program product, which can improve the accuracy of information filtering, reduce information interference and optimize the results of text generation at least to a certain extent.

[0007] According to a first aspect of the present disclosure, a method for generating text is provided, comprising:

[0008] Acquire a user's input text, and obtain candidate texts related to the input text according to the input text;

[0009] Inputting the input text and the candidate text into a text filtering model, wherein the text filtering model includes a character matching sub-model, a similarity matching sub-model and an interdependence measurement sub-model;

[0010] Filter the candidate texts through the sub-model in the text filtering model to obtain filtering results corresponding to the sub-model;

[0011] A target matching text corresponding to the input text is obtained according to the filtering results of each of the sub-models, and an output text corresponding to the input text is generated according to the target matching text.

[0012] In an exemplary embodiment of the present disclosure, when the sub-model is the character matching sub-model, filtering the candidate text by the sub-model in the text filtering model to obtain the filtering result corresponding to the sub-model includes:

[0013] Determine the weighting coefficients corresponding to each character in the input text and the candidate text, and obtain the hash value corresponding to each character according to the prime number mapping corresponding to each character and the weighting coefficients;

[0014] Obtaining a matching value between the input text and the candidate text according to a hash value corresponding to each character in the input text and a hash value corresponding to each character in the candidate text;

[0015] According to the matching values ​​of the input text and the candidate text, a filtering result of the character matching sub-model for the candidate text is obtained.

[0016] In an exemplary embodiment of the present disclosure, when the sub-model is the similarity matching sub-model, filtering the candidate text by the sub-model in the text filtering model to obtain the filtering result corresponding to the sub-model includes:

[0017] Obtain corresponding word embedding vectors according to each word in the input text and the candidate text;

[0018] Obtaining the similarity between the input text and the candidate text according to the word embedding vector and the word weight of each word;

[0019] According to the similarity between the input text and the candidate text, a filtering result of the similarity matching sub-model for the candidate text is obtained.

[0020] In an exemplary embodiment of the present disclosure, when the sub-model is the interdependence measurement sub-model, filtering the candidate text by the sub-model in the text filtering model to obtain the filtering result corresponding to the sub-model includes:

[0021] Acquire conditional variables related to the input text, and determine conditional probability distributions corresponding to the input text and the candidate text respectively under the given conditional variables;

[0022] Obtaining the amount of shared information between the input text and the candidate text according to the conditional probability distribution and the joint probability distribution of the input text, the candidate text and the conditional variable;

[0023] According to the shared information amount between the input text and the candidate text, a filtering result of the interdependence measurement sub-model for the candidate text is obtained.

[0024] In an exemplary embodiment of the present disclosure, obtaining candidate text related to the input text according to the input text includes:

[0025] Based on a preset search algorithm, candidate texts related to the input text are searched from a preset text set.

[0026] In an exemplary embodiment of the present disclosure, before searching for candidate texts related to the input text from a preset text set, the method further includes:

[0027] Preprocess the user's input text to obtain preprocessed formatted input text.

[0028] In an exemplary embodiment of the present disclosure, the step of generating an output text corresponding to the input text according to the target matching text includes:

[0029] The target matching text is input into the generation model to obtain the output text corresponding to the input text.

[0030] According to a second aspect of the present disclosure, there is provided a text generation device, comprising:

[0031] A candidate text acquisition module, used to acquire a user's input text and obtain candidate texts related to the input text according to the input text;

[0032] A filtering model input module, used for inputting the input text and the candidate text into a text filtering model, wherein the text filtering model includes a character matching sub-model, a similarity matching sub-model and an interdependence measurement sub-model;

[0033] A candidate text filtering module, used to filter the candidate texts through the sub-models in the text filtering model to obtain filtering results corresponding to the sub-models;

[0034] The output text generation module is used to obtain the target matching text corresponding to the input text according to the filtering results of each sub-model, and generate the output text corresponding to the input text according to the target matching text.

[0035] According to a third aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute any one of the above-described methods for generating text by executing the executable instructions.

[0036] According to a fourth aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method for generating text described in any one of the above is implemented.

[0037] The exemplary embodiments of the present disclosure may have the following beneficial effects:

[0038] In the text generation method of the example implementation method of the present disclosure, by dynamically evaluating the relevance of the text and accurately filtering irrelevant information, it is ensured that only key content is transmitted during the text generation process, which not only effectively reduces information overload and interference, but also significantly improves the accuracy and relevance of the generated content, greatly improves the generation quality, and effectively reduces errors and information illusions in the text generation process, thereby significantly improving the processing effect of information-intensive language tasks, and solving the problem of information overload and interference of irrelevant information caused by the imperfect retrieval system when the generation system processes open domain question and answer and fact verification tasks. In practical applications, the above-mentioned text generation method can effectively improve the quality and efficiency of text generation, so that the system has a stronger response capability when processing diversified and complex information, and is particularly suitable for complex knowledge-intensive tasks such as open domain question and answer and fact verification, and can provide users with a more intelligent and high-quality service experience.

[0039] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0041] Figure 1 A schematic diagram showing a flow chart of a method for generating text according to an exemplary embodiment of the present disclosure;

[0042] Figure 2 A schematic diagram of a process of performing text filtering through a character matching sub-model according to an exemplary embodiment of the present disclosure is shown;

[0043] Figure 3A schematic diagram of a process of performing text filtering through a similarity matching sub-model according to an exemplary embodiment of the present disclosure is shown;

[0044] Figure 4 A schematic diagram of a process of performing text filtering by using an interdependence metric sub-model according to an exemplary embodiment of the present disclosure is shown;

[0045] Figure 5 A schematic diagram showing a flow chart of a method for generating text according to a specific implementation of the present disclosure;

[0046] Figure 6 A block diagram showing a text generation device according to an exemplary embodiment of the present disclosure;

[0047] Figure 7 A schematic diagram of the structure of a computer system suitable for implementing the electronic device of the embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0048] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.

[0049] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0050] In some related embodiments, the retrieval-enhanced generation system directly integrates the retrieved context information into the generation model. Although it can expand the knowledge coverage, it often reduces the output quality due to the introduction of irrelevant or erroneous information. The possible problems are as follows:

[0051] 1. Lack of dynamic filtering mechanism: The methods in the relevant embodiments are mostly static filtering, which lacks the ability to flexibly respond to complex and changing context scenarios, resulting in low efficiency of the system when processing multi-hop questions and answers or complex queries.

[0052] 2. Over-reliance on local context: The filtering methods in the relevant embodiments can often only capture local context information and cannot effectively identify global semantic associations, resulting in poor performance of the generated content in a wide range of knowledge application scenarios.

[0053] Based on the above problems, this exemplary embodiment first provides a method for generating text. Figure 1 As shown, the method for generating the above text may include the following steps:

[0054] Step S110: Acquire the user's input text, and obtain candidate texts related to the input text according to the input text.

[0055] Step S120: Input the input text and the candidate text into a text filtering model, wherein the text filtering model includes a character matching sub-model, a similarity matching sub-model and an interdependence measurement sub-model.

[0056] Step S130: Filter the candidate texts through the sub-model in the text filtering model to obtain the filtering results corresponding to the sub-model.

[0057] Step S140: Obtain target matching text corresponding to the input text according to the filtering results of each sub-model, and generate output text corresponding to the input text according to the target matching text.

[0058] In the text generation method of the example implementation method of the present disclosure, by dynamically evaluating the relevance of the text and accurately filtering irrelevant information, it is ensured that only key content is transmitted during the text generation process, which not only effectively reduces information overload and interference, but also significantly improves the accuracy and relevance of the generated content, greatly improves the generation quality, and effectively reduces errors and information illusions in the text generation process, thereby significantly improving the processing effect of information-intensive language tasks, and solving the problem of information overload and interference of irrelevant information caused by the imperfect retrieval system when the generation system processes open domain question and answer and fact verification tasks. In practical applications, the above-mentioned text generation method can effectively improve the quality and efficiency of text generation, so that the system has a stronger response capability when processing diversified and complex information, and is particularly suitable for complex knowledge-intensive tasks such as open domain question and answer and fact verification, and can provide users with a more intelligent and high-quality service experience.

[0059] Next, combine Figures 2 to 5 The above steps of this exemplary embodiment are described in more detail.

[0060] In step S110, the user's input text is acquired, and candidate texts related to the input text are obtained according to the input text.

[0061] In this example implementation, the user's input text may include a question text input by the user, or factual information that the user wants to retrieve, etc. The candidate text related to the input text is context information related to the input text retrieved from a large-scale data set.

[0062] In this example implementation, the user's input text may be preprocessed first to obtain the preprocessed formatted input text.

[0063] Before searching for relevant contextual information, the system can receive the text input by the user and perform necessary preprocessing, including text cleaning and formatting, to remove noise in the text and ensure that the text format is friendly to machine processing.

[0064] In this example implementation, candidate texts related to the input text may be searched from a preset text set based on a preset search algorithm.

[0065] By using advanced search algorithms, such as some large models for text search, we can find information related to the preprocessed text in large-scale data sets, lay the foundation for subsequent context analysis, and provide the necessary detailed context information. Text preprocessing and search together provide a solid foundation for efficient and accurate information filtering and matching.

[0066] In step S120, the input text and the candidate texts are input into a text filtering model, wherein the text filtering model includes a character matching sub-model, a similarity matching sub-model and an interdependence measurement sub-model.

[0067] In this example implementation, a text filtering model may be used to filter candidate texts. The text filtering model includes a context filtering model for evaluating the relevance between each retrieved piece of information and the target fact.

[0068] Context filtering refers to the technology of optimizing information processing based on the context of text content in data processing or information retrieval. This method evaluates the relevance of text to the target facts, screens out information that is highly relevant to the task, and filters out irrelevant content, ensuring the accuracy and practicality of information output. This approach improves the efficiency and quality of decision support.

[0069] The context filtering model can effectively identify and filter out information that is irrelevant to the current verification task, retaining only the most critical and supportive content and passing it to the generation model.

[0070] In this example implementation, the text filtering model can adopt a parallel processing architecture design, which includes three highly integrated sub-models, which optimize the filtering effect at different levels, greatly improving the processing speed and efficiency. The first is the weighted hash sliding window character matching sub-model, which can use weighted hashing technology to quickly screen document fragments to match the content paragraphs most relevant to the query. Its accuracy and speed have been optimized, and it can quickly locate highly relevant documents in large-scale data; the second is the context-aware word embedding vocabulary similarity analysis sub-model, which captures the multi-dimensional semantic information of vocabulary through a deep learning model, and conducts a deeper analysis and optimization of the semantic consistency between documents and queries, thereby improving the accuracy and relevance of information; the third is the information sharing sub-model of conditional interdependence measurement, which uses advanced information measurement technology to evaluate the degree of sharing of different information under specific conditions, and further optimize the process of problem understanding and answer generation. The three sub-models work together through parallel processing, greatly shortening the processing time while ensuring the accuracy of the results.

[0071] In step S130, the candidate texts are filtered using the sub-model in the text filtering model to obtain filtering results corresponding to the sub-model.

[0072] In this example implementation, when the sub-model is a character matching sub-model, such as Figure 2 As shown, the candidate texts are filtered by the sub-model in the text filtering model to obtain the filtering results corresponding to the sub-model, which may specifically include the following steps:

[0073] Step S210: Determine the weighting coefficient corresponding to each character in the input text and the candidate text, and obtain the hash value corresponding to each character according to the prime number mapping and the weighting coefficient corresponding to each character.

[0074] In this example implementation, the character distribution and frequency of the string can be considered, and a weight coefficient ω(c) can be introduced, where c represents the character, and the weight of each character is considered in the hash function:

[0075]

[0076] Among them, prime(c) is the prime number mapping corresponding to each character to ensure the uniqueness of the hash function and minimize collisions. In this way, not only simple string matching is performed, but also the complexity of the internal structure of the string and the statistical properties of the characters are taken into account.

[0077] Step S220: Obtain matching values ​​of the input text and the candidate text according to the hash values ​​corresponding to each character in the input text and the hash values ​​corresponding to each character in the candidate text.

[0078] For the input text string s and the candidate text string t, a more complex substring matching function m(s,t) can be defined by adding a sliding window and probability evaluation mechanism. The model is as follows:

[0079]

[0080] Among them, δ(x,y) is a decision function, which takes the value of 1 when x=y and 0 otherwise. The hash function is introduced here to map a string to an integer, reducing the amount of calculation for direct string comparison. Choose a suitable hash function to minimize the probability of collision, and use the sliding window method to reduce repeated calculations.

[0081] Step S230: Obtain filtering results of the character matching sub-model for the candidate text according to the matching values ​​of the input text and the candidate text.

[0082] The output result of the character matching sub-model is the matching value of the input text and the candidate text, which indicates the number of matches of string s in string t. The more matches, the higher the character matching degree between the two. The candidate texts are filtered according to the character matching degree between the input text and the candidate text to obtain the filtering result of the character matching sub-model.

[0083] In this example implementation, when the sub-model is a similarity matching sub-model, Figure 3 As shown, the candidate texts are filtered by the sub-model in the text filtering model to obtain the filtering results corresponding to the sub-model, which may specifically include the following steps:

[0084] Step S310: Obtain corresponding word embedding vectors according to each word in the input text and the candidate text.

[0085] For input text A and candidate text B, through A i and B i Represents the i-th word in text A and B respectively, vec(A i ) and vec(B i ) represents a word embedding vector. The word embedding vector can be obtained according to a pre-trained embedding model, or other vector conversion methods can be used, which is not specifically limited in this example implementation.

[0086] Step S320: Obtain the similarity between the input text and the candidate text based on the word embedding vector and word weight of each word.

[0087] Considering the relevance of words in a specific context, context weight adjustment can be introduced to make the similarity calculation more precise and adaptable to specific application scenarios. The specific mathematical model is:

[0088]

[0089] Among them, w i It is the weight of the word in a specific context.

[0090] The function of the similarity matching sub-model is to help optimize document selection and improve the accuracy of answers by evaluating the similarity between candidate documents and user queries in terms of vocabulary usage. This method not only uses traditional cosine similarity calculation, but also introduces word embedding technology to capture rich semantic information of each word through a deep learning model.

[0091] Step S330: According to the similarity between the input text and the candidate text, obtain the filtering result of the similarity matching sub-model for the candidate text.

[0092] The output result of the similarity matching sub-model is the similarity between the input text and the candidate text. The candidate texts can be filtered according to the similarity value, and the candidate texts with relatively high similarity are retained.

[0093] In this example implementation, when the sub-model is an interdependence measurement sub-model, Figure 4 As shown, the candidate texts are filtered by the sub-model in the text filtering model to obtain the filtering results corresponding to the sub-model, which may specifically include the following steps:

[0094] Step S410: Acquire conditional variables related to the input text, and determine the conditional probability distributions corresponding to the input text and the candidate texts respectively under the given conditional variables.

[0095] The interdependence metric submodel is used to quantitatively evaluate the degree of information sharing between random variables under specific conditions to optimize question parsing and answer generation. For input text x and candidate text y, p(x|z) and p(y|z) can be used to represent the conditional probability distribution of x and y given z, where z is a third-party conditional variable related to the input text. For example, in an advertising delivery scenario, it is necessary to output the delivery effect for different users, and z can be different delivery user types.

[0096] Step S420. Obtain the shared information amount of the input text and the candidate text according to the conditional probability distribution and the joint probability distribution of the input text, the candidate text and the conditional variable.

[0097] In this example implementation, an advanced information measurement technology, called conditional interdependence measurement, can be used to examine the dependency relationship between two variables under the influence of a third variable, thereby enhancing the model's ability to handle complex queries. The mathematical formula is:

[0098]

[0099] Among them, p(x,y,z) is the joint probability distribution of the three variables. This method not only strengthens the understanding of the complex relationship between data, but also improves the response accuracy and efficiency of intelligent systems.

[0100] Step S430: Obtain filtering results of the interdependence measurement sub-model for the candidate texts according to the amount of shared information between the input text and the candidate texts.

[0101] The above formula can calculate the shared information between the input text and the candidate text. The higher the shared information, the higher the degree of dependence between the two. The candidate texts can be filtered according to the shared information, and the candidate texts with relatively high degree of dependence are retained.

[0102] In this example implementation, by adding a dynamic context filtering method, the common information overload and irrelevant information interference problems of existing generation systems in open domain question and answer and fact verification tasks are solved. The character matching submodel, similarity matching submodel and interdependence measurement submodel are processed in parallel to dynamically evaluate and adjust the filtering strategy. This strategy enables the system to flexibly adjust its processing flow according to the current input content and needs, dynamically filter and accurately identify useful contexts through entropy weight composite indicators, optimize the input of the generation model, and more accurately capture and filter key information in complex question and answer and multi-hop question and answer scenarios. By accurately quantifying the correlation between different information sources, the system can ensure that the information delivered to the generation module is both accurate and supportive, thereby providing a strong guarantee for generating more reasonable and accurate text or answers.

[0103] In step S140, a target matching text corresponding to the input text is obtained according to the filtering results of each sub-model, and an output text corresponding to the input text is generated according to the target matching text.

[0104] In this example implementation, a target matching text corresponding to the input text can be obtained according to the output results of each sub-model by voting, sorting or direct selection, and an output text corresponding to the input text can be generated according to the target matching text. Taking the question-answering system as an example, the input text is the question entered by the user, and the output text is the answer corresponding to the question.

[0105] In this example implementation, the target matching text may be input into the generation model to obtain output text corresponding to the input text.

[0106] The filtered target matching text can be fed into the generation model to generate the final text or answer based on the evaluation results. During this process, the system comprehensively considers the relevance and support of the information to ensure that the generated content is not only accurate but also highly relevant to the user query. Finally, the generated results can be displayed through the user interface, completing the entire process from information retrieval to text generation.

[0107] In this example implementation, on the basis of dynamic context filtering, an integration strategy is further used to effectively combine context filtering with the text generation model. This strategy not only adjusts the input of the text generation model, but also optimizes the processing process to ensure that the generated text is highly relevant and accurate. This integration method not only enhances the information utilization efficiency of the model, but also significantly improves the performance and accuracy of the model in different text generation tasks.

[0108] like Figure 5 The figure is a complete flow chart of a method for generating text in a specific implementation manner of the present disclosure, which is an example of the above steps in this example implementation manner. The specific steps of the flow chart are as follows:

[0109] Step S510. Input text.

[0110] Step S520: Data preprocessing.

[0111] Receive and clean text input by users, format it and remove noise, and ensure that the text format is machine-friendly.

[0112] Step S530: Information retrieval.

[0113] Use advanced search algorithms to find information related to the processed text in large-scale data sets, providing the necessary detailed contextual information for context analysis and filtering steps.

[0114] The above two steps together provide a solid foundation for efficient and accurate information filtering and matching.

[0115] Step S540: Context filtering.

[0116] This module can contain three highly integrated sub-modules, which optimize the filtering effect at different levels: the first is the weighted hash sliding window character matching module, which uses weighted hashing technology to quickly filter document fragments to match the content paragraphs most relevant to the query. Its accuracy and speed have been optimized, and it can quickly locate highly relevant documents in large-scale data; the second is the context-aware word embedding vocabulary similarity analysis module, which captures the multi-dimensional semantic information of vocabulary through a deep learning model, and conducts a deeper analysis and optimization of the semantic consistency between documents and queries, thereby improving the accuracy and relevance of information; the third is the information sharing module of conditional interdependence measurement, which uses advanced information measurement technology to evaluate the degree of sharing of different information under specific conditions, and further optimize the process of question understanding and answer generation. The three modules work together through parallel processing, which greatly shortens the processing time while ensuring the accuracy of the results.

[0117] Step S550: Text generation.

[0118] The filtered information is fed into the generation module, which generates the final text or answer based on the evaluation results.

[0119] Step S560: Output the result.

[0120] Outputting these generated texts or answers completes the entire process from information retrieval to text generation. The system's context filtering module not only significantly improves the intelligence of the generated system, but also enhances its adaptability when processing complex queries.

[0121] It should be noted that although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0122] Furthermore, the present disclosure also provides a text generation device. Figure 6 As shown, the text generation device may include a candidate text acquisition module 610, a filtering model input module 620, a candidate text filtering module 630 and a module 640. Among them:

[0123] The candidate text acquisition module 610 may be used to acquire the user's input text and obtain candidate texts related to the input text according to the input text;

[0124] The filtering model input module 620 can be used to input the input text and the candidate text into the text filtering model, wherein the text filtering model includes a character matching sub-model, a similarity matching sub-model and an interdependence measurement sub-model;

[0125] The candidate text filtering module 630 may be used to filter the candidate texts through the sub-models in the text filtering model to obtain filtering results corresponding to the sub-models;

[0126] The output text generation module 640 can be used to obtain the target matching text corresponding to the input text according to the filtering results of each sub-model, and generate the output text corresponding to the input text according to the target matching text.

[0127] In some exemplary embodiments of the present disclosure, the candidate text filtering module 630 may include a character hash value determination unit, a text matching value determination unit, and a text matching value filtering unit.

[0128] The character hash value determination unit can be used to determine the weight coefficient corresponding to each character in the input text and the candidate text, and obtain the hash value corresponding to each character according to the prime number mapping and the weight coefficient corresponding to each character;

[0129] The text matching value determination unit may be used to obtain the matching value of the input text and the candidate text according to the hash value corresponding to each character in the input text and the hash value corresponding to each character in the candidate text;

[0130] The text matching value filtering unit can be used to obtain the filtering result of the character matching sub-model for the candidate text according to the matching value of the input text and the candidate text.

[0131] In some exemplary embodiments of the present disclosure, the candidate text filtering module 630 may further include a word embedding vector determination unit, a text similarity determination unit, and a text similarity filtering unit.

[0132] The word embedding vector determination unit can be used to obtain corresponding word embedding vectors according to each word in the input text and the candidate text;

[0133] The text similarity determination unit can be used to obtain the similarity between the input text and the candidate text according to the word embedding vector and the word weight of each word;

[0134] The text similarity filtering unit can be used to obtain the filtering result of the similarity matching sub-model for the candidate text according to the similarity between the input text and the candidate text.

[0135] In some exemplary embodiments of the present disclosure, the candidate text filtering module 630 may further include a conditional probability distribution determination unit, a shared information amount determination unit, and a shared information amount filtering unit.

[0136] in:

[0137] The conditional probability distribution determination unit may be used to obtain conditional variables related to the input text, and determine the conditional probability distributions corresponding to the input text and the candidate text respectively under the given conditional variables;

[0138] The shared information amount determination unit may be used to obtain the shared information amount of the input text and the candidate text according to the conditional probability distribution and the joint probability distribution of the input text, the candidate text and the conditional variable;

[0139] The shared information filtering unit can be used to obtain the filtering result of the interdependence measurement sub-model for the candidate text according to the shared information between the input text and the candidate text.

[0140] In some exemplary embodiments of the present disclosure, the candidate text acquisition module 610 may include a text search unit, which may be used to search for candidate texts related to the input text from a preset text set based on a preset search algorithm.

[0141] In some exemplary embodiments of the present disclosure, the candidate text acquisition module 610 may further include a text preprocessing unit, which may be used to preprocess the user's input text to obtain the preprocessed formatted input text.

[0142] In some exemplary embodiments of the present disclosure, the output text generation module 640 may include a generation model input unit, which may be used to input the target matching text into the generation model to obtain an output text corresponding to the input text.

[0143] The specific details of each module / unit in the above-mentioned text generation device have been described in detail in the corresponding method embodiment part and will not be repeated here.

[0144] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the exemplary embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0145] Figure 7 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present disclosure is shown.

[0146] It should be noted that Figure 7 The computer system 700 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.

[0147] like Figure 7 As shown, computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. Various programs and data required for system operation are also stored in RAM 703. CPU 701, ROM 702 and RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to bus 704.

[0148] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.

[0149] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication section 709, and / or installed from a removable medium 711. When the computer program is executed by a central processing unit (CPU) 701, various functions defined in the system of the present disclosure are executed.

[0150] The exemplary embodiments of the present disclosure also provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, the method for generating the text is implemented.

[0151] In one embodiment, the computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing a computer program. The readable storage medium may be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk (HDD), solid-state drive (SSD), and the like. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing a computer program, such as a read-only memory, a NAND flash memory, and the like.

[0152] In one embodiment, the computer program product may be an intangible product including a computer program. Exemplarily, the computer program product may be implemented as a virtual digital product, such as a digital file storing an executable file, an installation package, etc. of the computer program.

[0153] The code of the computer program can be written in one or more programming languages. Programming languages ​​such as C language, Java, C++, etc. The program code can be executed entirely on the user computing device, or partially on the user computing device, or as a separate software package, or partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (e.g., an Internet connection provided by an operator).

[0154] The computer program may be carried or transmitted via electrical, magnetic, optical, electromagnetic, infrared, or other signals. The electronic device may convert the signal carrying the computer program into a digital signal, thereby running the computer program. When the computer program is run on an electronic device, its code is used to enable the electronic device to execute (more specifically, the processor of the electronic device may execute) the method steps of various exemplary embodiments of the present disclosure, such as the method for generating the above-mentioned text.

[0155] The flow charts and block diagrams in the accompanying drawings illustrate the possible architecture, functions and operations of the systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0156] It should be noted that, although several modules of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules described above can be concretized in one module. Conversely, the features and functions of one module described above can be further divided into multiple modules to be concretized.

[0157] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. The present disclosure is intended to cover any variations, uses or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary technical means in the art that are not disclosed in the present disclosure.

[0158] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims

1. A method for generating text, characterized in that: include: Acquire a user's input text, and obtain candidate texts related to the input text according to the input text; Inputting the input text and the candidate text into a text filtering model, wherein the text filtering model includes a character matching sub-model, a similarity matching sub-model and an interdependence measurement sub-model; Filter the candidate texts through the sub-model in the text filtering model to obtain filtering results corresponding to the sub-model; A target matching text corresponding to the input text is obtained according to the filtering results of each of the sub-models, and an output text corresponding to the input text is generated according to the target matching text.

2. The method for generating text according to claim 1, characterized in that: When the sub-model is the character matching sub-model, filtering the candidate text by the sub-model in the text filtering model to obtain the filtering result corresponding to the sub-model includes: Determine the weighting coefficients corresponding to each character in the input text and the candidate text, and obtain the hash value corresponding to each character according to the prime number mapping corresponding to each character and the weighting coefficients; Obtaining a matching value between the input text and the candidate text according to a hash value corresponding to each character in the input text and a hash value corresponding to each character in the candidate text; According to the matching values ​​of the input text and the candidate text, a filtering result of the character matching sub-model for the candidate text is obtained.

3. The method for generating text according to claim 1, characterized in that: When the sub-model is the similarity matching sub-model, filtering the candidate text by the sub-model in the text filtering model to obtain the filtering result corresponding to the sub-model includes: Obtain corresponding word embedding vectors according to each word in the input text and the candidate text; Obtaining the similarity between the input text and the candidate text according to the word embedding vector and the word weight of each word; According to the similarity between the input text and the candidate text, a filtering result of the similarity matching sub-model for the candidate text is obtained.

4. The method for generating text according to claim 1, characterized in that: When the sub-model is the interdependence measurement sub-model, filtering the candidate texts by the sub-model in the text filtering model to obtain the filtering result corresponding to the sub-model includes: Acquire conditional variables related to the input text, and determine conditional probability distributions corresponding to the input text and the candidate text respectively under the given conditional variables; Obtaining the amount of shared information between the input text and the candidate text according to the conditional probability distribution and the joint probability distribution of the input text, the candidate text and the conditional variable; According to the shared information amount between the input text and the candidate text, a filtering result of the interdependence measurement sub-model for the candidate text is obtained.

5. The method for generating text according to claim 1, characterized in that: The step of obtaining candidate texts related to the input text according to the input text includes: Based on a preset search algorithm, candidate texts related to the input text are searched from a preset text set.

6. The method for generating text according to claim 5, characterized in that: Before searching for candidate texts related to the input text from a preset text set, the method further includes: Preprocess the user's input text to obtain preprocessed formatted input text.

7. The method for generating text according to claim 1, characterized in that: Generating the output text corresponding to the input text according to the target matching text includes: The target matching text is input into the generation model to obtain the output text corresponding to the input text.

8. A text generation device, characterized in that: include: A candidate text acquisition module, used to acquire a user's input text and obtain candidate texts related to the input text according to the input text; A filtering model input module, used for inputting the input text and the candidate text into a text filtering model, wherein the text filtering model includes a character matching sub-model, a similarity matching sub-model and an interdependence measurement sub-model; A candidate text filtering module, used to filter the candidate texts through the sub-models in the text filtering model to obtain filtering results corresponding to the sub-models; The output text generation module is used to obtain the target matching text corresponding to the input text according to the filtering results of each sub-model, and generate the output text corresponding to the input text according to the target matching text.

9. An electronic device, characterized in that: include: processor; as well as A memory for storing one or more programs, which, when executed by the processor, enables the processor to implement the text generation method according to any one of claims 1 to 7.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the text generation method according to any one of claims 1 to 7 is implemented.