Text data generation method and device based on user requirements, equipment and medium

By segmenting the initial text data, semantic rewriting and updating the entity word, the problems of low efficiency and high cost of text data generation in the prior art are solved, and text data that meets user needs are quickly and efficiently generated.

CN119783679AActive Publication Date: 2025-04-08CHINA UNITED NETWORK COMM GRP CO LTD +2
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411865620.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-04-08
Estimated Expiration
2044-12-17

AI Technical Summary

Technical Problem

The prior art relies on manual annotation or web crawlers when building text training sets, which are inefficient and costly, have different data quality, and are difficult to quickly and efficiently obtain text data that meets user needs.

Method used

By obtaining the preset initial text data, performing slicing to obtain the semantic part and entity part, semantic rewriting and entity word updates are performed respectively to generate target text data.

Benefits of technology

It realizes the rapid generation of large amounts of text data that meets user needs, improves the efficiency and diversity of data generation, and reduces the cost and dependence of manual annotation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119783679A_ABST
    Figure CN119783679A_ABST
Patent Text Reader

Abstract

The embodiment of the invention provides a text data generation method and device based on user requirements, equipment and a medium. The method comprises the following steps: acquiring preset initial text data; wherein the preset initial text data is text data meeting user requirements; segmenting the preset initial text data to obtain a semantic part and an entity part in the preset initial text data; wherein the semantic part represents semantic information in the text data; the entity part represents entity words in the text data; performing semantic rewriting processing on the semantic part to obtain a rewritten semantic part, and performing word updating processing on the entity part to obtain an updated entity part; and generating target text data according to the rewritten semantic part and the updated entity part. The method is used for achieving the effect of quickly generating a large amount of text data meeting user requirements.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of text data generation, and in particular to a method, device, equipment and medium for generating text data based on user needs. Background Art

[0002] With the development of big model technology, big models are gradually being applied to various scenarios. In order to ensure that big models can meet the needs of users in corresponding scenarios, it is necessary to use a large amount of data from corresponding scenarios to form a data set for big model training, and use the data set to train the big model so that the big model can handle the tasks of the corresponding scenarios and meet the needs of users in the corresponding scenarios.

[0003] At present, the methods of constructing text training sets mostly rely on manual annotation or crawling data with web crawlers, which are inefficient and costly, and the data quality is uneven. Therefore, how to quickly and efficiently obtain a large amount of text data that meets user needs has become a problem that needs to be solved urgently. Summary of the invention

[0004] The embodiments of the present application provide a method, apparatus, device and medium for generating text data based on user needs, so as to achieve the effect of quickly generating a large amount of text data that meets the user needs.

[0005] In a first aspect, an embodiment of the present application provides a method for generating text data based on user needs, comprising:

[0006] Acquire preset initial text data; wherein the preset initial text data is text data that meets user needs;

[0007] The preset initial text data is segmented to obtain a semantic part and an entity part in the preset initial text data; wherein the semantic part represents the semantic information in the text data; and the entity part represents the entity words in the text data;

[0008] Performing semantic rewriting processing on the semantic part to obtain a rewritten semantic part, and performing word updating processing on the entity part to obtain an updated entity part;

[0009] The target text data is generated according to the rewritten semantic part and the updated entity part.

[0010] Optionally, in the above method, performing word update processing on the entity part to obtain an updated entity part includes:

[0011] From a preset entity database, search for entity words associated with the entity part as associated entities; wherein the preset entity database stores multiple entity words;

[0012] The words to be updated are determined from the associated entities, and masking is performed on the words to be updated, and the masked associated entities are determined as updated entity parts.

[0013] Optionally, in the above method, determining the words to be updated from the associated entities includes:

[0014] If it is determined that the grammatical structure of the associated entity is a verb-object structure, semantic recognition processing is performed on the verb and the object in the associated entity respectively, and the words to be updated are determined from the verb and the object.

[0015] Optionally, in the method described above, demand information is pre-set, and the demand information represents user demand; performing semantic recognition processing on verbs and objects in the associated entities respectively, and determining the words to be updated from the verbs and objects, including:

[0016] Performing semantic recognition processing on the verbs in the associated entity to determine the relevance between the verbs and the demand information as a first relevance, and performing semantic recognition processing on the objects in the associated entity to determine the relevance between the objects and the demand information as a second relevance;

[0017] According to the first relevance and the second relevance, a word to be updated is determined from the verb and the object.

[0018] Optionally, in the above method, determining the words to be updated from the associated entities includes:

[0019] If it is determined that the grammatical structure of the associated entity is not a verb-object structure, the associated entity is determined as a word to be updated.

[0020] Optionally, the method described above searches for entity words associated with the entity part from a preset entity database as associated entities, including:

[0021] Obtaining entity words in a preset entity database, and determining the degree of association between the entity part and the entity word; wherein the degree of association represents the degree of correlation between the entity part and the entity word;

[0022] According to the association between the entity part and the entity word, the associated entity is determined from a preset entity database.

[0023] Optionally, the method described above performs segmentation processing on the preset initial text data to obtain the semantic part and the entity part in the preset initial text data, including:

[0024] Based on the preset recognition model, the semantic part and entity part are identified from the preset initial text data, and the semantic part and entity part are segmented; wherein the preset recognition model is a pre-trained language model, which is used to identify the semantics and entity in the text data

[0025] Optionally, the method described above generates target text data according to the rewritten semantic part and the updated entity part, including:

[0026] The rewritten semantic part and the updated entity part are concatenated to obtain a first text to be processed;

