CN116894489B - Text generation method, electronic equipment and storage medium - Google Patents
Text generation method, electronic equipment and storage medium Download PDFInfo
- Publication number
- CN116894489B CN116894489B CN202311155179.3A CN202311155179A CN116894489B CN 116894489 B CN116894489 B CN 116894489B CN 202311155179 A CN202311155179 A CN 202311155179A CN 116894489 B CN116894489 B CN 116894489B
- Authority
- CN
- China
- Prior art keywords
- text
- preset
- similarity
- list
- entity
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 43
- 238000000605 extraction Methods 0.000 claims abstract description 21
- 230000003247 decreasing effect Effects 0.000 claims description 3
- 238000005516 engineering process Methods 0.000 description 2
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004590 computer program Methods 0.000 description 1
- 239000000284 extract Substances 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000003058 natural language processing Methods 0.000 description 1
- 230000001737 promoting effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N5/00—Computing arrangements using knowledge-based models
- G06N5/02—Knowledge representation; Symbolic representation
- G06N5/022—Knowledge engineering; Knowledge acquisition
- G06N5/025—Extracting rules from data
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F18/00—Pattern recognition
- G06F18/20—Analysing
- G06F18/22—Matching criteria, e.g. proximity measures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0475—Generative networks
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Abstract
The invention provides a text generation method, electronic equipment and a storage medium, and relates to the technical field of text generation, wherein the method is used for generating a text which has an entity relationship and is similar to a preset text based on ChatGPT, and comprises the following steps: acquiring a preset text list, sending a first control instruction to the ChatGPT, acquiring n pieces of new text data generated by the ChatGPT, marking the n pieces of new text data as target texts, generating similarity command texts based on the similarity between the acquired target texts and the preset text list, acquiring the entity relation quantity of the target texts by using a relation extraction model, and if the entity relation quantity does not meet the entity relation quantity threshold condition, generating the entity relation quantity command texts, thereby generating an acquisition second control instruction, inputting the second control instruction into the ChatGPT, and acquiring a first final text list.
Description
Technical Field
The present invention relates to the field of text generation technologies, and in particular, to a text generation method, an electronic device, and a storage medium.
Background
The ChatGPT full name Chat Generative Pre-trained Transformer is a large language surface model, is a natural language processing tool driven by artificial intelligence technology, can generate answers, can perform tasks such as interaction according to chat context, and plays a role in promoting a plurality of fields. In the entity relation extraction, a great number of sentences containing entity relations are required to be used for relation extraction, and how to acquire the great number of sentences containing the entity relations is important.
Disclosure of Invention
Aiming at the technical problems, the invention adopts the following technical scheme: a text generation method for generating a text having an entity relationship and similar to a preset text based on ChatGPT, the method comprising the steps of:
s100, acquiring a preset text list A= { A 1 ,A 2 ,…,A i ,…,A m },A i The method is an ith preset text, the value range of i is 1 to m, m is the number of the preset texts, and any two preset texts are different.
S200, a first control instruction is sent to the ChatGPT, wherein the first control instruction at least comprises a generated command text and a preset text list A, the generated command text is = "referring to the preset text list A, n pieces of new text data are generated", and n is larger than or equal to a first preset numerical value.
S300, acquiring n pieces of new text data generated by ChatGPT, and marking the n pieces of new text data as target texts, thereby acquiring a target text list B= { B 1 ,B 2 ,…,B j ,…,B n },B j Is the jth item label text, and the value range of j is 1 to n.
S400, pair B j Acquisition of B j Similarity R with preset text list A j Obtain R= (1/n) Σ n j=1 R j If R ∉ [ R 1 ,R 2 ]Obtaining a similarity command text, wherein the similarity command text is as follows: the similarity of the target text list B is R, and the similarity of the generated text and the preset text list A is increased/decreased this time; r is R 1 R is the minimum similarity threshold 2 Is the maximum similarity threshold.
S500Target text B using a relational extraction model j Extracting to obtain B j Number of entity relationships C in j Thereby obtaining c= Σ n j=1 C j The method comprises the steps of carrying out a first treatment on the surface of the If C ∉ [ D 1 ,D 2 ]Generating an entity relation quantity command text, wherein the entity relation quantity command text is C, and the total number of entity relations epsilon [ D ] in the text generated by this time of please control 1 ,D 2 ]”;D 1 Is the minimum entity relationship number threshold, D 2 Is the maximum entity relationship number threshold.
S600, acquiring a second control instruction, wherein the second control instruction at least comprises a generation command text, a similarity command text, an entity relation quantity command text and a preset text list A, and inputting the second control instruction into the ChatGPT to acquire a first final text list.
A non-transitory computer readable storage medium having at least one instruction or at least one program stored therein, wherein the at least one instruction or the at least one program is loaded and executed by a processor to implement a text generation method as described above.
An electronic device comprising a processor and the aforementioned non-transitory computer-readable storage medium.
The invention has at least the following beneficial effects:
in summary, a preset text list is obtained, a first control instruction is sent to the ChatGPT, n pieces of new text data generated by the ChatGPT are obtained, the n pieces of new text data are marked as target texts, so that the target text list is obtained, the similarity between the target text and the preset text list is obtained, if the similarity does not meet a similarity threshold condition, a similarity command text is generated, a relation extraction model is used for extracting the target text, the number of entity relations of the target text is obtained, if the number of entity relations does not meet the entity relation threshold condition, a number of entity relation command texts are generated, a second control instruction is obtained, a second control instruction is input to the ChatGPT based on the generated command text, the similarity command text, the number of entity relation command text and the preset text list, the first final text output by the ChatGPT is obtained through the method, the first final text output by the ChatGPT has a certain similarity and the preset text and is not completely the same, the first final text contains a certain number of entity relations, a large amount of text is provided for tasks such as entity extraction of the subsequent first final text, and the entity extraction data can be rapidly generated for the entity extraction of the sample data.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a text generation method according to an embodiment of the present invention.
Detailed Description
The following description of the embodiments of the present invention will be made clearly and completely with reference to the accompanying drawings, in which it is apparent that the embodiments described are only some embodiments of the present invention, but not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to fall within the scope of the invention.
The embodiment of the invention provides a text generation method, which is used for generating a text which has an entity relationship and is similar to a preset text based on ChatGPT, as shown in figure 1, and comprises the following steps:
s100, acquiring a preset text list A= { A 1 ,A 2 ,…,A i ,…,A m },A i The method is an ith preset text, the value range of i is 1 to m, m is the number of the preset texts, and any two preset texts are different.
S200, a first control instruction is sent to the ChatGPT, wherein the first control instruction at least comprises a generated command text and a preset text list A, the generated command text= "please refer to the preset text list A, n pieces of new text data" are generated, and n is larger than or equal to a first preset numerical value.
Specifically, the first preset value may be determined according to actual requirements, which may be understood as: and determining a first preset value according to the number of the ChatGPT which can be generated and the calling times of the ChatGPT which are reduced as much as possible.
Optionally, n is more than 1 and less than 100; preferably, n=10.
In one embodiment of the present invention, the preset text list a= { a 1 ,A 2 },A 1 : reddish is the father of reddish blue, A 2 : the first control instruction is "please refer to the preset text list a, n pieces of new text data are generated, a= { reddish is father of reddish blue, and the first control instruction is" the same student relationship }).
S300, acquiring n pieces of new text data generated by ChatGPT, and marking the n pieces of new text data as target texts, thereby acquiring a target text list B= { B 1 ,B 2 ,…,B j ,…,B n },B j Is the jth item label text, and the value range of j is 1 to n.
S400, pair B j Acquisition of B j Similarity R with preset text list A j Obtain R= (1/n) Σ n j=1 R j If R ∉ [ R 1 ,R 2 ]Obtaining a similarity command text, wherein the similarity command text is as follows: the similarity of the target text list B is R, and the similarity of the generated text and the preset text list A is increased/decreased this time; r is R 1 R is the minimum similarity threshold 2 Is the maximum similarity threshold.
Preferably, R 1 =0.2;R 2 =0.5。
Specifically, if R ∉ [ R 1 ,R 2 ]Obtaining the similarity command text comprises the following steps:
s410, if R > R 2 The similarity command text is as follows: the similarity of the target text list B is R, and the generated text and the preset text are reduced at this timeSimilarity of text list a.
S420, if R < R 1 The similarity command text is as follows: the similarity of the target text list B is R, and the similarity of the generated text and the preset text list A is increased.
In one exemplary illustration of the present invention, the similarity r=0.6 > R of the target text list B and the preset text list a 2 At this time, the similarity command text is "the similarity of the target text list B is 0.6, and the generated text is reduced from the preset text list a.
In another exemplary illustration of the present invention, the similarity r=0.1 < R of the target text list B and the preset text list a 1 =0.2, at this time, the similarity command text is: the similarity of the target text list B is 0.2, and the similarity of the generated text and the preset text list A is increased.
In summary, the objective of the present invention is to obtain a text with an entity relationship, so that the target text output by ChatGPT is not identical to or different from the preset text, and therefore, the similarity is set between 0.2 and 0.5, so that the output target text has a certain similarity to or is not identical to the preset text.
S500, using a relation extraction model to extract the target text B j Extracting to obtain B j Number of entity relationships C in j Thereby obtaining c= Σ n j=1 C j The method comprises the steps of carrying out a first treatment on the surface of the If C ∉ [ D 1 ,D 2 ]Generating an entity relation quantity command text, wherein the entity relation quantity command text is C, and the total number of entity relations epsilon [ D ] in the text generated by this time of please control 1 ,D 2 ]”;D 1 Is the minimum entity relationship number threshold, D 2 Is the maximum entity relationship number threshold.
Specifically, those skilled in the art know that any relation extraction model for extracting the target text in the prior art belongs to the protection scope of the present invention, and is not described herein.
Specifically, what isThe number of entity relations is the number of entity relations, the entity relations in the invention are relations among entities, the entity relations and the entity relations form triples, and the number of the entity relations refers to the number of the formed triples. In one exemplary illustration of the invention, target text B j For Xiaohong graduation at Beijing university, the relation extraction model is used for extraction to obtain an entity: reddish; entity: university of Beijing; entity relationship: graduation; target text B j The number of entity relationships in the system is 1, if 1 is less than D 1 At this time, the entity relationship quantity command text is "the entity relationship quantity in the target text list B is 1, and the total number of entity relationships in the text generated by this time of request control is epsilon [2,5]]”。
Specifically, D 1 =2;D 2 =5。
S600, acquiring a second control instruction, wherein the second control instruction at least comprises a generation command text, a similarity command text, an entity relation quantity command text and a preset text list A, and inputting the second control instruction into the ChatGPT to acquire a first final text list.
In an exemplary illustration of the present invention, the first control instruction is "please refer to a preset text list a, n pieces of new text data are generated, a= { reddish is a father of reddish blue, heaven and happy are classmates relationship }", the similarity command text is "similarity of the target text list B is 0.6, the similarity of the generated text and the preset text list a is reduced this time", the number of entity relationship command texts is "number of entity relationships in the target text list B is 1, and the total number of entity relationships in the generated text is controlled this time e [2,5]"; therefore, the second control instruction is "please refer to the preset text list a, 10 new text data are generated, the similarity of the target text list B is 0.6, the similarity of the generated text and the preset text list a is reduced this time, the number of entity relations in the target text list B is 1, the total number of entity relations e [2,5] in the generated text is controlled this time, a= { reddish is the father of reddish, and the heaven and happy are the classmates }).
In summary, a preset text list is obtained, a first control instruction is sent to the ChatGPT, n pieces of new text data generated by the ChatGPT are obtained, the n pieces of new text data are marked as target texts, so that the target text list is obtained, the similarity between the target text and the preset text list is obtained, if the similarity does not meet a similarity threshold condition, a similarity command text is generated, a relation extraction model is used for extracting the target text, the number of entity relations of the target text is obtained, if the number of entity relations does not meet the entity relation threshold condition, a number of entity relation command texts are generated, a second control instruction is obtained, a second control instruction is input to the ChatGPT based on the generated command text, the similarity command text, the number of entity relation command text and the preset text list, the first final text output by the ChatGPT is obtained through the method, the first final text output by the ChatGPT has a certain similarity and the preset text and is not completely the same, the first final text contains a certain number of entity relations, a large amount of text is provided for tasks such as entity extraction of the subsequent first final text, and the entity extraction data can be rapidly generated for the entity extraction of the sample data.
Furthermore, the invention puts the entity relation quantity command text and the similarity command text in the second control instruction to enable the ChatGPT to generate the text meeting the two requirements at the same time, thereby reducing the calling times of the ChatGPT and saving the resources.
Specifically, for B j Acquisition of B j The similarity with the preset text list A comprises the following steps:
s401, obtain B j ={B j,1 ,B j,2 ,…,B j,g ,…,B j,z(j) },B j,g Is the g preset characters in the j target text, the value range of g is 1 to z (j), and z (j) is the number of the preset characters in the j target text, wherein the preset characters comprise Chinese characters and English characters.
In one exemplary illustration of the invention, target text B 1 "Xiaohong graduation at Beijing university". "Pich" is the 3 rd character in the target text, target text B 1 Is 9.
S402, obtaining A i ={A i,1 ,A i,2 ,…,A i,r ,…,A i,s(i) },A i,r Is the r preset character in the i preset text, the value range of r is 1 to s (i), and s (i) is the number of preset characters in the i preset text.
In one exemplary illustration of the present invention, text A is preset 1 Is "reddish is the father of bluish". "" blue "is preset text A 1 The 5 th character of the text A is preset 1 The number of characters of (2) is 8.
S403, calculating A i And B j Recall ratio U of (2) j =max{U j1 ,U j2 ,…,U ji ,…,U jm },U ji =LCS(A i ,B j )/s(i),LCS(A i ,B j ) Is A i And B j The number of characters contained in the longest common subsequence of (a).
Specifically, the recall rate of the target text and all preset texts is calculated to be the maximum value, and the maximum value is taken as the recall rate of the target text. The LCS (A) i ,B j ) Is A i And B j The number of characters of the longest common subsequence of (a) is not necessarily consecutive, and the longest common subsequence has a word order.
In one exemplary illustration of the invention, the LCS (A i ,B j )=1。
S404, calculate A i And B j Accuracy P of (2) j =max{P j1 ,P j2 ,…,P ji ,…,P jm },P ji =LCS(A i ,B j )/z(j)。
Specifically, the maximum value of the accuracy rates of the target text and all the preset texts is calculated as the accuracy rate of the target text.
S405, obtaining B j Similarity to the preset text list ABeta is a preset parameter value.
Based on S401-S405, the similarity between the target text and the preset text is calculated by a Rouge-L method, the Rouge-L uses the longest public subsequence, the Rouge-L does not require continuity, the sequence of the words is concerned, and the method is suitable for the purpose of generating similar but different target sentences through preset sentences.
In another embodiment of the present invention, S400-S600 are replaced with the following steps:
s001, pair B j Acquisition of B j Similarity R with preset text list A j Obtain R= (1/n) Σ n j=1 R j If R is E [ R 1 ,R 2 ]S002 is performed; otherwise, the first control instruction is made to be: the command text, the preset text list a, and the similarity command text are generated, and S200 is performed.
Specifically, it can be understood that: s001 enables the ChatGPT generation similarity to belong to [ R ] through a first control instruction 1 ,R 2 ]Is a target text list of (1).
S002, using the relation extraction model to extract the target text B j Extracting to obtain B j Number of entity relationships E in j Thereby obtaining E= Σ n j=1 E j 。
S003, if E [ D ] 1 ,D 2 ]Taking the target text list B as a second final text list D 1 Is the minimum entity relationship number threshold, D 2 Is the maximum entity relationship number threshold.
S004, if E ∉ [ D 1 ,D 2 ]Generating an entity relation quantity command text, acquiring a third control instruction, inputting the third control instruction into the ChatGPT, and acquiring a second final text list, wherein the third control instruction at least comprises a generated command text, a preset text list A and an entity relation quantity command text, the entity relation quantity command text is' the entity relation quantity in a target text list B is C, and the total number of entity relations E [ D ] in the text generated by the current request control 1 ,D 2 ]”。
Based on S001-S004, the method enables the ChatGPT to generate the target text list meeting the similarity requirement by changing the first control instruction, and then extracts the entity relationship, so that compared with the method for directly extracting after calculating the similarity, the method can further ensure the similarity of the target text, and the third control instruction reduces the similarity command statement, so that the situation that the ChatGPT does not understand the overlong command statement and generates two half-sentence combinations is avoided.
In another embodiment of the present invention, S300 is followed by the following steps performed in parallel with S400-S600:
s001, pair B j Acquisition of B j Similarity R with preset text list A j Obtain R= (1/n) Σ n j=1 R j If R is E [ R 1 ,R 2 ]S002 is performed; otherwise, the first control instruction is made to be: the command text, the preset text list a, and the similarity command text are generated, and S200 is performed.
S002, using the relation extraction model to extract the target text B j Extracting to obtain B j Number of entity relationships E in j Thereby obtaining E= Σ n j=1 E j 。
S003, if E [ D ] 1 ,D 2 ]Taking the target text list B as a second final text list D 1 Is the minimum entity relationship number threshold, D 2 Is the maximum entity relationship number threshold.
S004, if E ∉ [ D 1 ,D 2 ]Generating an entity relation quantity command text, acquiring a third control instruction, inputting the third control instruction into the ChatGPT, and acquiring a second final text list, wherein the third control instruction at least comprises a generated command text, a preset text list A and an entity relation quantity command text, the entity relation quantity command text is' the entity relation quantity in a target text list B is C, and the total number of entity relations E [ D ] in the text generated by the current request control 1 ,D 2 ]”。
Still further, still include:
s010, acquiring the number of entity relations contained in each first final text in the first final text list, and accordingly acquiring the sum of the number of the first entity relations.
S020, obtaining the number of entity relations contained in each second final text in the second final text list, thereby obtaining the sum of the number of the second entity relations.
S030, if the sum of the first entity relation numbers is greater than the sum of the second entity relation numbers, determining the first final text list as a text list to be used; otherwise, the second final text list is determined as the text list to be used.
In summary, the method for generating the text uses a text generation method to obtain a first final text list, uses a second final text acquisition method to obtain a second final text list, is equivalent to the use of two methods to acquire the final text list, determines to use the first final text list or the second final text list finally by comparing the entity relation quantity contained in the first final text and the second final text, and uses the method corresponding to the text list to be used at the time of generating the text which has the entity relation and is similar to the preset text later, thereby better generating the text which has the entity relation and is similar to the preset text.
Embodiments of the present invention also provide a non-transitory computer readable storage medium that may be disposed in an electronic device to store at least one instruction or at least one program for implementing one of the methods embodiments, the at least one instruction or the at least one program being loaded and executed by the processor to implement the methods provided by the embodiments described above.
Embodiments of the present invention also provide an electronic device comprising a processor and the aforementioned non-transitory computer-readable storage medium.
Embodiments of the present invention also provide a computer program product comprising program code for causing an electronic device to carry out the steps of the method according to the various pre-set embodiments of the invention as described in the present specification when said program product is run on the electronic device.
Although specific embodiments of the invention have been described in detail through presets, it should be understood by those skilled in the art that the above presets are for purposes of illustration only and are not intended to limit the scope of the invention. Those skilled in the art will also appreciate that many modifications may be made to the embodiments without departing from the scope and spirit of the invention. The scope of the invention is defined by the appended claims.
Claims (10)
1. A text generation method for generating text having an entity relationship and similar to a preset text based on ChatGPT, the method comprising the steps of:
s100, acquiring a preset text list A= { A 1 ,A 2 ,…,A i ,…,A m },A i The method comprises the steps that i is the ith preset text, the value range of i is 1 to m, m is the number of the preset texts, and any two preset texts are different;
s200, a first control instruction is sent to the ChatGPT, wherein the first control instruction at least comprises a generated command text and a preset text list A, the generated command text is = "referring to the preset text list A, n pieces of new text data are generated", and n is greater than or equal to a first preset numerical value;
s300, acquiring n pieces of new text data generated by ChatGPT, and marking the n pieces of new text data as target texts, thereby acquiring a target text list B= { B 1 ,B 2 ,…,B j ,…,B n },B j Is the label text of the j-th item, and the value range of j is 1 to n;
s400, pair B j Acquisition of B j Similarity R with preset text list A j Obtain R= (1/n) Σ n j=1 R j If R ∉ [ R 1 ,R 2 ]Obtaining a similarity command text, wherein the similarity command text is as follows: the similarity of the target text list B is R, and the similarity of the generated text and the preset text list A is increased/decreased this time; r is R 1 R is the minimum similarity threshold 2 Is the maximum similarity threshold;
s500, using a relation extraction model to extract the target text B j Extracting to obtain B j Number of entity relationships C in j Thereby obtaining c= Σ n j=1 C j The method comprises the steps of carrying out a first treatment on the surface of the If C ∉ [ D 1 ,D 2 ]Generating entity relationship quantity commandsThe text is the entity relation quantity command text which is C, the total number of entity relations E [ D ] in the text generated by this time of please control 1 ,D 2 ]”;D 1 Is the minimum entity relationship number threshold, D 2 Is a maximum entity relationship number threshold;
s600, acquiring a second control instruction, wherein the second control instruction at least comprises a generation command text, a similarity command text, an entity relation quantity command text and a preset text list A, and inputting the second control instruction into the ChatGPT to acquire a first final text list.
2. The text generation method according to claim 1, wherein for B j Acquisition of B j The similarity with the preset text list A comprises the following steps:
s401, obtain B j ={B j,1 ,B j,2 ,…,B j,g ,…,B j,z(j) },B j,g The method comprises the steps that the method is the g preset characters in the j target text, the value range of g is 1 to z (j), and z (j) is the number of the preset characters in the j target text, wherein the preset characters comprise Chinese characters and English characters;
s402, obtaining A i ={A i,1 ,A i,2 ,…,A i,r ,…,A i,s(i) },A i,r The value range of r is 1 to s (i), and s (i) is the number of preset characters in the ith preset text;
s403, calculating A i And B j Recall ratio U of (2) j =max{U j1 ,U j2 ,…,U ji ,…,U jm },U ji =LCS(A i ,B j )/s(i),LCS(A i ,B j ) Is A i And B j The number of characters contained in the longest common subsequence of (a);
s404, calculate A i And B j Accuracy P of (2) j =max{P j1 ,P j2 ,…,P ji ,…,P jm },P ji =LCS(A i ,B j )/z(j);
S405, obtaining B j Similarity to the preset text list ABeta is a preset parameter value.
3. The text generation method according to claim 1, wherein in S400, if R ∉ [ R 1 ,R 2 ]Obtaining the similarity command text comprises the following steps:
s410, if R > R 2 The similarity command text is as follows: the similarity of the target text list B is R, and the similarity of the generated text and the preset text list A is reduced;
s420, if R < R 1 The similarity command text is as follows: the similarity of the target text list B is R, and the similarity of the generated text and the preset text list A is increased.
4. A text generation method according to claim 3, characterized in that S400-S600 are replaced by the steps of:
s001, pair B j Acquisition of B j Similarity R with preset text list A j Obtain R= (1/n) Σ n j=1 R j If R is E [ R 1 ,R 2 ]S002 is performed; otherwise, the first control instruction is made to be: generating a command text, a preset text list A and a similarity command text, and executing S200;
s002, using the relation extraction model to extract the target text B j Extracting to obtain B j Number of entity relationships E in j Thereby obtaining E= Σ n j=1 E j ;
S003, if E [ D ] 1 ,D 2 ]Taking the target text list B as a second final text list D 1 Is the minimum entity relationship number threshold, D 2 Is a maximum entity relationship number threshold;
S004,if E ∉ [ D 1 ,D 2 ]Generating an entity relation quantity command text, acquiring a third control instruction, inputting the third control instruction into the ChatGPT, and acquiring a second final text list, wherein the third control instruction at least comprises a generated command text, a preset text list A and an entity relation quantity command text, the entity relation quantity command text is' the entity relation quantity in a target text list B is C, and the total number of entity relations E [ D ] in the text generated by the current request control 1 ,D 2 ]”。
5. A text generation method according to claim 3, characterized in that after S300 further comprises the following steps performed in parallel with S400-S600:
s001, pair B j Acquisition of B j Similarity R with preset text list A j Obtain R= (1/n) Σ n j=1 R j If R is E [ R 1 ,R 2 ]S002 is performed; otherwise, the first control instruction is made to be: generating a command text, a preset text list A and a similarity command text, and executing S200;
s002, using the relation extraction model to extract the target text B j Extracting to obtain B j Number of entity relationships E in j Thereby obtaining E= Σ n j=1 E j ;
S003, if E [ D ] 1 ,D 2 ]Taking the target text list B as a second final text list D 1 Is the minimum entity relationship number threshold, D 2 Is a maximum entity relationship number threshold;
s004, if E ∉ [ D 1 ,D 2 ]Generating an entity relation quantity command text, acquiring a third control instruction, inputting the third control instruction into the ChatGPT, and acquiring a second final text list, wherein the third control instruction at least comprises a generated command text, a preset text list A and an entity relation quantity command text, the entity relation quantity command text is' the entity relation quantity in a target text list B is C, and the total number of entity relations E [ D ] in the text generated by the current request control 1 ,D 2 ]”。
6. The text generation method according to claim 1, wherein R 1 =0.2;R 2 =0.5。
7. The text generation method according to claim 1, wherein D 1 =2;D 2 =5。
8. The text generation method according to claim 1, wherein n=10.
9. A non-transitory computer readable storage medium having at least one instruction or at least one program stored therein, wherein the at least one instruction or the at least one program is loaded and executed by a processor to implement the text generation method of any of claims 1-8.
10. An electronic device comprising a processor and the non-transitory computer readable storage medium of claim 9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311155179.3A CN116894489B (en) | 2023-09-08 | 2023-09-08 | Text generation method, electronic equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311155179.3A CN116894489B (en) | 2023-09-08 | 2023-09-08 | Text generation method, electronic equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116894489A CN116894489A (en) | 2023-10-17 |
CN116894489B true CN116894489B (en) | 2023-11-17 |
Family
ID=88315195
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311155179.3A Active CN116894489B (en) | 2023-09-08 | 2023-09-08 | Text generation method, electronic equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116894489B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111241838A (en) * | 2020-01-15 | 2020-06-05 | 北京百度网讯科技有限公司 | Text entity semantic relation processing method, device and equipment |
CN111259671A (en) * | 2020-01-15 | 2020-06-09 | 北京百度网讯科技有限公司 | Semantic description processing method, device and equipment for text entity |
CN114398952A (en) * | 2021-12-14 | 2022-04-26 | 北京百度网讯科技有限公司 | Training text generation method and device, electronic equipment and storage medium |
CN116432705A (en) * | 2023-03-20 | 2023-07-14 | 华润数字科技有限公司 | Text generation model construction method, text generation device, equipment and medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20230214583A1 (en) * | 2019-01-08 | 2023-07-06 | Paperless Parts, Inc. | Systems and methods for generating textual instructions for manufacturers from hybrid textual and image data |
-
2023
- 2023-09-08 CN CN202311155179.3A patent/CN116894489B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111241838A (en) * | 2020-01-15 | 2020-06-05 | 北京百度网讯科技有限公司 | Text entity semantic relation processing method, device and equipment |
CN111259671A (en) * | 2020-01-15 | 2020-06-09 | 北京百度网讯科技有限公司 | Semantic description processing method, device and equipment for text entity |
CN114398952A (en) * | 2021-12-14 | 2022-04-26 | 北京百度网讯科技有限公司 | Training text generation method and device, electronic equipment and storage medium |
CN116432705A (en) * | 2023-03-20 | 2023-07-14 | 华润数字科技有限公司 | Text generation model construction method, text generation device, equipment and medium |
Also Published As
Publication number | Publication date |
---|---|
CN116894489A (en) | 2023-10-17 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109871532B (en) | Text theme extraction method and device and storage medium | |
CN110457675B (en) | Predictive model training method and device, storage medium and computer equipment | |
CN108920445B (en) | Named entity identification method and device based on Bi-LSTM-CRF model | |
CN107193807B (en) | Artificial intelligence-based language conversion processing method and device and terminal | |
CN111222305A (en) | Information structuring method and device | |
CN107273356A (en) | Segmenting method, device, server and storage medium based on artificial intelligence | |
CN112699686B (en) | Semantic understanding method, device, equipment and medium based on task type dialogue system | |
CN110321426B (en) | Digest extraction method and device and computer equipment | |
CN110895559A (en) | Model training method, text processing method, device and equipment | |
CN111143571B (en) | Entity labeling model training method, entity labeling method and device | |
CN112667796B (en) | Dialogue reply method and device, electronic equipment and readable storage medium | |
CN110347802A (en) | A kind of text analyzing method and device | |
CN112328735A (en) | Hot topic determination method and device and terminal equipment | |
CN107797981B (en) | Target text recognition method and device | |
CN114722833A (en) | Semantic classification method and device | |
CN116955578B (en) | Information processing method, device, equipment and medium of pre-training language model | |
CN116894489B (en) | Text generation method, electronic equipment and storage medium | |
CN110609895B (en) | Sample automatic generation method for actively selecting examples to conduct efficient text classification | |
CN116483979A (en) | Dialog model training method, device, equipment and medium based on artificial intelligence | |
CN111597336A (en) | Processing method and device of training text, electronic equipment and readable storage medium | |
CN111368532A (en) | Topic word embedding disambiguation method and system based on LDA | |
CN115600595A (en) | Entity relationship extraction method, system, equipment and readable storage medium | |
CN111401069A (en) | Intention recognition method and intention recognition device for conversation text and terminal | |
CN113886530A (en) | Semantic phrase extraction method and related device | |
CN114141235A (en) | Voice corpus generation method and device, computer equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |