Training method of text generation model, text generation method and device

By presetting the Chinese language model to extract candidate selling points from the target text and constructing a selling point candidate set, the text generation model is trained, which solves the problem of poor extraction results caused by the large amount of training corpus in the existing technology, and achieves efficient selling point phrase extraction. .

CN113240485BActive Publication Date: 2024-09-20BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 10 Cites 0 Cited by

Patent Information

Application Number
CN202110506426.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-10
Publication Date
2024-09-20
Estimated Expiration
2041-05-10

AI Technical Summary

Technical Problem

Existing text generation models require a large amount of training corpus during training, making it difficult for the model to extract new key phrases and the extraction effect is poor.

Method used

The candidate selling points are extracted from the target text through the preset Chinese language model, a selling point candidate set is constructed, and the preset text generation model is trained using the selling point candidate set and the target selling point phrases to reduce the difficulty of obtaining training corpus.

Benefits of technology

It achieves better output effects, avoids using a large amount of training data, improves the accurate extraction of selling point phrases, and reduces manual extraction costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113240485B
    Figure CN113240485B
Patent Text Reader

Abstract

The present application provides a training method, a text generation method and a device for a text generation model, wherein the training method includes: extracting candidate selling points from a target text according to a preset Chinese language model, constructing a selling point candidate set according to the candidate selling points, selecting a target selling point phrase from the target text, and training the preset text generation model according to the selling point candidate set and the target selling point phrase. In this technical solution, by pre-extracting phrases from the target text using a preset Chinese language model to obtain a candidate selling point candidate set, and forming a training data pair with the target selling point phrase, the preset text generation model is trained, and a large amount of training data is not required, and the trained preset text generation model will not have hallucinations and has a good output effect.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of machine learning technology, and in particular to a training method for a text generation model, a text generation method and a device. Background Art

[0002] Usually, users can browse item information through the display interface of the terminal device. In order to facilitate users to quickly understand the items, some key phrases describing the features or core attributes of the items, such as selling points, are extracted from the detailed introduction text of the items and displayed on the display interface. Users can quickly understand the items by browsing the key phrases.

[0003] In the prior art, the automatic extraction method of key phrases mainly uses a large amount of key phrases as training corpus to train the model, and then inputs a long article introduction text into the trained model to complete automatic extraction through the model to obtain the key phrases.

[0004] However, the model used in the prior art requires a massive amount of training corpus to enable the model to have good performance during model training, and the training corpus is obtained from an existing knowledge database, making it difficult for the trained model to extract new key phrases, resulting in poor key phrase extraction effect of the trained model. Summary of the invention

[0005] The present application provides a text generation model training method, a text generation method and a device, which are used to solve the problem of poor output effect of existing text generation models.

[0006] In a first aspect, an embodiment of the present application provides a method for training a text generation model, comprising:

[0007] Extracting candidate selling points from the target text according to a preset Chinese language model, wherein the preset Chinese language model is trained using preset selling point knowledge base data, and the candidate selling points are used to describe the first feature of the item;

[0008] Constructing a selling point candidate set based on the candidate selling points;

[0009] Selecting a target selling point phrase from the target text;

[0010] A preset text generation model is trained according to the selling point candidate set and the target selling point phrase.

[0011] In a possible design of the first aspect, extracting candidate selling points from the target text according to a preset Chinese language model includes:

[0012] Segmenting the target text to obtain candidate phrases;

[0013] Using the preset Chinese language model, scoring the candidate phrase to obtain a score for the candidate phrase;

[0014] According to the score of the candidate phrase and a preset score threshold, a candidate selling point is obtained from the candidate phrase.

[0015] In another possible design of the first aspect, using the preset Chinese language model to score the candidate phrase to obtain the score of the candidate phrase includes:

[0016] Constructing unigram, bigram and trigram segmentations of the candidate phrase;

[0017] Using the preset Chinese language model, the scores of the unigram segmentation, the bigram segmentation and the trigram segmentation are calculated;

[0018] The score of the candidate phrase is determined according to the scores of the uni-gram segmentation, the bigram segmentation and the tri-gram segmentation.

[0019] In another possible design of the first aspect, the step of selecting a target selling point phrase from the target text includes:

[0020] Using a preset model to perform text classification on the target text, determining whether a phrase in the target text contains a selling point word, where the selling point word is a word used to describe the characteristics of an item;

[0021] If the phrase contains a selling point word, the phrase is used as the target selling point phrase.

[0022] In another possible design of the first aspect, before extracting candidate selling points from the target text according to the preset Chinese language model, the method further includes:

[0023] Acquire preset selling point knowledge base data, wherein the preset selling point knowledge base data includes selling point words;

[0024] The preset Chinese language model is trained according to the preset selling point knowledge base data.

[0025] In another possible design of the first aspect, the training of the preset Chinese language model according to the preset selling point knowledge base data includes:

[0026] Performing word segmentation, stop word processing and symbol filtering on the preset selling point knowledge base data to obtain training data;

[0027] The preset Chinese language model is trained based on the training data.

[0028] In yet another possible design of the first aspect, constructing a selling point candidate set according to the candidate selling points includes:

[0029] Acquire a marked selling point of the target text, where the marked selling point is used to describe a second feature of the item, and the first feature is different from the second feature;

[0030] A selling point candidate set is constructed based on the marked selling points and the candidate selling points.