[0027] Expanding the first text to be processed to obtain a second text to be processed;

[0028] The words to be updated are added to the masked part of the second text to be processed to obtain target text data.

[0029] In a second aspect, an embodiment of the present application provides a device for generating text data based on user needs, including:

[0030] An acquisition unit, used to acquire preset initial text data; wherein the preset initial text data is text data that meets user needs;

[0031] A segmentation unit is used to segment the preset initial text data to obtain a semantic part and an entity part in the preset initial text data; wherein the semantic part represents the semantic information in the text data; and the entity part represents the entity words in the text data;

[0032] A processing unit, configured to perform semantic rewriting processing on the semantic part to obtain a rewritten semantic part, and perform word update processing on the entity part to obtain an updated entity part;

[0033] The generating unit is used to generate target text data according to the rewritten semantic part and the updated entity part.

[0034] In a third aspect, an embodiment of the present application provides a device for generating text data based on user needs, including: a memory, a processor;

[0035] The memory stores computer-executable instructions;

[0036] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.

[0037] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.

[0038] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.

[0039] The method, device, equipment and medium for generating text data based on user needs provided by the embodiment of the present application obtains the initial text data preset by the user, and segments the text data to obtain the semantic part and entity part of the preset initial text data, rewrites the semantic part, updates the words of the entity part, and generates the target text data according to the rewritten semantic part and the updated entity part. By segmenting the initial text data, the semantic part and entity part of the text data are accurately obtained, which is convenient for operation; the semantic part is rewritten to generate sentences with similar semantics but different expressions, enriching the types of data; the entity part is updated to obtain more new related updated entity parts; according to the rewritten semantic part and the updated entity part, a large amount of target text data that meets the needs can be quickly generated, improving the efficiency and diversity of data generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0041] Figure 1 A flowchart of a method for generating text data based on user needs provided in an embodiment of the present disclosure;

[0042] Figure 2 A flowchart of a method for generating text data based on user needs provided in an embodiment of the present disclosure;

[0043] Figure 3 A flowchart of a method for generating text data based on user needs provided in an embodiment of the present disclosure;

[0044] Figure 4 A flowchart of a method for generating text data based on user needs provided in an embodiment of the present disclosure;

[0045] Figure 5 A structural block diagram of a device for generating text data based on user needs provided in an embodiment of the present disclosure;

[0046] Figure 6 A structural block diagram of a device for generating text data based on user needs provided in an embodiment of the present disclosure;

[0047] Figure 7 A structural block diagram of an electronic device provided in an embodiment of the present disclosure;

[0048] Figure 8 It is a block diagram of an electronic device according to an exemplary embodiment.

[0049] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0050] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0051] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0052] First, the terms involved in this application are explained:

[0053] BERT model: It is a Transformer-based deep learning model, mainly used for natural language processing tasks. The BERT model uses a large amount of text data to learn language representation through pre-training, and then fine-tunes it in specific NLP tasks to achieve better performance.

[0054] RoBERTa: A series of improvements and optimizations are made based on the BERT model to improve BERT's performance on various natural language understanding tasks.

[0055] Entity: Words such as names of people, places, and behaviors that have specific meanings.

[0056] ‌Prompt tuning: The main idea of ​​the Prompt fine-tuning method is to convert different downstream tasks into a common form during model pre-training through templates, narrow the difference in training data between pre-training and fine-tuning, reduce the storage and computing resource usage of the pre-trained model when fine-tuning downstream tasks, and improve the performance of the model in downstream tasks.

[0057] With the development of big model technology, big models are gradually applied to various scenarios. In order to make the big model run according to user needs, it is necessary to use a training set to train the big model in advance. The construction of the training set requires obtaining a large amount of data related to the demand field. By combining these data related to the demand field, an effective training set is formed.

[0058] Among the current applications of large models, using large models for text recognition is a relatively major use case, which is usually used in various scenarios such as behavior recognition and interest recommendation. However, the construction of training sets for corresponding scenarios has become a more difficult problem at present.

[0059] At present, most of the methods for constructing text training sets have difficult-to-solve problems and limitations. For example, the traditional method is to use manual annotation and construct data, and the annotators screen and annotate a large amount of text to generate a training set that meets the requirements. This is costly and inefficient, and is easily affected by the subjective influence of the staff, resulting in uneven data quality. Another method is to use web crawlers to crawl Internet texts. Due to the current upgrade of the Internet security mechanism, it is difficult to crawl valid content, and the data volume is large. The data also needs to be reviewed and filtered, making it difficult to use efficiently. The text generated using the traditional semantic rewriting method is too similar to the original text, making it difficult to generate diverse data and effectively generate new content.

[0060] The method for generating text data based on user needs provided in this application is intended to solve the above technical problems in the prior art.

[0061] The specific application scenario of this application is the generation of text data, which is used to process the initial text data preset by the user according to the needs, obtain the semantic part and the entity part after segmentation, rewrite the semantic part, update the words of the entity part, and generate the target text data according to the rewritten semantic part and the updated entity part. It makes it possible to quickly generate a large amount of target text data that meets the user's needs according to the user's needs and the preset initial text data. It solves the technical problem of complex and inefficient text data generation.

[0062] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0063] Figure 1 A flowchart of a method for generating text data based on user needs provided in an embodiment of the present disclosure is provided. The method can be executed by a device for generating text data based on user needs.

[0064] like Figure 1 As shown, the method comprises the following steps:

[0065] S101, obtaining preset initial text data; wherein the preset initial text data is text data that meets user needs.

