Text generation method and device, equipment and storage medium

By responding to text processing instructions and using intelligent assistant and neural network technology to automatically generate text, the problems of low text generation efficiency and error risk in the existing technology are solved, and efficient and accurate text generation is achieved.

CN119227640APending Publication Date: 2024-12-31BEIJING QIHOOD TECHNOLOGY CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202310780447.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-06-29
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

In the prior art, text generation efficiency is low and prone to typos and semantic problems, which are mainly due to the need for manual editing by users, resulting in low efficiency.

Method used

By responding to text processing instructions, obtaining the pending text and processing types, determining the associated text, and generating target text based on the associated text and pending text, using intelligent assistant and neural network technology for automated generation, including extracting text keywords, semantic analysis, Steps such as feature extraction and weight fraction calculation.

Benefits of technology

It reduces the workload of user-generated text, improves the efficiency and quality of text generation, reduces the risk of typos and semantic mismatch, and improves the user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119227640A_ABST
    Figure CN119227640A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of computers, and discloses a text generation method and device, equipment and a storage medium. The method comprises the following steps: in response to a triggered text processing instruction, obtaining a to-be-processed text and a processing type in the text processing instruction; determining an associated text according to the processing type and the to-be-processed text; and generating a target text according to the associated text and / or the to-be-processed text. The associated text can be determined according to the processing type in the text processing instruction and the to-be-processed text, and the target text is generated according to the associated text and / or the to-be-processed text. Compared with an existing mode of generating the text only through manual editing of the user, the mode can generate the target text according to the processing type selected by the user and the to-be-processed text, the workload of generating the text by the user is reduced, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a text generation method, device, equipment and storage medium. Background Art

[0002] In the prior art, when creating text content, users are required to manually consult relevant materials or manually edit based on subjective ideas, and the text generation efficiency is low. Moreover, since users manually edit word by word, it is easy to have defects such as typos and semantic incomprehension. Therefore, how to improve the efficiency of text generation has become a technical problem that needs to be solved urgently.

[0003] The above contents are only used to assist in understanding the technical solution of the present invention and do not constitute an admission that the above contents are prior art. Summary of the invention

[0004] The main purpose of the present invention is to provide a text generation method, device, equipment and storage medium, aiming to solve the technical problem that text generation in the prior art requires manual editing by users, resulting in low text generation efficiency.

[0005] To achieve the above object, the present invention provides a text generation method, which comprises the following steps:

[0006] In response to the triggered text processing instruction, obtaining the text to be processed and the processing type in the text processing instruction;

[0007] Determine the associated text according to the processing type and the text to be processed;

[0008] Generate a target text according to the associated text and / or the text to be processed.

[0009] Optionally, the step of determining the associated text according to the processing type and the text to be processed includes:

[0010] When the processing type is intelligent text generation, extracting text keywords from the text to be processed;

[0011] Determining a text generation intention corresponding to the text to be processed based on the text keywords;

[0012] Determine associated text according to the text generation intention and the text keywords.

[0013] Optionally, the step of generating a target text according to the associated text and / or the text to be processed includes:

[0014] Determining the text similarity between the associated text and the text to be processed;

[0015] Selecting similar texts from the associated texts, the similarity between which and the text to be processed is greater than a preset threshold;

[0016] Eliminate duplicate texts in the similar texts to obtain the target text.

[0017] Optionally, the step of determining the associated text according to the processing type and the text to be processed includes:

[0018] When the processing type is to generate a summary class, the text to be processed is cleaned and pre-processed to obtain a cleaned text;

[0019] Determining a weight score for each word in the cleaned text;

[0020] Extracting a target sentence from the text to be processed according to the weight scores of the respective words;

[0021] Generate associated text according to the target sentence.

[0022] Optionally, the step of determining the weight score of each word in the cleaned text includes:

[0023] Determining each target word in the cleaned text;

[0024] Determining the word frequency and inverse document frequency corresponding to the target vocabulary;

[0025] A weight score of the target vocabulary is determined based on the word frequency and the inverse document frequency.

[0026] Optionally, the step of extracting a target sentence from the text to be processed according to the weight scores of the respective words comprises:

[0027] Selecting a preset number of high-weight words according to the weight scores of each word;

[0028] A target sentence containing the high-weight vocabulary is selected from the text to be processed based on the high-weight vocabulary.

[0029] Optionally, the step of determining the associated text according to the processing type and the text to be processed includes:

[0030] When the processing type is a continuation type, performing semantic analysis on the text to be processed to obtain a semantic analysis result;

[0031] Performing feature extraction on the text to be processed to obtain a feature extraction result, wherein the feature extraction result includes at least one of a keyword, an entity, and a topic;

[0032] Determine the associated text according to the semantic analysis result and the feature extraction result.

[0033] Optionally, the step of determining the associated text according to the semantic analysis result and the feature extraction result includes:

[0034] Determine a continuation strategy according to the semantic analysis result and the feature extraction result;

[0035] The associated text is determined according to the continuation strategy, the semantic analysis result and the feature extraction result.

