Title generation method, model training method, device, electronic device and medium

By performing sequence annotation on the text to be predicted, obtaining word segmentation importance labels and generating titles, the problem of low accuracy of text title generation in the existing technology is solved, and more accurate and convenient title generation is achieved.

CN114065743BActive Publication Date: 2024-09-06BEIJING SOGOU TECHNOLOGY DEVELOPMENT CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111166948.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-30
Publication Date
2024-09-06
Estimated Expiration
2041-09-30

Smart Images

  • Figure CN114065743B
    Figure CN114065743B
Patent Text Reader

Abstract

The present invention discloses a title generation method, a model training method, a device, an electronic device and a medium, wherein the method comprises: obtaining a text to be predicted; performing sequence annotation on text segmentation in the text to be predicted, and performing title generation based on sequence annotation labels obtained by the sequence annotation to obtain a text title of the text to be predicted. The above scheme uses sequence annotation technology to generate text titles, thereby improving the accuracy and convenience of text title generation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a title generation method, a model training method, a device, an electronic device and a medium. Background Art

[0002] Title generation is the most common application in natural language processing. The so-called "title" is a process from one sequence to another, that is, after performing word segmentation, part-of-speech tagging and semantic extraction analysis on an input text, the text title corresponding to the input text is obtained. The text title can represent the text meaning of the input text.

[0003] In the prior art, a statistical model is used to generate text titles, that is, the keywords included in the input text are counted, and then the corresponding text titles are obtained by querying a preset database based on the keywords. However, it is found in practice that the use of keywords to query text titles will result in different articles having the same keywords, and the generated text titles are the same, but the correlation with the content of the article is not strong, resulting in low accuracy of the generated text titles. Summary of the invention

[0004] The embodiments of the present invention solve the technical problem of low accuracy of text title generation in the prior art by providing a title generation method, a model training method, a device, an electronic device and a medium.

[0005] In a first aspect, an embodiment of the present invention provides a method for generating a title, comprising:

[0006] Get the text to be predicted;

[0007] Performing sequence tagging on the text segmentation in the text to be predicted, and generating a title based on the sequence tagging tags obtained by the sequence tagging to obtain a text title of the text to be predicted;

[0008] The sequence annotation tags are used to reflect the importance of text segmentations in the text to be predicted.

[0009] Optionally, the text to be predicted includes input text to be predicted, or the text to be predicted includes input text to be predicted and keywords of the input text.

[0010] Optionally, the text to be predicted includes an input text to be predicted and keywords of the input text, and the step of performing sequence tagging on text segmentation words in the text to be predicted, and performing title generation based on sequence tagging tags obtained by the sequence tagging, to obtain a text title of the text to be predicted includes:

[0011] Obtaining the position information of the keyword in the input text;

[0012] Sequence annotation is performed on the text segmentation words in the text to be predicted according to the position information, and title generation is performed based on the sequence annotation tags obtained by the sequence annotation to obtain the text title of the text to be predicted.

[0013] Optionally, the text title includes m target title segmentations, each of the target title segmentations corresponds to a title segmentation position, and m is a positive integer. The title generation is performed based on the sequence annotation tag obtained by the sequence annotation to obtain the text title of the text to be predicted, including:

[0014] According to the sequence label and the text to be predicted, the label and title segmentation are predicted for each of the title segmentation positions, to obtain the predicted label for each of the title segmentation positions, at least one predicted title segmentation for each of the title segmentation positions, and the predicted probability of the predicted title segmentation;

[0015] According to the predicted annotation label of each of the title segmentation positions and the predicted probability of the predicted title segmentation, the target title segmentation located at each of the title segmentation positions is determined from at least one predicted title segmentation at each of the title segmentation positions, thereby obtaining the text title of the text to be predicted.

[0016] Optionally, the determining the target title segmentation at each title segmentation position from at least one predicted title segmentation at each title segmentation position according to the predicted annotation label at each title segmentation position and the predicted probability of the predicted title segmentation comprises:

[0017] If the predicted annotation tag of the title segmentation position is a start annotation tag, a predicted title segmentation satisfying a first preset condition is selected from at least one predicted title segmentation at the title segmentation position as the target title segmentation at the title segmentation position;

[0018] The first preset condition includes: the predicted annotation tag of the predicted title segment is the start annotation tag, and the predicted probability of the predicted title segment is greater than a first threshold.

[0019] Optionally, the determining the target title segmentation at each title segmentation position from at least one predicted title segmentation at each title segmentation position according to the predicted annotation label at each title segmentation position and the predicted probability of the predicted title segmentation comprises:

[0020] If the predicted annotation label of the title segmentation position is an intermediate annotation label, a predicted title segmentation satisfying a second preset condition is selected from at least one predicted title segmentation at the title segmentation position as the target title segmentation at the title segmentation position;

[0021] Among them, the second preset condition includes: the predicted title segmentation and the first i target title segmentations constitute a text segment in the input text, and the prediction probability of the predicted title segmentation is greater than a second threshold, and i is a positive integer less than or equal to m.

[0022] Optionally, the determining the target title segmentation at each title segmentation position from at least one predicted title segmentation at each title segmentation position according to the predicted annotation label at each title segmentation position and the predicted probability of the predicted title segmentation comprises:

[0023] If the predicted annotation tag of the title segmentation position is an external annotation tag, selecting a predicted title segmentation satisfying a third preset condition from at least one predicted title segmentation at the title segmentation position as the target title segmentation at the title segmentation position;

[0024] Among them, the third preset condition includes: the predicted probability of the predicted title segmentation is greater than a third threshold.

[0025] Optionally, before calling the title generation model, the method further includes:

[0026] Acquire a training data set, the training data set comprising training samples, training titles of the training samples, true sequence labels of the training samples, and true sequence labels of the training titles;

[0027] Using the training data set to train a preset initial title model to obtain the title generation model;

[0028] Among them, the true sequence label of the training sample is obtained by sequence labeling each sample segment in the training sample, and is used to reflect the importance of each sample segment in the training sample; the true sequence label of the training title is obtained by sequence labeling each title segment in the training title, and is used to reflect the importance of each title segment in the training title.

[0029] Optionally, the title generation model includes a target encoding model and a target decoding model, the initial title model includes an initial encoding model and an initial decoding model, and the using the training data set to train the preset initial title model to obtain the title generation model includes:

[0030] The initial coding model is trained according to the training samples and the true sequence labels of the training samples, and the parameters in the initial coding model are updated using a first loss function to obtain the target coding model;

[0031] Training the initial decoding model according to the training title and the true sequence label of the training title, and updating the parameters in the initial decoding model using a second loss function to obtain the target decoding model;

[0032] The first loss function is used to indicate the error loss between the true sequence label of the training sample and the predicted sequence label of the training sample, and the predicted sequence label of the training sample is the predicted sequence label obtained by inputting the training sample into the initial coding model for sequence labeling;

[0033] The second loss function is used to indicate the error loss between the true sequence label of the training title and the predicted sequence label of the training title, and the predicted sequence label of the training title is the predicted sequence label obtained by inputting the training title into the initial decoding model for sequence labeling.

[0034] In other words, the target encoding model is obtained by updating the parameters in the initial encoding model using the first loss function, and the target decoding model is obtained by updating the parameters in the initial decoding model using the second loss function.

[0035] In a second aspect, an embodiment of the present invention provides a model training method, comprising:

[0036] Acquire a training data set, the training data set comprising training samples, training titles of the training samples, true sequence labels of the training samples, and true sequence labels of the training titles;

