Sample text generation method and device

By selecting sample text matching the scene information and correcting it, an accurate target sample text is generated, which solves the problem of insufficiently accurate and flexible sample text generation in the prior art, and improves the training effect of the text processing model.

CN114638210BActive Publication Date: 2025-01-17CHINESE PEOPLES LIBERATION ARMY UNIT 93114
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210234093.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-03-10
Publication Date
2025-01-17
Estimated Expiration
2042-03-10

AI Technical Summary

Technical Problem

Existing text intelligent processing technology requires a large number of sample texts for training, resulting in the inaccurate and flexible generation of sample texts.

Method used

By obtaining the scene information and sample text library, select candidate sample text matching the first scene information, and use the second scene information to correct it to generate the target sample text to accurately match the scene information.

Benefits of technology

It improves the accuracy and flexibility of the target sample text, reduces dependence on the sample text library, and enhances the training effect of the text processing model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114638210B_ABST
    Figure CN114638210B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for generating sample text. The method comprises: obtaining scene information and a sample text library, wherein the scene information comprises first scene information and second scene information; selecting candidate sample texts matching the first scene information from the sample text library; replacing the text to be replaced in the candidate sample texts with the second scene information to generate target sample texts. Thus, matching candidate sample texts can be selected based on the first scene information, and the candidate sample texts can be corrected using the second scene information, so that the generated target sample texts accurately match the scene information, which helps to improve the accuracy and flexibility of the target sample texts.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] At present, with the development of artificial intelligence technologies such as deep learning and natural language processing, text intelligent processing technology has gradually matured. For example, text intelligent processing technology can be used to automatically obtain the subject content, semantics, intention, etc. of the text. In related technologies, text intelligent processing technology requires a large amount of sample text to train algorithms or models. Summary of the invention

[0003] The present invention aims to solve one of the technical problems in the above-mentioned technology at least to some extent.

[0004] To this end, an object of the present invention is to propose a sample text generation method, which can select matching candidate sample texts based on first scene information, and use second scene information to correct the candidate sample texts, so that the generated target sample texts accurately match the scene information, which helps to improve the accuracy and flexibility of the target sample texts.

[0005] The second objective of the present invention is to provide a sample text generating device.

[0006] A third objective of the present invention is to provide an electronic device.

[0007] A fourth object of the present invention is to provide a computer-readable storage medium.

[0008] The first aspect of the present invention proposes a sample text generation method, comprising: obtaining scene information and a sample text library, wherein the scene information includes first scene information and second scene information; selecting candidate sample text matching the first scene information from the sample text library; replacing the text to be replaced in the candidate sample text with the second scene information to generate a target sample text.

[0009] According to the sample text generation method of the embodiment of the present invention, a candidate sample text matching the first scene information can be selected from the sample text library, and the text to be replaced in the candidate sample text can be replaced with the second scene information to generate a target sample text. Thus, a matching candidate sample text can be selected based on the first scene information, and the candidate sample text can be corrected using the second scene information, so that the generated target sample text accurately matches the scene information, which helps to improve the accuracy and flexibility of the target sample text.

[0010] In addition, the sample text generation method proposed in the above embodiment of the present invention may also have the following additional technical features:

[0011] In one embodiment of the present invention, the selecting, from the sample text library, candidate sample text that matches the first scene information includes: obtaining a first similarity between the sample text and the first scene information; and selecting, from the sample text library, the candidate sample text that matches the first scene information based on the first similarity.

[0012] In one embodiment of the present invention, the obtaining of the first similarity between the sample text and the first scene information includes: obtaining annotation information of the sample text; obtaining a second similarity between the annotation information and the first scene information, and determining the second similarity as the first similarity.

[0013] In one embodiment of the present invention, the method further includes: acquiring at least one preset scene dimension; collecting the scene information according to each of the scene dimensions, and generating the scene information under each of the scene dimensions.

[0014] In one embodiment of the present invention, the method further includes: obtaining at least one preset annotation dimension; annotating the sample text according to each annotation dimension to generate the annotation information under each annotation dimension; and storing each annotation information in the sample text library.

[0015] In one embodiment of the present invention, obtaining the second similarity between the annotation information and the first scene information includes: identifying the overlapping dimension between the annotation dimension of the annotation information and the scene dimension of the first scene information; obtaining the target annotation information and the target first scene information under the overlapping dimension; obtaining the third similarity between the target annotation information and the target first scene information, and determining the third similarity as the second similarity.