[0066] Exemplarily, the user or staff manually constructs at least one initial text according to the demand, which is the preset initial text data. Obtain the initial text data. For example, if the user needs to train a large model that can recognize social activity texts, the demand for text data is text data of social content, and the manually constructed initial text can be "I want to plan an outing, is there anyone to join me?" or "Meeting with friends on the weekend."

[0067] S102, segmenting the preset initial text data to obtain a semantic part and an entity part in the preset initial text data; wherein the semantic part represents the semantic information in the text data; and the entity part represents the entity words in the text data.

[0068] Exemplarily, the preset initial text data is segmented to obtain the semantic part and entity part of the preset initial text data. For example, a large model can be pre-set, and the large model can be a natural language processing model, which is used to identify the text content of the initial text data, identify the semantic content and entity content in the initial text data, and segment the preset initial text data, segmenting the semantic content into semantic parts, and segmenting the entity content into entity parts. Among them, the semantic part represents the semantics in the initial text data, and the entity part represents specific behaviors, place names, names of people and other content related to user needs. In this embodiment, the model structure of the model is not specifically limited.

[0069] For example, the user's demand for text data is text data with social content, and the preset initial text data is "I want to plan a picnic, is there anyone to join me?". The preset natural language processing model is used to identify the preset initial text data, and the semantic content is identified as "I want, is there anyone to join me?"; the entity content related to social activities is identified as "Planning a picnic". The placeholder is used to fill in the position where the entity part is removed, and "I want XXXX, is there anyone to join me?" is obtained. "I want XXXX, is there anyone to join me?" is determined as the semantic part of the preset initial text data; "Planning a picnic" is determined as the entity part of the preset initial text data.

[0070] S103, performing semantic rewriting processing on the semantic part to obtain a rewritten semantic part, and performing word updating processing on the entity part to obtain an updated entity part.

[0071] Exemplarily, the semantic part is rewritten in a diversified manner to obtain a rewritten semantic part. Among them, the rewriting process of the semantic part is equivalent to a synonymous paraphrase of the semantic part, and the rewritten semantic part is semantically similar to the original semantic part but has a different expression. For example, a rewriting model can be preset, and the preset rewriting model is a large model. The preset rewriting model is used to rewrite the semantic part to generate at least one text content with similar semantics but different expression. According to the preset rewriting model, the semantic part is rewritten to obtain a rewritten semantic part. For example, the semantic part is "I want XXXX, is anyone coming?", and the semantic part can be rewritten into "I want XXXX, is anyone coming too?" and at least one rewritten text.

[0072] Perform word update processing on the entity part to obtain an updated entity part. For example, a word update model can be preset, and the preset word update model can be a large model. The preset word update model is used to perform semantic recognition on the entity part, and replace the entity part with synonyms, update the entity part to multiple synonyms, and use the synonyms as new entities to obtain an updated entity part. For example, the entity part is "planning an outing", and the semantics thereof is recognized and replaced with at least one updated entity part such as a synonym "planning an outing", "planning a hiking activity", and "planning a spring outing".

[0073] S104: Generate target text data according to the rewritten semantic part and the updated entity part.

[0074] Exemplarily, the target text data is generated according to the rewritten semantic part and the updated entity part. For example, the updated entity part may replace the placeholder content in the rewritten semantic part, that is, replace the "XXXX" in the rewritten semantic part. For example, the placeholder in the rewritten semantic part "I want XXXX, is anyone coming?" is replaced with the updated entity part "Planning a hiking activity" or "Planning a spring outing activity", and "I want to plan a hiking activity, is anyone coming?" or "I want to plan a spring outing activity, is anyone coming?" is obtained. Each updated entity part is replaced with each rewritten semantic part to obtain at least one replaced text, and the replaced text is determined as the target text data.

[0075] In one example, after obtaining the target text data, the target text data is verified and processed to determine the verification score of each target text in the target text data, and the verification score represents the degree of correlation between the target text data and the data required by the user. For example, a verification model can be pre-set, and the verification model is used to verify the target text data. The verification model can be a large model. A preset verification data set is obtained, and the preset large model is trained using the verification data set to obtain a preset verification model. According to the preset verification model, the target text data is verified and processed to determine the verification score of each text, and the text in the target text data whose verification score is lower than the preset verification score threshold is deleted.

[0076] The method, device, equipment and medium for generating text data based on user needs provided by the embodiment of the present application obtains the initial text data preset by the user, and segments the text data to obtain the semantic part and entity part of the preset initial text data, rewrites the semantic part, updates the words of the entity part, and generates the target text data according to the rewritten semantic part and the updated entity part. By segmenting the initial text data, the semantic part and entity part of the text data are accurately obtained, which is convenient for operation; the semantic part is rewritten to generate sentences with similar semantics but different expressions, enriching the types of data; the entity part is updated to obtain more new related updated entity parts; according to the rewritten semantic part and the updated entity part, a large amount of target text data that meets the needs can be quickly generated, improving the efficiency and diversity of data generation.

[0077] Figure 2 The present invention provides a flowchart of a method for generating text data based on user needs in an embodiment of the present invention. Figure 1 Based on the embodiment, the entity part is processed by word update to obtain the updated entity part, which is described in detail. The method includes:

[0078] From a preset entity database, entity words associated with the entity part are searched as associated entities; wherein the preset entity database stores multiple entity words; words to be updated are determined from the associated entities, and the words to be updated are masked, and the masked associated entities are determined as updated entity parts.

[0079] like Figure 2 As shown, the method comprises the following steps:

[0080] S201, obtaining preset initial text data; wherein the preset initial text data is text data that meets user needs.