[0036] Optionally, the step of determining the associated text according to the processing type and the text to be processed includes:

[0037] When the processing type is polishing, extracting target keywords from the text to be processed;

[0038] When the target keyword meets the preset condition, searching for the description text corresponding to the target keyword;

[0039] Generate associated text corresponding to the target keyword according to the description text.

[0040] Optionally, after the step of generating the target text according to the associated text and / or the text to be processed, the method further includes:

[0041] Determining an insertion position of the target text;

[0042] The target text is inserted into the insertion position according to a preset insertion strategy.

[0043] Optionally, before the step of obtaining the text to be processed and the processing type in the text processing instruction in response to the triggered text processing instruction, the step further includes:

[0044] Monitor user operation behaviors through preset monitoring events;

[0045] Acquire the text to be processed and the processing type selected by the user according to the operation behavior;

[0046] A text processing instruction is generated according to the text to be processed and the processing type.

[0047] In addition, to achieve the above object, the present invention also provides a text generation device, the device comprising:

[0048] A response module, used for responding to the triggered text processing instruction and obtaining the text to be processed and the processing type in the text processing instruction;

[0049] A determination module, used for determining the associated text according to the processing type and the text to be processed;

[0050] A generating module is used to generate a target text according to the associated text and / or the text to be processed.

[0051] In addition, to achieve the above-mentioned purpose, the present invention also proposes a text generation device, which includes: a memory, a processor, and a text generation program stored in the memory and executable on the processor, wherein the text generation program is configured to implement the steps of the text generation method described above.

[0052] In addition, to achieve the above-mentioned purpose, the present invention also proposes a storage medium, on which a text generation program is stored, and when the text generation program is executed by a processor, the steps of the text generation method described above are implemented.

[0053] The present invention responds to a triggered text processing instruction, obtains the text to be processed and the processing type in the text processing instruction; determines the associated text according to the processing type and the text to be processed; and generates the target text according to the associated text and / or the text to be processed. Since the present invention can determine the associated text according to the processing type and the text to be processed in the text processing instruction, and generate the target text according to the associated text and / or the text to be processed. Compared with the existing method of generating text only through manual editing by the user, the above method of the present invention can generate the target text according to the processing type and the text to be processed selected by the user, thereby reducing the workload of the user in generating text and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 It is a structural schematic diagram of a text generation device in a hardware operating environment involved in an embodiment of the present invention;

[0055] Figure 2 It is a flowchart of the first embodiment of the text generation method of the present invention;

[0056] Figure 3 It is a flowchart of the second embodiment of the text generation method of the present invention;

[0057] Figure 4 A schematic diagram of a flow chart of a third embodiment of a text generation method of the present invention;

[0058] Figure 5 This is a structural block diagram of the first embodiment of the text generation device of the present invention.

[0059] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0060] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.

[0061] Reference Figure 1 , Figure 1 The present invention is a schematic diagram of the structure of a text generation device in a hardware operating environment according to an embodiment of the present invention.

[0062] like Figure 1 As shown, the text generation device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a wireless fidelity (Wireless-Fidelity, WI-FI) interface). The memory 1005 may be a high-speed random access memory (Random Access Memory, RAM), or a stable non-volatile memory (Non-Volatile Memory, NVM), such as a disk storage. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.

[0063] Those skilled in the art will understand that Figure 1 The structure shown in the text generation device does not constitute a limitation of the text generation device, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.

[0064] like Figure 1 As shown, the memory 1005 as a storage medium may include an operating system, a network communication module, a user interface module, and a text generation program.

[0065] exist Figure 1 In the text generating device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the text generating device of the present invention can be set in the text generating device, and the text generating device calls the text generating program stored in the memory 1005 through the processor 1001, and executes the text generating method provided by the embodiment of the present invention.

[0066] Based on the above-mentioned text generation device, an embodiment of the present invention provides a text generation method, referring to Figure 2 , Figure 2 Schematic diagram of the flow chart of the first embodiment of the text generation method of the present invention.

[0067] In this embodiment, the text generation method includes the following steps:

[0068] Step S10: In response to the triggered text processing instruction, the text to be processed and the processing type in the text processing instruction are obtained.

[0069] It should be noted that the execution subject of this embodiment can be a computing service device with data processing, network communication and program running functions, such as a mobile phone, a tablet computer, a personal computer, etc., or an electronic device or a text generation device that can realize the above functions. The text generation device is taken as an example to illustrate this embodiment and the following embodiments.

[0070] In order to improve information processing capabilities, in some embodiments, an intelligent assistant can be installed on the text generating device. The intelligent assistant can be a program built based on natural language processing technology of the Generative Pre-trained Transformer (GPT) model. The intelligent assistant can receive the user's input text, parse the input text into a computer-understandable data format, and then use the pre-trained neural network model to generate response text.

[0071] In the specific implementation, the intelligent assistant uses the neural network in deep learning technology and is trained through a large amount of corpus data, so that it can learn the structure, grammatical rules and semantic information of the language. After the user enters the text, the intelligent assistant will first segment and parse the text, convert it into a computer-readable vector form, and then send it to the pre-trained neural network model for inference. During the inference process, the intelligent assistant will predict the most likely next response based on the text entered by the user and the previous context. This prediction process is based on the model's learning of a large amount of corpus data, so it can largely restore the way humans express natural language and generate highly coherent and natural response text. Finally, the intelligent assistant returns the generated response text to the user to complete a dialogue interaction. Throughout the process, the intelligent assistant will continue to learn and optimize to provide more accurate and user-friendly answers.

[0072] It should be noted that the text generation device may be a tool for processing documents, tables and presentations provided for individual users and / or enterprises, such as onlyoffice. The text processing instruction may be a command triggered by a user to generate a target text. The text processing instruction may include a text to be processed and a processing type. The processing type may include generating a continuation text of the text to be processed, generating a summary corresponding to the text to be processed, checking formatting issues in the text to be processed, polishing the text to be processed, etc. The text to be processed may be a reference text selected by the user. In some cases, the user may not select the text to be processed, for example, directly input a question to generate a target text about the question.

[0073] Furthermore, in order to capture the user's text processing instructions, before step S10, the method further includes: monitoring the user's operation behavior through a preset monitoring event;

[0074] Acquire the text to be processed and the processing type selected by the user according to the operation behavior;

[0075] A text processing instruction is generated according to the text to be processed and the processing type.

[0076] It should be noted that the preset monitoring event can be an event that can monitor the user's operation behavior, including: mouse click events, monitoring cursor events, etc. The onlyoffice event mechanism can be used. When the user selects text, the text selected by the user, that is, the text to be processed, can be obtained, and then the processing type selected by the user based on the displayed optional processing types can be obtained. A text processing instruction is generated according to the text to be processed and the processing type.

[0077] Step S20: determining the associated text according to the processing type and the text to be processed.

[0078] It should be noted that the determination of the associated text according to the processing type and the text to be processed may be to generate or query the text corresponding to the text to be processed, i.e. the associated text, according to the processing type. For example, when the processing type is to generate a summary, a summary text corresponding to the text to be processed, i.e. the associated text, is generated.

[0079] Furthermore, in order to generate text according to the user's text generation requirements and improve the user experience, the step S20 may include: when the processing type is a continuation type, performing semantic analysis on the text to be processed to obtain a semantic analysis result;

[0080] Performing feature extraction on the text to be processed to obtain a feature extraction result, wherein the feature extraction result includes at least one of a keyword, an entity, and a topic;

[0081] Determine the associated text according to the semantic analysis result and the feature extraction result.

[0082] It should be noted that the continuation type may be to continue to generate text based on the text to be processed. The semantic analysis of the text to be processed to obtain the semantic analysis result may be to understand the context, background and related information of the text to be processed by performing semantic analysis on the text to be processed. The feature extraction of the text to be processed may be to extract feature information such as keywords, named entities, themes, emotions, etc. in the text to be processed. The determination of the associated text based on the semantic analysis result and the feature extraction result may be based on an intelligent assistant, and the semantic analysis result and the feature extraction result are input into the intelligent assistant to obtain the associated text output by the intelligent assistant.

[0083] Furthermore, in order to make the generated associated text more in line with the user's expectations, the step of determining the associated text according to the semantic analysis result and the feature extraction result includes:

[0084] Determine a continuation strategy according to the semantic analysis result and the feature extraction result;

[0085] The associated text is determined according to the continuation strategy, the semantic analysis result and the feature extraction result.

[0086] It should be noted that the continuation strategy may include the type of continuation, which may include: generating a coherent story, generating relevant knowledge information, and generating a strategy for a certain topic. Determining the associated text according to the continuation strategy, the semantic analysis result, and the feature extraction result may be to search for associated information related to the feature extraction result, and then extract semantic information related to the semantics of the text to be processed from the associated information according to the semantic analysis result, and combine the semantic related information into an associated text according to the text expression method corresponding to the continuation strategy. The text expression method may be a text description method formulated in advance according to the continuation strategy. For example, when the continuation strategy is to generate a coherent story, the text expression method may be to describe it according to the timeline of the development of the event. When the continuation strategy is to generate relevant knowledge information, the text expression method may be to express it in sequence according to the relevance to the knowledge in the text to be processed, that is, to give priority to selecting the text with higher relevance to the text to be processed as the associated text. When the processing type is the continuation type, generating the target text according to the associated text and / or the text to be processed may be to insert the associated text into the corresponding position in the text to be processed to obtain the target text, for example, the associated text that explains the keywords and knowledge points in the text to be processed. Alternatively, the associated text may be inserted after the text to be processed to generate the target text. Alternatively, the associated text may be optimized to obtain the target text. Optimizing the associated text may include: Proofreading grammar and spelling: checking and correcting grammatical errors, spelling errors and punctuation problems in the text. Automatic proofreading tools such as Grammarly may be used to assist in checking. Ensure clear expression: explore whether there are ambiguous or vague sentences, and reorganize or rewrite them if necessary. Optimize sentence structure: check and optimize long, passive voice or complex sentences. Try to use concise, active voice expressions. Unify vocabulary and tone: keep the vocabulary and tone consistent throughout the text. Avoid reusing the same vocabulary, and use synonyms to replace it. Check paragraph structure: ensure that each paragraph has a clear topic sentence and that there are appropriate transitions between paragraphs. Strengthen arguments: ensure that the thesis and arguments support the theme of the article, and check whether the evidence is appropriate and sufficient.