[0016] In one embodiment of the present invention, the obtaining of the third similarity between the target annotation information and the target first scene information includes: obtaining the fourth similarity between the target annotation information and the target first scene information under any of the overlapping dimensions; and obtaining the third similarity based on the corresponding fourth similarity under each of the overlapping dimensions.

[0017] In one embodiment of the present invention, storing each of the annotation information in the sample text library includes: obtaining a storage location of each of the annotation information in the sample text library; and storing each of the annotation information in the corresponding storage location.

[0018] In one embodiment of the present invention, after generating the target sample text, the method further includes: training a text processing model according to the target sample text.

[0019] The second aspect of the present invention proposes a sample text generation device, including: an acquisition module, used to acquire scene information and a sample text library, wherein the scene information includes first scene information and second scene information; a selection module, used to select candidate sample text matching the first scene information from the sample text library; a generation module, used to replace the text to be replaced in the candidate sample text with the second scene information to generate a target sample text.

[0020] The sample text generation device of the embodiment of the present invention can select candidate sample texts matching the first scenario information from the sample text library, and replace the text to be replaced in the candidate sample texts with the second scenario information to generate the target sample text. Thus, the matching candidate sample texts can be selected based on the first scenario information, and the candidate sample texts can be corrected using the second scenario information, so that the generated target sample texts accurately match the scenario information, which helps to improve the accuracy and flexibility of the target sample texts.

[0021] In addition, the sample text generation device proposed in the above embodiment of the present invention may also have the following additional technical features:

[0022] In one embodiment of the present invention, the selection module includes: an acquisition unit, used to obtain a first similarity between the sample text and the first scene information; and a selection unit, used to select the candidate sample text matching the first scene information from the sample text library based on the first similarity.

[0023] In one embodiment of the present invention, the acquisition unit is further used to: acquire annotation information of the sample text; acquire a second similarity between the annotation information and the first scene information, and determine the second similarity as the first similarity.

[0024] In one embodiment of the present invention, the device further includes: a collection module, the collection module being used to: obtain at least one preset scene dimension; collect the scene information according to each of the scene dimensions, and generate the scene information under each of the scene dimensions.

[0025] In one embodiment of the present invention, the device also includes: a labeling module, which is used to: obtain at least one preset labeling dimension; label the sample text according to each labeling dimension to generate the labeling information under each labeling dimension; and store each labeling information in the sample text library.

[0026] In one embodiment of the present invention, the acquisition unit is also used to: identify the overlapping dimension between the annotation dimension of the annotation information and the scene dimension of the first scene information; obtain the target annotation information and the target first scene information under the overlapping dimension; obtain the third similarity between the target annotation information and the target first scene information, and determine the third similarity as the second similarity.

[0027] In one embodiment of the present invention, the acquisition unit is further used to: acquire the fourth similarity between the target annotation information and the target first scene information under any of the overlapping dimensions; and acquire the third similarity based on the corresponding fourth similarity under each of the overlapping dimensions.

[0028] In one embodiment of the present invention, the annotation module is further used to: obtain the storage location of each annotation information in the sample text library; and store each annotation information in the corresponding storage location.

[0029] In one embodiment of the present invention, the device further comprises: a training module, wherein the training module is used to train a text processing model according to the target sample text.

[0030] The third aspect of the present invention provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the sample text generation method as described in the first aspect of the present invention is implemented.

[0031] The electronic device of the embodiment of the present invention can select candidate sample texts matching the first scene information from the sample text library through the processor executing the computer program stored in the memory, and replace the text to be replaced in the candidate sample texts with the second scene information to generate the target sample text. Thus, the matching candidate sample texts can be selected based on the first scene information, and the candidate sample texts can be corrected using the second scene information, so that the generated target sample texts accurately match the scene information, which helps to improve the accuracy and flexibility of the target sample texts.

[0032] The fourth aspect of the present application provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the sample text generation method described in the first aspect of the present application is implemented.