[0081] Exemplarily, this step may refer to the above-mentioned step S101 and will not be described in detail.

[0082] S202, segmenting the preset initial text data to obtain a semantic part and an entity part in the preset initial text data; wherein the semantic part represents the semantic information in the text data; and the entity part represents the entity words in the text data.

[0083] Exemplarily, this step may refer to the above-mentioned step S102 and will not be described in detail.

[0084] S203, performing semantic rewriting processing on the semantic part to obtain a rewritten semantic part, and searching for entity words associated with the entity part from a preset entity database as associated entities; wherein the preset entity database stores a plurality of entity words.

[0085] Exemplarily, according to a preset semantic rewriting model, a semantic part is subjected to diversified rewriting processing to obtain at least one rewritten semantic part.

[0086] The entity database is pre-set, and a plurality of entity words related to user needs are stored in the pre-set entity database. For example, if the user's demand for text data is text data of social content, the pre-set entity database contains various entity words related to social, such as social behavior, friend titles, and social locations.

[0087] From the preset entity library, search for entity words associated with the entity part as associated entities. For example, an entity semantic recognition model can be pre-set, and the preset entity semantic recognition model is used to recognize the semantics of the entity part. The preset entity semantic recognition model can be a large model. According to the entity part, based on the preset entity semantic recognition model, the semantics of the entity part is recognized, and in the preset entity database, entity words with similar semantics to the entity part are searched as associated entities. For example, if the entity part is "planning an outing", semantic recognition is performed on the entity part, and entity words semantically related to the entity part are queried from the preset entity library. At least one related entity word such as "planning an outing", "planning a hiking activity", and "planning a spring outing activity" can be found, and the found entity word is determined as an associated entity.

[0088] The beneficial effect of such a setting is that by pre-setting an entity database related to user needs and searching for related entities from the entity database, the scope of entity search can be narrowed, the efficiency of searching for related entities can be improved, the related entities found can be made more accurate, and the search efficiency can be improved.

[0089] In this embodiment, entity words associated with entity parts are searched from a preset entity database as associated entities, including: obtaining entity words in the preset entity database, and determining the association degree between the entity part and the entity words; wherein the association degree represents the degree of relevance between the entity part and the entity words; and determining the associated entity from the preset entity database according to the association degree between the entity part and the entity words.

[0090] Specifically, an entity database related to user needs is preset, entity words in the preset entity database are obtained, and the association between the entity part and the entity word is determined. For example, a recommendation model can be preset, and the recommendation model is used to calculate the association between the entity part and the entity word. The preset recommendation model can be a shopping basket model.

[0091] According to the entity part, the preset entity database, based on the preset recommendation model, the entity words in the preset entity database are traversed to determine the association between the entity part and each entity word in the entity database. Among them, the association between the entity part and the entity word includes at least one of the indicators such as support and confidence. For any entity word, based on the preset recommendation model, the frequency of the entity word and the entity part appearing at the same time in all usage scenarios is determined, and the frequency is determined as the support; the probability of the entity part and the entity word appearing at the same time in the scenario where the entity part appears is determined, and the probability is determined as the confidence.

[0092] According to the determined association between the entity part and the entity word, the associated entity is determined from a preset entity database. For example, a relevance threshold may be preset, and entity words in the preset entity word database whose relevance exceeds the preset relevance threshold are determined as associated entities.

[0093] The beneficial effect of such a setting is that the shopping basket model is used to determine the association between the entity part and the entity word, and the association is calculated through multiple indicators of the shopping basket model, so that the determined association is more accurate and the correlation between the determined associated entity and the entity part is higher.

[0094] S204: Determine the words to be updated from the associated entities, mask the words to be updated, and determine the masked associated entities as updated entity parts.

[0095] Exemplarily, after obtaining at least one associated entity associated with the entity part, the words to be updated are determined from the associated entities, and the words to be updated are masked. For example, the associated entity can be subjected to grammatical structure recognition to identify the grammatical structure composition of the associated entity, such as a verb-object structure or a non-verb-object structure. If the grammatical structure of the associated entity is a non-verb-object structure, the associated entity is determined as a word to be updated; if the grammatical structure of the associated entity is a verb-object structure, the object part in the grammatical structure is determined as a word to be updated. Masking the words to be updated can be replacing the words to be updated with placeholders, and determining the masked associated entity as the updated entity part. For example, if the associated entity is "planning an outing", the grammatical structure is recognized, and it is judged to be a verb-object structure, and the object component in the structure is determined as a word to be updated, and it is masked to obtain the updated entity part "planning XXXX"; if the associated entity is "party plan", the grammatical structure is recognized, and it is judged to be a non-verb-object structure, then the associated entity is determined as a word to be updated, and it is masked to obtain the updated entity part "XXXX". In this embodiment, the method for grammatical structure recognition is not specifically limited.

[0096] The beneficial effect of such a setting is that the words to be updated in the associated entities are determined one by one, and the words to be updated are masked, so that the subsequent replacement operation can be more flexible, eliminating the problem of subject-object mismatch in the replacement link, and making the semantics of the generated text data smoother and more reasonable.

[0097] In this embodiment, determining the words to be updated from the associated entity includes: if it is determined that the grammatical structure of the associated entity is a verb-object structure, performing semantic recognition processing on the verb and the object in the associated entity respectively, and determining the words to be updated from the verb and the object.