[0037] Using the training data set to train a preset initial title model to obtain a title generation model;

[0038] Among them, the true sequence label of the training sample is obtained by sequence labeling each sample segment in the training sample, and is used to reflect the importance of each sample segment in the training sample; the true sequence label of the training title is obtained by sequence labeling each title segment in the training title, and is used to reflect the importance of each title segment in the training title.

[0039] Optionally, the title generation model includes a target encoding model and a target decoding model, the initial title model includes an initial encoding model and an initial decoding model, and the using the training data set to train the preset initial title model to obtain the title generation model includes:

[0040] The initial coding model is trained according to the training samples and the true sequence labels of the training samples, and the parameters in the initial coding model are updated using a first loss function to obtain the target coding model;

[0041] Training the initial decoding model according to the training title and the true sequence label of the training title, and updating the parameters in the initial decoding model using a second loss function to obtain the target decoding model;

[0042] Among them, the first loss function is used to indicate the error loss between the true sequence label of the training sample and the predicted sequence label of the training sample, and the predicted sequence label of the training sample is the predicted sequence label obtained by inputting the training sample into the initial encoding model for sequence labeling; the second loss function is used to indicate the error loss between the true sequence label of the training title and the predicted sequence label of the training title, and the predicted sequence label of the training title is the predicted sequence label obtained by inputting the training title into the initial decoding model for sequence labeling.

[0043] In a third aspect, an embodiment of the present invention provides a title generation device, comprising:

[0044] An acquisition module, used to acquire the text to be predicted;

[0045] A generation module, used to perform sequence annotation on the text segmentation in the text to be predicted, and generate a title based on the sequence annotation tags obtained by the sequence annotation to obtain a text title of the text to be predicted;

[0046] The sequence annotation tags are used to reflect the importance of text segmentations in the text to be predicted.

[0047] For the contents not introduced or described in the embodiments of the present application, please refer to the relevant introduction in the aforementioned method embodiments, which will not be repeated here.

[0048] In a fourth aspect, an embodiment of the present invention provides a model training device, comprising:

[0049] An acquisition module, used to acquire a training data set, wherein the training data set includes training samples, training titles of the training samples, true sequence labels of the training samples, and true sequence labels of the training titles;

[0050] A training module, used to train a preset initial title model using the training data set to obtain a title generation model;

[0051] Among them, the true sequence label of the training sample is obtained by sequence labeling each sample segment in the training sample, and is used to reflect the importance of each sample segment in the training sample; the true sequence label of the training title is obtained by sequence labeling each title segment in the training title, and is used to reflect the importance of each title segment in the training title.

[0052] In a fifth aspect, an embodiment of the present invention provides an electronic device comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute operation instructions corresponding to the title generation method provided in the first aspect, or operation instructions corresponding to the model training method provided in the second aspect.

[0053] In a sixth aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps corresponding to the title generation method provided in the first aspect, or implements the steps corresponding to the model training method provided in the second aspect.

[0054] One or more technical solutions provided by the embodiments of the present invention achieve at least the following technical effects or advantages:

[0055] The solution provided by the embodiment of the present invention obtains the text to be predicted, performs sequence annotation on the text segmentation in the text to be predicted, and generates a title based on the sequence annotation label obtained by the sequence annotation to obtain the text title of the text to be predicted, wherein the sequence annotation label is used to reflect the importance of the text segmentation in the text to be predicted. In the above scheme, the importance of the text segmentation in the text to be predicted is identified by performing sequence annotation on the text to be predicted, and then the text title of the text to be predicted is generated according to the text segmentation of different importance. In this way, the sequence annotation technology can be used to realize the generation of text titles, which is conducive to improving the accuracy and convenience of text title generation, and also solves the technical problems such as low accuracy caused by using keywords to generate text titles in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0056] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.

[0057] Figure 1 It is a flowchart of a method for generating a title provided by an embodiment of the present invention.

[0058] Figure 2 It is a structural schematic diagram of a possible initial title model provided by an embodiment of the present invention.

[0059] Figure 3 Schematic diagram of a possible initial title model training provided by an embodiment of the present invention.

[0060] Figure 4 It is a flowchart of another title generation method provided by an embodiment of the present invention.

[0061] Figure 5 It is a schematic diagram of a text title display provided by an embodiment of the present invention.

[0062] Figure 6 It is a flowchart of a model training method provided by an embodiment of the present invention.

[0063] Figure 7 It is a schematic diagram of a title generating device provided by an embodiment of the present invention.

[0064] Figure 8 It is a schematic diagram of a model training device provided by an embodiment of the present invention.

[0065] Fig. 9 is a schematic diagram of an electronic device provided by an embodiment of the present invention.

[0066] Fig.10 It is a structural diagram of a server provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0067] The present invention provides a title generation method, device, electronic device and readable storage medium to solve the technical problem of low accuracy of text title generation in the prior art. The overall idea is as follows:

[0068] Acquire a text to be predicted; perform sequence annotation on text segmentations in the text to be predicted, and generate a title based on the sequence annotation tags obtained by the sequence annotation to obtain a text title of the text to be predicted; wherein the sequence annotation tags are used to reflect the importance of the text segmentations in the text to be predicted.

[0069] Through the above technical solution, the importance of the text segmentation in the text to be predicted is marked by sequence annotation, and then the text title of the text to be predicted is generated according to the text segmentation with different importance. In this way, the generation of text title can be realized by using sequence annotation technology, which is conducive to improving the accuracy and convenience of text title generation, and also solves the technical problems such as low accuracy caused by using keywords to generate text title in the prior art.

[0070] See also Figure 1 , is a flowchart of a method for generating a title provided by an embodiment of the present invention. Figure 1 The method shown includes the following implementation steps:

[0071] S101: Obtain text to be predicted.

[0072] The text to be predicted described in the present invention may refer to the input text to be predicted, or may refer to the input text to be predicted and the keywords of the input text. The number of the keywords is not limited, and may be one or more, which may be determined by the actual needs of the system or the user. In practical applications, the input text may include text in any format, such as txt text, Doc text, etc., and may also include text obtained by using text recognition technology. The text recognition technology includes but is not limited to optical character recognition (OCR), geometric feature extraction technology, or other technologies for text or word recognition.

[0073] The method for obtaining the keywords of the input text is not limited. For example, the keywords may be input by the user through the user interaction interface provided by the terminal device, or may be received from other terminal devices or servers, or may be keywords extracted from the input text by the terminal device using keyword extraction technology, etc. The keyword extraction technology includes but is not limited to text keyword extraction based on term frequency-inverse document frequency (TF-IDF), text keyword extraction based on text graph ranking (TextRank), text keyword extraction based on word segmentation and part-of-speech tagging (pyhanlp), or other technologies for text keyword extraction, etc.

[0074] The terminal devices involved in the present invention include but are not limited to smart phones, tablet computers, PDAs, wearable devices, or other devices with network communication functions.

[0075] S102: Sequence tagging is performed on the text segmentation in the text to be predicted, and a title is generated based on the sequence tagging label obtained by the sequence tagging to obtain a text title of the text to be predicted, wherein the sequence tagging label is used to reflect the importance of the text segmentation in the text to be predicted.

[0076] In a specific embodiment, the present invention may first use a sequence labeling technology to perform sequence labeling on the text segmentation in the text to be predicted to obtain a corresponding sequence labeling label. Then, based on the sequence labeling label, a title is generated for the text to be predicted to obtain a text title of the text to be predicted. The sequence labeling technology will be described in detail below in the present invention and will not be elaborated here.