[0033] The computer-readable storage medium of the embodiment of the present invention can select candidate sample texts matching the first scenario information from the sample text library by storing a computer program and being executed by a processor, and replace the text to be replaced in the candidate sample texts with the second scenario information to generate a target sample text. Thus, the matching candidate sample texts can be selected based on the first scenario information, and the candidate sample texts can be corrected using the second scenario information, so that the generated target sample texts accurately match the scenario information, which helps to improve the accuracy and flexibility of the target sample texts.

[0034] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS

[0035] The above and / or additional aspects and advantages of the present invention will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0036] Figure 1 A schematic diagram of a flow chart of a method for generating a sample text according to an embodiment of the present invention;

[0037] Figure 2 A schematic diagram of a flow chart before obtaining a sample text library in a sample text generation method according to an embodiment of the present invention;

[0038] Figure 3 A schematic diagram of a flow chart of obtaining a second similarity in a sample text generation method according to an embodiment of the present invention;

[0039] Figure 4 is a schematic diagram of the structure of a sample text generating device according to an embodiment of the present invention; and

[0040] Figure 5 FIG. 1 is a schematic structural diagram of an electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0041] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present invention, and should not be construed as limiting the present invention.

[0042] The following describes the sample text generation method, device, electronic device and storage medium of the embodiments of the present invention in conjunction with the accompanying drawings.

[0043] Figure 1 The figure is a flowchart of a method for generating sample text according to an embodiment of the present invention.

[0044] like Figure 1 As shown, the sample text generation method of the embodiment of the present invention includes:

[0045] S101, acquiring scene information and a sample text library, wherein the scene information includes first scene information and second scene information.

[0046] In the embodiment of the present invention, scene information can be obtained, wherein the scene information includes first scene information and second scene information. It should be noted that both the first scene information and the second scene information can be set according to actual conditions, and no excessive restrictions are made here.

[0047] In one embodiment, the scene information may include scene information under at least one scene dimension. It should be noted that the scene dimension can be set according to actual conditions, and no excessive restrictions are made here. For example, the scene dimension includes but is not limited to time, object country, object type, object number, object position, object speed, object behavior, object intention, object status, etc. Among them, the object position includes but is not limited to the object longitude, object latitude, object altitude, etc., and the object status includes but is not limited to the object radar status, object communication status, etc.

[0048] In one embodiment, the first scene information and / or the second scene information includes scene information under at least one scene dimension. For example, the first scene information includes scene information under scene dimensions such as object position, object behavior, and object intention, and the second scene information includes scene information under scene dimensions such as time and object type.

[0049] In one embodiment, at least one preset scene dimension may be obtained, and scene information may be collected according to each scene dimension to generate scene information under each scene dimension. Thus, the method may generate scene information under the scene dimension according to the preset scene dimension.

[0050] In one embodiment, scene information can be collected by a collection device. It should be noted that the collection device can be set according to actual conditions, and there is no excessive limitation here. For example, the collection device includes but is not limited to sensors, cameras, radars, navigation systems, etc. Among them, the navigation system includes but is not limited to the Global Positioning System (GPS), BeiDou Navigation Satellite System (BDS), etc.

[0051] In one implementation, a file carrying scene information may be acquired through network transmission, and the scene information may be collected from the file.

[0052] In one embodiment, simulation data carrying scene information can be generated by a simulation model, and scene information can be collected from the simulation data. It should be noted that the simulation model can be set according to actual conditions, and no excessive restrictions are made here. For example, the simulation model can be a deep learning model.

[0053] In an embodiment of the present invention, a sample text library may be obtained. It should be noted that the sample text library may include a plurality of sample texts.

[0054] In one implementation, a file carrying the sample text may be acquired through network transmission, and the sample text may be extracted from the file.

[0055] In one embodiment, simulation data carrying sample text can be generated by a simulation model, and sample text can be extracted from the simulation data. It should be noted that the simulation model can be set according to actual conditions, and no excessive restrictions are made here. For example, the simulation model can be a deep learning model.

[0056] S102: Select candidate sample texts matching the first scene information from a sample text library.

[0057] In the embodiment of the present invention, candidate sample texts matching the first scene information may be selected from the sample text library.

[0058] In one embodiment, selecting candidate sample texts matching the first scene information from the sample text library may include obtaining a first similarity between the sample text and the first scene information, and selecting candidate sample texts matching the first scene information from the sample text library based on the first similarity.

[0059] In one embodiment, obtaining the first similarity between the sample text and the first scene information may include inputting the sample text and the first scene information into a similarity model, and the similarity model outputting the first similarity between the sample text and the first scene information. It should be noted that the similarity model can be set according to actual conditions and is not limited here.

[0060] In one implementation, selecting a candidate sample text matching the first scene information from a sample text library based on the first similarity may include the following two possible implementations:

[0061] Method 1: sort the sample texts from high to low according to the first similarity, and determine the top N sample texts as candidate sample texts, where N is a positive integer.

[0062] It should be noted that N can be set according to actual conditions and is not limited here. For example, N can be set to 1.

[0063] Therefore, the method can sort the sample texts according to the first similarity, and select N sample texts with greater first similarity as candidate sample texts.

[0064] Method 2: Determine the sample text whose first similarity is greater than a preset similarity threshold as the candidate sample text.

[0065] It should be noted that the preset similarity threshold can be set according to actual conditions and is not limited too much here. For example, the preset similarity threshold can be set to 80%.

[0066] Therefore, the method can screen out sample texts whose first similarity is greater than a preset similarity threshold as candidate sample texts.

[0067] S103: Replace the text to be replaced in the candidate sample text with the second scene information to generate a target sample text.

[0068] In the embodiment of the present invention, the text to be replaced in the candidate sample text may be replaced with the second scene information to generate the target sample text, and the candidate sample text may be corrected using the second scene information.

[0069] In one implementation, before replacing the text to be replaced in the candidate sample text with the second scene information, it may include identifying the scene dimension of the second scene information, and using the text in the candidate sample text corresponding to the identified scene dimension as the text to be replaced.

[0070] For example, if the second scene information includes scene information under the time and object type scene dimensions, the text corresponding to the time and object type scene dimensions in the candidate sample text can be used as the text to be replaced. For example, if the second scene information includes "8 am" and "vehicle", and the candidate sample text includes "6 pm" and "airplane", then "6 pm" in the candidate sample text can be replaced with "8 am", and "airplane" can be replaced with "vehicle".

[0071] In summary, according to the sample text generation method of the embodiment of the present invention, a candidate sample text matching the first scene information can be selected from the sample text library, and the text to be replaced in the candidate sample text can be replaced with the second scene information to generate a target sample text. Thus, a matching candidate sample text can be selected based on the first scene information, and the candidate sample text can be corrected using the second scene information, so that the generated target sample text accurately matches the scene information, which helps to improve the accuracy and flexibility of the target sample text.

[0072] Based on any of the above embodiments, Figure 2 As shown, before obtaining the sample text library in step S101, the following may be included:

[0073] S201: Obtain at least one preset annotation dimension.

[0074] It should be noted that the annotation dimensions can be set according to the actual situation and are not limited here. For example, the annotation dimensions include but are not limited to the identification information, source, name, processing start time, processing end time, number of events contained in the sample text, event type, event time, event subject, event content, country of the objects contained in the event, object type, object location, object behavior, object intention, etc., which are not limited here.

[0075] In one implementation, identification information may be set for the annotation dimensions to distinguish different annotation dimensions.

[0076] S202: label the sample text according to each labeling dimension to generate labeling information under each labeling dimension.

[0077] In the embodiment of the present invention, the sample text may be annotated according to each annotation dimension to generate annotation information under each annotation dimension.

[0078] For example, if the annotation dimensions include event time, object type, object location, object behavior, and object intent, the sample text can be annotated separately according to the event time, object type, object location, object behavior, and object intent annotation dimensions to generate annotation information under the event time, object type, object location, object behavior, and object intent annotation dimensions.

[0079] S203: Store each annotation information into a sample text library.

[0080] In the embodiment of the present invention, each annotation information may be stored in a sample text library.

[0081] In one implementation, storing each annotation information in the sample text library may include obtaining a storage location of each annotation information in the sample text library, and storing each annotation information in a corresponding storage location.

[0082] In one embodiment, a storage location of the corresponding annotation information may be set for each sample text, and different annotation information of the same sample text may correspond to different storage locations. For example, the storage location of the annotation information corresponding to each sample text may be obtained, and the storage location of each annotation information may be divided according to the annotation dimension.

[0083] For example, the storage location of the annotation information corresponding to sample text A is storage location A, and the annotation dimensions corresponding to sample text A include event time, object type, object location, object behavior, and object intention. Then storage location A can be divided into 5 storage locations, namely storage location A 1 , A 2 To A5 , storage location A 1 , A 2 To A 5 The storage locations of the annotation information of the sample text A corresponding to the annotation dimensions of event time, object type, object location, object behavior, and object intention are respectively.

[0084] Therefore, the method can generate annotation information under the preset annotation dimension according to the preset annotation dimension.

[0085] Based on any of the above embodiments, obtaining the first similarity between the sample text and the first scene information may include obtaining annotation information of the sample text, obtaining a second similarity between the annotation information and the first scene information, and determining the second similarity as the first similarity.

[0086] In one implementation, obtaining the annotation information of the sample text may include obtaining the storage location of the annotation information in the sample text library, and obtaining the annotation information from the storage location. It should be noted that the relevant content of obtaining the storage location of the annotation information in the sample text library can be referred to the above embodiment, which will not be repeated here.

[0087] In one embodiment, obtaining the second similarity between the annotation information and the first scene information may include inputting the annotation information and the first scene information into a similarity model, and the similarity model outputting the first similarity between the annotation information and the first scene information.

[0088] Thus, the method can obtain the second similarity between the annotation information of the sample text and the first scene information, and determine the second similarity as the first similarity to achieve the acquisition of the first similarity between the sample text and the first scene information.

[0089] Based on any of the above embodiments, Figure 3 As shown, obtaining the second similarity between the annotation information and the first scene information may include:

[0090] S301, identifying the overlapping dimension between the annotation dimension of the annotation information and the scene dimension of the first scene information.

[0091] In the embodiment of the present invention, the annotation dimension of the annotation information and the scene dimension of the first scene information have overlapping dimensions, and the number of the overlapping dimensions may be one or more.

[0092] For example, if the annotation dimensions of the annotation information include event time, object type, object location, object behavior, and object intention, and the scene dimensions of the first scene information include object location, object behavior, and object intention, then the overlapping dimensions between the annotation dimensions of the annotation information and the scene dimensions of the first scene information include object location, object behavior, and object intention.

[0093] S302, obtaining target labeling information and target first scene information in overlapping dimensions.

[0094] In an embodiment of the present invention, target annotation information in the overlapping dimension may be acquired from the annotation information, and target first scene information in the overlapping dimension may be acquired from the first scene information.

[0095] For example, if the overlapping dimensions include object position, object behavior, and object intention, the target annotation information under the object position, object behavior, and object intention can be obtained from the annotation information, and the target first scene information under the object position, object behavior, and object intention can be obtained from the first scene information.

[0096] S303: Obtain a third similarity between the target annotation information and the target first scene information, and determine the third similarity as the second similarity.

[0097] In one embodiment, obtaining the third similarity between the target annotation information and the target first scene information may include inputting the target annotation information and the target first scene information into a similarity model, and the similarity model outputting the first similarity between the target annotation information and the target first scene information.

[0098] In one embodiment, obtaining the third similarity between the target annotation information and the target first scene information may include fuzzifying the target annotation information and the target first scene information respectively, generating a first fuzzy value corresponding to the target annotation information and a second fuzzy value corresponding to the target first scene information, and obtaining the similarity parameter between the target annotation information and the target first scene information by the following formula:

[0099]

[0100] Among them, d i is the similarity parameter between the target annotation information corresponding to the i-th sample text and the target first scene information, m is the number of overlapping dimensions, A in is the first fuzzy value corresponding to the target annotation information under the nth overlapping dimension corresponding to the i-th sample text, B in is the second fuzzy value corresponding to the target first scene information under the nth overlapping dimension corresponding to the i-th sample text, and the similarity parameter d i Negatively correlated with the third similarity.

[0101] In one embodiment, obtaining the third similarity between the target annotation information and the target first scene information may include obtaining the fourth similarity between the target annotation information and the target first scene information in any overlapping dimension, and obtaining the third similarity based on the corresponding fourth similarity in each overlapping dimension.

[0102] In one embodiment, obtaining the fourth similarity between the target annotation information and the target first scene information in any overlapping dimension may include, for any overlapping dimension, performing fuzzy processing on the target annotation information and the target first scene information, respectively, generating a first fuzzy value corresponding to the target annotation information and a second fuzzy value corresponding to the target first scene information, and obtaining the fourth similarity based on the absolute difference between the first fuzzy value and the second fuzzy value. The absolute difference is negatively correlated with the fourth similarity.