[0098] Specifically, the grammatical structure of the associated entity is identified. If it is determined that the grammatical structure of the associated entity is a verb-object structure, the verb and object in the associated entity are semantically identified. For example, a verb-object semantic recognition model can be pre-set, and the verb-object semantic recognition model is used to identify the semantics of the verb in the associated entity, and the semantics of the object in the associated entity. By identifying the verb semantics and object semantics in the associated entity, according to the verb semantics and object semantics in the associated entity, the part of the entity that contains the user's needs in the semantics is determined as the word to be updated. For example, if the user's demand for text data is text data of social content, and the associated entity is "planning an outing", the verb part and the object part thereof are semantically identified, and it is determined that "outing activities" in its object part is the entity of the user's needs, and then "outing activities" are determined as the word to be updated.

[0099] The beneficial effect of such a setting is that semantic recognition is performed on verbs and objects respectively, and the words to be updated are determined from the verbs or objects based on the results of semantic recognition, so that the determined words to be updated are more accurate, more in line with user needs, and easier to replace later.

[0100] In this embodiment, demand information is pre-set, and the demand information represents user demand; semantic recognition processing is performed on the verbs and objects in the associated entities respectively, and the words to be updated are determined from the verbs and objects, including: performing semantic recognition processing on the verbs in the associated entities, determining the correlation between the verbs and the demand information, which is a first correlation, and performing semantic recognition processing on the objects in the associated entities, determining the correlation between the objects and the demand information, which is a second correlation; based on the first correlation and the second correlation, determining the words to be updated from the verbs and objects.

[0101] Specifically, demand information is pre-set, and the demand information represents user demand, that is, the demand information is the user's demand and limitation on the content of text data, and the demand information can be, for example, "text data of social content". According to the associated entity, based on the preset verb-object semantic recognition model, the verb in the associated entity is semantically recognized, and the verb semantic information is determined. The verb semantic information represents the semantics of the verb, and the correlation between the verb and the demand information is determined as the first correlation; the object in the associated entity is semantically recognized, and the object semantic information is determined. The object semantic information represents the semantics of the object, and the correlation between the object and the demand information is determined as the second correlation.

[0102] According to the first correlation and the second correlation, if the first correlation is greater than the second correlation, the correlation between the verb and the demand information is greater than the correlation between the object and the demand information, and the verb is determined as the word to be updated; if the second correlation is greater than the first correlation, the correlation between the object and the demand information is greater than the correlation between the verb and the demand information, and the object is determined as the word to be updated; if the first correlation is the same as the second correlation, the verb and the object are equally correlated, and the verb and the object are respectively determined as the words to be updated.

[0103] For example, if the demand information is "text data of social content" and the associated entity is "planning an outing", semantic recognition is performed on it to obtain the first and second relevance of the associated entity, and it is determined that the second relevance of the associated entity is greater than the first relevance, then the object has a higher relevance to the user's demand information, and the object "outing" is determined as the word to be updated; if the demand information is "text data of sports content" and the associated entity is "running to first place", semantic recognition is performed on it to obtain the first and second relevance of the associated entity, and it is determined that the first relevance of the associated entity is greater than the second relevance, then the verb has a higher relevance to the user's demand information, and the verb "run" is determined as the word to be updated; if the demand information is "text data of learning content" and the associated entity is "getting first in the grade", semantic recognition is performed on it to obtain the first and second relevance of the associated entity, and it is determined that the first relevance and the second relevance of the associated entity are the same, then the verb "getting" and the object "getting first in the grade" are respectively determined as the words to be updated.

[0104] The effect of this arrangement is that the verb and the object can be identified separately, and the relevance between the semantics of the verb and the object and the demand information required by the user can be analyzed, and the words to be updated can be determined based on the relevance, so that the determined words to be updated are more relevant to the user.

[0105] S205: Generate target text data according to the rewritten semantic part and the updated entity part.

[0106] Exemplarily, this step may refer to the above-mentioned step S104 and will not be described in detail.

[0107] The method, device, equipment and medium for generating text data based on user needs provided by the embodiment of the present application obtains the initial text data preset by the user, and segments the text data to obtain the semantic part and entity part of the preset initial text data, rewrites the semantic part, updates the words of the entity part, and generates the target text data according to the rewritten semantic part and the updated entity part. By segmenting the initial text data, the semantic part and entity part of the text data are accurately obtained, which is convenient for operation; the semantic part is rewritten to generate sentences with similar semantics but different expressions, enriching the types of data; the entity part is updated to obtain more new related updated entity parts; according to the rewritten semantic part and the updated entity part, a large amount of target text data that meets the needs can be quickly generated, improving the efficiency and diversity of data generation.

[0108] Figure 3 The present invention provides a flowchart of a method for generating text data based on user needs in an embodiment of the present invention. Figure 1Based on the embodiment, the preset initial text data is segmented to obtain the semantic part and the entity part in the preset initial text data, and the method is described in detail, including:

[0109] Based on a preset recognition model, a semantic part and an entity part are identified from the preset initial text data, and the semantic part and the entity part are segmented; wherein the preset recognition model is a pre-trained language model, which is used to identify the semantics and entities in the text data.

[0110] like Figure 3 As shown, the method comprises the following steps:

[0111] S301, obtaining preset initial text data; wherein the preset initial text data is text data that meets user needs.

[0112] Exemplarily, this step may refer to the above-mentioned step S101 and will not be described in detail.

[0113] S302. Based on a preset recognition model, a semantic part and an entity part are identified from the preset initial text data, and the semantic part and the entity part are segmented; wherein the preset recognition model is a pre-trained language model for identifying semantics and entities in text data.