[0077] In another specific embodiment, the present invention can call a trained title generation model, perform sequence labeling on text segmentation in the text to be predicted, and generate a title based on the sequence labeling tags obtained by the sequence labeling to obtain a text title of the text to be predicted.

[0078] The title generation model of the present invention is a model for generating text titles, which may include but is not limited to a sequence to sequence (seq2seq) model, a bidirectional encoding representation model (encoderrepresentations from transformers, BERT), or other mathematical models with a deep attention mechanism (Transformer) network, etc. It should be noted that the title generation model of the present invention adopts an encoder-decoder framework to achieve deep learning and accurate generation of text titles. The following takes the example that the title generation model includes a target encoding model and a target decoding model, which can also be correspondingly referred to as a target encoder and a target decoder, to introduce the relevant embodiments involved in the training and use of the title generation model.

[0079] First, a training example of the title generation model is introduced.

[0080] The present invention first constructs an initial title model, which corresponds to the title generation model and has the same model framework. The initial title model includes an initial encoding model (also referred to as an initial encoder) and an initial decoding model (also referred to as an initial decoder). The present invention does not limit the internal network frameworks of the initial encoding model and the initial decoding model, which can be set according to the actual needs of the system. For example, the initial encoding model and the initial decoding model both include convolutional layers, pooling layers, activation layers, fully connected layers or other functional network layers, and the arrangement order and number of each network layer in the model can be set according to actual needs. Alternatively, if the initial encoding model and the initial decoding model include functional modules composed of at least one of the above-mentioned network layers, etc., the present invention does not elaborate or limit them.

[0081] See also Figure 2 A possible structural diagram of the initial title model is shown in FIG. Figure 2In the embodiment, the initial title model includes an initial encoding model and an initial decoding model. The initial encoding model includes a multi-head attention mechanism module (Multi-Head Attention), a normalization module (Add&Normalization) and a forward feedback module (FeedForward). The number of arrangements of each functional module is not limited. The figure shows a multi-attention mechanism module, two normalization modules and a forward feedback module as an example, but it does not constitute a limitation. The multi-attention mechanism module, the normalization module and the forward feedback module are all composed of network layers with different functions. For example, the normalization module includes a linear layer (or activation layer), etc., which will not be described in detail in the present invention.

[0082] The initial decoding model includes a multi-head attention mechanism module (Multi-Head Attention), a normalization module (Add & Normalization), a forward feedback module (Feed Forward), a linear layer (Linear Layer, also referred to as a linear module) and a classification module (Softmax). As shown in the figure, the initial decoding model consists of two multi-head attention mechanism modules, three normalization modules, a forward feedback module, a linear module and a classification module. It should be noted that each functional module in the initial encoding model and the decoding model is set by the system according to actual needs, which can be used to enhance and extract features of the input text of the model to achieve sequence annotation and title generation of the input text, and the present invention is not limited here. Optionally, the initial encoding model and the initial decoding model may also include a position encoding module (shown as position encoding) for encoding the position information of the text segmentation contained in the input text of the model, so as to be used for feature enhancement or feature extraction of subsequent other functional modules, so as to better achieve sequence annotation and title generation of the input text.

[0083] Next, the present invention can obtain a training data set, which includes training data such as training samples, training titles of the training samples, true sequence labels of the training samples, and true sequence labels of the training titles. The present invention does not limit the number of the training samples and the training titles of the training samples, which are usually more than 1,000. The greater the number, the higher the precision or accuracy of the title generation model obtained by subsequent training. For the convenience of describing the present invention, the following takes one training sample and one training title of the training sample as an example to explain the relevant content, but it does not constitute a limitation. The true sequence label of the training sample is obtained by pre-sequentially annotating each sample segmentation in the training sample, which is used to reflect the importance of each sample segmentation in the training sample. The true sequence label of the training title is obtained by pre-sequentially annotating each title segmentation in the training title, which is used to reflect the importance of each title segmentation in the training title. In practical applications, the true sequence labels of the training samples and the training titles can be specifically customized by the user or the system, which is not limited by the present invention. The sample segmentation, the title segmentation and the text segmentation involved in the present invention may refer to a segmentation word, a segmentation character, a segmentation phrase, etc., and the present invention does not make any limitation thereto.

[0084] The present invention does not limit the implementation means of the sequence labeling. For example, the present invention can adopt begin inside outside (BIO) sequence labeling, begin inside outside end single (BIOES) sequence labeling, or other sequence labeling techniques. For example, taking BIO sequence labeling as an example, the following shows the result examples of real sequence labels obtained by performing BIO labeling on a training sample and the training title of the training sample.

[0085] Training samples:

[0086] A Guangzhou university student bravely captured a gangster in a subway station

[0087] OOBIOBIIOOOOOBIII

[0088] Training Title:

[0089] Guangzhou university student bravely captures criminal

[0090] BIIIIOOOOBIII

[0091] From the above example, we can see that the keywords "Guangzhou", "college students" and "bravely capture criminals" in the training samples are all labeled with "BI", while other non-keywords are labeled with "O". Among them, the B label indicates that the labeled word is the beginning label of the keyword. The I label indicates that the labeled word is the middle label of the keyword. The O label can also be called an external label, indicating that the labeled word is not a keyword, or is another word, etc.

[0092] Finally, the present invention uses the training data set to train the constructed initial title model to obtain the title generation model. The following describes a specific embodiment of training the initial title model to obtain the title generation model.

[0093] In a specific embodiment, the present invention can use the training samples and the real sequence labels of the training samples to train the initial coding model, and obtain the corresponding target coding model in the title generation model. Specifically, during the training process, the present invention can cyclically use the first loss function to update the model parameters in the initial coding model until the loss value of the first loss function is lower than the first preset value, so as to train and obtain the final target coding model. The first preset value is a system-defined threshold, such as an experience value set according to user experience, or a threshold set according to actual system requirements. In actual applications, the first preset value can be, for example, 0.

[0094] Among them, the first loss function is used to indicate the error loss between the true sequence label of the training sample and the predicted sequence label of the training sample. The predicted sequence label of the training sample is the predicted sequence label obtained by inputting the training sample into the initial coding model for sequence labeling prediction. Specifically, in the initial coding model, each sample segment in the training sample can be sequence labeled.

[0095] In another specific embodiment, the present invention can use the training samples, the training titles of the training samples and the real sequence labels of the training titles to train the initial decoding model, and obtain the corresponding target decoding model in the title generation model. Specifically, during the training process, the present invention can cyclically use the second loss function to update the model parameters in the initial decoding model until the loss value of the second loss function is lower than the second preset value, so as to obtain the final target decoding model through training. The second preset value is a system-defined threshold, such as an experience value set according to user experience, or a threshold set according to actual system requirements. In practical applications, the second preset value can be, for example, 0.

[0096] Among them, the second loss function is used to indicate the error loss between the true sequence label of the training title and the predicted sequence label of the training title. The predicted sequence label of the training title is the predicted sequence label obtained by inputting the training title into the initial decoding model for sequence labeling prediction. Specifically, in the initial decoding model, each title segment in the training title can be sequence labeled.

[0097] It should be noted that the training sample corresponds to the text to be predicted, which may include the original text for training, or include the original text for training and keywords in the original text. Regarding how to extract the keywords in the original text, please refer to the relevant introduction in the aforementioned step S101, which will not be repeated here. When the training sample includes the original text for training and keywords in the original text, the present invention can first obtain the position information of each keyword in the original text corresponding to the original text. During the model training process, the present invention can also train the initial encoding model and the initial decoding model in the initial title model respectively in combination with the position information of each keyword in the training text, so as to obtain the target encoding model and the target decoding model in the title generation model accordingly.