[0103] In one implementation, obtaining the third similarity based on the corresponding fourth similarities under each overlapping dimension may include taking an average value of the fourth similarities as the third similarity.

[0104] For example, if the overlapping dimensions include object position, object behavior, and object intention, the fourth similarity between the target annotation information under the object position and the target first scene information can be obtained, as well as the fourth similarity between the target annotation information under the object behavior and the target first scene information, and the fourth similarity between the target annotation information under the object intention and the target first scene information can be obtained, and the average of each fourth similarity obtained above is taken as the third similarity.

[0105] It should be noted that, in the embodiments of the present invention, the specific method of fuzzy processing can be set according to actual conditions, and no excessive restrictions are made here. For example, the annotation information and the first scene information can be fuzzy processed respectively through the membership function.

[0106] Therefore, the method can obtain the overlapping dimension between the annotation information of the sample text and the scene dimension of the first scene information, and obtain the third similarity between the target annotation information and the target first scene information under the overlapping dimension, and determine the third similarity as the second similarity to achieve the acquisition of the second similarity between the annotation information of the sample text and the first scene information.

[0107] On the basis of any of the above embodiments, after generating the target sample text in step S103, the text processing model may be trained according to the target sample text. It should be noted that the text processing model may be set according to the actual situation, and no excessive restrictions are made here. For example, the functions of the text processing model include but are not limited to word segmentation, semantic extraction, topic extraction, intention prediction, behavior prediction, etc.

[0108] In one embodiment, the target sample text can be annotated according to each annotation dimension, the annotation information under each annotation dimension can be generated, and the annotation information can be stored in the sample text library. Thus, the method can store the annotation information of the target sample text in the sample text library, and can realize the real-time update of the sample text library.

[0109] In one embodiment, training a text processing model according to a target sample text may include inputting the target sample text into the text processing model, outputting the processing result of the target sample text by the text processing model, adjusting the model parameters of the text processing model using the annotation information and the processing result of the target sample text, until the model training end condition is reached, and a trained text processing model is generated. It should be noted that the model training end condition can be set according to actual conditions, and is not limited here. For example, the model training end condition includes but is not limited to the model training times reaching a preset times threshold, the model accuracy reaching a preset accuracy threshold, etc.

[0110] Therefore, this method can train the text processing model according to the target sample text with a high degree of matching with the scene information, which can improve the training effect and performance of the text processing model.

[0111] In order to implement the above embodiment, the present invention also proposes a sample text generating device.

[0112] Figure 4 Schematic diagram of the structure of a sample text generating device according to an embodiment of the present invention.

[0113] like Figure 4 As shown, the sample text generating device 100 according to the embodiment of the present invention includes: an acquisition module 110 , a selection module 120 and a generation module 130 .

[0114] The acquisition module 110 is used to acquire scene information and a sample text library, wherein the scene information includes first scene information and second scene information;

[0115] The selection module 120 is used to select candidate sample texts matching the first scene information from the sample text library;

[0116] The generating module 130 is used to replace the text to be replaced in the candidate sample text with the second scene information to generate a target sample text.

[0117] In one embodiment of the present invention, the selection module 120 includes: an acquisition unit, used to acquire a first similarity between the sample text and the first scene information; and a selection unit, used to select the candidate sample text matching the first scene information from the sample text library based on the first similarity.

[0118] In one embodiment of the present invention, the acquisition unit is further used to: acquire annotation information of the sample text; acquire a second similarity between the annotation information and the first scene information, and determine the second similarity as the first similarity.

[0119] In one embodiment of the present invention, the sample text generation device 100 also includes: a collection module, which is used to: obtain at least one preset scene dimension; collect the scene information according to each scene dimension, and generate the scene information under each scene dimension.

[0120] In one embodiment of the present invention, the sample text generation device 100 also includes: a labeling module, which is used to: obtain at least one preset labeling dimension; label the sample text according to each labeling dimension to generate the labeling information under each labeling dimension; and store each labeling information in the sample text library.