[0087] Furthermore, in order to generate text according to the user's text generation requirements and improve the user experience, the step S20 may further include: when the processing type is polishing, extracting target keywords from the text to be processed;

[0088] When the target keyword meets the preset condition, searching for the description text corresponding to the target keyword;

[0089] Generate associated text corresponding to the target keyword according to the description text.

[0090] It should be noted that the target keyword may be a key phrase or sentence in the text to be processed, and the preset condition may be a condition pre-set to determine whether a phrase or sentence has room for further explanation or polishing. For example, when the target keyword is a preset word, a technical term, or a referenced link, it is determined that the target keyword meets the preset condition, and the description text may be a text used to explain or describe the target keyword. The associated text corresponding to the target keyword generated according to the description text may be selected from the searched description text to best explain or assist the user in understanding the target keyword.

[0091] Step S30: Generate a target text according to the associated text and / or the text to be processed.

[0092] It should be noted that the generation of the target text according to the associated text and / or the text to be processed may be to integrate the associated text and / or the text to be processed according to the processing type to generate a text that meets the user's expectations, that is, the target text. For example, if the processing type is to generate a summary of the text to be processed, then the associated text is the summary text corresponding to the text to be processed, and the generation of the target text according to the associated text and / or the text to be processed may be to generate a text containing the summary text according to the associated text and the text to be processed. After the target text is generated, the insertion position of the target text may also be determined; and the target text may be inserted into the insertion position according to a preset insertion strategy.

[0093] It should be noted that the preset insertion strategy may be a preset way of inserting the target text into the text to be processed, and may be a setting of the insertion speed of the target text according to the text length of the target text to improve the visual experience of the user.

[0094] In response to a triggered text processing instruction, this embodiment obtains the text to be processed and the processing type in the text processing instruction; determines the associated text according to the processing type and the text to be processed; and generates the target text according to the associated text and / or the text to be processed. Since this embodiment can determine the associated text according to the processing type and the text to be processed in the text processing instruction, and generate the target text according to the associated text and / or the text to be processed. Compared with the existing method of generating text only through manual editing by the user, the above method of this embodiment can generate the target text according to the processing type and the text to be processed selected by the user, thereby reducing the workload of the user in generating text and improving the user experience.

[0095] refer to Figure 3 , Figure 3 Schematic diagram of the flow chart of the second embodiment of the text generation method of the present invention.

[0096] Based on the above first embodiment, in this embodiment, step S20 includes:

[0097] Step S201: When the processing type is to generate a summary, the text to be processed is cleaned and pre-processed to obtain a cleaned text.

[0098] It should be noted that the cleaning preprocessing of the text to be processed may be cleaning and tidying up the text to be processed, including removing irrelevant content, eliminating duplicate information, fixing formatting problems and spelling errors, etc. The quality and accuracy of the generated text can be improved by cleaning preprocessing the text to be processed.

[0099] Step S202: Determine the weight score of each word in the cleaned text.

[0100] It should be noted that the determining of the weight score of each word in the cleaned text may be performed by using a statistical method such as TF-IDF to determine the weight score of each word in the cleaned text.

[0101] Further, in order to generate associated text that conforms to the semantics of the text to be processed, the step S202 may include: determining each target word in the cleaned text;

[0102] Determining the word frequency and inverse document frequency corresponding to the target vocabulary;

[0103] A weight score of the target vocabulary is determined based on the word frequency and the inverse document frequency.

[0104] It should be noted that the target vocabulary may be a key phrase or sentence selected from the text to be processed. The word frequency corresponding to the target vocabulary may be determined by counting the frequency of occurrence of the target vocabulary in the text to be processed, and the calculation formula may be: (number of occurrences of the target vocabulary in the text to be processed) / (total number of words in the text to be processed). The inverse document frequency may measure the general importance of the target vocabulary in the text to be processed, and may determine the total paragraphs in the text to be processed, and determine the number of paragraphs containing the target vocabulary. The calculation formula for calculating the inverse document frequency may be: log (total number of paragraphs in the text to be processed / number of paragraphs containing the target vocabulary). Determining the weight score of the target vocabulary based on the word frequency and the inverse document frequency may be to multiply the word frequency of the target vocabulary by the inverse document frequency as the weight score of the target vocabulary.

[0105] Step S203: extracting a target sentence from the text to be processed according to the weight scores of the various words.

[0106] It should be noted that extracting the target sentence from the text to be processed according to the weight scores of the various words may be selecting words whose weight scores are greater than a preset threshold according to the weight scores of the various words, and determining the sentence to which the selected words belong, i.e., the target sentence.