[0098] For example, see Figure 3 A diagram showing a possible initial title model training. Figure 2 The initial title model includes an initial encoding model and an initial decoding model. Figure 3 The present invention inputs the training samples (specifically, the original text and the location information of the keywords in the original text), the real sequence labels of the training samples, the training titles and the real sequence labels of the training titles into the initial title model. Inside the model, the present invention can use the first loss function (the source BIO loss Loss function shown in the figure) to correct and update the model parameters in the initial encoding model to obtain a target encoding model with higher training accuracy. Correspondingly, the second loss function (the target BIO loss Loss function shown in the figure) can be used to correct and update the model parameters in the initial decoding model to obtain a target decoding model with higher training accuracy. After the target encoding model and the target decoding model are obtained through training, the trained title generation model can be obtained.

[0099] Next, an example of using the title generation model is introduced, that is, a specific example of step S102 is introduced.

[0100] In step S102, after obtaining the text to be predicted, the present invention can call the trained title generation model to perform sequence labeling and title generation on the text to be predicted, so as to obtain the text title of the text to be predicted.

[0101] In a specific embodiment, if the text to be predicted includes the input text to be predicted and keywords in the input text, the present invention can first locate / determine the position information of each keyword in the input text, and then use the title generation model to perform sequence annotation and title generation on the text to be predicted according to the position information to obtain the text title of the text to be predicted. Among them, the position information of each keyword in the input text can be determined and obtained in the title generation model, or it can be determined and obtained before inputting into the title generation model, which depends on the internal functional configuration of the specific title generation model, and the present invention does not limit it. The following is a specific embodiment of text title generation.

[0102] Specifically, the present invention can first perform word segmentation processing on the text to be predicted to obtain the text segmentation of the text to be predicted. In practical applications, the word segmentation processing for the text to be predicted can be placed inside the title generation model for processing, or can be placed outside the title generation model for processing, which can be specifically determined according to the actual functional configuration inside the model, and the present invention does not limit it. After the word segmentation processing, the present invention can first perform sequence annotation on the text segmentation in the text to be predicted in the title generation model to obtain the sequence annotation label of the text segmentation in the text to be predicted, which can be referred to as the sequence annotation label below. Then, based on the sequence annotation label, the text title of the text to be predicted is generated for the text to be predicted. Specifically, the text title can be composed of m target title segmentations, for example, each target title segmentation corresponds to a title segmentation position, and the present invention can perform the following steps S401 and S402 to output the target title segmentation located at each title segmentation position. Wherein, m is a positive integer set by the user or the system.

[0103] See also Figure 4 , is a flow chart of another method for generating a title provided by an embodiment of the present invention. Figure 4 The method shown includes the following implementation steps:

[0104] S401. Predicting the label and the title segmentation for each title segmentation position according to the sequence label and the text to be predicted, and obtaining a predicted label, at least one predicted title segmentation, and a predicted probability of the predicted title segmentation for each title segmentation position.

[0105] S402: According to the predicted annotation label of each title segmentation position and the predicted probability of the predicted title segmentation, the target title segmentation located at each title segmentation position is determined from at least one of the predicted title segmentations, thereby obtaining the text title of the text to be predicted.

[0106] The present invention uses the same method for obtaining / determining the target title segmentation at each of the m title segmentation positions. For ease of description, the current segmentation position among the m title segmentation positions is taken as an example to introduce a specific implementation method for determining the target title segmentation at the current segmentation position. Among them, the current segmentation position is any one of the m title segmentation positions. After the present invention determines the target title segmentation of each of the m title segmentation positions, the text title of the text to be predicted can be obtained, and the process ends.

[0107] In a specific implementation, the present invention can predict the label and title segmentation of the current segmentation position according to the sequence label of the text to be predicted and the text to be predicted, and obtain the predicted label of the current segmentation position, at least one predicted title segmentation of the current segmentation position, and the predicted probability of each predicted title segmentation. Specifically, the present invention can predict the label and title segmentation of the current segmentation position according to the sequence label of the text to be predicted and the text to be predicted, and optionally in combination with the predicted first n target title segmentations (i.e., the target title segmentations at the n segmentation positions before the current segmentation position). Among them, n is a positive integer set by the user or the system, for example, n is the number of all target title segmentations before the current segmentation position, etc. The predicted probability is used to reflect the probability that the predicted title segmentation is the target title segmentation at the current segmentation position. If the predicted probability is larger, it means that the probability that the predicted title segmentation is the target title segmentation at the current segmentation position is greater.

[0108] Furthermore, the present invention can determine the target title segmentation at the current segmentation position according to the predicted annotation label at the current segmentation position, at least one predicted title segmentation at the current segmentation position, and the predicted probability of each predicted title segmentation. Several specific implementation methods are introduced below.

[0109] In a specific embodiment, when the predicted annotation tag of the current word segmentation position is a start annotation tag (such as a B annotation tag), the start annotation tag is used to indicate that the title segmentation at the current word segmentation position is the beginning part of a keyword. At this time, the present invention can filter out a predicted title segmentation that meets the first preset condition from at least one of the predicted title segmentations to determine it as / as the target title segmentation located at the current word segmentation position.

[0110] The first preset condition is a condition related to the start markup tag and used to filter the target title segmentation word, which is set by the user or the system. For example, it may include but is not limited to the predicted markup tag of the predicted title segmentation word being the start markup tag, and the predicted probability of the predicted title segmentation word being greater than the first threshold. In other words, for example, at this time, the present invention can first find one or more candidate title segmentations whose predicted markup tag is the start markup tag from at least one of the predicted title segmentations. Then, the title segmentations whose predicted probability is greater than the first threshold are filtered out from the one or more candidate title segmentations as the target title segmentation word located at the current segmentation position. Among them, the first threshold is a custom setting, such as an experience value set according to user experience, or a threshold set according to actual system needs.

[0111] In another specific embodiment, when the predicted annotation tag of the current segmentation position is an intermediate annotation tag (such as an I annotation tag), the intermediate annotation tag is used to indicate that the title segmentation at the current segmentation position is the middle part of the keyword. At this time, the present invention can filter out a predicted title segmentation that meets the second preset condition from at least one of the predicted title segmentations as the target title segmentation located at the current segmentation position.

[0112] The second preset condition is a condition related to the intermediate annotation tag set by the user or the system and used to filter the target title segmentation. For example, it may include but is not limited to the predicted title segmentation and the first i target title segmentations (i.e., the target title segmentations at the i segmentation positions before the current segmentation position) can form a text segment in the text to be predicted, and the prediction probability of the predicted title segmentation is greater than the second threshold. Wherein, i is a positive integer less than or equal to m, which can be a positive integer set by the user or the system, such as i is 1, etc. In other words, for example, at this time, the present invention can first find out from at least one of the predicted title segmentations at least one candidate title segmentation that supports the i target title segmentations predicted before the current segmentation position to form the text segment to be predicted (specifically, the input text in the text to be predicted), and remove the predicted title segmentations that cannot form the text segment of the text to be predicted. Furthermore, the present invention further filters out the title segmentation with a prediction probability greater than the second threshold from the at least one candidate title segmentation as the target title segmentation located at the current segmentation position. The second threshold is a custom setting, such as an experience value set according to user experience, or a threshold set according to actual system requirements.