[0031] In a second aspect, an embodiment of the present application provides a text generation method, comprising:

[0032] Obtaining a text to be extracted, and extracting a selling point phrase from the text to be extracted using a preset text generation model, wherein the preset text generation model is trained using a selling point candidate set and a target selling point phrase;

[0033] Calculate the similarity between each selling point phrase;

[0034] According to the similarity, each selling point phrase is merged to obtain a target phrase.

[0035] In a possible design of the second aspect, the step of extracting a selling point phrase from the text to be extracted by using the preset text generation model includes:

[0036] Segmenting the text to be extracted to obtain phrases to be extracted;

[0037] Determining whether the phrase to be extracted contains a selling point word, wherein the selling point word is a word used to describe the characteristics of an item;

[0038] If the phrase to be extracted contains a selling point word, extracting a selling point phrase from the phrase to be extracted using the preset text generation model;

[0039] If the phrase to be extracted does not contain a selling point word, the phrase to be extracted is screened out.

[0040] In another possible design of the second aspect, if the phrase to be extracted includes a selling point word, extracting a selling point phrase from the phrase to be extracted using the preset text generation model includes:

[0041] If the phrase to be extracted contains a selling point word, segmenting, stop word processing and symbol filtering are performed on the phrase to be extracted to obtain an input text;

[0042] The input text is input into the preset text generation model, and the preset text generation model is used to extract selling point phrases from the input text.

[0043] In a third aspect, an embodiment of the present application provides a training device for a text generation model, comprising:

[0044] An extraction module, configured to extract candidate selling points from the target text according to a preset Chinese language model, wherein the preset Chinese language model is trained using preset selling point knowledge base data, and the candidate selling points are used to describe the first feature of the item;

[0045] A construction module, used to construct a selling point candidate set based on the candidate selling points;

[0046] A selection module, used for selecting a target selling point phrase from the target text;

[0047] The training module is used to train a preset text generation model according to the selling point candidate set and the target selling point phrase.

[0048] In a fourth aspect, an embodiment of the present application provides a text generation device, including:

[0049] An acquisition module, used to acquire a text to be extracted, and extract a selling point phrase from the text to be extracted using a preset text generation model, wherein the preset text generation model is trained using a selling point candidate set and a target selling point phrase;

[0050] A calculation module, used for calculating the similarity between each selling point phrase;

[0051] The merging module is used to merge the selling point phrases according to the similarity to obtain a target phrase.

[0052] In a fifth aspect, an embodiment of the present application provides a computer device, including a memory and at least one processor;

[0053] The memory stores computer-executable instructions;

[0054] The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method described above.

[0055] In a sixth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed by a processor, they are used to implement the method described above.

[0056] The training method, text generation method and device of the text generation model provided in the embodiments of the present application use a preset Chinese language model to extract phrases from the target text in advance to obtain a selling point candidate set, and use the selling points corresponding to the selling point candidate set and the target selling point phrases containing the selling points in the target text to form training data pairs to train the preset text generation model. It does not require the use of a large amount of training data, and the trained preset text generation model will not have hallucinations and has a good output effect. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] The accompanying drawings herein are incorporated in and constitute a part of the specification, illustrate embodiments consistent with the present application, and together with the description, are used to explain the principles of the present application;

[0058] Figure 1 A schematic diagram of a display interface of a terminal device provided in an embodiment of the present application;

[0059] Figure 2 A flowchart of a first embodiment of a method for training a text generation model provided in an embodiment of the present application;

[0060] Figure 3 A schematic diagram of the network structure of the preset text generation model;

[0061] Figure 4 A flowchart of a second embodiment of a method for training a text generation model provided in an embodiment of the present application;

[0062] Figure 5 A flowchart of a text generation method provided in an embodiment of the present application;

[0063] Figure 6 A schematic diagram of the structure of a training device for a text generation model provided in an embodiment of the present application;

[0064] Figure 7 A schematic diagram of the structure of a text generation device provided in an embodiment of the present application;

[0065] Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of the present application.

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

[0067] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

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

[0069] N-grams:

[0070] The Chinese language model (N-gram) is an algorithm based on a statistical language model, which can score phrases in a data source and obtain the probability value of each phrase in the data source.

[0071] Lasertagger Model:

[0072] The Lasertagger model is a text generation model that can infer a series of editing operations to convert the source text into the target text. The editing operations mainly include deletion operations, retention operations, and addition operations.

[0073] Figure 1 A schematic diagram of a display interface of a terminal device provided in an embodiment of the present application, such as Figure 1 As shown, in a terminal device (taking a mobile phone as an example) having a display interface 10, when a user browses an item on the mobile phone, a picture of the item and the selling point of the item can be displayed on the display interface 10. The selling points of the first item in the display interface 10 are "high-definition screen" and "online business learning", and the second item has no selling point. The selling point is a text description of the item, and due to the limitation of the size of the display interface, the selling point can only be as brief and refined as possible, and must be able to fully express the characteristics or core attributes of the item, so that users can understand the item more intuitively and accurately. On some online trading platforms, by displaying the selling points of the item, the transaction rate of the item can be improved to a certain extent.

[0074] In real life, any different item has a different selling point. Generally, the selling point is provided by the owner of the item or a third party. The selling point needs to be extracted from a long text of the item introduction. If the selling point is extracted manually, it will undoubtedly consume a lot of manpower and time costs. In addition, when there are many types of items, the items need to be classified. For example, items of the same color and different models are divided into two categories, and different selling points are used respectively, while items of the same model and different colors are classified into the same category, and the same selling point can be used. Regarding how to automatically extract the selling point of the item from the long text of the item introduction, the existing technology currently mainly provides the following methods:

[0075] 1. Selling point generation based on N-gram language model mainly involves training N-gram language model for phrase combinations in the existing selling point knowledge base. The trained language model scores phrases from other data sources to obtain the probability value of a phrase becoming a selling point phrase. Low-quality product selling points are filtered out by setting thresholds to obtain candidate phrases for the product. The defect of this method is that since the N-gram language model is trained based on the existing selling point knowledge base, it is difficult to discover new selling point phrases.

[0076] 2. Text generation is performed based on the sequence-to-sequence generation model of the seq2seq series. The seq2seq model uses a multi-layer long short-term memory network (LSTM) to encode the input sequence into an intermediate vector, and uses another deep LSTM to decode the intermediate vector into a target sequence. When training the seq2seq model, a large amount of training data is required, and the inference speed is slow. The inference results are uncontrollable and require a lot of post-processing.

[0077] In summary, there is no good text extraction method in the prior art that can avoid using a large amount of training corpus and enable the trained model to extract a target text of good quality from the source text.

[0078] For the above text, the embodiments of the present application provide a training method, a text generation method and a device for a text generation model, by first using a Chinese language model to perform text extraction on the target text to obtain candidate selling points with higher quality, and then using the candidate selling points to construct a selling point candidate set, and using the selling point candidate set and the target selling point phrases to train a preset lasertagger model. On the one hand, the difficulty of obtaining training corpus can be reduced, and on the other hand, the trained lasertagger model can have a better output effect, realize the accurate extraction of selling point phrases, avoid the use of manual extraction of selling point phrases, improve the extraction effect and avoid labor costs.

[0079] The technical solution of the present application is described in detail below through specific embodiments. It should be noted that the following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments.

[0080] Figure 2 The flowchart of the first embodiment of the training method of the text generation model provided in the embodiment of the present application is shown in FIG. The method can be applied to a processing device such as a computer. Figure 2 As shown, the method may include the following steps:

[0081] S201. Extract candidate selling points from the target text according to a preset Chinese language model.

[0082] The preset Chinese language model may refer to an N-gram language model, which may be trained using a large number of selling point phrases in the preset selling point knowledge base data. The candidate selling point is used to describe the first feature of the item. For example, the first feature may refer to the core attribute of the item or the feature of the item, such as the core attribute of a laptop computer is a "high-definition screen".

[0083] Specifically, the target text includes expert articles and item reviews. Taking the expert article as an example, the expert article can be a long text description used to provide a detailed text introduction to the item. The candidate selling points extracted from the target text through the preset Chinese language model contain relatively few words. Exemplarily, the candidate selling points include between 3-7 words. For example, "online business learning" includes a total of 6 words.

[0084] In this embodiment, the target text is input into a preset Chinese language model. The target text can be divided into several phrases. Each phrase in the target text is scored by the preset Chinese language model, and the probability score of each phrase is output. According to the probability score of each phrase, the phrase whose probability meets the set threshold is selected as a candidate selling point.

[0085] Exemplarily, the number of candidate selling points can be adjusted according to the size of the set threshold. For example, when the set threshold is low, multiple candidate selling points can be obtained, and when the set threshold is high, fewer candidate selling points can be obtained.

[0086] S202: Construct a selling point candidate set based on the candidate selling points.

[0087] In this embodiment, the selling point candidate set includes a plurality of candidate selling points, and the selling point candidate set can be used as target data for training a preset text generation model.

[0088] Exemplarily, the selling point candidate set can also add annotated selling points. When the target text is extracted based on the preset Chinese language model, since the preset Chinese language model is trained based on the existing preset selling point knowledge base data, if the target text includes new selling points, the preset Chinese language model may not be able to extract them. At this time, these new selling points are annotated as annotated selling points and are constructed together with the candidate selling points to obtain a selling point candidate set.

[0089] S203: Select a target selling point phrase from the target text.

[0090] In this embodiment, the selling point candidate set is used as target data, and the target selling point phrase is used as source data to form a training data pair, and the training data pair is used to train the preset text generation model.

[0091] Exemplarily, the fasttext model may be used to perform text classification to determine whether a phrase in the target text contains a selling point word, and if so, select it as the target selling point phrase.

[0092] S204: training a preset text generation model according to the selling point candidate set and the target selling point phrase.

[0093] Specifically, the target selling point phrase is used as input data and input into a preset text generation model, and the selling point candidate set is used as a true value and is used for comparison and verification of the output value of the preset text generation model.

[0094] For example, the target selling point phrase may be "equipped with a powerful internal unit that can heat quickly", and the corresponding candidate selling point in the selling point candidate set may be "powerful and fast heating".