[0107] Further, in order to generate the associated text that meets the semantics of the text to be processed, the step S203 may include: selecting a preset number of high-weight words according to the weight scores of the respective words;

[0108] A target sentence containing the high-weight vocabulary is selected from the text to be processed based on the high-weight vocabulary.

[0109] It should be noted that the preset number may be a preset number of selected high-weight words. The selecting of a preset number of high-weight words according to the weight scores of the respective words may be to sort the words according to the weight scores of the respective words, and select a preset number of words with higher weight scores, i.e., high-weight words, according to the sorting results.

[0110] Step S204: Generate associated text according to the target sentence.

[0111] It should be noted that the generating of the associated text according to the target sentence may be to integrate the target sentence to obtain a text containing the target sentence, i.e., the associated text. Specifically, the selected target sentences may be integrated in the order in which the target sentences appear in the text to be processed to obtain the associated text.

[0112] In a specific implementation, a generative summary method can also be used to generate a summary corresponding to the text to be processed, that is, by understanding the meaning of the text to be processed and creating a new expression to generate a summary. The specific steps are: predefine a summary template for a specific type of text, then determine the target summary template to which the text to be processed belongs, and extract information from the text to be processed to fill the target summary template, so as to obtain a summary corresponding to the text to be processed, that is, the associated text.

[0113] In this embodiment, when the processing type is to generate a summary, the text to be processed is cleaned and preprocessed to obtain a cleaned text; the weight score of each word in the cleaned text is determined; the target sentence is extracted from the text to be processed according to the weight score of each word; and the associated text is generated according to the target sentence. In this embodiment, when the processing type is to generate a summary, the target sentence can be extracted from the text to be processed according to the weight score of each word in the text to be processed, and the associated text is generated according to the target sentence. This avoids users from manually writing summary texts of the text to be processed, thereby improving the user experience.

[0114] refer to Figure 4 , Figure 4 Schematic diagram of the flow chart of the third embodiment of the text generation method of the present invention.

[0115] Based on the above embodiments, in this embodiment, step S20 includes:

[0116] Step S205: When the processing type is the intelligent text generation type, extract text keywords from the text to be processed.

[0117] It should be noted that when the processing type is intelligent text generation, the text to be processed can be a description of the text to be generated input by the user. For example, the text to be processed input or selected by the user is: "XX place travel guide in June", "Where to travel in June", etc., and the selected processing type is intelligent text generation. The extraction of text keywords in the text to be processed can be feature extraction of the text to be processed to obtain feature words related to text generation in the text to be processed. For example, when the text to be processed is: "XX place travel guide in June", "Where to travel in June", the text keywords can be: travel, XX place, June.

[0118] Step S206: Determine the text generation intention corresponding to the text to be processed based on the text keywords.

[0119] It should be noted that the text generation intention corresponding to the text to be processed determined based on the text keywords can be to perform semantic analysis on the text to be processed based on the text keywords, and determine the text generation intention that the user wants to generate according to the semantic analysis results. The text generation intention may include the type of text to be generated, and the text type may be a strategy type, sentiment analysis type, popular science type, etc. For example, feature extraction is performed on a certain text to be processed "I want to eat", and the extracted text keywords may be: want and eat. Then the semantic analysis result obtained by performing semantic analysis on the text to be processed according to the text keywords may be: indicating that the user currently has the intention to eat, which may be seeking dining suggestions or indicating that he is hungry. At this time, the user's text generation intention may be to recommend nearby restaurants, and the generated text type may be a strategy type, for example, nearby restaurant information.

[0120] Step S207: determining associated text according to the text generation intention and the text keywords.

[0121] It should be noted that the determination of the associated text according to the text generation intention and the text keywords may be information related to the query according to the text generation intention and the text keywords. For example, the text keywords are: want, eat. The text generation intention is to recommend a nearby restaurant, then the associated text may be information about the restaurant queried according to the text generation intention and the text keywords, including information such as the restaurant location, rating, special dishes, per capita consumption, and whether it is open.

[0122] Furthermore, in order to avoid text redundancy and improve text accuracy so that the generated text meets the user's expectations, the step S30 may include: determining the text similarity between the associated text and the text to be processed;

[0123] Selecting similar texts from the associated texts, the similarity between which and the text to be processed is greater than a preset threshold;

[0124] Eliminate duplicate texts in the similar texts to obtain the target text.

[0125] It should be noted that the determination of the text similarity between the associated text and the text to be processed may be to convert the associated text and the text to be processed into vector representations to obtain an associated text vector and a text to be processed vector, and then calculate the cosine similarity between the associated text vector and the text to be processed vector. The cosine similarity is used as the text similarity between the associated text and the text to be processed, and Jaccard similarity, edit distance, etc. may also be calculated, which is not limited in this embodiment.