[0113] In another specific embodiment, when the predicted annotation tag of the current segmentation position is an external annotation tag (such as an O annotation tag), the external annotation tag is used to indicate that the title segmentation at the current segmentation position is other parts except the beginning and the middle part, such as a non-keyword part, etc. At this time, the present invention can filter out a predicted title segmentation that meets the third preset condition from at least one of the predicted title segmentations as the target title segmentation at the current segmentation position.

[0114] The third preset condition is a condition for filtering target title segmentation words set by the user or the system, for example, it may include but is not limited to the predicted probability of the predicted title segmentation words being greater than the third threshold. In other words, for example, at this time, the present invention can filter out the title segmentation words with a predicted probability greater than the third threshold from at least one of the predicted title segmentation words as the target title segmentation words located at the current segmentation word position. The third threshold value is a custom setting, such as an experience value set according to user experience, or a threshold value set according to actual system requirements, etc.

[0115] It should be noted that the first threshold, the second threshold and the third threshold are all customized settings of the system, and they may be the same or different, and the present invention does not limit them. The number of the target title participles predicted at the current participle position is not limited, and it may be one or more, which depends on the actual situation predicted inside the model. When there are multiple target title participles at the current participle position, the present invention finally generates multiple text titles. In other words, the number of the text titles generated by the present invention may be one or more, which depends on the actual internal operation of the title generation model, and the present invention does not limit them.

[0116] The text title of the text to be predicted described in the present invention may include but is not limited to a general title, a style title or other custom-set classification titles, etc. Among them, the style title refers to a text title with a preset style type, and the preset style type includes but is not limited to question sentences, exclamation sentences, data sentences, introduction sentences, contrast sentences, pain point key sentences, suspense sentences, label sentences or other style types described by custom titles, etc. The question sentence refers to the use of question sentences to describe the text title. The exclamation sentence refers to the use of exclamation sentences to describe the text title. The data sentence refers to the use of data to describe the text title, that is, data is used in the text title. The introduction sentence refers to the use of personal pronouns to describe the text title, that is, the use of first or second person pronouns in the text title to enhance the reader's sense of involvement. The contrast sentence refers to the expression of contrasting meanings in the text title to reflect the writing intention. The pain point key sentence refers to the description of the text title by raising pain point problems and listing solutions, such as how to solve problems encountered. The suspense sentence pattern refers to the use of some special or novel things in the text title to raise questions to create suspense; or deliberately hiding key information and leaving blanks to arouse people's curiosity, etc. The label sentence pattern refers to the use of labels in the text title to represent certain things, such as WeChat merchants in the circle of friends, etc.

[0117] For example, see Figure 5 A schematic diagram showing a possible display text title is shown. Figure 5 In the figure, the lower left frame part represents the text content of the text to be predicted. The lower right frame part represents the text title generated by calling the title generation model. Figure 5 In the example, the text title includes at least one general title and at least one style title, and the figure shows two general titles and three style titles as an example. In the display interface, the user can select a target title from among them according to personal preferences or personal needs as the final text title of the text to be predicted, and the present invention does not limit this.

[0118] To better understand the present invention, an example is given below for illustration. For example, taking the following text to be predicted as an example, the text to be predicted is input into the title generation model, and the text title of the text to be predicted is output. The text to be predicted and the text title of the text to be predicted are respectively as follows:

[0119] The text to be predicted: During the Spring and Autumn Period and the Warring States Period, the whole society was in a great transformation. Politically, since the ruler of the central government at that time was no longer the "founding emperor" of the year, but was raised by eunuchs in the deep palace, facing the strong coercion of the feudal lords who dominated the local area, the entire ruling system became fragmented and even collapsed. These major changes made the traditional "norms" unable to maintain the order and normal development of the whole society well. As a result, some people put forward many statements, and various schools of thought such as Confucianism, Legalism, Taoism, and Mohism emerged in society. They wrote books, lectured, and debated, presenting a prosperous scene in academia, forming a hundred schools of thought. As a member of the "Hundred Schools of Thought", Confucianism advocates and advocates that in order to maintain the normal order of society and make it develop normally, it is necessary to establish many "norms" of different natures to work together.

[0120] Most ancient people were very superstitious. They believed in "ghosts and gods" and thought that "norms" reflected the will of "ghosts and gods". The culture of the Xia and Shang dynasties was centered on the culture of ghosts and gods. After the demise of the Shang Dynasty, the people of the Zhou Dynasty were skeptical of the Shang people's claim that "the Shang Dynasty was born by the will of heaven". As a result, they began to doubt the Shang culture centered on sacrifices and ghosts and gods, and found that "norms" were actually formulated by those who held authority. In the Western Zhou Dynasty, Duke Zhou "established rituals and music". "Rites" is the general term for political norms, moral norms, and various rules and regulations that maintain the hierarchy of the rulers.

[0121] During the Spring and Autumn Period, as rituals and music were falling apart, people began to doubt "Heaven". "Since Confucius came to China, China has been influenced by him and has taken the path of replacing religion with morality." Sun Tzu said: "What does Heaven say? The four seasons run, and all things grow. What does Heaven say?" This shows Sun Tzu's doubts about Wu Tianshang as a personal God. Confucius also said: "When the world is ruled by virtue, rituals, music, conquests and wars are decided by the emperor; when the world is ruled by no virtue, rituals, music, conquests and wars are decided by the princes." From this, we can see that Confucianism has changed the source of "norms" from the will of "ghosts and gods" to the will of the authority.

[0122] Confucianism believes that the formulation of "norms" is in the hands of those in authority. They divide "norms" into three levels: "Tao" at the top, "morality, etiquette, customs, village agreements, family traditions, and business rules" in the middle, and "law" at the bottom, which together form an inverted pyramid.

[0123] The "virtue" mentioned by Confucianism has two meanings: political and individual. On the political level, Confucianism first attaches importance to establishing the morality of officials, requiring rulers to establish virtuous politics and practice moral governance. Confucius said: "Governing with virtue is like the North Star, which stays in its place and is surrounded by other stars." From this, it can be seen that on the political level, Confucianism takes benevolent politics as the main content of the moral governance thought, and uses rituals and music as the way of moral education to implement it; on the individual level, Confucianism emphasizes the morality of the people and roots "virtue" in people's hearts and minds. Mencius believes that "benevolence, righteousness, courtesy, and wisdom" are the qualities that everyone is born with. Mencius said: "The reason why a gentleman is different from others is because of his mind." "Virtue" is a more specific criterion for governing the world and cultivating oneself. This criterion will vary from time to time, from matter to matter, and from person to person in the specific use process, so its scope of application is relatively narrow compared to "Tao".

[0124] Confucius believed that "ritual" comes from authority, customs and human feelings, and also reflects the code of conduct and behavior of authority and order. Confucius said: "I have heard that ritual is the most important thing for people to live. Without ritual, there is no way to respect the gods of heaven and earth, no way to distinguish the positions of monarchs and ministers, superiors and subordinates, and the old and the young, no way to distinguish the relationships between men and women, fathers and sons, brothers, and relatives. A gentleman respects this. Then he teaches the people with what he can and does not abolish the festival. After he has accomplished something, he will then prepare the carvings and articles and the brocades to continue. Then he will discuss funerals, prepare the tripods and sacrificial dishes, set up the pork and basil, repair the ancestral temple, and worship and order the clan at the right time. Then he will make his house comfortable, dress modestly, and humble his palace. He will not carve the table on his car, nor carve the utensils, nor eat two different kinds of food, so as to share the benefits with the people. This is how the gentlemen of the past performed rituals."

[0125] "The Analects of Confucius: Zilu" says: "If rites and music are not flourishing, then punishments will not be appropriate; if punishments are not appropriate, then the people will not know what to do." The "law" here refers to punishments and laws. It reflects the will and ideas of those who hold authority. It is legislated for the benefit of the rulers themselves. Its purpose is only to protect some special interests or eliminate some special obstacles. Its essence is to maintain the legitimacy and stability of imperial rule.

[0126] Therefore, the rationality, legitimacy and scope of application of "law" become very narrow. Although "law" can force people to follow it through the power of the ruler, people may not necessarily believe in "law" in their hearts. They just follow it under the pressure of the situation, so its effectiveness is relatively small. "Law" is used outside the scope of application of "norms" at the middle and high levels such as "Taoism" and "morality, etiquette, customs, village agreements, family traditions, and business rules", so its scope of application itself becomes narrower and is therefore at the bottom.

[0127] The text title output by the title generation model: The source of "norms" changes from "ghosts and gods" to the will of the authority.

[0128] According to an embodiment of the present invention, by acquiring a text to be predicted, sequence annotation is performed on the text segmentation in the text to be predicted, and a title is generated based on the sequence annotation label obtained by the sequence annotation, so as to obtain a text title of the text to be predicted, wherein the sequence annotation label is used to reflect the importance of the text segmentation in the text to be predicted. In the above scheme, the importance of the text segmentation in the text to be predicted is identified by sequence annotation of the text to be predicted, and then the text title of the text to be predicted is generated according to the text segmentation of different importance. In this way, the generation of text titles can be realized by using sequence annotation technology, which is conducive to improving the accuracy and convenience of text title generation, and also solves the technical problems such as low accuracy caused by using keywords to generate text titles in the prior art.

[0129] See also Figure 6 , is a flow chart of a model training method provided by an embodiment of the present invention. Figure 6 The method shown can be applied to terminal devices, such as smart phones, platform computers, etc.; it can also be applied to servers that establish data interaction with terminal devices, which is not limited in the present invention. The method includes the following implementation steps:

[0130] S601. Acquire a training data set, where the training data set includes training samples, training titles of the training samples, true sequence labels of the training samples, and true sequence labels of the training titles.

[0131] The true sequence label of the training sample of the present invention is obtained by performing sequence labeling on each sample segmentation in the training sample, and the true sequence label of the training sample is used to reflect the importance of each sample segmentation in the training sample. The true sequence label of the training title is obtained by performing sequence labeling on each title segmentation in the training title, and the true sequence label of the training title is used to reflect the importance of each title segmentation in the training title.

[0132] S602: Use the training data set to train a preset initial title model to obtain a title generation model.

[0133] The initial title model of the present invention includes an initial encoding model and an initial decoding model, and the title generation model includes a target encoding model and a target decoding model.

[0134] In a specific embodiment, the present invention can train the initial coding model according to the training samples and the true sequence labels of the training samples, and use a first loss function to update the parameters in the initial coding model during the training process to obtain the target coding model in the title generation model. The first loss function is used to indicate the error loss between the true sequence labels of the training samples and the predicted sequence labels of the training samples. The predicted sequence labels of the training samples are the predicted sequence labels obtained by inputting the training samples into the initial coding model for sequence labeling.

[0135] In another specific embodiment, the present invention can train the initial decoding model at least according to the training title and the true sequence label of the training title, and use the second loss function to update the parameters in the initial decoding model during the training process to obtain the target decoding model in the title generation model. The second loss function is used to indicate the error loss between the true sequence label of the training title and the predicted sequence label of the training title. The predicted sequence label of the training title is the predicted sequence label obtained by inputting the training title into the initial decoding model for sequence labeling.

[0136] For details not introduced or described in the embodiments of the present invention, please refer to the aforementioned Figure 1 The relevant introduction about the training embodiment of the title generation model in the method embodiment will not be repeated here.

[0137] According to the embodiment of the present invention, a training data set including training samples, training titles of the training samples, true sequence labels of the training samples and true sequence labels of the training titles is obtained, and then the training data set is used to train the preset initial title model to obtain the final title generation model. In this way, sequence labeling technology can be added to the title generation model, which is conducive to improving the precision or accuracy of the title generation model in generating titles, and also improves the accuracy of model training.

[0138] Based on the same inventive concept, the embodiments of the present invention also provide a title generation device, a model training device, an electronic device and a server. Figure 7 , is a schematic diagram of the structure of a title generation device provided by an embodiment of the present invention. Figure 7 The device 70 shown comprises:

[0139] An acquisition module 701 is used to acquire the text to be predicted;

[0140] A generating module 702 is used to perform sequence annotation on the text segmentation in the text to be predicted, and to generate a title based on the sequence annotation tags obtained by the sequence annotation to obtain a text title of the text to be predicted;

[0141] The sequence annotation tags are used to reflect the importance of text segmentations in the text to be predicted.

[0142] Optionally, the text to be predicted includes input text to be predicted, or the text to be predicted includes input text to be predicted and keywords of the input text.

[0143] Optionally, the text to be predicted includes the input text to be predicted and keywords of the input text, and the generating module 702 is specifically used for:

[0144] Obtaining the position information of the keyword in the input text;

[0145] The text to be predicted is sequence-tagged according to the position information, and a title is generated based on a sequence tag label obtained by the sequence tagging to obtain a text title of the text to be predicted.

[0146] Optionally, the text title includes m target title segmentations, each of the target title segmentations corresponds to a title segmentation position, m is a positive integer, and the generating module 702 is specifically used for:

[0147] According to the sequence label and the text to be predicted, the label and title segmentation are predicted for each of the title segmentation positions, to obtain the predicted label for each of the title segmentation positions, at least one predicted title segmentation for each of the title segmentation positions, and the predicted probability of the predicted title segmentation;

[0148] According to the predicted annotation label of each title segmentation position and the predicted probability of the predicted title segmentation, the target title segmentation located at each title segmentation position is determined from at least one predicted title segmentation at each title segmentation position.

[0149] Optionally, the generating module 702 is specifically used for:

[0150] If the predicted annotation tag of the title segmentation position is a start annotation tag, a predicted title segmentation satisfying a first preset condition is selected from at least one predicted title segmentation at the title segmentation position as the target title segmentation at the title segmentation position;

[0151] The first preset condition includes: the predicted annotation tag of the predicted title segment is the start annotation tag, and the predicted probability of the predicted title segment is greater than a first threshold.

[0152] Optionally, the generating module 702 is specifically used for:

[0153] If the predicted annotation label of the title segmentation position is an intermediate annotation label, a predicted title segmentation satisfying a second preset condition is selected from at least one predicted title segmentation at the title segmentation position as the target title segmentation at the title segmentation position;

[0154] Among them, the second preset condition includes: the predicted title segmentation and the first i target title segmentations constitute a text segment in the text to be predicted, and the prediction probability of the predicted title segmentation is greater than a second threshold, and i is a positive integer.

[0155] Optionally, the generating module 702 is specifically used for:

[0156] If the predicted annotation label of the title segmentation position is another annotation label, a predicted title segmentation satisfying a third preset condition is selected from at least one predicted title segmentation at the title segmentation position as the target title segmentation at the title segmentation position;

[0157] Among them, the third preset condition includes: the predicted probability of the predicted title segmentation is greater than a third threshold.

[0158] Optionally, the device 70 further includes a training module 703, wherein:

[0159] The acquisition module 701 is further used to acquire a training data set, wherein the training data set includes training samples, training titles of the training samples, true sequence labels of the training samples, and true sequence labels of the training titles;

[0160] The training module 703 is further used to train the preset initial title model using the training data set to obtain the title generation model;