[0114] Exemplarily, a recognition model is pre-set, and the preset recognition model is used to recognize the semantic part and the entity part in the preset initial text data, and to segment the semantic part and the entity part. The preset recognition model can be a pre-trained language model, such as a BERT model, a RoBERTa model, etc. Pre-training can be, for example, that the user prepares labeled text data in advance according to needs, and the labeled text data is labeled text data that meets the user's needs, and the preset recognition model is pre-trained using the labeled text data, so that the preset recognition model can accurately recognize the semantic part and the entity part from the text data.

[0115] According to the preset initial text data and based on the preset recognition model, the semantic part and the entity part are identified from the preset initial text data, and the semantic part and the entity part are segmented.

[0116] The beneficial effect of such a setting is that a pre-set recognition model for identifying semantics and entities is used to recognize the preset initial text data, accurately obtain the semantics and entities in the initial text data, and separate the semantics and entities, which can facilitate different processing of the semantics and entities and improve the diversity of the generated data.

[0117] S303: performing semantic rewriting processing on the semantic part to obtain a rewritten semantic part, and performing word updating processing on the entity part to obtain an updated entity part.

[0118] Exemplarily, this step may refer to the above-mentioned step S103 and will not be described in detail.

[0119] S304: Generate target text data according to the rewritten semantic part and the updated entity part.

[0120] Exemplarily, this step may refer to the above-mentioned step S104 and will not be described in detail.

[0121] The method, device, equipment and medium for generating text data based on user needs provided by the embodiment of the present application obtains the initial text data preset by the user, and segments the text data to obtain the semantic part and entity part of the preset initial text data, rewrites the semantic part, updates the words of the entity part, and generates the target text data according to the rewritten semantic part and the updated entity part. By segmenting the initial text data, the semantic part and entity part of the text data are accurately obtained, which is convenient for operation; the semantic part is rewritten to generate sentences with similar semantics but different expressions, enriching the types of data; the entity part is updated to obtain more new related updated entity parts; according to the rewritten semantic part and the updated entity part, a large amount of target text data that meets the needs can be quickly generated, improving the efficiency and diversity of data generation.

[0122] Figure 4 The present invention provides a flowchart of a method for generating text data based on user needs in an embodiment of the present invention. Figure 1 Based on the embodiment, generating target text data according to the rewritten semantic part and the updated entity part is described in detail, and the method includes:

[0123] The rewritten semantic part and the updated entity part are concatenated to obtain a first text to be processed; the text to be processed is expanded to obtain a second text to be processed; and the words to be updated are added to the masked part of the second text to be processed to obtain target text data.

[0124] like Figure 4 As shown, the method comprises the following steps:

[0125] S401, obtaining preset initial text data; wherein the preset initial text data is text data that meets user needs.

[0126] Exemplarily, this step may refer to the above-mentioned step S101 and will not be described in detail.

[0127] S402, segmenting the preset initial text data to obtain a semantic part and an entity part in the preset initial text data; wherein the semantic part represents the semantic information in the text data; and the entity part represents the entity words in the text data.

[0128] Exemplarily, this step may refer to the above-mentioned step S102 and will not be described in detail.

[0129] S403: performing semantic rewriting processing on the semantic part to obtain a rewritten semantic part, and performing word updating processing on the entity part to obtain an updated entity part.

[0130] Exemplarily, this step may refer to the above-mentioned step S103 and will not be described in detail.

[0131] S404: Concatenate the rewritten semantic part and the updated entity part to obtain a first text to be processed.

[0132] Exemplarily, the rewritten semantic part and the updated entity part are spliced ​​to obtain the first text to be processed. For example, the updated entity part may replace the placeholder in the rewritten semantic part, and the replaced text is determined as the first text to be processed. For example, if the rewritten semantic part is "I want XXXX, is anyone else coming?" and the updated entity part is "Planning XXXX", then the updated entity part replaces the placeholder in the rewritten semantic part to obtain "I want to plan XXXX, is anyone else coming?", and the text is determined as the first text to be processed.

[0133] The beneficial effect of such a setting is that while retaining the masking process, the updated entity part and the rewritten semantic part are spliced, which does not change the semantics while increasing the diversity of the text and generating a variety of different first texts to be processed.

[0134] S405: Expand the first text to be processed to obtain a second text to be processed.

[0135] Exemplarily, the first text to be processed is expanded to obtain the second text to be processed. For example, an expansion model may be preset, and the preset expansion model is used to expand the first text to be processed, and the preset expansion model is a language model tuned by prompt. According to the first text to be processed, based on the preset expansion model, the first text to be processed is expanded to enrich the details and content in the first text to be processed, so that the sentences of the first text to be processed are more natural and diversified. For example, if the first text to be processed is "I want to plan XXXX, is anyone coming?", it is expanded to obtain "Recently I really want to get together with everyone. I haven't met with friends for a long time. I want to plan XXXX. Is anyone coming?", and the text is determined as the second text to be processed.

[0136] The beneficial effect of such a setting is that the first text to be processed is expanded, the details of the first text to be processed are richer, the text sentences are more fluent, the text quality is closer to the level of real text, and the text quality and diversity are improved.

[0137] S406: Add the words to be updated to the masked part of the second text to be processed to obtain target text data.