[0126] The preset threshold may be a preset similarity threshold, which is used to select texts that are relatively similar to the text to be processed from the associated texts, and used to generate the target text. The elimination of duplicate texts in the similar texts may be to calculate the similarity between the similar texts, determine two similar texts whose similarity between the similar texts is greater than a preset similarity threshold as duplicate texts, and delete any similar text in the duplicate texts. The target text is obtained by the similar texts after the duplicate texts are eliminated.

[0127] In this embodiment, when the processing type is the intelligent text generation type, text keywords in the text to be processed are extracted; based on the text keywords, the text generation intention corresponding to the text to be processed is determined; and the associated text is determined according to the text generation intention and the text keywords. In this embodiment, when the processing type is the intelligent text generation type, the text generation intention of the user can be determined according to the text keywords in the text to be processed input by the user, and then the associated text is automatically generated. It can help users generate text that meets their expectations and improve the user experience.

[0128] Reference Figure 5, Figure 5 This is a structural block diagram of the first embodiment of the text generation device of the present invention.

[0129] like Figure 5 As shown, the text generation device proposed in the embodiment of the present invention includes:

[0130] A response module 10 is used to obtain the text to be processed and the processing type in the text processing instruction in response to the triggered text processing instruction;

[0131] A determination module 20, configured to determine associated text according to the processing type and the text to be processed;

[0132] The generating module 30 is used to generate a target text according to the associated text and / or the text to be processed.

[0133] In response to a triggered text processing instruction, this embodiment obtains the text to be processed and the processing type in the text processing instruction; determines the associated text according to the processing type and the text to be processed; and generates the target text according to the associated text and / or the text to be processed. Since this embodiment can determine the associated text according to the processing type and the text to be processed in the text processing instruction, and generate the target text according to the associated text and / or the text to be processed. Compared with the existing method of generating text only through manual editing by the user, the above method of this embodiment can generate the target text according to the processing type and the text to be processed selected by the user, thereby reducing the workload of the user in generating text and improving the user experience.

[0134] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of the present invention. In practical applications, technicians in this field can select part or all of them according to actual needs to achieve the purpose of the present embodiment, and no limitation is made here.

[0135] In addition, for technical details not fully described in this embodiment, reference can be made to the text generation method provided in any embodiment of the present invention, and will not be repeated here.

[0136] Based on the above-mentioned first embodiment of the text generation device of the present invention, a second embodiment of the text generation device of the present invention is proposed.

[0137] In this embodiment, the determination module 20 is further used to extract text keywords from the text to be processed when the processing type is the intelligent text generation type;

[0138] Determining a text generation intention corresponding to the text to be processed based on the text keywords;

[0139] Determine associated text according to the text generation intention and the text keywords.

[0140] Furthermore, the determination module 20 is also used to determine the text similarity between the associated text and the text to be processed;

[0141] Selecting similar texts from the associated texts, the similarity between which and the text to be processed is greater than a preset threshold;

[0142] Eliminate duplicate texts in the similar texts to obtain the target text.

[0143] Furthermore, the determination module 20 is also used to perform cleaning preprocessing on the text to be processed to obtain a cleaned text when the processing type is to generate a summary class;

[0144] Determining a weight score for each word in the cleaned text;

[0145] Extracting a target sentence from the text to be processed according to the weight scores of the respective words;

[0146] Generate associated text according to the target sentence.

[0147] Furthermore, the determination module 20 is also used to determine each target word in the cleaned text;

[0148] Determining the word frequency and inverse document frequency corresponding to the target vocabulary;

[0149] A weight score of the target vocabulary is determined based on the word frequency and the inverse document frequency.

[0150] Furthermore, the determination module 20 is further configured to select a preset number of high-weight words according to the weight scores of the respective words;

[0151] A target sentence containing the high-weight vocabulary is selected from the text to be processed based on the high-weight vocabulary.

[0152] Furthermore, the determination module 20 is further configured to perform semantic analysis on the text to be processed to obtain a semantic analysis result when the processing type is a continuation type;

[0153] Performing feature extraction on the text to be processed to obtain a feature extraction result, wherein the feature extraction result includes at least one of a keyword, an entity, and a topic;

[0154] Determine the associated text according to the semantic analysis result and the feature extraction result.

[0155] Furthermore, the determination module 20 is further used to determine a continuation strategy according to the semantic analysis result and the feature extraction result;

[0156] The associated text is determined according to the continuation strategy, the semantic analysis result and the feature extraction result.

[0157] Furthermore, the determination module 20 is further configured to extract target keywords from the text to be processed when the processing type is polishing;

[0158] When the target keyword meets the preset condition, searching for the description text corresponding to the target keyword;

[0159] Generate associated text corresponding to the target keyword according to the description text.

[0160] Furthermore, the generating module 30 is also used to determine the insertion position of the target text;

[0161] The target text is inserted into the insertion position according to a preset insertion strategy.

[0162] Furthermore, the response module 10 is also used to monitor user operation behaviors through preset monitoring events;

[0163] Acquire the text to be processed and the processing type selected by the user according to the operation behavior;

[0164] A text processing instruction is generated according to the text to be processed and the processing type.

[0165] Other embodiments or specific implementations of the text generation device of the present invention can refer to the above-mentioned method embodiments, which will not be described in detail here.