[0161] Among them, the true sequence label of the training sample is obtained by sequence labeling each sample segment in the training sample, and is used to reflect the importance of each sample segment in the training sample; the true sequence label of the training title is obtained by sequence labeling each title segment in the training title, and is used to reflect the importance of each title segment in the training title.

[0162] Optionally, the title generation model includes a target encoding model and a target decoding model, the initial title model includes an initial encoding model and an initial decoding model, and the training module 703 is specifically used to:

[0163] The initial coding model is trained according to the training samples and the true sequence labels of the training samples, and the parameters in the initial coding model are updated using a first loss function to obtain the target coding model;

[0164] Training the initial decoding model according to the training title and the true sequence label of the training title, and updating the parameters in the initial decoding model using a second loss function to obtain the target decoding model;

[0165] The first loss function is used to indicate the error loss between the true sequence label of the training sample and the predicted sequence label of the training sample, and the predicted sequence label of the training sample is the predicted sequence label obtained by inputting the training sample into the initial coding model for sequence labeling;

[0166] The second loss function is used to indicate the error loss between the true sequence label of the training title and the predicted sequence label of the training title, and the predicted sequence label of the training title is the predicted sequence label obtained by inputting the training title into the initial decoding model for sequence labeling.

[0167] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0168] Please also see Figure 8 , is a schematic diagram of the structure of a model training device provided by an embodiment of the present invention. Figure 8 The device 80 shown includes: an acquisition module 801 and a training module 802, wherein:

[0169] The acquisition module 801 is used to acquire a training data set, wherein the training data set includes training samples, training titles of the training samples, true sequence labels of the training samples, and true sequence labels of the training titles;

[0170] The training module 802 is used to train a preset initial title model using the training data set to obtain a title generation model;

[0171] Among them, the true sequence label of the training sample is obtained by sequence labeling each sample segment in the training sample, and is used to reflect the importance of each sample segment in the training sample; the true sequence label of the training title is obtained by sequence labeling each title segment in the training title, and is used to reflect the importance of each title segment in the training title.

[0172] Optionally, the title generation model includes a target encoding model and a target decoding model, the initial title model includes an initial encoding model and an initial decoding model, and the training module 802 is specifically used to:

[0173] The initial coding model is trained according to the training samples and the true sequence labels of the training samples, and the parameters in the initial coding model are updated using a first loss function to obtain the target coding model;

[0174] Training the initial decoding model according to the training title and the true sequence label of the training title, and updating the parameters in the initial decoding model using a second loss function to obtain the target decoding model;

[0175] Among them, the first loss function is used to indicate the error loss between the true sequence label of the training sample and the predicted sequence label of the training sample, and the predicted sequence label of the training sample is the predicted sequence label obtained by inputting the training sample into the initial encoding model for sequence labeling; the second loss function is used to indicate the error loss between the true sequence label of the training title and the predicted sequence label of the training title, and the predicted sequence label of the training title is the predicted sequence label obtained by inputting the training title into the initial decoding model for sequence labeling.

[0176] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.

[0177] Based on the same inventive concept, an embodiment of the present invention provides an electronic device 800, Fig. 9 8 is a block diagram of an electronic device 800 according to an exemplary embodiment. For example, the device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

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

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

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

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

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

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

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

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

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

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

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

[0189] Fig.101 is a schematic diagram of the structure of the server in some embodiments of the present invention. The server 1900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1922 (for example, one or more processors) and memory 1932, and one or more storage media 1930 (for example, one or more mass storage devices) storing application programs 1942 or data 1944. Among them, the memory 1932 and the storage medium 1930 can be short-term storage or permanent storage. The program stored in the storage medium 1930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 1922 can be configured to communicate with the storage medium 1930 and execute a series of instruction operations in the storage medium 1930 on the server 1900.

[0190] The server 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input and output interfaces 1958, one or more keyboards 1956, and / or, one or more operating systems 1941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.

[0191] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a device (server or terminal), enables the device to perform the title generation method of the aforementioned embodiments, for example, the method includes:

[0192] Get the text to be predicted;

[0193] The text segmentations in the text to be predicted are sequence labeled, and a title is generated based on the sequence labeling tags obtained by the sequence labeling to obtain a text title of the text to be predicted; wherein the sequence labeling tags are used to reflect the importance of the text segmentations in the text to be predicted.

[0194] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a device (server or terminal), enables the device to perform the model training method of the aforementioned embodiments, for example, the method includes:

[0195] Acquire a training data set, the training data set comprising training samples, training titles of the training samples, true sequence labels of the training samples, and true sequence labels of the training titles;

[0196] Using the training data set to train a preset initial title model to obtain the title generation model;

[0197] Among them, the true sequence label of the training sample is obtained by sequence labeling each sample segment in the training sample, and is used to reflect the importance of each sample segment in the training sample; the true sequence label of the training title is obtained by sequence labeling each title segment in the training title, and is used to reflect the importance of each title segment in the training title.

[0198] One or more technical solutions provided by the embodiments of the present invention achieve at least the following technical effects or advantages: the present invention performs sequence annotation on the text to be predicted to identify the importance of the text segmentation in the text to be predicted, and then generates the text title of the text to be predicted according to the text segmentation with different importance. In this way, the sequence annotation technology can be used to realize the generation of text titles, which is conducive to improving the accuracy and convenience of text title generation, and also solves the technical problems such as low accuracy caused by using keywords to generate text titles in the prior art.

[0199] Those skilled in the art will readily appreciate other embodiments of the invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.

[0200] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims. The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included in the scope of protection of the present invention.

Claims

1. A method for generating a title, characterized in that: include: Get the text to be predicted; Performing sequence tagging on the text segmentation in the text to be predicted, and generating a title based on the sequence tagging tags obtained by the sequence tagging to obtain a text title of the text to be predicted; The sequence annotation tag is used to reflect the importance of the text segmentation in the text to be predicted; The text title includes m target title segmentations, each of the target title segmentations corresponds to a title segmentation position, and m is a positive integer; the title generation is performed based on the sequence annotation tags obtained by the sequence annotation to obtain the text title of the to-be-predicted text, including: According to the sequence label and the text to be predicted, the label and title segmentation are predicted for each of the title segmentation positions, to obtain the predicted label for each of the title segmentation positions, at least one predicted title segmentation for each of the title segmentation positions, and the predicted probability of the predicted title segmentation; According to the predicted annotation label of each of the title segmentation positions and the predicted probability of the predicted title segmentation, the target title segmentation located at each of the title segmentation positions is determined from at least one predicted title segmentation at each of the title segmentation positions, thereby obtaining the text title of the text to be predicted.

2. The method according to claim 1, characterized in that The text to be predicted includes the input text to be predicted, or the text to be predicted includes the input text to be predicted and keywords of the input text.

3. The method according to claim 2, characterized in that The text to be predicted includes an input text to be predicted and keywords of the input text, and the text segmentation in the text to be predicted is sequence-tagged, and a title is generated based on a sequence tag label obtained by the sequence tagging, and the text title of the text to be predicted is obtained, including: Obtaining the position information of the keyword in the input text; Sequence annotation is performed on the text segmentation words in the text to be predicted according to the position information, and title generation is performed based on the sequence annotation tags obtained by the sequence annotation to obtain the text title of the text to be predicted.

