Text data generation method and device based on user demand, equipment and medium
By segmenting and rewriting the initial text data, target text data that meets user needs is generated, solving the problems of low efficiency and high cost in existing technologies, and realizing efficient and diversified text data generation.
Patent Information
- Application Number
- CN202411865620.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-12-17
AI Technical Summary
Existing technologies are inefficient and costly in constructing text training sets, making it difficult to generate diverse text data that meets user needs.
By acquiring initial text data, segmentation is performed to extract semantic and entity parts. The semantic parts are then rewritten, and the entity parts are updated with new words, ultimately generating target text data that meets the user's needs.
It improves the efficiency and diversity of text data generation, enabling the rapid generation of large amounts of text data that meet user needs.
Smart Images

Figure CN119783679B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of text data generation, and in particular to a method, apparatus, device, and medium for generating text data based on user needs. Background Technology
[0002] With the development of large-scale model technology, large-scale models are gradually being applied to various scenarios. To ensure that large-scale models can meet the needs of users in corresponding scenarios, it is necessary to use a large amount of data from the corresponding scenario to construct a dataset for training the large-scale model, and then use the dataset to train the large-scale model so that it can handle the tasks of the corresponding scenario and meet the user needs of the corresponding scenario.
[0003] Currently, methods for constructing text training sets mostly rely on manual annotation or web crawling to obtain data, which is inefficient, costly, and results in inconsistent data quality. Therefore, how to quickly and efficiently acquire large amounts of text data that meet user needs has become an urgent problem to be solved. Summary of the Invention
[0004] This application provides 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 user needs.
[0005] In a first aspect, embodiments of this application provide a method for generating text data based on user needs, including:
[0006] Obtain preset initial text data; wherein, the preset initial text data is text data that meets the user's needs;
[0007] The preset initial text data is segmented to obtain the semantic part and entity part of 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] The semantic part is semantically rewritten to obtain the rewritten semantic part, and the entity part is word-updated to obtain the updated entity part;
[0009] The target text data is generated based on the rewritten semantic part and the updated entity part.
[0010] Optionally, using the method described above, the entity part is subjected to word update processing to obtain the updated entity part, including:
[0011] From the preset entity database, find the entity words that are associated with the entity part, which are the associated entities; the preset entity database stores multiple entity words;
[0012] The words to be updated are identified from the associated entities, and the words to be updated are masked. The masked associated entities are then identified as the updated entity parts.
[0013] Optionally, the method described above, determining the words to be updated from associated entities, includes:
[0014] If the grammatical structure of the associated entity is determined to be a verb-object structure, then semantic recognition processing is performed on the verb and object in the associated entity to determine the words to be updated from the verb and object.
[0015] Optionally, in the method described above, demand information is pre-set, representing user needs; semantic recognition processing is performed on verbs and objects in the associated entities to determine the words to be updated from the verbs and objects, including:
[0016] Semantic recognition processing is performed on verbs in associated entities to determine the relevance between verbs and demand information, which is the first relevance; and semantic recognition processing is performed on objects in associated entities to determine the relevance between objects and demand information, which is the second relevance.
[0017] Based on the first and second relevance, words to be updated are determined from verbs and objects.
[0018] Optionally, the method described above, determining the words to be updated from associated entities, includes:
[0019] If it is determined that the grammatical structure of the associated entity is not a verb-object structure, then the associated entity is identified as a word to be updated.
[0020] Optionally, using the method described above, entity words associated with the entity part are searched from a preset entity database to form associated entities, including:
[0021] Retrieve entity words from a pre-defined entity database and determine the degree of correlation between entity parts and entity words; whereby the degree of correlation represents the degree of relevance between entity parts and entity words.
[0022] Based on the degree of relevance between entity parts and entity words, related entities are determined from a pre-set entity database.
[0023] Optionally, the method described above involves segmenting the preset initial text data to obtain the semantic and entity parts of the preset initial text data, including:
[0024] Based on a pre-defined recognition model, semantic and entity parts are identified from pre-defined initial text data, and then segmented into semantic and entity parts. The pre-defined recognition model is a pre-trained language model used to identify semantics and entities in the text data.
[0025] Optionally, the method described above generates target text data based on the rewritten semantic portion and the updated entity portion, including:
[0026] The rewritten semantic part and the updated entity part are concatenated to obtain the first text to be processed.
[0027] The first text to be processed is expanded to obtain the second text to be processed.
[0028] The words to be updated are added to the obscured parts of the second text to be processed to obtain the target text data.
[0029] Secondly, embodiments of this application provide a text data generation apparatus based on user needs, comprising:
[0030] The acquisition unit is used to acquire preset initial text data; wherein the preset initial text data is text data that meets the user's needs;
[0031] The segmentation unit is used to segment the preset initial text data to obtain the semantic part and entity part of 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] The processing unit is used to perform semantic rewriting on the semantic part to obtain the rewritten semantic part, and to perform word update on the entity part to obtain the updated entity part.
[0033] The generation unit is used to generate target text data based on the rewritten semantic part and the updated entity part.
[0034] Thirdly, embodiments of this application provide a text data generation device based on user needs, including: a memory and a processor;
[0035] The memory stores computer-executed instructions;
[0036] The processor executes computer execution instructions stored in the memory, causing the processor to perform the first aspect and / or various possible implementations of the first aspect as described above.
[0037] Fourthly, embodiments of this application provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, are used to implement the first aspect and / or various possible implementations of the first aspect.
[0038] Fifthly, embodiments of this application provide a computer program product, including a computer program that, when executed by a processor, implements the first aspect and / or various possible implementations of the first aspect.
[0039] The method, apparatus, device, and medium for generating text data based on user needs provided in this application embodiment acquire user-preset initial text data, segment the text data to obtain the semantic and entity parts of the preset initial text data, rewrite the semantic part, update the word content of the entity part, and generate target text data based on the rewritten semantic and updated entity parts. By segmenting the initial text data, the semantic and entity parts of the text data are accurately obtained, facilitating operation; rewriting the semantic part generates semantically similar but differently expressed sentences, enriching the data types; updating the entity part yields more new and related updated entity parts; and by using the rewritten semantic and updated entity parts, a large amount of target text data that meets the requirements can be quickly generated, improving the efficiency and diversity of data generation. Attached Figure Description
[0040] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.
[0041] Figure 1 A flowchart illustrating a method for generating text data based on user needs, provided in an embodiment of this disclosure;
[0042] Figure 2 A flowchart illustrating a method for generating text data based on user needs, provided in an embodiment of this disclosure;
[0043] Figure 3 A flowchart illustrating a method for generating text data based on user needs, provided in an embodiment of this disclosure;
[0044] Figure 4 A flowchart illustrating a method for generating text data based on user needs, provided in an embodiment of this disclosure;
[0045] Figure 5 A structural block diagram of a text data generation apparatus based on user needs provided in an embodiment of this disclosure;
[0046] Figure 6 A structural block diagram of a text data generation apparatus based on user needs provided in an embodiment of this disclosure;
[0047] Figure 7 A structural block diagram of an electronic device provided in an embodiment of this disclosure;
[0048] Figure 8 This is a block diagram illustrating an electronic device according to an exemplary embodiment.
[0049] The accompanying drawings illustrate specific embodiments of this application, which will be described in more detail below. These drawings and descriptions are not intended to limit the scope of the concept in any way, but rather to illustrate the concept of this application to those skilled in the art through reference to particular embodiments. Detailed Implementation
[0050] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numbers in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with this application. Rather, they are merely examples of apparatuses and methods consistent with some aspects of this 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, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties. Furthermore, the collection, use and processing of the relevant data must comply with relevant laws, regulations and standards, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0052] First, let me explain the terms used in this application:
[0053] BERT model: A Transformer-based deep learning model primarily used for natural language processing tasks. The BERT model learns language representations using large amounts of text data through pre-training, and then fine-tunes it for specific NLP tasks to achieve better performance.
[0054] RoBERTa is an improvement and optimization of the BERT model to enhance its performance on various natural language understanding tasks.
[0055] Entities: Words such as personal names, place names, 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 forms commonly used during model pre-training using templates, thereby reducing the difference between training data during pre-training and fine-tuning, reducing the storage and computational resource usage of the pre-trained model during fine-tuning of downstream tasks, and improving the model's performance in downstream tasks.
[0057] With the development of large model technology, large models are gradually being applied to various scenarios. In order for large models to run in accordance with user needs, it is necessary to train the large models in advance using training sets. The construction of training sets requires the acquisition of a large amount of data related to the demand domain. By combining this data related to the demand domain, an effective training set can be formed.
[0058] Currently, the primary application of large-scale models is text recognition, which is commonly used in various scenarios such as behavior recognition and interest recommendation. However, constructing training sets for these scenarios has become a challenging problem.
[0059] Currently, most methods for constructing text training sets have intractable problems and limitations. For example, traditional methods use manual annotation and data construction, where annotators screen and annotate a large amount of text to generate a training set that meets the requirements. This is costly and inefficient, and easily influenced by the subjective opinions of the staff, resulting in inconsistent data quality. Another method is to use web crawlers to crawl internet text. However, due to the upgrading of internet security mechanisms, it is difficult to crawl effective content, and the large amount of data also requires data review and filtering, making it difficult to use efficiently. Text generated using traditional semantic rewriting methods 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 aims to solve the above-mentioned technical problems in the prior art.
[0061] The specific application scenario of this application is text data generation. It processes initial text data preset by the user according to their needs, segments it to obtain semantic and entity parts, rewrites the semantic part, updates the words in the entity part, and generates target text data based on the rewritten semantic and updated entity parts. This allows for the rapid generation of a large amount of diverse target text data that meets user needs based on preset initial text data. It solves the technical problems of complex and inefficient text data generation.
[0062] The technical solution of this application and how the technical solution of this application solves the above-mentioned technical problems are described in detail below with specific embodiments. These specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of this application will now be described with reference to the accompanying drawings.
[0063] Figure 1 This is a flowchart illustrating a method for generating text data based on user needs, provided in an embodiment of the present disclosure. This method can be executed by a device for generating text data based on user needs.
[0064] like Figure 1 As shown, the method includes the following steps:
[0065] S101. Obtain preset initial text data; wherein, the preset initial text data is text data that meets the user's needs.
[0066] For example, a user or staff member manually constructs at least one initial text based on requirements, which is a preset initial text data. The initial text data is obtained. For instance, if a user needs to train a large model that can recognize text related to social activities, then the required text data is text data containing social content. The manually constructed initial text could be something like, "I'd like to plan a picnic, anyone want to join?" or "Having a get-together with friends this weekend."
[0067] S102. The preset initial text data is segmented to obtain the semantic part and entity part of 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] For example, preset initial text data is segmented to obtain a semantic part and an entity part. For instance, a large model can be pre-set, which can be a natural language processing (NLP) model. This NLP model is used to identify the text content of the initial text data, recognizing the semantic and entity content within it, and segmenting the preset initial text data, dividing the semantic content into semantic parts and the entity content into entity parts. The semantic parts represent the semantics of the initial text data, while the entity parts represent specific behaviors, place names, personal names, etc., related to user needs. In this embodiment, the model structure is not specifically limited.
[0069] For example, a user's request for text data is social content. The preset initial text data is "I want to plan a picnic, anyone want to join?". A preset natural language processing model identifies this preset initial text data, recognizing the semantic content as "I want, anyone want to join?" and the entity content related to social activities as "plan a picnic". Placeholders are used to fill in the spaces where the entity part has been removed, resulting in "I want XXXX, anyone want to join?". "I want XXXX, anyone want to join?" is identified as the semantic part of the preset initial text data; "plan a picnic" is identified as the entity part of the preset initial text data.
[0070] S103. Perform semantic rewriting on the semantic part to obtain the rewritten semantic part, and perform word update on the entity part to obtain the updated entity part.
[0071] For example, the semantic part is rewritten in various ways to obtain the rewritten semantic part. This rewriting process is equivalent to paraphrasing the semantic part, resulting in a rewritten semantic part that is semantically similar to the original but expresses a different meaning. For instance, a rewriting model can be pre-defined, which is a large-scale model used to rewrite the semantic part, generating at least one text content that is semantically similar but expresses a different meaning. Based on the pre-defined rewriting model, the semantic part is rewritten to obtain the rewritten semantic part. For example, if the semantic part is "I want XXXX, anyone want to come?", it can be rewritten as "I want XXXX, anyone else want to come?" or at least one other rewritten text.
[0072] The entity part is updated by word processing to obtain the updated entity part. For example, a word update model can be preset. 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 it with synonyms. The entity part is updated with multiple synonyms, and the synonyms are used as new entities to obtain the updated entity part. For example, if the entity part is "planning a suburban outing", the semantics are recognized and it is replaced with at least one of the synonyms such as "planning an outdoor activity", "planning a hiking activity", or "planning a spring outing".
[0073] S104. Generate target text data based on the rewritten semantic part and the updated entity part.
[0074] For example, target text data is generated based on the rewritten semantic part and the updated entity part. For instance, the updated entity part could replace the placeholder content in the rewritten semantic part; that is, replacing "XXXX" in the rewritten semantic part. For example, replacing the placeholder in the rewritten semantic part "I want to XXXX, anyone want to come?" with the updated entity part "plan a hiking activity" or "plan a spring outing", resulting in "I want to plan a hiking activity, anyone want to come?" or "I want to plan a spring outing, anyone want to come?". Each updated entity part replaces each rewritten semantic part, resulting in at least one replaced text, which is then identified as the target text data.
[0075] In one example, after obtaining the target text data, validation processing is performed on the target text data to determine the validation score of each target text. The validation score characterizes the relevance between the target text data and the data required by the user. For example, a validation model can be pre-set to validate the target text data; this model can be a large model. A pre-defined validation dataset is obtained, and the pre-defined large model is trained using the validation dataset to obtain the pre-defined validation model. Based on the pre-defined validation model, the target text data is validated to determine the validation score of each text. Texts in the target text data with validation scores lower than a pre-defined validation score threshold are deleted.
[0076] The method, apparatus, device, and medium for generating text data based on user needs provided in this application embodiment acquire user-preset initial text data, segment the text data to obtain the semantic and entity parts of the preset initial text data, rewrite the semantic part, update the word content of the entity part, and generate target text data based on the rewritten semantic and updated entity parts. By segmenting the initial text data, the semantic and entity parts of the text data are accurately obtained, facilitating operation; rewriting the semantic part generates semantically similar but differently expressed sentences, enriching the data types; updating the entity part yields more new and related updated entity parts; and by using the rewritten semantic and updated entity parts, a large amount of target text data that meets the requirements can be quickly generated, improving the efficiency and diversity of data generation.
[0077] Figure 2 This is a flowchart illustrating a method for generating text data based on user needs, provided in an embodiment of this disclosure. Figure 1 Based on the embodiments, word update processing is performed on the entity part to obtain the updated entity part, which is described in detail below. The method includes:
[0078] From the preset entity database, find entity words associated with the entity part, which are called associated entities; the preset entity database stores multiple entity words; determine the words to be updated from the associated entities, and perform masking processing on the words to be updated, and determine the masked associated entities as the updated entity part.
[0079] like Figure 2 As shown, the method includes the following steps:
[0080] S201. Obtain preset initial text data; wherein, the preset initial text data is text data that meets the user's needs.
[0081] For example, this step can refer to step S101 above, and will not be repeated here.
[0082] S202. The preset initial text data is segmented to obtain the semantic part and entity part of 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] For example, this step can refer to step S102 above, and will not be repeated here.
[0084] S203. Perform semantic rewriting on the semantic part to obtain the rewritten semantic part, and search for entity words associated with the entity part from the preset entity database to form associated entities; wherein, the preset entity database stores multiple entity words.
[0085] For example, based on a preset semantic rewriting model, the semantic part is rewritten in various ways to obtain at least one rewritten semantic part.
[0086] A pre-configured entity database is set up, storing multiple entity words related to user needs. For example, if the user's requirement for text data is social content, the pre-configured entity database contains various social-related entity words, such as social behaviors, friend titles, and social locations.
[0087] From a pre-defined entity database, entity words associated with the entity part are searched to identify related entities. For example, an entity semantic recognition model can be pre-set to identify the semantics of the entity part. This model can be a large model. Based on the entity part and the pre-defined entity semantic recognition model, the semantics of the entity part are identified, and entity words with similar semantics to the entity part are searched in the pre-defined entity database to identify related entities. For example, if the entity part is "planning an outing", semantic recognition is performed on the entity part, and entity words with semantically related meanings are searched in the pre-defined entity database. At least one related entity word such as "planning an outdoor activity", "planning a hiking activity", or "planning a spring outing" can be found, and the found entity word is identified as a related entity.
[0088] The advantage of this setup is that by pre-setting up an entity database related to user needs and searching for related entities from this database, the scope of entity search can be narrowed, the efficiency of finding related entities can be improved, the found related entities can be more accurate, and the search efficiency can be increased.
[0089] In this embodiment, searching for entity words associated with an entity part from a preset entity database to identify associated entities includes: obtaining entity words from the preset entity database and determining the degree of association between the entity part and the entity words; wherein, the degree of association characterizes the degree of correlation between the entity part and the entity words; and determining associated entities from the preset entity database based on the degree of association between the entity part and the entity words.
[0090] Specifically, an entity database related to user needs is pre-set, entity words from the pre-set entity database are retrieved, and the relevance between entity parts and entity words is determined. For example, a recommendation model can be pre-set to calculate the relevance between entity parts and entity words; the pre-set recommendation model could be a shopping basket model.
[0091] Based on the entity part and a pre-defined entity database, and using a pre-defined recommendation model, the entity words in the pre-defined entity database are traversed to determine the correlation between the entity part and each entity word in the entity database. The correlation between the entity part and entity words includes at least one of the following metrics: support, confidence, etc. For any entity word, based on the pre-defined recommendation model, the frequency of simultaneous occurrence of the entity word and entity part in all usage scenarios is determined, and this frequency is defined as the support; the probability of simultaneous occurrence of the entity part and entity word in scenarios where the entity part appears is determined, and this probability is defined as the confidence.
[0092] Based on the degree of relevance between the determined entity parts and entity words, related entities are identified from a pre-set entity database. For example, a relevance threshold can be preset, and entity words in the pre-set entity thesaurus whose relevance exceeds the preset threshold can be identified as related entities.
[0093] The advantage of this setup is that by using the basket model to determine the relevance between entity parts and entity words, and by calculating the relevance through multiple indicators of the basket model, the determined relevance is more accurate, and the correlation between the identified related entities and entity parts is higher.
[0094] S204. Determine the words to be updated from the associated entities, and perform masking on the words to be updated, then determine the masked associated entities as the updated entity parts.
[0095] For example, after obtaining at least one associated entity related to the entity part, the word to be updated is determined from the associated entities, and the word to be updated is masked. For example, the associated entities can be grammatically identified to determine their grammatical structure components, such as verb-object structures or non-verb-object structures. If the grammatical structure of the associated entity is a non-verb-object structure, then the associated entity is determined as the word to be updated; if the grammatical structure of the associated entity is a verb-object structure, then the object part of the grammatical structure is determined as the word to be updated. The masking of the word to be updated can be done by replacing the word to be updated with a placeholder, and then determining the masked associated entity as the updated entity part. For example, if the associated entity is "planning an outing", its grammatical structure is identified, it is determined to be a verb-object structure, the object component in the structure is determined as the word to be updated, and it is masked to obtain the updated entity part "planning XXXX"; if the associated entity is "party plan", its grammatical structure is identified, it is determined to be a non-verb-object structure, then the associated entity is determined as the word to be updated, and it is masked to obtain the updated entity part "XXXX". In this embodiment, no specific limitations are made on the method for recognizing grammatical structures.
[0096] The advantage of this setup is that it identifies the words to be updated in each associated entity and masks them, making subsequent replacement operations more flexible, eliminating verb-object mismatch issues in the replacement process, and making the generated text data more semantically coherent and reasonable.
[0097] In this embodiment, determining the word to be updated from the associated entity includes: if the grammatical structure of the associated entity is determined to be a verb-object structure, then semantic recognition processing is performed on the verb and object in the associated entity respectively, and the word to be updated is determined from the verb and object.
[0098] Specifically, the grammatical structure of related entities is identified. If the grammatical structure of the related entity is determined to be a verb-object structure, semantic recognition processing is performed on the verb and object of the related entity separately. For example, a verb-object semantic recognition model can be pre-set. This model is used to identify the semantics of the verb and the object in the related entity. By identifying the semantics of the verb and the object in the related entity, the part of the entity containing the user's needs is identified as the word to be updated. For example, if the user's need for text data is social content, and the related entity is "planning a picnic," semantic recognition is performed on the verb and object parts. If "picnic" in the object part is determined to be the entity of the user's needs, then "picnic" is identified as the word to be updated.
[0099] The advantage of this setup is that it performs semantic recognition on verbs and objects separately. Based on the results of semantic recognition, it determines the words to be updated from the verbs or objects, making the determined words to be updated more accurate and better meet the user's needs, thus facilitating subsequent replacement.
[0100] In this embodiment, demand information is pre-set, which represents user needs; semantic recognition processing is performed on verbs and objects in the associated entities to determine the words to be updated from the verbs and objects, including: performing semantic recognition processing on verbs in the associated entities to determine the relevance between the verbs and the demand information, which is the first relevance; and performing semantic recognition processing on objects in the associated entities to determine the relevance between the objects and the demand information, which is the second relevance; and determining the words to be updated from the verbs and objects based on the first relevance and the second relevance.
[0101] Specifically, pre-set requirement information represents user needs; that is, the requirement information is the user's needs and limitations regarding the text data content. The requirement information could be, for example, "text data of social content." Based on the associated entities and a pre-defined verb-object semantic recognition model, semantic recognition processing is performed on the verbs in the associated entities to determine their semantic information. This verb semantic information represents the semantics of the verbs, and the relevance between the verbs and the requirement information is determined, which is the first degree of relevance. Semantic recognition processing is also performed on the objects in the associated entities to determine their semantic information. This object semantic information represents the semantics of the objects, and the relevance between the objects and the requirement information is determined, which is the second degree of relevance.
[0102] Based on the first and second relevance scores, if the first relevance score is greater than the second relevance score, then the verb is more relevant to the demand information than the object, and the verb is identified as a word to be updated. If the second relevance score is greater than the first relevance score, then the object is more relevant to the demand information than the verb, and the object is identified as a word to be updated. If the first and second relevance scores are the same, then the verb and object are equally relevant, and both the verb and object are identified as words to be updated.
[0103] For example, if the demand information is "text data of social content" and the associated entity is "planning a picnic," semantic recognition is performed to obtain the first and second relevance of the associated entity. If the second relevance is determined to be greater than the first, then the object is more relevant to the user's demand information, and the object "picnic" is identified as a 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 to obtain the first and second relevance of the associated entity. If the first relevance is determined to be greater than the second, then the verb is more relevant to the user's demand information, and the verb "run" is identified as a word to be updated. If the demand information is "text data of learning content" and the associated entity is "getting first place in the grade," semantic recognition is performed to obtain the first and second relevance of the associated entity. If the first and second relevance are the same, then the verb "getting first place" and the object "getting first place in the grade" are identified as words to be updated respectively.
[0104] The effectiveness of this setup lies in the ability to identify verbs and objects separately, analyze the semantics of verbs and objects and their relevance to the user's desired information, and determine the words to be updated based on the relevance, thus making the determined words to be updated more relevant to the user.
[0105] S205. Generate target text data based on the rewritten semantic part and the updated entity part.
[0106] For example, this step can refer to step S104 above, and will not be repeated here.
[0107] The method, apparatus, device, and medium for generating text data based on user needs provided in this application embodiment acquire user-preset initial text data, segment the text data to obtain the semantic and entity parts of the preset initial text data, rewrite the semantic part, update the word content of the entity part, and generate target text data based on the rewritten semantic and updated entity parts. By segmenting the initial text data, the semantic and entity parts of the text data are accurately obtained, facilitating operation; rewriting the semantic part generates semantically similar but differently expressed sentences, enriching the data types; updating the entity part yields more new and related updated entity parts; and by using the rewritten semantic and updated entity parts, a large amount of target text data that meets the requirements can be quickly generated, improving the efficiency and diversity of data generation.
[0108] Figure 3 This is a flowchart illustrating a method for generating text data based on user needs, provided in an embodiment of this disclosure. Figure 1Based on the embodiments, the preset initial text data is segmented to obtain the semantic and entity parts of the preset initial text data. A detailed description of this method is provided, which includes:
[0109] Based on a pre-set recognition model, semantic and entity parts are identified from the pre-set initial text data, and the semantic and entity parts are segmented. The pre-set recognition model is a pre-trained language model used to identify semantics and entities in the text data.
[0110] like Figure 3 As shown, the method includes the following steps:
[0111] S301. Obtain preset initial text data; wherein, the preset initial text data is text data that meets the user's needs.
[0112] For example, this step can refer to step S101 above, and will not be repeated here.
[0113] S302. Based on a preset recognition model, identify the semantic part and the entity part from the preset initial text data, and perform segmentation processing on the semantic part and the entity part; wherein, the preset recognition model is a pre-trained language model used to identify the semantics and entities in the text data.
[0114] For example, a pre-set recognition model is used to identify the semantic and entity parts in the pre-set initial text data and to segment the semantic and entity parts. The pre-set recognition model can be a pre-trained language model, such as BERT or RoBERTa. Pre-training can be, for example, by the user preparing labeled text data in advance according to their needs. The labeled text data is labeled to meet the user's requirements, and the pre-set recognition model is pre-trained using the labeled text data so that the pre-set recognition model can accurately identify the semantic and entity parts from the text data.
[0115] Based on the preset initial text data and 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 advantage of this setup is that by using a pre-set recognition model for identifying semantics and entities, the preset initial text data can be identified, accurately obtaining the semantics and entities in the initial text data. Separating semantics and entities makes it easier to process them differently, thereby improving the diversity of the generated data.
[0117] S303. Perform semantic rewriting on the semantic part to obtain the rewritten semantic part, and perform word update on the entity part to obtain the updated entity part.
[0118] For example, this step can refer to step S103 above, and will not be repeated here.
[0119] S304. Generate target text data based on the rewritten semantic part and the updated entity part.
[0120] For example, this step can refer to step S104 above, and will not be repeated here.
[0121] The method, apparatus, device, and medium for generating text data based on user needs provided in this application embodiment acquire user-preset initial text data, segment the text data to obtain the semantic and entity parts of the preset initial text data, rewrite the semantic part, update the word content of the entity part, and generate target text data based on the rewritten semantic and updated entity parts. By segmenting the initial text data, the semantic and entity parts of the text data are accurately obtained, facilitating operation; rewriting the semantic part generates semantically similar but differently expressed sentences, enriching the data types; updating the entity part yields more new and related updated entity parts; and by using the rewritten semantic and updated entity parts, a large amount of target text data that meets the requirements can be quickly generated, improving the efficiency and diversity of data generation.
[0122] Figure 4 This is a flowchart illustrating a method for generating text data based on user needs, provided in an embodiment of this disclosure. Figure 1 Based on the embodiments, a detailed description is provided of generating target text data according to the rewritten semantic part and the updated entity part. The method includes:
[0123] The rewritten semantic part and the updated entity part are concatenated to obtain the first text to be processed; the text to be processed is expanded to obtain the second text to be processed; the words to be updated are added to the obscured parts of the second text to obtain the target text data.
[0124] like Figure 4 As shown, the method includes the following steps:
[0125] S401. Obtain preset initial text data; wherein, the preset initial text data is text data that meets the user's needs.
[0126] For example, this step can refer to step S101 above, and will not be repeated here.
[0127] S402. The preset initial text data is segmented to obtain the semantic part and entity part of 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] For example, this step can refer to step S102 above, and will not be repeated here.
[0129] S403. Perform semantic rewriting on the semantic part to obtain the rewritten semantic part, and perform word update on the entity part to obtain the updated entity part.
[0130] For example, this step can refer to step S103 above, and will not be repeated here.
[0131] S404. The rewritten semantic part and the updated entity part are concatenated to obtain the first text to be processed.
[0132] For example, the rewritten semantic part and the updated entity part are concatenated to obtain the first text to be processed. For instance, the updated entity part can replace the placeholders in the rewritten semantic part, and the replaced text is identified as the first text to be processed. For example, if the rewritten semantic part is "I want XXXX, anyone else want to come?", and the updated entity part is "Plan XXXX", then the updated entity part replaces the placeholders in the rewritten semantic part, resulting in "I want to plan XXXX, anyone else want to come?", and this text is identified as the first text to be processed.
[0133] The advantage of this setup is that, while preserving the masking process, the updated entity part is concatenated with the rewritten semantic part. This increases the diversity of the text without changing the semantics, generating multiple different first texts to be processed.
[0134] S405. Expand the first text to be processed to obtain the second text to be processed.
[0135] For example, the first text to be processed is expanded to obtain the second text to be processed. For instance, an expansion model can be pre-set, which is a language model optimized using prompts. Based on the first text to be processed and the pre-set expansion model, the first text is expanded to enrich its details and content, making the sentences more natural and diverse. For example, if the first text to be processed is "I want to plan XXXX, anyone want to come?", expanding it to "I really want to get together with everyone lately, it's been too long since I met my friends, I want to plan XXXX, anyone want to come?", this text is then identified as the second text to be processed.
[0136] The beneficial effect of this setting is that it expands the first text to be processed, making the details of the first text to be processed richer, the text sentences more fluent, and the text quality closer to the level of real text, thereby improving the text quality and diversity.
[0137] S406. Add the words to be updated to the obscured part of the second text to be processed to obtain the target text data.
[0138] For example, the words to be updated are added to the obscured parts of the second text to be processed to obtain the target text data. For instance, if the second text to be processed is "I really want to get together with everyone lately, it's been too long since I met my friends, I'm planning XXXX, anyone want to come?", the corresponding associated entity is a verb-object structure, and the words to be updated are determined to be "outing activities", "hiking activities", "spring outings", etc., etc., and these words are used to replace the obscured parts of the second text to be processed, respectively, to obtain at least one target text data such as "I really want to get together with everyone lately, it's been too long since I met my friends, I'm planning an outing, anyone want to come?", "I really want to get together with everyone lately, it's been too long since I met my friends, I'm planning a hiking activity, anyone want to come?", "I really want to get together with everyone lately, it's been too long since I met my friends, I'm planning a spring outing, anyone want to come?", etc.
[0139] The beneficial effect of this setting is that adding the words to be updated to the masked part of the second text to be processed can match verbs with objects, and the verbs and objects of the corresponding related entities will not conflict, thus improving text quality and reducing text errors. By replacing different words to be updated, a large amount of text with related content can be generated, thereby improving the speed and efficiency of text generation.
[0140] The method, apparatus, device, and medium for generating text data based on user needs provided in this application embodiment acquire user-preset initial text data, segment the text data to obtain the semantic and entity parts of the preset initial text data, rewrite the semantic part, update the word content of the entity part, and generate target text data based on the rewritten semantic and updated entity parts. By segmenting the initial text data, the semantic and entity parts of the text data are accurately obtained, facilitating operation; rewriting the semantic part generates semantically similar but differently expressed sentences, enriching the data types; updating the entity part yields more new and related updated entity parts; and by using the rewritten semantic and updated entity parts, a large amount of target text data that meets the requirements can be quickly generated, improving the efficiency and diversity of data generation.
[0141] Figure 5 This is a structural block diagram of a text data generation apparatus based on user needs provided in an embodiment of the present disclosure.
[0142] For ease of explanation, only the parts relevant to the embodiments of this disclosure are shown, with reference to... Figure 5 The text data generation device 500 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 the rewritten semantic part, and to perform word update processing on the entity part to obtain the updated entity part;
[0146] The generation unit 504 is used to generate target text data based on the rewritten semantic part and the updated entity part.
[0147] Figure 6 This is a structural block diagram of a text data generation apparatus based on user needs provided in an embodiment of the present disclosure.
[0148] exist Figure 5 Based on the illustrated embodiments, as Figure 6As shown, the segmentation unit 502 includes a search module 5021 and a masking 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 the associated entities; wherein, the preset entity database stores multiple entity words;
[0150] The masking module 5022 is used to determine the words to be updated from the associated entities, and to mask the words to be updated, and to determine the masked associated entities as the updated entity parts.
[0151] In one example, the masking module 5022 includes:
[0152] The first determination submodule is used to perform semantic recognition processing on the verbs and objects in the determined associated entity if the grammatical structure of the associated entity is a verb-object structure, and to determine the words to be updated from the verbs and objects.
[0153] In one example, the identification submodule is specifically used for:
[0154] Semantic recognition processing is performed on the verbs in the associated entities to determine the relevance between the verbs and the demand information, which is the first relevance; and semantic recognition processing is performed on the objects in the associated entities to determine the relevance between the objects and the demand information, which is the second relevance.
[0155] The word to be updated is determined from the verb and the object based on the first relevance and the second relevance.
[0156] In one example, the masking module 5022 includes:
[0157] The second determining submodule is used 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 verb-object structure.
[0158] In one example, module 5021 is searched, including:
[0159] The association determination module is used to obtain entity words from the preset entity database and determine the association degree between the entity part and the entity word; wherein, the association degree characterizes 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 based on the degree of association between the entity part and the entity word.
[0161] In one example, segmentation unit 502 includes:
[0162] The recognition module is used to identify semantic and entity parts from the preset initial text data based on a preset recognition model, and to segment the semantic and entity parts; wherein the preset recognition model is a pre-trained language model used to identify semantics and entities in the text data.
[0163] In one example, generation unit 504 includes:
[0164] The splicing module is used to splice the rewritten semantic part and the updated entity part to obtain the first text to be processed;
[0165] An expansion module is used to expand the text to be processed to obtain a second text to be processed;
[0166] An adding module is used to add the word to be updated to the obscured part of the second text to be processed, thereby obtaining the target text data.
[0167] Figure 7 This is 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, the instructions being executed by the at least one processor 702 to enable the at least one processor 702 to perform the user-demand-based text data generation method of this disclosure.
[0168] The electronic device 700 also 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 embodiments of this disclosure, this disclosure also provides an electronic device, a readable storage medium, and a computer program product.
[0170] According to embodiments of this disclosure, this disclosure also provides a computer program product comprising: a computer program stored in a readable storage medium, at least one processor of an electronic device being able to read the computer program from the readable storage medium, and the at least one processor executing the computer program causing the electronic device to perform the scheme provided in any of the above embodiments.
[0171] Figure 8This is a block diagram illustrating an electronic device according to an exemplary embodiment. The device may be a mobile phone, computer, digital broadcasting terminal, messaging device, game console, tablet device, medical device, fitness device, personal digital assistant, etc.
[0172] Device 800 may include one or more of the following components: processing component 802, memory 804, power supply component 806, multimedia component 808, audio component 811, input / output (I / O) interface 812, sensor component 814, and communication component 816.
[0173] Processing component 802 typically controls the overall operation of device 800, such as operations associated with display, telephone calls, data communication, camera operation, and recording. Processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the methods described above. Furthermore, processing component 802 may include one or more modules to facilitate interaction between processing component 802 and other components. For example, processing component 802 may include a multimedia module to facilitate interaction between multimedia component 808 and processing component 802.
[0174] Memory 804 is configured to store various types of data to support the operation of device 700. Examples of this data include instructions for any application or method operating on device 800, contact data, phonebook data, messages, pictures, videos, etc. 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 storage, flash memory, magnetic disk, or optical disk.
[0175] Power supply component 806 provides power to various components of device 800. Power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to device 800.
[0176] 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 touchscreen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touches, swipes, and gestures on the touch panel. The touch sensors may sense not only the boundaries of the touch or swipe action but also the duration and pressure associated with the touch or swipe operation. In some embodiments, multimedia component 808 includes a front-facing camera and / or a rear-facing camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front-facing camera and / or the rear-facing camera may receive external multimedia data. Each front-facing camera and rear-facing camera may be a fixed optical lens system or have focal length and optical zoom capabilities.
[0177] Audio component 810 is configured to output and / or input audio signals. For example, audio component 810 includes a microphone (MIC) configured to receive external audio signals when device 800 is in an operating mode, such as call mode, recording mode, and voice recognition mode. The received audio signals may be further stored in memory 804 or transmitted via communication component 816. In some embodiments, 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 buttons, volume buttons, power buttons, and lock buttons.
[0179] Sensor assembly 814 includes one or more sensors for providing status assessments of various aspects of device 800. For example, sensor assembly 814 may detect the on / off state of device 800, the relative positioning of components such as the display and keypad of device 800, changes in the position of device 800 or a component of device 800, the presence or absence of user contact with device 800, the orientation or acceleration / deceleration of device 800, and temperature changes of device 800. Sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. 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, sensor assembly 814 may also include an accelerometer, a gyroscope, a magnetometer, a pressure sensor, or a temperature sensor.
[0180] Communication component 816 is configured to facilitate wired or wireless communication between device 800 and other devices. Device 800 can access wireless networks based on communication standards, such as WiFi, 2G, or 3G, or combinations thereof. In one exemplary embodiment, communication component 816 receives broadcast signals or broadcast-related information from an external broadcast management system via a broadcast channel. In one exemplary embodiment, communication component 816 also includes a near-field communication (NFC) module to facilitate short-range communication. For example, the NFC module may 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, 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 methods described above.
[0182] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, which can be executed by a processor 820 of device 800 to perform the above-described method. For example, the non-transitory computer-readable storage medium may be a ROM, random access memory (RAM), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0183] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by the processor of a terminal device, enables the terminal device to perform the aforementioned method for generating text data based on user needs.
[0184] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily essential to this application.
[0185] It should be further noted that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowchart may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0186] It should be understood that the above-described device embodiments are merely illustrative, and the device of this application can also be implemented in other ways. For example, the division of units / modules in the above embodiments is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units, modules, or components may be combined, or integrated into another system, or some features may be ignored or not executed.
[0187] Furthermore, unless otherwise specified, the functional units / modules in the various embodiments of this application can be integrated into one unit / module, or each unit / module can exist physically separately, or two or more units / modules can be integrated together. The integrated units / modules described above can be implemented in hardware or as software program modules.
[0188] When integrated units / modules are implemented in hardware, the hardware can be digital circuits, analog circuits, etc. The physical implementation of the hardware structure includes, but is not limited to, transistors, memristors, etc. Unless otherwise specified, the processor can be any suitable hardware processor, such as a CPU, GPU, FPGA, DSP, and ASIC, etc. Unless otherwise specified, the storage unit can be any suitable magnetic or magneto-optical storage medium, such as Resistive Random Access Memory (RRAM), Dynamic Random Access Memory (DRAM), Static Random Access Memory (SRAM), Enhanced Dynamic Random Access Memory (EDRAM), High-Bandwidth Memory (HBM), Hybrid Memory Cube (HMC), etc.
[0189] If the integrated unit / module is implemented as a software program module and sold or used as an independent product, it can be stored in a computer-readable storage device (CMD). Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a memory and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned memory includes various media capable of storing program code, such as a USB flash drive, read-only memory (ROM), random access memory (RAM), portable hard drive, magnetic disk, or optical disk.
[0190] In the above embodiments, the descriptions of each embodiment have their own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments. The technical features of the above embodiments can be combined arbitrarily. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as these combinations of technical features do not contradict each other, they should be considered within the scope of this specification.
[0191] Other embodiments of this application will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of this application that follow the general principles of this application and include common knowledge or customary techniques in the art not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of this application are indicated by the following claims.
[0192] It should be understood that this application is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of this application is limited only by the appended claims.
Claims
1. A method for generating text data based on user needs, characterized in that, include; Obtain 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; wherein the semantic part represents the semantic information in the text data; and the entity part represents the entity words in the text data. The semantic part is semantically rewritten to obtain the rewritten semantic part, and the entity part is word-updated to obtain the updated entity part. Based on the rewritten semantic part and the updated entity part, generate target text data; The entity part is subjected to word update processing to obtain the updated entity part, including: From a preset entity database, find entity words that are associated with the entity part, which are the associated entities; wherein, the preset entity database stores multiple entity words; If the grammatical structure of the associated entity is determined to be a verb-object structure, then semantic recognition processing is performed on the verb and object in the associated entity respectively, the word to be updated is determined from the verb and the object, and the word to be updated is masked, and the masked associated entity is determined as the updated entity part; Pre-set demand information, which represents user needs; semantic recognition processing is performed on the verbs and objects in the associated entities to determine the words to be updated from the verbs and objects, including: Semantic recognition processing is performed on the verbs in the associated entities to determine the relevance between the verbs and the demand information, which is the first relevance; and semantic recognition processing is performed on the objects in the associated entities to determine the relevance between the objects and the demand information, which is the second relevance. The word to be updated is determined from the verb and the object based on the first relevance and the second relevance.
2. The method according to claim 1, characterized in that, The words to be updated are determined from the associated entities, including: If it is determined that the grammatical structure of the associated entity is not a verb-object structure, then the associated entity is identified as a word to be updated.
3. The method according to claim 1, characterized in that, From a pre-defined entity database, search for entity words associated with the entity portion; these are the associated entities, including: Obtain entity words from the preset entity database and determine the correlation between the entity part and the entity word; wherein, the correlation represents the degree of relevance between the entity part and the entity word; The associated entity is determined from a preset entity database based on the degree of association between the entity part and the entity word.
4. The method according to claim 1, characterized in that, The preset initial text data is segmented to obtain the semantic and entity parts of the preset initial text data, including: Based on a preset recognition model, semantic and entity parts are identified from the preset initial text data, and the semantic and entity parts are segmented; wherein, the preset recognition model is a pre-trained language model used to identify semantics and entities in the text data.
5. The method according to claim 1, characterized in that, Based on the rewritten semantic portion and the updated entity portion, target text data is generated, including: The rewritten semantic part and the updated entity part are concatenated to obtain the first text to be processed. The first text to be processed is expanded to obtain the second text to be processed. The words to be updated are added to the obscured portion of the second text to be processed to obtain the target text data.
6. A device for generating text data based on user needs, characterized in that, include: An acquisition unit is used to acquire preset initial text data; wherein the preset initial text data is text data that meets user requirements; The segmentation unit is used to segment the preset initial text data to obtain the semantic part and the 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. The processing unit is configured to perform semantic rewriting on the semantic part to obtain the rewritten semantic part, and to perform word update on the entity part to obtain the updated entity part; The generation unit is used to generate target text data based on the rewritten semantic part and the updated entity part; The processing unit is specifically used to search for entity words associated with the entity part from a preset entity database, which are then considered as associated entities; wherein, the preset entity database stores multiple entity words; and pre-set demand information, which represents user demands; If the grammatical structure of the associated entity is determined to be a verb-object structure, then semantic recognition processing is performed on the verbs in the associated entity to determine the relevance between the verbs and the requirement information, which is the first relevance; and semantic recognition processing is performed on the objects in the associated entity to determine the relevance between the objects and the requirement information, which is the second relevance; based on the first relevance and the second relevance, words to be updated are determined from the verbs and the objects, and the words to be updated are masked, and the masked associated entity is determined as the updated entity part.
7. 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-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 5.
9. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1-5.
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