[0166] In addition, an embodiment of the present invention further provides a storage medium, on which a text generation program is stored. When the text generation program is executed by a processor, the steps of the text generation method described above are implemented.

[0167] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or system. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or system including the element.

[0168] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0169] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as a read-only memory / random access memory, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0170] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.

[0171] The present invention discloses A1, a text generation method, which comprises the following steps:

[0172] In response to the triggered text processing instruction, obtaining the text to be processed and the processing type in the text processing instruction;

[0173] Determine the associated text according to the processing type and the text to be processed;

[0174] Generate a target text according to the associated text and / or the text to be processed.

[0175] A2. The text generation method as described in A1, wherein the step of determining the associated text according to the processing type and the text to be processed comprises:

[0176] When the processing type is intelligent text generation, extracting text keywords from the text to be processed;

[0177] Determining a text generation intention corresponding to the text to be processed based on the text keywords;

[0178] Determine associated text according to the text generation intention and the text keywords.

[0179] A3. The text generation method as described in A2, wherein the step of generating the target text according to the associated text and / or the text to be processed comprises:

[0180] Determining the text similarity between the associated text and the text to be processed;

[0181] Selecting similar texts from the associated texts, the similarity between which and the text to be processed is greater than a preset threshold;

[0182] Eliminate duplicate texts in the similar texts to obtain the target text.

[0183] A4. The text generation method as described in A1, wherein the step of determining the associated text according to the processing type and the text to be processed comprises:

[0184] When the processing type is to generate a summary class, the text to be processed is cleaned and pre-processed to obtain a cleaned text;

[0185] Determining a weight score for each word in the cleaned text;

[0186] Extracting a target sentence from the text to be processed according to the weight scores of the respective words;

[0187] Generate associated text according to the target sentence.

[0188] A5. In the text generation method as described in A4, the step of determining the weight score of each word in the cleaned text comprises:

[0189] Determining each target word in the cleaned text;

[0190] Determining the word frequency and inverse document frequency corresponding to the target vocabulary;

[0191] A weight score of the target vocabulary is determined based on the word frequency and the inverse document frequency.

[0192] A6. The text generation method as described in A4, wherein the step of extracting target sentences from the text to be processed according to the weight scores of the respective words comprises:

[0193] Selecting a preset number of high-weight words according to the weight scores of each word;

[0194] A target sentence containing the high-weight vocabulary is selected from the text to be processed based on the high-weight vocabulary.

[0195] A7. In the text generation method described in A1, the step of determining the associated text according to the processing type and the text to be processed comprises:

[0196] When the processing type is a continuation type, performing semantic analysis on the text to be processed to obtain a semantic analysis result;

[0197] Performing feature extraction on the text to be processed to obtain a feature extraction result, wherein the feature extraction result includes at least one of a keyword, an entity, and a topic;

[0198] Determine the associated text according to the semantic analysis result and the feature extraction result.

[0199] A8. The text generation method as described in A7, wherein the step of determining the associated text according to the semantic analysis result and the feature extraction result comprises:

[0200] Determine a continuation strategy according to the semantic analysis result and the feature extraction result;

[0201] The associated text is determined according to the continuation strategy, the semantic analysis result and the feature extraction result.

[0202] A9. In the text generation method described in A1, the step of determining the associated text according to the processing type and the text to be processed comprises:

[0203] When the processing type is polishing, extracting target keywords from the text to be processed;

[0204] When the target keyword meets the preset condition, searching for the description text corresponding to the target keyword;

[0205] Generate associated text corresponding to the target keyword according to the description text.

[0206] A10. The text generation method as described in any one of A1 to A9, after the step of generating the target text according to the associated text and / or the text to be processed, further comprising:

[0207] Determining an insertion position of the target text;

[0208] The target text is inserted into the insertion position according to a preset insertion strategy.

[0209] A11. The text generation method as described in any one of A1 to A9, before the step of obtaining the text to be processed and the processing type in the text processing instruction in response to the triggered text processing instruction, further comprising:

[0210] Monitor user operation behaviors through preset monitoring events;

[0211] Acquire the text to be processed and the processing type selected by the user according to the operation behavior;

[0212] A text processing instruction is generated according to the text to be processed and the processing type.

[0213] The present invention discloses B12, a text generation device, the text generation device comprising:

[0214] A response module, used for responding to the triggered text processing instruction and obtaining the text to be processed and the processing type in the text processing instruction;

[0215] A determination module, used for determining the associated text according to the processing type and the text to be processed;

[0216] A generating module is used to generate a target text according to the associated text and / or the text to be processed.

[0217] B13, as described in B12, the text generation device, the determination module is further used to extract text keywords in the text to be processed when the processing type is intelligent text generation type;

[0218] Determining a text generation intention corresponding to the text to be processed based on the text keywords;

[0219] Determine associated text according to the text generation intention and the text keywords.

[0220] B14, in the text generation device as described in B13, the determination module is further used to determine the text similarity between the associated text and the text to be processed;