[0138] Exemplarily, the words to be updated are added to the masked part of the second text to be processed to obtain the target text data. For example, if the second text to be processed is "I really want to get together with everyone recently. I haven't met with friends for a long time. I want to plan XXXX. Does anyone want to come?", the corresponding associated entity is a subject-verb structure, and it is determined that the words to be updated include "outing activities", "hiking activities", "spring outing activities" and other words, which are replaced with the masked part of the second text to be processed respectively to obtain "I really want to get together with everyone recently. I haven't met with friends for a long time. I want to plan an outing. Does anyone want to come?" "I really want to get together with everyone recently. I haven't met with friends for a long time. I want to plan a hiking activity. Does anyone want to come?" "I really want to get together with everyone recently. I haven't met with friends for a long time. I want to plan a spring outing. Does anyone want to come?" and at least one target text data.

[0139] The beneficial effect of this setting is that by adding the words to be updated to the masked part of the second text to be processed, the verb and the object can be matched, and the verb and the object of the corresponding associated entity do not conflict, thereby improving the text quality and reducing text errors. By replacing different words to be updated, a large amount of text with related content can be generated, which improves the speed and efficiency of text generation.

[0140] The method, device, equipment and medium for generating text data based on user needs provided by the embodiment of the present application obtains the initial text data preset by the user, and segments the text data to obtain the semantic part and entity part of the preset initial text data, rewrites the semantic part, updates the words of the entity part, and generates the target text data according to the rewritten semantic part and the updated entity part. By segmenting the initial text data, the semantic part and entity part of the text data are accurately obtained, which is convenient for operation; the semantic part is rewritten to generate sentences with similar semantics but different expressions, enriching the types of data; the entity part is updated to obtain more new related updated entity parts; according to the rewritten semantic part and the updated entity part, a large amount of target text data that meets the needs can be quickly generated, improving the efficiency and diversity of data generation.

[0141] Figure 5 A structural block diagram of a device for generating text data based on user needs provided in an embodiment of the present disclosure.

[0142] For the sake of convenience, only the parts related to the embodiments of the present disclosure are shown. Figure 5 The device 500 for generating text data based on user needs includes: an acquisition unit 501, a segmentation unit 502, a processing unit 503 and a generation unit 504.

[0143] The acquisition unit 501 is used to acquire preset initial text data; wherein the preset initial text data is text data that meets the user's needs;

[0144] The segmentation unit 502 is used to segment the preset initial text data to obtain a semantic part and an entity part in the preset initial text data; wherein the semantic part represents the semantic information in the text data; and the entity part represents the entity words in the text data;

[0145] The processing unit 503 is used to perform semantic rewriting processing on the semantic part to obtain a rewritten semantic part, and perform word update processing on the entity part to obtain an updated entity part;

[0146] The generating unit 504 is used to generate target text data according to the rewritten semantic part and the updated entity part.

[0147] Figure 6 A structural block diagram of a device for generating text data based on user needs provided in an embodiment of the present disclosure.

[0148] exist Figure 5 Based on the embodiment shown, Figure 6As shown, the segmentation unit 502 includes a search module 5021 and a shielding module 5022 .

[0149] The search module 5021 is used to search for entity words associated with the entity part from a preset entity database, which are associated entities; wherein the preset entity database stores a plurality of entity words;

[0150] The masking module 5022 is used to determine the words to be updated from the associated entities, mask the words to be updated, and determine the masked associated entities as the updated entity parts.

[0151] In one example, the shielding module 5022 includes:

[0152] The first determination submodule is used to perform semantic recognition processing on the verb and the object in the associated entity respectively if it is determined that the grammatical structure of the associated entity is a verb-object structure, and determine the words to be updated from the verb and the object.

[0153] In one example, the identification submodule is specifically used for:

[0154] Performing semantic recognition processing on the verb in the associated entity to determine the relevance between the verb and the demand information as a first relevance, and performing semantic recognition processing on the object in the associated entity to determine the relevance between the object and the demand information as a second relevance;

[0155] The words to be updated are determined from the verb and the object according to the first relevance and the second relevance.

[0156] In one example, the shielding module 5022 includes:

[0157] The second determination submodule is configured to determine the associated entity as a word to be updated if it is determined that the grammatical structure of the associated entity is not a subject-verb structure.

[0158] In one example, the search module 5021 includes:

[0159] An association determination module, used to obtain entity words in the preset entity database, and determine the association degree between the entity part and the entity word; wherein the association degree represents the degree of correlation between the entity part and the entity word;

[0160] The associated entity module is used to determine the associated entity from a preset entity database according to the association between the entity part and the entity word.

[0161] In one example, the segmentation unit 502 includes:

[0162] The recognition module is used to recognize semantic parts and entity parts from the preset initial text data based on a preset recognition model, and to segment the semantic parts and entity parts; wherein the preset recognition model is a pre-trained language model, which is used to recognize semantics and entities in text data.

[0163] In one example, the generating unit 504 includes:

[0164] A splicing module, used for splicing the rewritten semantic part and the updated entity part to obtain a first text to be processed;

[0165] An expansion module, used for expanding the text to be processed to obtain a second text to be processed;

[0166] An adding module is used to add the to-be-updated words to the masked part of the second to-be-processed text to obtain the target text data.

[0167] Figure 7 A structural block diagram of an electronic device provided in an embodiment of the present disclosure, the electronic device may be a terminal device or a server, such as Figure 7 As shown, the electronic device 700 includes: at least one processor 702; and a memory 701 communicatively connected to the at least one processor 702; wherein the memory stores instructions executable by the at least one processor 702, and the instructions are executed by the at least one processor 702 so that the at least one processor 702 can execute the method for generating text data based on user needs disclosed in the present invention.

[0168] The electronic device 700 further includes a receiver 703 and a transmitter 804. The receiver 703 is used to receive instructions and data sent by other devices, and the transmitter 704 is used to send instructions and data to external devices.