4. The method according to claim 1, characterized in that The step of determining the target title segmentation at each title segmentation position from at least one predicted title segmentation at each title segmentation position according to the predicted label at each title segmentation position and the predicted probability of the predicted title segmentation comprises: If the predicted annotation tag of the title segmentation position is a start annotation tag, a predicted title segmentation satisfying a first preset condition is selected from at least one predicted title segmentation at the title segmentation position as the target title segmentation at the title segmentation position; The first preset condition includes: the predicted annotation tag of the predicted title segment is the start annotation tag, and the predicted probability of the predicted title segment is greater than a first threshold.

5. The method according to claim 1, characterized in that The step of determining the target title segmentation at each title segmentation position from at least one predicted title segmentation at each title segmentation position according to the predicted label at each title segmentation position and the predicted probability of the predicted title segmentation comprises: If the predicted annotation label of the title segmentation position is an intermediate annotation label, a predicted title segmentation satisfying a second preset condition is selected from at least one predicted title segmentation at the title segmentation position as the target title segmentation at the title segmentation position; Among them, the second preset condition includes: the predicted title segmentation and the first i target title segmentations constitute a text segment in the text to be predicted, and the prediction probability of the predicted title segmentation is greater than a second threshold, and i is a positive integer less than or equal to m.

6. The method according to claim 1, characterized in that The step of determining the target title segmentation at each title segmentation position from at least one predicted title segmentation at each title segmentation position according to the predicted label at each title segmentation position and the predicted probability of the predicted title segmentation comprises: If the predicted annotation tag of the title segmentation position is an external annotation tag, selecting a predicted title segmentation satisfying a third preset condition from at least one predicted title segmentation at the title segmentation position as the target title segmentation at the title segmentation position; Among them, the third preset condition includes: the predicted probability of the predicted title segmentation is greater than a third threshold.

7. The method according to claim 1, characterized in that The step of performing sequence tagging on the text segmentation words in the text to be predicted, and generating a title based on the sequence tagging tags obtained by the sequence tagging to obtain the text title of the text to be predicted includes: Calling the title generation model to perform sequence annotation on the text segmentation in the text to be predicted, and performing title generation based on the sequence annotation tags obtained by the sequence annotation to obtain the text title of the text to be predicted; Before calling the title generation model, the method further includes: Acquire a training data set, the training data set comprising training samples, training titles of the training samples, true sequence labels of the training samples, and true sequence labels of the training titles; Using the training data set to train a preset initial title model to obtain the title generation model; Among them, the true sequence label of the training sample is obtained by sequence labeling each sample segment in the training sample, and is used to reflect the importance of each sample segment in the training sample; the true sequence label of the training title is obtained by sequence labeling each title segment in the training title, and is used to reflect the importance of each title segment in the training title.

8. The method according to claim 7, characterized in that The title generation model includes a target encoding model and a target decoding model, the initial title model includes an initial encoding model and an initial decoding model, and the using the training data set to train the preset initial title model to obtain the title generation model includes: The initial coding model is trained according to the training samples and the true sequence labels of the training samples, and the parameters in the initial coding model are updated using a first loss function to obtain the target coding model; Training the initial decoding model according to the training title and the true sequence label of the training title, and updating the parameters in the initial decoding model using a second loss function to obtain the target decoding model; The first loss function is used to indicate the error loss between the true sequence label of the training sample and the predicted sequence label of the training sample, and the predicted sequence label of the training sample is the predicted sequence label obtained by inputting the training sample into the initial coding model for sequence labeling; The second loss function is used to indicate the error loss between the true sequence label of the training title and the predicted sequence label of the training title, and the predicted sequence label of the training title is the predicted sequence label obtained by inputting the training title into the initial decoding model for sequence labeling.

9. A model training method, characterized in that: include: Acquire a training data set, the training data set comprising training samples, training titles of the training samples, true sequence labels of the training samples, and true sequence labels of the training titles; Using the training data set to train a preset initial title model to obtain a title generation model; The true sequence label of the training sample is obtained by performing sequence labeling on each sample segment in the training sample, and is used to reflect the importance of each sample segment in the training sample; the true sequence label of the training title is obtained by performing sequence labeling on each title segment in the training title, and is used to reflect the importance of each title segment in the training title; The title generation model includes a target encoding model and a target decoding model, the initial title model includes an initial encoding model and an initial decoding model, and the using the training data set to train the preset initial title model to obtain the title generation model includes: The initial coding model is trained according to the training samples and the true sequence labels of the training samples, and the parameters in the initial coding model are updated using a first loss function to obtain the target coding model; Training the initial decoding model according to the training title and the true sequence label of the training title, and updating the parameters in the initial decoding model using a second loss function to obtain the target decoding model; Among them, the first loss function is used to indicate the error loss between the true sequence label of the training sample and the predicted sequence label of the training sample, and the predicted sequence label of the training sample is the predicted sequence label obtained by inputting the training sample into the initial encoding model for sequence labeling; the second loss function is used to indicate the error loss between the true sequence label of the training title and the predicted sequence label of the training title, and the predicted sequence label of the training title is the predicted sequence label obtained by inputting the training title into the initial decoding model for sequence labeling.

10. A title generating device, characterized in that: include: An acquisition module, used to acquire the text to be predicted; A generation module, used to perform sequence annotation on the text segmentation in the text to be predicted, and generate a title based on the sequence annotation tags obtained by the sequence annotation to obtain a text title of the text to be predicted; The sequence annotation tag is used to reflect the importance of the text segmentation in the text to be predicted; The text title includes m target title segmentations, each of which corresponds to a title segmentation position, and m is a positive integer. The generation module is specifically used for: According to the sequence label and the text to be predicted, the label and title segmentation are predicted for each of the title segmentation positions, to obtain the predicted label for each of the title segmentation positions, at least one predicted title segmentation for each of the title segmentation positions, and the predicted probability of the predicted title segmentation; According to the predicted annotation label of each of the title segmentation positions and the predicted probability of the predicted title segmentation, the target title segmentation located at each of the title segmentation positions is determined from at least one predicted title segmentation at each of the title segmentation positions, thereby obtaining the text title of the text to be predicted.

11. A model training device, characterized in that: include: An acquisition module, used to acquire a training data set, wherein the training data set includes training samples, training titles of the training samples, true sequence labels of the training samples, and true sequence labels of the training titles; A training module, used to train a preset initial title model using the training data set to obtain a title generation model; The true sequence label of the training sample is obtained by performing sequence labeling on each sample segment in the training sample, and is used to reflect the importance of each sample segment in the training sample; the true sequence label of the training title is obtained by performing sequence labeling on each title segment in the training title, and is used to reflect the importance of each title segment in the training title; The training module is specifically used for: The initial coding model is trained according to the training samples and the true sequence labels of the training samples, and the parameters in the initial coding model are updated using a first loss function to obtain a target coding model; Training the initial decoding model according to the training title and the true sequence label of the training title, and updating the parameters in the initial decoding model using a second loss function to obtain a target decoding model; Among them, the first loss function is used to indicate the error loss between the true sequence label of the training sample and the predicted sequence label of the training sample, and the predicted sequence label of the training sample is the predicted sequence label obtained by inputting the training sample into the initial encoding model for sequence labeling; the second loss function is used to indicate the error loss between the true sequence label of the training title and the predicted sequence label of the training title, and the predicted sequence label of the training title is the predicted sequence label obtained by inputting the training title into the initial decoding model for sequence labeling.

12. An electronic device, characterized in that: The invention comprises a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors to execute the operation instructions corresponding to the method as claimed in any one of claims 1 to 7, or the operation instructions corresponding to the method as claimed in claim 9.

13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the program implements the steps corresponding to the method according to any one of claims 1 to 7; or implements the steps corresponding to the method according to claim 9.