[0095] In this embodiment, the preset text generation model is a lasertagger model. The lasertagger model is a method based on text editing to generate text, converting the generation task into a labeling task, wherein text labeling is a sequence labeling model for deleting, retaining or adding characters. The core idea of ​​the lasertagger model is: labeling the sequence characters in the input source text, assigning a labeling label to each character, and the labeling labels are divided into basic labels, additional labels, and exchange labels. The basic label is used to delete or retain the characters. The additional label refers to inserting a character that does not exist in the source text, such as punctuation or demonstrative pronouns (such as she, he and it), and the exchange label refers to exchanging the order of characters or sentences in the source text.

[0096] For example, Figure 3 This is a schematic diagram of the network structure of the preset text generation model. The Lasertagger model is divided into two parts. One part is the encoder. The encoder uses the BERT-base architecture as the embedding layer 301, including 12 self-attention layers 302 to construct the input latent vector. The other part is the decoder. The decoder uses a single-layer transformer 311 on top of BERT. When predicting the annotation label of the nth character, the embedding of the first n-1 words that have been generated is added.

[0097] The embodiment of the present application uses the N-gram model to extract high-quality candidate selling points from the target text, and then uses the candidate selling points and the target selling point phrases to construct training data pairs to train the preset lasertagger model, which can reduce the difficulty of obtaining training corpus and does not require the use of a large amount of training data. At the same time, the trained lasertagger model is not prone to hallucinations when generating the target text, has a fast prediction speed, has a good output effect, and improves the efficiency of text generation.

[0098] Exemplarily, based on the above embodiment, in some embodiments, the above step S201 can be implemented by the following steps:

[0099] Sentence the target text and obtain candidate phrases;

[0100] Use a preset Chinese language model to score the candidate phrases and obtain the scores of the candidate phrases;

[0101] Obtain candidate selling points from the candidate phrases according to the scores of the candidate phrases and a preset score threshold.

[0102] Specifically, the target text is a long piece of text composed of several sentences. The target text can be segmented into several sentences according to the punctuation marks of each sentence, and then these sentences are edited to finally obtain several candidate phrases.

[0103] Exemplarily, the preset Chinese language model is an N-gram model. Taking "intelligent voice control" as an example of a candidate phrase, the score of "intelligent voice control" is calculated through the following formula:

[0104] P("intelligent voice control") = P(intelligent | <s>)*P(voice|intelligence)*P(control|voice)*P(< / s> | control).

[0105] In the above formula, P("intelligent voice control") represents the score of the candidate phrase "intelligent voice control", and P(intelligent | <s>) represents the total number of all candidate phrases starting with the word "intelligence" / the total number of candidate phrases, P(voice|intelligence) represents the number of times the words "voice" and "intelligence" appear simultaneously in the training corpus / the number of times the word "intelligence" appears, and so on, P(< / s> | control) represents the total number of all candidate phrases / candidate phrases ending with the word "control".

[0106] Optionally, the preset score threshold can be set according to the actual situation. The higher the score of each candidate phrase, the greater the probability that it is a candidate selling point.

[0107] In the embodiment of the present application, by using the N-gram model to score the candidate phrases in the target text, and selecting the candidate selling points with higher scores therefrom as high-quality training data, it is not necessary to use a large amount of training data, reducing the difficulty of obtaining training data.

[0108] Further, on the basis of the above embodiment, in some embodiments, the above "using a preset Chinese language model to score the candidate phrases and obtain the scores of the candidate phrases" can be specifically implemented through the following steps:

[0109] Construct unigram, bigram, and trigram segmentations of the candidate phrases;

[0110] Use a preset Chinese language model to calculate the scores of the unigram, bigram, and trigram segmentations;

[0111] Determine the score of the candidate phrase according to the scores of the unigram, bigram, and trigram segmentations.

[0112] In this embodiment, taking "intelligent voice control" as an example of a candidate phrase, the constructed unigram segmentation is "intelligent, able to speak, voice, voice control, control", the bigram segmentation is "intelligent voice, voice control", and the ternary segmentation is "intelligent voice control". By determining the scores of the unigram segmentation, bigram segmentation and ternary segmentation, the score of the candidate phrase is finally obtained.

[0113] The embodiment of the present application determines the score of a candidate phrase by determining the scores of a unigram segmentation, a bigram segmentation, and a trigram segmentation of the candidate phrase, thereby improving the accuracy of the score of the candidate phrase and obtaining a better quality candidate phrase.

[0114] Figure 4 A flow chart of Embodiment 2 of the training method for the text generation model provided in the embodiment of the present application is shown in FIG. Figure 4 As shown, the method specifically comprises the following steps:

[0115] S401. Extract candidate selling points from the target text according to a preset Chinese language model.

[0116] S402: Construct a selling point candidate set based on the candidate selling points.

[0117] S403: Select a target selling point phrase from the target text.

[0118] S404: Using a preset model to classify the target text, determine whether a phrase in the target text contains a selling point word.

[0119] S405: If the phrase contains a selling point word, the phrase is used as a target selling point phrase.

[0120] S406: Training a preset text generation model according to the selling point candidate set and the target selling point phrase.

[0121] For the above steps S401-S403 and step S406, reference may be made to the explanation of steps S201-S204 in the above embodiment, which will not be elaborated here. This embodiment mainly explains steps S404-S405.

[0122] Among them, selling point words are words used to describe the characteristics of items.

[0123] In this embodiment, when training the preset text generation model, the training data set is used as the given input text. The preset text generation model will directly output the generation result based on the input text, and the generation result is obtained from the input text. If the input text does not include selling point words, the generation result will not include selling point words.

[0124] Exemplarily, a fast text classification model (eg, a fasttext model) may be used to perform binary classification on phrases in the target text to determine whether the phrases contain selling point words.

[0125] The embodiment of the present application identifies phrases in the target text and removes phrases that do not contain selling point words from the training data set, thereby improving the quality of the training data set and the subsequent training effect of the preset text generation model.

[0126] Optionally, based on the above embodiments, in some embodiments, before the above step S201, the following steps may also be included:

[0127] Obtain the preset selling point knowledge base data.

[0128] According to the preset selling point knowledge base data, a preset Chinese language model is trained.

[0129] The preset selling point knowledge base data includes selling point words. Exemplarily, a large number of existing selling point words are stored in the preset selling point knowledge database.

[0130] In this embodiment, the preset Chinese language model is an N-gram language model.

[0131] The embodiment of the present application trains the N-gram model by using the existing preset selling point knowledge base data. Since the training data comes from the existing preset selling point knowledge base data, the difficulty of obtaining the training data can be reduced. There is no need to manually extract selling point words as training data, thereby reducing labor costs.

[0132] Further, based on the above embodiment, in some embodiments, the above step of "training to obtain a preset Chinese language model according to the preset selling point knowledge base data" can be implemented by the following steps:

[0133] Perform word segmentation, stop word processing and symbol filtering on the preset selling point knowledge base data to obtain training data;

[0134] According to the training data, a preset Chinese language model is trained.

[0135] In this embodiment, the selling point knowledge base data is preset as an original database, and the selling point words therein are extracted from the detailed introduction texts of various items.

[0136] Exemplarily, word segmentation refers to dividing a phrase into multiple words. For example, the phrase is "I am a student". After word segmentation, the words obtained are "I", "is", "a", and "student".

[0137] Stop word filtering refers to filtering out some common, widely used, but less meaningful words in the preset selling point knowledge database. Exemplary stop words include modal particles, adverbs, prepositions, conjunctions, etc., such as "in", "of", "and", "is", etc.

[0138] Symbol filtering refers to filtering some punctuation marks (such as commas, periods, etc.) in the preset selling point database.

[0139] The embodiment of the present application performs word segmentation, stop word processing and symbol filtering on the preset selling point knowledge base data, and obtains the processed data as training data to train the N-gram model, which can improve the training effect of the model.

[0140] Exemplarily, based on the above embodiment, in some embodiments, the above step S202 can be implemented by the following steps:

[0141] Get the annotated selling points of the target text.

[0142] According to the marked selling points and candidate selling points, a selling point candidate set is constructed.

[0143] Among them, the marked selling point is used to describe the second feature of the item, and the first feature is different from the second feature.

[0144] In this embodiment, the marked selling point can be a phrase different from the candidate selling point. After the selling point candidate phrases are extracted from the target text using the N-gram model, the target text can be annotated manually to mark some selling points that cannot be extracted by the N-gram model and mark them out as marked selling points.

[0145] The embodiment of the present application uses the annotated selling points and the selling point candidate phrases to jointly construct the selling point candidate phrases, thereby reducing the cost of manually annotating the selling points of the target text and improving the efficiency of obtaining the selling point candidate set.

[0146] Figure 5 The flowchart of the text generation method provided in the embodiment of the present application is as follows. The method can be applied to terminal devices such as computers, such as Figure 5 As shown, the method comprises the following steps:

[0147] S501: Obtain a text to be extracted, and use a preset text generation model to extract selling point phrases from the text to be extracted.

[0148] The preset text generation model is obtained by training using a selling point candidate set and a target selling point phrase.

[0149] In this embodiment, the preset text generation model can be the lasertagger model mentioned above. By inputting the text to be extracted into the model and editing the text to be extracted, multiple selling point phrases are obtained, such as the two selling point phrases of "online business learning" and "high-definition screen".

[0150] For example, taking "the air conditioner can independently dehumidify and drive away humid air, so you don't have to worry about indoor humidity in rainy seasons" as the text to be extracted, the selling point phrase extracted by the trained lasertagger model is "independent dehumidification", and taking "equipped with a powerful indoor unit that can heat quickly" as the text to be extracted, the selling point phrase extracted by the trained lasertagger model is "full power, fast heating".

[0151] For example, taking the English text "Dylan won Nobel prize. Dylan is an American musician." as an input text, the lasertagger model will perform corresponding editing operations on the input text and finally output the text result. The specific editing operation process is shown in the following table:

[0152]

[0153]

[0154] In the table above, Source indicates the input text "Dylan won Nobel prize. Dylan is an American musician.", Tags indicates the label corresponding to each character in the input text, DELETE indicates deleting the character, KEEP indicates retaining the character, and SWAP indicates swapping labels and swapping the order of the characters. Finally, the obtained Realization indicates the output text result "Dylan, an American musician, won Nobel prize".

[0155] S502: Calculate the similarity between each selling point phrase.

[0156] In this embodiment, the similarity calculation formula between selling points can be as follows:

[0157] S=(S1+S2+S3+S4) / 4.

[0158] In the above formula, S represents similarity, S1 represents Levenshtein distance, which refers to the minimum number of editing operations required to convert one string into another. Editing operations include replacing one character with another, inserting a character, and deleting a character. S2 represents Jaro-Winkler distance, S3 represents the longest common substring, and S4 represents edit distance.

[0159] The calculation formula of S1 is as follows:

[0160] S1=(sum-ldist) / sum

[0161] In the above formula, sum is the total length of the two strings a and b, ldist is the edit distance. In the class edit distance, deleting a character, inserting a character, ldist plus 1, and replacing a character with another character, ldist plus 2.

[0162] The calculation formula of S2 is as follows:

[0163]

[0164] S2=d j +lp(1-d j )

[0165] In the above formula, s1 and s2 are the two strings to be compared, m is the matching length of s1 and s2, t is the number of transpositions, d j represents the score, p represents the factor for adjusting the prefix match, and l represents the length of the prefix match.

[0166] The number of transpositions t needs to be determined based on the matching window value. When the distance between two characters is less than the matching window value, the two characters are considered to be matched, but if the positions are different, transposition is required. The matching window calculation formula is as follows:

[0167]

[0168] For example, for a set of character strings AECFR and AMECFDR, MW=2.5, m=5, the matching character string AECFR has an order in the two character strings, so there is no need to perform transposition, t=0.

[0169] S3 can be calculated by the following formula: S3 = L2 / avg (|s1|, |s2|)

[0170] In the above formula, s1 and s2 are two strings that need to be compared, and L2 represents the length of the common substring.

[0171] S4 can be calculated by the following formula: S4 = (sum-ldist) / sum.

[0172] S503: According to the similarity, each selling point phrase is merged to obtain a target phrase.

[0173] Specifically, selling point phrases with high similarity are merged to form a phrase. After merging all selling point phrases with high similarity, a target phrase is finally obtained, that is, a selling point phrase that describes the characteristics of the item.

[0174] The embodiment of the present application generates a target text by using a lasertagger model. The obtained target text comes from the text to be extracted, has strong controllability, and the generated result is not prone to hallucinations. It also has a faster prediction speed, stronger adaptability, and a stronger output effect.

[0175] Exemplarily, based on the above embodiment, in some embodiments, the above step S501 can be implemented by the following steps:

[0176] Sentence the text to be extracted to obtain phrases to be extracted;

[0177] Determine whether the phrase to be extracted contains a selling point word;

[0178] If the phrase to be extracted contains a selling point word, a preset text generation model is used to extract the selling point phrase from the phrase to be extracted;

[0179] If the phrase to be extracted does not contain the selling point word, the phrase to be extracted will be screened out.

[0180] Among them, selling point words are words used to describe the characteristics of an item.

[0181] In this embodiment, the text to be extracted may be divided into sentences according to punctuation marks in the text to be extracted, so as to obtain a number of phrases to be extracted.

[0182] Exemplarily, the fasttext model may be used for text classification to determine whether the phrase to be extracted contains selling point words. If so, the selling point words are directly input into the preset text generation model; otherwise, the selling point words are not input into the preset text generation model.

[0183] The embodiment of the present application can improve the output effect of the preset text generation model by dividing the phrase to be extracted into sentences and determining whether the phrase to be extracted contains the selling point word, thereby avoiding the situation where the generated target text does not contain the selling point word.

[0184] Further, based on the above embodiment, in some embodiments, the above step of "if the phrase to be extracted contains a selling point word, using a preset text generation model to extract a selling point phrase from the phrase to be extracted" can be specifically implemented by the following steps:

[0185] If the phrase to be extracted contains a selling point word, the phrase to be extracted is segmented, stop word processed and symbol filtered to obtain the input text;

[0186] The input text is input into a preset text generation model, and the preset text generation model is used to extract selling point phrases from the input text.

[0187] In this embodiment, word segmentation refers to dividing a phrase into multiple words. For example, if the phrase is "I am a student", after word segmentation, the words obtained are "I", "I am", "a", and "student". Stop word filtering refers to filtering out some manually input and non-automatically generated words in the preset selling point knowledge database. Symbol filtering refers to filtering out some punctuation marks (such as commas, periods, etc.) in the preset selling point database.

[0188] The embodiment of the present application obtains the input text by performing word segmentation, stop word processing and symbol filtering on the phrase to be extracted, so that the preset text generation model can output a better target text and improve the generation quality of the selling point phrase.

[0189] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0190] Figure 6 The structure diagram of the training device of the text generation model provided in the embodiment of the present application is as follows. The device can be integrated into a computer or can be independent of the computer and cooperate with the computer to complete the above method. Figure 6 As shown, the training device 60 of the text generation model includes an extraction module 61, a construction module 62, a selection module 63 and a training module 64.

[0191] The extraction module 61 is used to extract candidate selling points from the target text according to a preset Chinese language model. The construction module 62 is used to construct a selling point candidate set according to the candidate selling points. The selection module 63 is used to select a target selling point phrase from the target text. The training module 64 is used to train a preset text generation model according to the selling point candidate set and the target selling point phrase.

[0192] The preset Chinese language model is trained using preset selling point knowledge base data, and the candidate selling point is used to describe the first feature of the item.

[0193] In some embodiments, the extraction module 61 is specifically used to:

[0194] Sentence the target text and obtain candidate phrases;

[0195] Using a preset Chinese language model, the candidate phrases are scored to obtain scores of the candidate phrases;

[0196] According to the scores of the candidate phrases and a preset score threshold, candidate selling points are obtained from the candidate phrases.

[0197] Optionally, in some embodiments, the extraction module 61 is specifically used to:

[0198] Construct unigram, bigram and trigram segmentations of candidate phrases;

[0199] Using the preset Chinese language model, the scores of unigram, bigram and trigram segmentation are calculated;

[0200] The score of the candidate phrase is determined based on the scores of the uni-gram segmentation, the bigram segmentation, and the tri-gram segmentation.

[0201] In some embodiments, the training device for the text generation model further includes a screening module for:

[0202] Use the preset model to classify the target text and determine whether the phrases in the target text contain selling points.

[0203] If the phrase contains a selling point word, the phrase is used as the target selling point phrase.

[0204] Among them, selling point words are words used to describe the characteristics of items.

[0205] In some embodiments, the text generation model training device 60 further includes: a data acquisition module, which is used to:

[0206] Acquire preset selling point knowledge base data, wherein the preset selling point knowledge base data includes selling point words;

[0207] According to the preset selling point knowledge base data, a preset Chinese language model is trained.

[0208] In some embodiments, the data acquisition module is specifically used to:

[0209] Perform word segmentation, stop word processing and symbol filtering on the preset selling point knowledge base data to obtain training data;

[0210] According to the training data, a preset Chinese language model is trained.

[0211] In some embodiments, the building block 62 is specifically used to:

[0212] Get the annotated selling points of the target text;

[0213] According to the marked selling points and candidate selling points, a selling point candidate set is constructed.

[0214] Among them, the marked selling point is used to describe the second feature of the item, and the first feature is different from the second feature.

[0215] The device provided in the embodiment of the present application can be used to execute the training method of the text generation model in the above embodiment. Its implementation principle and technical effects are similar and will not be repeated here.

[0216] Figure 7 A schematic diagram of the structure of the text generation device provided in the embodiment of the present application is shown in FIG. Figure 7 As shown, the text generating device 70 includes: an acquisition module 71, a calculation module 72 and a merging module 73.

[0217] The acquisition module 71 is used to acquire the text to be extracted, and extract the selling point phrase from the text to be extracted using the preset text generation model. The calculation module 72 is used to calculate the similarity between each selling point phrase. The merging module 73 is used to merge each selling point phrase according to the similarity to obtain the target phrase.

[0218] In some embodiments, the acquisition module 71 is specifically used to:

[0219] Sentence the text to be extracted to obtain phrases to be extracted;

[0220] Determine whether the phrase to be extracted contains a selling point word;

[0221] If the phrase to be extracted contains a selling point word, a preset text generation model is used to extract the selling point phrase from the phrase to be extracted;

[0222] If the phrase to be extracted does not contain the selling point word, the phrase to be extracted will be screened out.

[0223] Among them, selling point words are words used to describe the characteristics of an item.

[0224] Optionally, in some embodiments, the acquisition module 71 is specifically used to:

[0225] If the phrase to be extracted contains a selling point word, the phrase to be extracted is segmented, stop word processed and symbol filtered to obtain the input text;

[0226] The input text is input into a preset text generation model, and the preset text generation model is used to extract selling point phrases from the input text.

[0227] The device provided in the embodiment of the present application can be used to execute the text generation method in the above embodiment. Its implementation principle and technical effects are similar and will not be repeated here.

[0228] It should be noted that it should be understood that the division of the various modules of the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And these modules can all be implemented in the form of software called by processing elements; they can also be all implemented in the form of hardware; some modules can also be implemented in the form of software called by processing elements, and some modules can be implemented in the form of hardware. For example, the determination module can be a separately established processing element, or it can be integrated in a chip of the above device. In addition, it can also be stored in the memory of the above device in the form of program code, and called and executed by a processing element of the above device. The implementation of other modules is similar. In addition, these modules can be fully or partially integrated together, or they can be implemented independently. The processing element here can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each module above can be completed by an integrated logic circuit of hardware in the processor element or instructions in the form of software.

[0229] Figure 8 A schematic diagram of the structure of a computer device provided in an embodiment of the present application, such as Figure 8 As shown, the server includes a memory 81 and at least one processor 82, the memory 81 stores computer-executable instructions; the at least one processor 82 executes the computer-executable instructions stored in the memory 81, so that the at least one processor 82 executes the method as described above.

[0230] Exemplarily, the computer device further includes a bus 83 , wherein the memory 81 is connected to the processor 82 via the bus 83 .

[0231] Exemplarily, the memory 81 can also be used to store a preset Chinese language model and a trained preset text generation model, etc. The memory 81 can be cloud storage or local storage.

[0232] For example, the bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0233] An embodiment of the present application also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed by a processor, they are used to implement the method as described above.

[0234] An embodiment of the present application also provides a computer program product, including a computer program / instruction, which implements the above method when executed by a processor.

[0235] In the present application, "at least one" means one or more, and "plurality" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship; in the formula, the character " / " indicates that the previous and next associated objects are in a "division" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can represent: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.

[0236] It is to be understood that the various numerical numbers involved in the embodiments of the present application are only for the convenience of description and are not intended to limit the scope of the embodiments of the present application. In the embodiments of the present application, the size of the sequence number of each process does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0237] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit it. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein with equivalents. However, these modifications or replacements do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A training method for a text generation model, characterized in that: include: Extracting candidate selling points from the target text according to a preset Chinese language model, wherein the preset Chinese language model is trained using data from a preset selling point knowledge base, and the candidate selling points are used to describe the first feature of the item; Constructing a selling point candidate set based on the candidate selling points; Selecting a target selling point phrase from the target text; Training a preset text generation model based on the selling point candidate set and the target selling point phrase; The preset text generation model is a Lasertagger model; The step of selecting a target selling point phrase from the target text includes: Performing text classification on the target text using a preset model to determine whether a phrase in the target text contains a selling point word, where the selling point word is a word used to describe the characteristics of an item; If the phrase in the target text contains a selling point word, the phrase in the target text is used as the target selling point phrase.

2. The method according to claim 1, characterized in that The step of extracting candidate selling points from the target text based on a preset Chinese language model includes: Segmenting the target text to obtain candidate phrases; Scoring the candidate phrases using the preset Chinese language model to obtain scores for the candidate phrases; According to the scores of the candidate phrases and a preset score threshold, candidate selling points are obtained from the candidate phrases.

3. The method according to claim 2, characterized in that Scoring the candidate phrases using the preset Chinese language model to obtain scores for the candidate phrases includes: Constructing unigram, bigram and trigram segmentations of the candidate phrase; Using the preset Chinese language model, the scores of the unigram, bigram and trigram segmentations are calculated; The score of the candidate phrase is determined according to the scores of the unigram, bigram and trigram.

4. The method according to claim 1, wherein Before extracting candidate selling points from the target text according to the preset Chinese language model, the method further includes: Acquiring preset selling point knowledge base data, wherein the preset selling point knowledge base data includes selling point words; The preset Chinese language model is trained based on the preset selling point knowledge base data.

5. The method according to claim 4, characterized in that The step of training the preset Chinese language model based on the preset selling point knowledge base data includes: Performing word segmentation, stop word processing, and symbol filtering on the preset selling point knowledge base data to obtain training data; The preset Chinese language model is obtained through training based on the training data.

6. The method according to claim 1, wherein The step of constructing a candidate selling point set based on the candidate selling points includes: Obtaining a marked selling point of the target text, where the marked selling point is used to describe a second feature of the item, where the first feature is different from the second feature; A selling point candidate set is constructed based on the marked selling points and the candidate selling points.

7. A text generation method, characterized in that: include: Obtaining a text to be extracted, and extracting a selling point phrase from the text to be extracted using a preset text generation model, wherein the preset text generation model is trained using the method according to any one of claims 1 to 6; Calculate the similarity between each selling point phrase; Based on the similarity, each selling point phrase is merged to obtain a target phrase.

8. The method according to claim 7, characterized in that The step of extracting selling point phrases from the text to be extracted by using the preset text generation model includes: Sentence the text to be extracted to obtain phrases to be extracted; Determining whether the phrase to be extracted contains a selling point word, where the selling point word is a word used to describe the characteristics of an item; If the phrase to be extracted contains a selling point word, extracting a selling point phrase from the phrase to be extracted using the preset text generation model; If the phrase to be extracted does not contain a selling point word, the phrase to be extracted is screened out.

9. The method according to claim 8, characterized in that If the phrase to be extracted contains a selling point word, extracting a selling point phrase from the phrase to be extracted using the preset text generation model includes: If the phrase to be extracted contains a selling point word, segmenting, stopping word processing and symbol filtering are performed on the phrase to be extracted to obtain an input text; The input text is input into the preset text generation model, and the preset text generation model is used to extract selling point phrases from the input text.

10. A training device for a text generation model, characterized in that: include: an extraction module, configured to extract candidate selling points from the target text according to a preset Chinese language model trained using data from a preset selling point knowledge base, wherein the candidate selling points are used to describe a first feature of the item; A construction module, configured to construct a selling point candidate set based on the candidate selling points; A selection module, configured to select a target selling point phrase from the target text; A training module, configured to train a preset text generation model based on the selling point candidate set and the target selling point phrase; the preset text generation model is a Lasertagger model; The selection module is specifically used to use a preset model to perform text classification on the target text, and determine whether a phrase in the target text contains a selling point word, where the selling point word is a word used to describe the characteristics of an item; if the phrase in the target text contains a selling point word, the phrase in the target text is used as the target selling point phrase.

11. A text generation device, characterized in that: include: An acquisition module, configured to acquire a text to be extracted and extract a selling point phrase from the text to be extracted using a preset text generation model, wherein the preset text generation model is trained using the method according to any one of claims 1 to 6; A calculation module, used to calculate the similarity between each selling point phrase; The merging module is used to merge the selling point phrases according to the similarity to obtain a target phrase.

12. A computer device, characterized in that: comprising a memory and at least one processor; The memory stores computer-executable instructions; The at least one processor executes the computer-executable instructions stored in the memory, so that the at least one processor performs the method according to any one of claims 1 to 9.

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

14. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the method according to any one of claims 1 to 9 is implemented.

Citation Information

Patent Citations

  • Short text query expansion and indexing method based on word vector

    CN104765769A

  • Short text similarity calculating method

    CN106484664A

  • Generation device and method for text classification model and a computer readable memory medium

    CN108804512A

  • Term extraction method and device based on deep learning network and storage medium

    CN109325226A

  • Language model training method and device and computer device

    CN110347799A