[0169] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.

[0170] According to an embodiment of the present disclosure, the present disclosure also provides a computer program product, which includes: a computer program, the computer program is stored in a readable storage medium, at least one processor of an electronic device can read the computer program from the readable storage medium, and at least one processor executes the computer program so that the electronic device executes the solution provided by any of the above embodiments.

[0171] Figure 8It is a block diagram of an electronic device according to an exemplary embodiment, which device may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0172] Device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 811 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .

[0173] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.

[0174] The memory 804 is configured to store various types of data to support operations on the device 700. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0175] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 can include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.

[0176] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0177] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a speech recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.

[0178] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.

[0179] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, and the sensor assembly 814 can also detect the position change of the device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include a light sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0180] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0181] In an exemplary embodiment, the device 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors, or other electronic components to perform the above methods.

[0182] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.

[0183] A non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a terminal device, enables the terminal device to execute the above-mentioned method for generating text data based on user needs.

[0184] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.

[0185] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.

[0186] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.

[0187] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.

[0188] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. Unless otherwise specified, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. Unless otherwise specified, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory (RRAM), a dynamic random access memory (DRAM), a static random access memory (SRAM), an enhanced dynamic random access memory (EDRAM), a high-bandwidth memory (HBM), a hybrid memory cube (HMC), etc.

[0189] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a memory, including a number of instructions to enable a computer device (which can be a personal computer, server or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0190] In the above embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0191] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.

[0192] It should be understood that the present application is not limited to the precise 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 application is limited only by the appended claims.

Claims

1. A method for generating text data based on user needs, characterized in that: include; Acquire preset initial text data; wherein the preset initial text data is text data that meets user needs; The preset initial text data is segmented to obtain a semantic part and an entity part in the preset initial text data; wherein the semantic part represents semantic information in the text data; and the entity part represents entity words in the text data; Performing semantic rewriting processing on the semantic part to obtain a rewritten semantic part, and performing word updating processing on the entity part to obtain an updated entity part; Target text data is generated according to the rewritten semantic part and the updated entity part.

2. The method according to claim 1, characterized in that Performing word update processing on the entity part to obtain an updated entity part includes: Searching for entity words associated with the entity part from a preset entity database as associated entities; wherein the preset entity database stores a plurality of entity words; The words to be updated are determined from the associated entities, and masking is performed on the words to be updated, and the masked associated entities are determined as the updated entity parts.

3. The method according to claim 2, characterized in that Determining the words to be updated from the associated entities includes: If it is determined that the grammatical structure of the associated entity is a verb-object structure, semantic recognition processing is performed on the verb and the object in the associated entity respectively, and the words to be updated are determined from the verb and the object.

4. The method according to claim 3, characterized in that: Demand information is preset, and the demand information represents user demand; Performing semantic recognition processing on the verbs and objects in the associated entity respectively, and determining the words to be updated from the verbs and objects, includes: Performing semantic recognition processing on the verb in the associated entity to determine the relevance between the verb and the demand information as a first relevance, and performing semantic recognition processing on the object in the associated entity to determine the relevance between the object and the demand information as a second relevance; The words to be updated are determined from the verb and the object according to the first relevance and the second relevance.

5. The method according to claim 2, characterized in that: Determining the words to be updated from the associated entities includes: If it is determined that the grammatical structure of the associated entity is not a subject-object structure, the associated entity is determined as a word to be updated.

6. The method according to claim 2, characterized in that From a preset entity database, search for entity words associated with the entity part, which are associated entities, including: Obtaining entity words in the preset entity database, and determining the degree of association between the entity part and the entity word; wherein the degree of association represents the degree of correlation between the entity part and the entity word; The associated entity is determined from a preset entity database according to the association degree between the entity part and the entity word.

7. The method according to claim 1, characterized in that The preset initial text data is segmented to obtain a semantic part and an entity part in the preset initial text data, including: Based on a preset recognition model, a semantic part and an entity part are identified from the preset initial text data, and the semantic part and the entity part are segmented; wherein the preset recognition model is a pre-trained language model for identifying semantics and entities in text data.

8. The method according to claim 2, characterized in that: Generating target text data according to the rewritten semantic part and the updated entity part, including: The rewritten semantic part and the updated entity part are concatenated to obtain a first text to be processed; Performing expansion processing on the first text to be processed to obtain a second text to be processed; The to-be-updated words are added to the masked portion of the second to-be-processed text to obtain the target text data.

9. A device for generating text data based on user needs, characterized in that: include: An acquisition unit, used to acquire preset initial text data; wherein the preset initial text data is text data that meets user needs; A segmentation unit, used for segmenting the preset initial text data to obtain a semantic part and an entity part in the preset initial text data; wherein the semantic part represents the semantic information in the text data; and the entity part represents the entity words in the text data; A processing unit, configured to perform semantic rewriting processing on the semantic part to obtain a rewritten semantic part, and perform word update processing on the entity part to obtain an updated entity part; A generating unit is used to generate target text data according to the rewritten semantic part and the updated entity part.

10. An electronic device for generating text data based on user needs, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 8 when executed by a processor.

12. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 8 when being executed by a processor.

Citation Information

Patent Citations

  • Word embedding semantic mapping-based event phrase learning method and apparatus

    CN107180026A

  • Method and device for generating text template, equipment and computer readable medium

    CN110162753A

  • Test corpus generation method and device and electronic equipment

    CN111488735A

  • Text extension method and device, equipment and medium

    CN114912448A

  • Text generation method and device, electronic equipment and computer readable storage medium

    CN116151267A