[0121] In one embodiment of the present invention, the acquisition unit is also used to: identify the overlapping dimension between the annotation dimension of the annotation information and the scene dimension of the first scene information; obtain the target annotation information and the target first scene information under the overlapping dimension; obtain the third similarity between the target annotation information and the target first scene information, and determine the third similarity as the second similarity.

[0122] In one embodiment of the present invention, the acquisition unit is further used to: acquire the fourth similarity between the target annotation information and the target first scene information under any of the overlapping dimensions; and acquire the third similarity based on the corresponding fourth similarity under each of the overlapping dimensions.

[0123] In one embodiment of the present invention, the annotation module is further used to: obtain the storage location of each annotation information in the sample text library; and store each annotation information in the corresponding storage location.

[0124] In one embodiment of the present invention, the sample text generating device 100 further includes: a training module, wherein the training module is used to train a text processing model according to the target sample text.

[0125] It should be noted that for details not disclosed in the sample text generating device of the embodiment of the present invention, please refer to the details disclosed in the sample text generating method of the above embodiment of the present invention, which will not be repeated here.

[0126] In summary, the sample text generation device of the embodiment of the present invention can select candidate sample texts matching the first scene information from the sample text library, and replace the text to be replaced in the candidate sample texts with the second scene information to generate the target sample text. Thus, the matching candidate sample texts can be selected based on the first scene information, and the candidate sample texts can be corrected using the second scene information, so that the generated target sample texts accurately match the scene information, which helps to improve the accuracy and flexibility of the target sample texts.

[0127] In order to implement the above embodiment, Figure 5 As shown, an embodiment of the present invention proposes an electronic device 200, including: a memory 210, a processor 220, and a computer program stored in the memory 210 and executable on the processor 220, and when the processor 220 executes the program, the above-mentioned sample text generation method is implemented.

[0128] The electronic device of the embodiment of the present invention can select candidate sample texts matching the first scene information from the sample text library through the processor executing the computer program stored in the memory, and replace the text to be replaced in the candidate sample texts with the second scene information to generate the target sample text. Thus, the matching candidate sample texts can be selected based on the first scene information, and the candidate sample texts can be corrected using the second scene information, so that the generated target sample texts accurately match the scene information, which helps to improve the accuracy and flexibility of the target sample texts.

[0129] In order to implement the above embodiment, the embodiment of the present invention proposes a computer-readable storage medium, on which a computer program is stored. When the program is executed by a processor, the above sample text generation method is implemented.

[0130] The computer-readable storage medium of the embodiment of the present invention can select candidate sample texts matching the first scenario information from the sample text library by storing a computer program and being executed by a processor, and replace the text to be replaced in the candidate sample texts with the second scenario information to generate a target sample text. Thus, the matching candidate sample texts can be selected based on the first scenario information, and the candidate sample texts can be corrected using the second scenario information, so that the generated target sample texts accurately match the scenario information, which helps to improve the accuracy and flexibility of the target sample texts.

[0131] In the description of the present invention, it should be understood that the terms "center", "longitudinal", "lateral", "length", "width", "thickness", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inside", "outside", "clockwise", "counterclockwise", "axial", "radial", "circumferential" and the like indicate orientations or positional relationships based on the orientations or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the referred device or element must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be understood as limiting the present invention.

[0132] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features. In the description of the present invention, the meaning of "plurality" is two or more, unless otherwise clearly and specifically defined.

[0133] In the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", "connected", "fixed" and the like should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, it can be the internal connection of two elements or the interaction relationship between two elements. For ordinary technicians in this field, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0134] In the present invention, unless otherwise clearly specified and limited, a first feature being "above" or "below" a second feature may mean that the first and second features are in direct contact, or the first and second features are in indirect contact through an intermediate medium. Moreover, a first feature being "above", "above" or "above" a second feature may mean that the first feature is directly above or obliquely above the second feature, or simply means that the first feature is higher in level than the second feature. A first feature being "below", "below" or "below" a second feature may mean that the first feature is directly below or obliquely below the second feature, or simply means that the first feature is lower in level than the second feature.

[0135] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.

[0136] Although the embodiments of the present invention have been shown and described above, it is to be understood that the above embodiments are exemplary and are not to be construed as limitations of the present invention. A person skilled in the art may change, modify, replace and vary the above embodiments within the scope of the present invention.

Claims