[0221] Selecting similar texts from the associated texts, the similarity between which and the text to be processed is greater than a preset threshold;

[0222] Eliminate duplicate texts in the similar texts to obtain the target text.

[0223] B15, the text generation device as described in B12, the determination module is further used to perform cleaning preprocessing on the to-be-processed text to obtain a cleaned text when the processing type is to generate a summary class;

[0224] Determining a weight score for each word in the cleaned text;

[0225] Extracting a target sentence from the text to be processed according to the weight scores of the respective words;

[0226] Generate associated text according to the target sentence.

[0227] B16, the text generation device as described in B14, the determination module is further used to determine each target word in the cleaned text;

[0228] Determining the word frequency and inverse document frequency corresponding to the target vocabulary;

[0229] A weight score of the target vocabulary is determined based on the word frequency and the inverse document frequency.

[0230] B17, as described in B15, the text generation device, the determination module is further used to select a preset number of high-weight words according to the weight scores of each word;

[0231] A target sentence containing the high-weight vocabulary is selected from the text to be processed based on the high-weight vocabulary.

[0232] B18, the text generation device as described in B12, the determination module is further used to perform semantic analysis on the text to be processed to obtain a semantic analysis result when the processing type is a continuation type;

[0233] Performing feature extraction on the text to be processed to obtain a feature extraction result, wherein the feature extraction result includes at least one of a keyword, an entity, and a topic;

[0234] Determine the associated text according to the semantic analysis result and the feature extraction result.

[0235] The present invention discloses C19, a text generation device, which includes: a memory, a processor, and a text generation program stored in the memory and executable on the processor, wherein the text generation program is configured to implement the steps of the text generation method described in any one of A1 to A11.

[0236] The present invention discloses D20, a storage medium, on which a text generation program is stored. When the text generation program is executed by a processor, the steps of the text generation method as described in any one of A1 to A11 are implemented.

Claims

1. A text generation method, characterized in that: The text generation method comprises the following steps: In response to the triggered text processing instruction, obtaining the text to be processed and the processing type in the text processing instruction; Determine the associated text according to the processing type and the text to be processed; Generate a target text according to the associated text and / or the text to be processed.

2. The text generation method according to claim 1, characterized in that: The step of determining the associated text according to the processing type and the text to be processed includes: When the processing type is intelligent text generation, extracting text keywords from the text to be processed; Determining a text generation intention corresponding to the text to be processed based on the text keywords; Determine associated text according to the text generation intention and the text keywords.

3. The text generation method according to claim 2, characterized in that: The step of generating a target text according to the associated text and / or the text to be processed comprises: Determining the text similarity between the associated text and the text to be processed; Selecting similar texts from the associated texts, the similarity between which and the text to be processed is greater than a preset threshold; Eliminate duplicate texts in the similar texts to obtain the target text.

4. The text generation method according to claim 1, characterized in that: The step of determining the associated text according to the processing type and the text to be processed includes: When the processing type is to generate a summary class, the text to be processed is cleaned and pre-processed to obtain a cleaned text; Determining a weight score for each word in the cleaned text; Extracting a target sentence from the text to be processed according to the weight scores of the respective words; Generate associated text according to the target sentence.

5. The text generation method according to claim 4, characterized in that: The step of determining the weight score of each word in the cleaned text includes: Determining each target word in the cleaned text; Determining the word frequency and inverse document frequency corresponding to the target vocabulary; A weight score of the target vocabulary is determined based on the word frequency and the inverse document frequency.

6. The text generation method according to claim 4, characterized in that: The step of extracting a target sentence from the text to be processed according to the weight scores of each word comprises: Selecting a preset number of high-weight words according to the weight scores of each word; A target sentence containing the high-weight vocabulary is selected from the text to be processed based on the high-weight vocabulary.

7. The text generation method according to claim 1, characterized in that: The step of determining the associated text according to the processing type and the text to be processed includes: When the processing type is a continuation type, performing semantic analysis on the text to be processed to obtain a semantic analysis result; Performing feature extraction on the text to be processed to obtain a feature extraction result, wherein the feature extraction result includes at least one of a keyword, an entity, and a topic; Determine the associated text according to the semantic analysis result and the feature extraction result.

8. A text generation device, characterized in that: The text generating device comprises: A response module, used for responding to the triggered text processing instruction and obtaining the text to be processed and the processing type in the text processing instruction; A determination module, used for determining the associated text according to the processing type and the text to be processed; A generating module is used to generate a target text according to the associated text and / or the text to be processed.

9. A text generation device, characterized in that: The device comprises: a memory, a processor, and a text generation program stored in the memory and executable on the processor, wherein the text generation program is configured to implement the steps of the text generation method according to any one of claims 1 to 7.

10. A storage medium, characterized in that: The storage medium stores a text generation program, and when the text generation program is executed by the processor, the steps of the text generation method according to any one of claims 1 to 7 are implemented.

Citation Information

Cited By

  • Automated dictation correction technology

    US12417758B1

  • Automated text correction using correction probability scores

    US12451118B1