1. A sample text generation method, characterized in that: include: Acquire scene information and a sample text library, wherein the scene information includes first scene information and second scene information; Selecting candidate sample texts matching the first scene information from the sample text library; The text to be replaced in the candidate sample text is replaced with the second scene information to generate a target sample text; wherein, The selecting a candidate sample text matching the first scene information from the sample text library includes: Obtaining a first similarity between the sample text and the first scene information; Selecting the candidate sample text matching the first scene information from the sample text library based on the first similarity; The obtaining a first similarity between the sample text and the first scene information includes: Obtaining annotation information of the sample text; Acquire a second similarity between the annotation information and the first scene information, and determine the second similarity as the first similarity; The acquiring a second similarity between the annotation information and the first scene information includes: Identifying an overlap dimension between a labeling dimension of the labeling information and a scene dimension of the first scene information; Obtaining target labeling information and target first scene information under the overlapping dimension; A third similarity between the target annotation information and the target first scene information is obtained, and the third similarity is determined as the second similarity.

2. The method according to claim 1, characterized in that The method further comprises: Obtain at least one preset scene dimension; The scene information is collected according to each of the scene dimensions, and the scene information under each of the scene dimensions is generated.

3. The method according to claim 2, characterized in that The method further comprises: Obtain at least one preset annotation dimension; Annotate the sample text according to each annotation dimension to generate the annotation information under each annotation dimension; Each of the annotation information is stored in the sample text library.

4. The method according to claim 1, characterized in that: The obtaining a third similarity between the target annotation information and the target first scene information includes: Obtaining a fourth similarity between the target annotation information and the target first scene information under any of the overlapping dimensions; The third similarity is obtained based on the fourth similarity corresponding to each of the overlapping dimensions.

5. The method according to claim 3, characterized in that: The step of storing each of the annotation information in the sample text library includes: Obtaining the storage location of each of the annotation information in the sample text library; Each of the marking information is stored in the corresponding storage location.

6. The method according to claim 1, characterized in that After generating the target sample text, the method further includes: The text processing model is trained according to the target sample text.

7. A sample text generating device, characterized in that: include: An acquisition module, used to acquire scene information and a sample text library, wherein the scene information includes first scene information and second scene information; A selection module, used for selecting candidate sample texts matching the first scene information from the sample text library; A generating module is used to replace the text to be replaced in the candidate sample text with the second scene information to generate a target sample text; wherein, The selection module comprises: An acquisition unit, configured to acquire a first similarity between the sample text and the first scene information; A selection unit, configured to select the candidate sample text matching the first scene information from the sample text library based on the first similarity; The acquisition unit is further used for: Obtaining annotation information of the sample text; Acquire a second similarity between the annotation information and the first scene information, and determine the second similarity as the first similarity; The acquisition unit is further used for: Identifying an overlap dimension between a labeling dimension of the labeling information and a scene dimension of the first scene information; Obtaining target labeling information and target first scene information under the overlapping dimension; A third similarity between the target annotation information and the target first scene information is obtained, and the third similarity is determined as the second similarity.

8. The device according to claim 7, characterized in that The device further comprises: a collection module, wherein the collection module is used to: Obtain at least one preset scene dimension; The scene information is collected according to each of the scene dimensions, and the scene information under each of the scene dimensions is generated.

9. The device according to claim 8, characterized in that The device further comprises: a marking module, wherein the marking module is used to: Obtain at least one preset annotation dimension; Annotate the sample text according to each annotation dimension to generate the annotation information under each annotation dimension; Each of the annotation information is stored in the sample text library.

10. The device according to claim 7, characterized in that The acquisition unit is further used for: Obtaining a fourth similarity between the target annotation information and the target first scene information under any of the overlapping dimensions; The third similarity is obtained based on the fourth similarity corresponding to each of the overlapping dimensions.

11. The device according to claim 9, characterized in that The annotation module is also used for: Obtaining the storage location of each of the annotation information in the sample text library; Each of the marking information is stored in the corresponding storage location.

12. The device according to claim 7, characterized in that The device further comprises: a training module, wherein the training module is used to: The text processing model is trained according to the target sample text.

13. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the sample text generation method according to any one of claims 1 to 6 is implemented.

14. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the sample text generation method as described in any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

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

    CN112036164A

  • Information pushing method and device

    CN112380331A