Text summary generation method, device, electronic device and storage medium

By extracting and annotating named entities in corpus text, building a neural network model, optimizing the BERT model, the problem of low accuracy in the recognition of named entities in the proprietary field in the existing technology is solved, and the accuracy of text summary is improved Spend.

CN113935328BActive Publication Date: 2024-11-05PINGAN INT SMART CITY TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

When existing text summary generation methods use pre-trained language models, it is difficult to correctly generate named entities in proprietary fields, resulting in low accuracy of generated text summary.

Method used

By obtaining multiple corpus texts, extracting and annotating named entities, building a neural network model of BiLSTM-CRF and attention mechanism, training the BERT model to optimize text summary generation and reducing named entity errors.

Benefits of technology

Improves the accuracy of named entities in text summary, reduces generation errors, and enhances the overall accuracy of text summary.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113935328B_ABST
    Figure CN113935328B_ABST
Patent Text Reader

Abstract

The present invention relates to the field of artificial intelligence technology, and provides a text summary generation method, device, electronic device and storage medium, extracts a first named entity in a corpus text, thereby generating a training text based on the corpus text and the first named entity, and training a BERT model based on multiple training texts, outputs a predicted text summary through the trained BERT model, and after obtaining a second named entity in the predicted text summary, generates an overall risk loss value based on the first named entity, the predicted text summary and the second named entity, thereby optimizing the BERT model based on the overall risk loss value, obtaining a text summary generation model, and finally using the text summary generation model to generate a text summary of a target text. The present invention improves the accuracy of named entities in the text summary by introducing named entities to train the BERT model, and then predicts the text summary through the BERT model, thereby reducing the situation of named entity errors in the text summary and improving the accuracy of generating the text summary.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Text summarization is to select important information from a long text and recompose it into a new short text. The two texts have the same semantics and express similar content with fewer words. In the environment of information explosion, it can help people quickly understand the content of the entire article without having to read a lot of text.

[0003] In the process of realizing the present invention, the inventors found that the existing text summary generation methods mainly use pre-trained language models, such as RoBerta2RoBerta, BART, Pegasus, etc., but such pre-trained language models are trained using public corpora, and the public corpora contain less proprietary domain information (such as medical), which makes it difficult to correctly generate proper nouns (named entities) in proprietary domains, resulting in frequent errors in the named entities in the generated text summary and low accuracy of the generated text summary. Summary of the invention

[0004] In view of the above, it is necessary to propose a text summary generation method, device, electronic device and storage medium, which introduce named entities to reduce the occurrence of named entity errors in the generated text summary and improve the accuracy of the generated text summary.

[0005] A first aspect of the present invention provides a method for generating a text summary, the method comprising:

[0006] Acquire multiple corpus texts, and extract the first named entity in each of the corpus texts;

[0007] Generate training text based on the corpus text and the corresponding first named entity, and train the BERT model based on a plurality of the training texts;

[0008] Obtain a predicted text summary output by the BERT model, and obtain a second named entity in the predicted text summary;

[0009] generating an overall risk loss value according to the first named entity, the predicted text summary, and the second named entity;

[0010] Optimizing the BERT model based on the overall risk loss value to obtain a text summary generation model;

[0011] A text summary of the target text is generated using the text summary generation model.

[0012] According to an optional implementation of the present invention, extracting the first named entity in each of the corpus texts includes:

[0013] Determining the selected corpus texts from the corpus texts as a training set;

[0014] Preprocessing each corpus text in the training set;

[0015] Perform named entity annotation on the preprocessed corpus text to obtain annotated corpus set;

[0016] Build a neural network model based on BiLSTM-CRF and attention mechanism;

[0017] Training the neural network model based on the annotated corpus to obtain a named entity recognition model;

[0018] The named entity recognition model is used to recognize the named entities of the corpus text that are not selected by the user in the corpus text to obtain the first named entity.

[0019] According to an optional embodiment of the present invention, the preprocessing of each corpus text in the training set includes:

[0020] Perform word segmentation processing on the corpus text to obtain multiple keywords; use a preset word embedding model to obtain a word vector for each keyword in the corpus text;

[0021] The word segmentation processing of the corpus text to obtain multiple keywords includes: segmenting the corpus text according to a preset dictionary to obtain multiple segmentation paths and multiple segmentation words corresponding to each segmentation path; calculating the path score of each segmentation path according to the segmentation weight of each segmentation word in the preset dictionary; and determining multiple keywords of the corpus text according to the path score.

[0022] According to an optional implementation of the present invention, before segmenting the corpus text according to a preset dictionary, the method further includes:

[0023] Acquire a domain text set, wherein the domain text set includes a plurality of domain texts and a plurality of domain keywords;

[0024] Calculate the number of keywords of each of the field keywords in the plurality of field texts;

[0025] Calculating the importance of each of the domain keywords according to the number of the keywords and the number of the plurality of domain texts;

[0026] The word segmentation weight of each of the domain keywords is calculated according to the importance of the domain keywords.

[0027] According to an optional implementation of the present invention, the training of the neural network model based on the annotated corpus to obtain the named entity recognition model includes:

[0028] Constructing an entity boundary feature vector, wherein the entity boundary feature vector includes an entity starting position mark vector and an entity length mark vector;

[0029] The word vector of the corpus text, the named entity label vector, the entity start position mark vector and the entity length mark vector are spliced ​​and input into the input layer of the neural network model;

[0030] Inputting the word vector obtained by the input layer into the BiLSTM layer and the attention mechanism layer of the neural network model;

[0031] Obtaining a bidirectional feature vector of the word vector at the BiLSTM layer;

[0032] In the attention mechanism layer, the position vector representing the word vector sequence and the bidirectional feature vector are concatenated and weight coefficients are assigned to obtain a feature vector;

[0033] Obtaining a label sequence calculated by the feature vector at a CRF layer of the neural network model;

[0034] Outputting the labeled sequence at an output layer of the neural network model;

[0035] The neural network model is iteratively trained based on the annotation sequence until a preset number of iterations is reached or the model loss value meets a preset condition, thereby obtaining the named entity recognition model.

[0036] According to an optional implementation of the present invention, generating a training text based on the corpus text and the corresponding first named entity includes:

[0037] Determine the first position of each character in each of the named entities in the corresponding corpus text;

[0038] Determine a second position of the named entity in the corresponding corpus text according to the first position;

[0039] According to the preset identifier, the corpus text and the corresponding named entity are concatenated with the position character corresponding to the second position to obtain a training text.

[0040] According to an optional implementation manner of the present invention, generating an overall risk loss value according to the first named entity, the predicted text summary and the second named entity includes:

[0041] Calculating a first risk loss value according to the predicted text summary and the corresponding real text summary;

[0042] Calculate a second risk loss value according to the first named entity and the corresponding second named entity;

[0043] An overall risk loss value is calculated based on the first risk loss value and the second risk loss value.

[0044] A second aspect of the present invention provides a text summary generating device, the device comprising:

[0045] An extraction module, used for acquiring a plurality of corpus texts and extracting a first named entity in each of the corpus texts;

[0046] A training module, used to generate training texts based on the corpus texts and the corresponding first named entities, and train a BERT model based on a plurality of the training texts;

[0047] An acquisition module, configured to acquire a predicted text summary output by the BERT model, and acquire a second named entity in the predicted text summary;

[0048] A first generating module, configured to generate an overall risk loss value according to the first named entity, the predicted text summary and the second named entity;

[0049] An optimization module, used for optimizing the BERT model based on the overall risk loss value to obtain a text summary generation model;

[0050] The second generation module is used to generate a text summary of the target text using the text summary generation model.

[0051] A third aspect of the present invention provides an electronic device, the electronic device comprising a processor, the processor being configured to implement the text summary generation method when executing a computer program stored in a memory.

[0052] A fourth aspect of the present invention provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the text summary generation method is implemented.

[0053] In summary, the text summary generation method, device, electronic device and storage medium described in the present invention extract the first named entity in each acquired corpus text, thereby generating a training text based on the corpus text and the corresponding first named entity, and training the BERT model based on multiple training texts, and outputting a predicted text summary through the trained BERT model, and after acquiring the second named entity in the predicted text summary, generating an overall risk loss value based on the first named entity, the predicted text summary and the second named entity, thereby optimizing the BERT model based on the overall risk loss value to obtain a text summary generation model, and finally using the text summary generation model to generate a text summary of the target text. The present invention can improve the accuracy of the named entities in the predicted text summary by introducing named entities to train the BERT model, and then predicting the text summary through the trained BERT model, thereby reducing the situation of named entity errors in the generated text summary and improving the accuracy of the generated text summary. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] Figure 1 It is a flowchart of the text summary generation method provided in Example 1 of the present invention.

[0055] Figure 2 It is a structural diagram of a text summary generating device provided in Embodiment 2 of the present invention.

[0056] Figure 3 It is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION

[0057] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that the embodiments of the present invention and the features in the embodiments can be combined with each other without conflict.

[0058] Unless otherwise defined, all technical and scientific terms used in the present invention have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used in the specification of the present invention are only for the purpose of describing the embodiments in an optional embodiment and are not intended to limit the present invention.

[0059] The text summary generation method provided in the embodiment of the present invention is executed by an electronic device, and accordingly, the text summary generation device runs in the electronic device.

[0060] Embodiment 1

[0061] Figure 1This is a flowchart of a text summary generation method provided in Embodiment 1 of the present invention. The text summary generation method specifically includes the following steps. According to different requirements, the order of the steps in the flowchart can be changed, and some steps can be omitted.

[0062] S11, obtaining a plurality of corpus texts, and extracting a first named entity in each of the corpus texts.

[0063] The electronic device may store a corpus in a local database in advance, where the corpus includes a plurality of corpus texts, and the plurality of corpus texts may be public corpus texts.

[0064] In response to the target trigger instruction, the electronic device obtains multiple corpus texts from the stored corpus set. The trigger instruction can be an acquisition instruction automatically triggered at a predetermined time point or within a predetermined time period, or can be an acquisition instruction triggered by a user.

[0065] After acquiring multiple corpus texts, the electronic device can extract named entities in each corpus text based on rule and dictionary methods, statistical methods, deep learning-based methods, etc. For ease of description, the named entities extracted from the corpus text are referred to as first named entities.

[0066] In an optional implementation, extracting the first named entity in each of the corpus texts includes:

[0067] Determining the selected corpus texts from the corpus texts as a training set;

[0068] Preprocessing each corpus text in the training set;

[0069] Perform named entity annotation on the preprocessed corpus text to obtain annotated corpus set;

[0070] Build a neural network model based on BiLSTM-CRF and attention mechanism;

[0071] Training the neural network model based on the annotated corpus to obtain a named entity recognition model;

[0072] The named entity recognition model is used to recognize the named entities of the corpus text that are not selected by the user in the corpus text to obtain the first named entity.

[0073] In this optional implementation, a named entity recognition model based on a bidirectional long short-term memory network-conditional random field BiLSTM-CRF and an attention mechanism is constructed to identify named entities in corpus text.

[0074] A preset number of corpus texts can be randomly selected as a training set, and then the selected corpus texts can be annotated with named entities using existing annotation methods such as the BIO method to obtain named entity label vectors, so that the selected corpus texts and the corresponding named entity label vectors can be used as annotated corpus sets to train a named entity recognition model, and then the named entities in the corpus texts other than the training set can be identified based on the trained named entity recognition model to obtain the first command entity.

[0075] Although all acquired corpus texts can be manually annotated, and manual annotation has higher accuracy, it is costly and inefficient. This optional embodiment only requires manual annotation of a small amount of corpus text, trains a named entity recognition model based on the small amount of manually annotated corpus text, and uses the named entity recognition model to automatically annotate the remaining corpus text, thereby reducing the workload of annotating named entities in the corpus text while obtaining named entities with higher accuracy.

[0076] Preprocessing the corpus text may include: performing word segmentation processing on the corpus text to obtain multiple keywords; and obtaining a word vector for each keyword in the corpus text using a preset word embedding model.

[0077] In some implementations, before preprocessing the corpus text, non-text data and garbled data in the corpus text may be removed first, thereby improving the efficiency of word segmentation processing on the corpus text.

[0078] In an optional implementation, the word segmentation processing is performed on the corpus text to obtain multiple keywords including:

[0079] Segmenting the corpus text according to a preset dictionary to obtain multiple segmentation paths and multiple segmentation words corresponding to each segmentation path;

[0080] Calculating a path score for each segmentation path according to the segmentation weight of each segmentation word in the preset dictionary;

[0081] According to the path score, a plurality of keywords of the corpus text are determined.

[0082] The preset dictionary stores a plurality of user-defined words and a word segmentation weight corresponding to each user-defined word, and the word segmentation weight is used to indicate the probability of the corresponding word segmentation being used. The larger the word segmentation weight, the greater the probability of the corresponding word segmentation being used, and the smaller the word segmentation weight, the smaller the probability of the corresponding word segmentation being used.

[0083] Different segmentation words can be obtained by segmenting the corpus text according to different custom words. After obtaining multiple segmentation paths, the electronic device can add up the segmentation weights corresponding to all the segmentation words in each segmentation path to obtain the path score of the segmentation path. For example, a segmentation path includes segmentation word W1, segmentation word W2, segmentation word W3, segmentation word W4, and segmentation word W5, wherein the segmentation weight of segmentation word W1 is Z1, the segmentation weight of segmentation word W2 is Z2, the segmentation weight of segmentation word W3 is Z3, the segmentation weight of segmentation word W4 is Z4, and the segmentation weight of segmentation word W5 is Z5. Then the path score of the segmentation path is the sum of Z1, Z2, Z3, Z4, and Z5.

[0084] The higher the path score, the higher the accuracy of segmenting the corpus text. The lower the path score, the lower the accuracy of segmenting the corpus text. The largest segmentation path is determined as the target path, and the multiple segmentation words corresponding to the target path are determined as multiple keywords.

[0085] This optional implementation manner segments the corpus text using a preset dictionary and calculates a path score for each segmentation path, and multiple keywords in the corpus text can be quickly and accurately determined based on the path scores.

[0086] In an optional implementation, before segmenting the corpus text according to a preset dictionary, the method further includes:

[0087] Acquire a domain text set, wherein the domain text set includes a plurality of domain texts and a plurality of domain keywords;

[0088] Calculate the number of keywords of each of the field keywords in the plurality of field texts;

[0089] Calculating the importance of each of the domain keywords according to the number of the keywords and the number of the plurality of domain texts;

[0090] The word segmentation weight of each of the domain keywords is calculated according to the importance of the domain keywords.

[0091] The domain text may refer to a text in a specific technical field, and the present invention does not impose any specific limitation thereto.

[0092] The electronic device can calculate the number of first texts of multiple field texts in the field text set, calculate the number of second texts of field texts containing a field keyword, and then calculate the logarithm of the ratio of the second text number to the first text number to obtain the importance of the field keyword.

[0093] After calculating the importance of each domain keyword, the electronic device calculates the product of the number of keywords and the corresponding importance of each domain keyword to obtain the segmentation weight of the domain keyword, and stores the mapping relationship between the domain keyword and the segmentation weight in the preset dictionary. Therefore, when performing segmentation processing on the corpus text, the corpus text is segmented based on the preset dictionary to obtain multiple segmentation paths and multiple segmentation segmentations corresponding to each segmentation path, and then the path score of each segmentation path is calculated according to the segmentation weight of each segmentation segmentation in the preset dictionary. Finally, according to the path score, multiple keywords of the corpus text are determined.

[0094] This optional implementation generates a word segmentation weight by using the keyword quantity and corresponding importance of the domain keyword, which can improve the influence of the word frequency of the domain keyword in the specific domain on the word segmentation weight, thereby improving the accuracy of the word segmentation weight. By storing the mapping relationship between the domain keyword and the word segmentation weight in the preset dictionary, it is beneficial to quickly segment the corpus text according to the preset dictionary, thereby improving the word segmentation efficiency of the corpus text; in addition, since the word segments in the corpus text all correspond to the domain keywords in the preset dictionary, the keywords obtained by segmenting the corpus text are all domain keywords, thereby improving the accuracy of word segmentation.

[0095] In an optional implementation, the training of the neural network model based on the annotated corpus to obtain a named entity recognition model includes:

[0096] Construct entity boundary feature vector;

[0097] The word vector of the corpus text, the named entity label vector, the entity start position mark vector and the entity length mark vector are spliced ​​and input into the input layer of the neural network model;

[0098] Inputting the word vector obtained by the input layer into the BiLSTM layer and the attention mechanism layer of the neural network model;

[0099] Obtaining a bidirectional feature vector of the word vector at the BiLSTM layer;

[0100] In the attention mechanism layer, the position vector representing the word vector sequence and the bidirectional feature vector are concatenated and weight coefficients are assigned to obtain a feature vector;

[0101] Obtaining a label sequence calculated by the feature vector at a CRF layer of the neural network model;

[0102] Outputting the labeled sequence at an output layer of the neural network model;

[0103] The neural network model is iteratively trained based on the annotation sequence until a preset number of iterations is reached or the model loss value meets a preset condition, thereby obtaining the named entity recognition model.

[0104] The entity boundary feature vector includes an entity start position mark vector and an entity length mark vector.

[0105] When extracting features of training data, multiple word segmentation features of the same named entity are normalized into features of the corresponding named entity, so as to train model parameters based on the features of the normalized named entity. When normalizing multiple character features of the same named entity, a weighted average method can be used, that is, multiple character features of the same named entity are weighted by a weight matrix to form features of the corresponding named entity. The weight matrix can be trained as a model parameter in model training.

[0106] In this optional implementation, since the training feature vector of the named entity recognition model includes an entity boundary feature vector, and the entity boundary feature vector represents the positional relationship of the corresponding named entity in the context, it is possible to solve the problem of low accuracy in named entity recognition caused by the entity boundary problem in the existing character-based named entity recognition model, thereby improving the performance of the named entity recognition model, thereby improving the accuracy of named entity recognition, and the improvement in the accuracy of named entity recognition can improve the performance of the trained BERT model and improve the predicted text summary output by the BERT model; in addition, the training feature vector of the named entity recognition model, in addition to the entity boundary feature vector of the training data, can also include the character vector of the training data and the named entity label vector, so that the trained named entity recognition model can further improve the recognition accuracy of the named entity based on the character vector of the input data to be recognized.

[0107] S12, generating training text based on the corpus text and the corresponding first named entity, and training the BERT model based on multiple training texts.

[0108] After acquiring multiple corpus texts and extracting the first named entity in each corpus text, the electronic device generates a training text based on each corpus text and the first named entity in the corpus text. The multiple training texts constitute a training set, and the BERT model is trained based on the training set.

[0109] In an optional implementation, generating a training text based on the corpus text and the corresponding first named entity includes:

[0110] Determine the first position of each character in each of the named entities in the corresponding corpus text;

[0111] Determine a second position of the named entity in the corresponding corpus text according to the first position;

[0112] According to the preset identifier, the corpus text and the corresponding named entity are concatenated with the position character corresponding to the second position to obtain a training text.

[0113] The characters corresponding to the named entity and the positional characters corresponding to its position are spliced ​​to the back of the corpus text, and the preset identifier SEP is added on both sides of the characters corresponding to the named entity and the positional characters corresponding to its position to indicate that this is a named entity. Exemplarily, assuming the position is (2, 4), the positional character corresponding to the position is "24". In the prior art, the BERT model is directly based on the corpus text as the input of the BERT model, that is, the BERT model is trained based on the corpus text, but the lack of domain information in the corpus text is ignored. Therefore, the prediction accuracy of the BERT model trained by the traditional method is poor. This embodiment uses the corpus text and the named entity as the input of the BERT model at the same time, which can not only retain the text information in the corpus text, but also add named entities to assist the BERT model in identifying the named entities in the corpus text, thereby improving the prediction accuracy of the BERT model.

[0114] S13, obtaining a predicted text summary output by the BERT model, and obtaining a second named entity in the predicted text summary.

[0115] The output of the BERT model is a generative summary text.

[0116] When training the BERT model, the BERT model needs to be fine-tuned to make the BERT model more suitable for downstream tasks. The downstream tasks in the present invention refer to text summary generation tasks in a specific field.

[0117] S14, generating an overall risk loss value according to the first named entity, the predicted text summary and the second named entity.

[0118] Usually when fine-tuning the BERT model, cross entropy is used to measure the gap between the predicted text summary and the true text summary, and the generation quality of the model is improved by reducing the cross entropy loss function.

[0119] This implementation determines the overall risk loss not only by the loss between the predicted text summary and the real text summary, but also by the loss between the first named entity in the corpus text and the corresponding second named entity in the predicted text summary.

[0120] In an optional implementation, generating an overall risk loss value according to the first named entity, the predicted text summary, and the second named entity includes:

[0121] Calculating a first risk loss value according to the predicted text summary and the corresponding real text summary;

[0122] Calculate a second risk loss value according to the first named entity and the corresponding second named entity;

[0123] An overall risk loss value is calculated based on the first risk loss value and the second risk loss value.

[0124] The real text summary is a text summary of the corpus text extracted manually. A first risk loss value is calculated based on the predicted text summary and the real text summary of each corpus text to evaluate the closeness between the predicted text summary and the real text summary.

[0125] In this optional implementation, in order to improve the quality of the named entities in the predicted text summary and reduce the error rate of the named entities, the error rate of the named entities is added to the overall loss function, as shown below:

[0126] Loss=CE(y pred ,y label )+λ*Loss ner ,

[0127] Loss ner =CE(ner(y pred ),ner(y label )).

[0128] loss=CE(y pred ,y label )+λ*loss ner loss ner =CE(ner(y pred ),ner(y label )) Among them, CE is cross entropy, y pred Represents the predicted text summary, y label Represents the true text summary, Loss ner Represents the error rate of named entities in text summaries, which is used to measure how different the named entities in the predicted text summaries are from those in the actual text summaries. ner The weight is a hyperparameter, which indicates how much penalty should be given for misidentifying named entities in the text summarization task. The larger the hyperparameter, the greater the penalty should be. ner(.) represents the named entity recognition model.

[0129] S15, optimizing the BERT model based on the overall risk loss value to obtain a text summary generation model.

[0130] The gradient descent method can be used to optimize the BERT model to obtain a text summary generation model.

[0131] S16, using the text summary generation model to generate a text summary of the target text.

[0132] The target text refers to the text that needs to be extracted from the text summary.

[0133] The target text is input into a text summary generation model, and a text summary of the target text is output through the text summary generation model.

[0134] The text summary generation method provided by the present invention is adopted to extract the first named entity in each acquired corpus text, thereby generating a training text based on the corpus text and the corresponding first named entity, and training a BERT model based on multiple training texts, and outputting a predicted text summary through the trained BERT model, and after acquiring the second named entity in the predicted text summary, generating an overall risk loss value according to the first named entity, the predicted text summary and the second named entity, thereby optimizing the BERT model based on the overall risk loss value, obtaining a text summary generation model, and finally using the text summary generation model to generate a text summary of the target text. The present invention can automatically extract important content that can cover the core idea of ​​the original text from an electronic text, and use a condensed text summary to represent the original lengthy text without losing any important meaning and information of the source document, providing an effective and quick way for people to quickly browse information and lock in their own points of interest, and by introducing named entities, effectively reducing the situation of named entity errors in the generated text summary, and improving the accuracy of the generated text summary.

[0135] Embodiment 2

[0136] Figure 2 It is a structural diagram of a text summary generating device provided in Embodiment 2 of the present invention.

[0137] In some embodiments, the text summary generating device 20 may include multiple functional modules composed of computer program segments. The computer programs of the various program segments in the text summary generating device 20 may be stored in a memory of an electronic device and executed by at least one processor to perform (see Figure 1 Description) Function of text summary generation.

[0138] In this embodiment, the text summary generating device 20 can be divided into a plurality of functional modules according to the functions performed. The functional modules may include: an extraction module 201, a training module 202, an acquisition module 203, a first generating module 204, an optimization module 205 and a second generating module 206. The module referred to in the present invention refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, which are stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.

[0139] The extraction module 201 is used to obtain multiple corpus texts and extract the first named entity in each of the corpus texts.

[0140] The electronic device may store a corpus in a local database in advance, where the corpus includes a plurality of corpus texts, and the plurality of corpus texts may be public corpus texts.

[0141] In response to the target trigger instruction, the electronic device obtains multiple corpus texts from the stored corpus set. The trigger instruction can be an acquisition instruction automatically triggered at a predetermined time point or within a predetermined time period, or can be an acquisition instruction triggered by a user.

[0142] After acquiring multiple corpus texts, the electronic device can extract named entities in each corpus text based on rule and dictionary methods, statistical methods, deep learning-based methods, etc. For ease of description, the named entities extracted from the corpus text are referred to as first named entities.

[0143] In an optional implementation, the extraction module 201 extracts the first named entity in each of the corpus texts including:

[0144] Determining the selected corpus texts from the corpus texts as a training set;

[0145] Preprocessing each corpus text in the training set;

[0146] Perform named entity annotation on the preprocessed corpus text to obtain annotated corpus set;

[0147] Build a neural network model based on BiLSTM-CRF and attention mechanism;

[0148] Training the neural network model based on the annotated corpus to obtain a named entity recognition model;

[0149] The named entity recognition model is used to recognize the named entities of the corpus text that are not selected by the user in the corpus text to obtain the first named entity.

[0150] In this optional implementation, a named entity recognition model based on a bidirectional long short-term memory network-conditional random field BiLSTM-CRF and an attention mechanism is constructed to identify named entities in corpus text.

[0151] A preset number of corpus texts can be randomly selected as a training set, and then the selected corpus texts can be annotated with named entities using existing annotation methods such as the BIO method to obtain named entity label vectors, so that the selected corpus texts and the corresponding named entity label vectors can be used as annotated corpus sets to train a named entity recognition model, and then the named entities in the corpus texts other than the training set can be identified based on the trained named entity recognition model to obtain the first command entity.

[0152] Although all acquired corpus texts can be manually annotated, and manual annotation has higher accuracy, it is costly and inefficient. This optional embodiment only requires manual annotation of a small amount of corpus text, trains a named entity recognition model based on the small amount of manually annotated corpus text, and uses the named entity recognition model to automatically annotate the remaining corpus text, thereby reducing the workload of annotating named entities in the corpus text while obtaining named entities with higher accuracy.

[0153] Preprocessing the corpus text may include: performing word segmentation processing on the corpus text to obtain multiple keywords; and obtaining a word vector for each keyword in the corpus text using a preset word embedding model.

[0154] In some implementations, before preprocessing the corpus text, non-text data and garbled data in the corpus text may be removed first, thereby improving the efficiency of word segmentation processing on the corpus text.

[0155] In an optional implementation, the word segmentation processing is performed on the corpus text to obtain multiple keywords including:

[0156] Segmenting the corpus text according to a preset dictionary to obtain multiple segmentation paths and multiple segmentation words corresponding to each segmentation path;

[0157] Calculating a path score for each segmentation path according to the segmentation weight of each segmentation word in the preset dictionary;

[0158] According to the path score, a plurality of keywords of the corpus text are determined.

[0159] The preset dictionary stores a plurality of user-defined words and a word segmentation weight corresponding to each user-defined word, and the word segmentation weight is used to indicate the probability of the corresponding word segmentation being used. The larger the word segmentation weight, the greater the probability of the corresponding word segmentation being used, and the smaller the word segmentation weight, the smaller the probability of the corresponding word segmentation being used.

[0160] Different segmentation words can be obtained by segmenting the corpus text according to different custom words. After obtaining multiple segmentation paths, the electronic device can add up the segmentation weights corresponding to all the segmentation words in each segmentation path to obtain the path score of the segmentation path. For example, a segmentation path includes segmentation word W1, segmentation word W2, segmentation word W3, segmentation word W4, and segmentation word W5, wherein the segmentation weight of segmentation word W1 is Z1, the segmentation weight of segmentation word W2 is Z2, the segmentation weight of segmentation word W3 is Z3, the segmentation weight of segmentation word W4 is Z4, and the segmentation weight of segmentation word W5 is Z5. Then the path score of the segmentation path is the sum of Z1, Z2, Z3, Z4, and Z5.

[0161] The higher the path score, the higher the accuracy of segmenting the corpus text. The lower the path score, the lower the accuracy of segmenting the corpus text. The largest segmentation path is determined as the target path, and the multiple segmentation words corresponding to the target path are determined as multiple keywords.

[0162] This optional implementation manner segments the corpus text using a preset dictionary and calculates a path score for each segmentation path, and multiple keywords in the corpus text can be quickly and accurately determined based on the path scores.

[0163] In an optional implementation, before segmenting the corpus text according to a preset dictionary, the electronic device further includes:

[0164] Acquire a domain text set, wherein the domain text set includes a plurality of domain texts and a plurality of domain keywords;

[0165] Calculate the number of keywords of each of the field keywords in the plurality of field texts;

[0166] Calculating the importance of each of the domain keywords according to the number of the keywords and the number of the plurality of domain texts;

[0167] The word segmentation weight of each of the domain keywords is calculated according to the importance of the domain keywords.

[0168] The domain text may refer to a text in a specific technical field, and the present invention does not impose any specific limitation thereto.

[0169] The electronic device can calculate the number of first texts of multiple field texts in the field text set, calculate the number of second texts of field texts containing a field keyword, and then calculate the logarithm of the ratio of the second text number to the first text number to obtain the importance of the field keyword.

[0170] After calculating the importance of each domain keyword, the electronic device calculates the product of the number of keywords and the corresponding importance of each domain keyword to obtain the segmentation weight of the domain keyword, and stores the mapping relationship between the domain keyword and the segmentation weight in the preset dictionary. Therefore, when performing segmentation processing on the corpus text, the corpus text is segmented based on the preset dictionary to obtain multiple segmentation paths and multiple segmentation segmentations corresponding to each segmentation path, and then the path score of each segmentation path is calculated according to the segmentation weight of each segmentation segmentation in the preset dictionary. Finally, according to the path score, multiple keywords of the corpus text are determined.

[0171] This optional implementation generates a word segmentation weight by using the keyword quantity and corresponding importance of the domain keyword, which can improve the influence of the word frequency of the domain keyword in the specific domain on the word segmentation weight, thereby improving the accuracy of the word segmentation weight. By storing the mapping relationship between the domain keyword and the word segmentation weight in the preset dictionary, it is beneficial to quickly segment the corpus text according to the preset dictionary, thereby improving the word segmentation efficiency of the corpus text; in addition, since the word segments in the corpus text all correspond to the domain keywords in the preset dictionary, the keywords obtained by segmenting the corpus text are all domain keywords, thereby improving the accuracy of word segmentation.

[0172] In an optional implementation, the training of the neural network model based on the annotated corpus to obtain a named entity recognition model includes:

[0173] Construct entity boundary feature vector;

[0174] The word vector of the corpus text, the named entity label vector, the entity start position mark vector and the entity length mark vector are spliced ​​and input into the input layer of the neural network model;

[0175] Inputting the word vector obtained by the input layer into the BiLSTM layer and the attention mechanism layer of the neural network model;

[0176] Obtaining a bidirectional feature vector of the word vector at the BiLSTM layer;

[0177] In the attention mechanism layer, the position vector representing the word vector sequence and the bidirectional feature vector are concatenated and weight coefficients are assigned to obtain a feature vector;

[0178] Obtaining a label sequence calculated by the feature vector at a CRF layer of the neural network model;

[0179] Outputting the labeled sequence at an output layer of the neural network model;

[0180] The neural network model is iteratively trained based on the annotation sequence until a preset number of iterations is reached or the model loss value meets a preset condition, thereby obtaining the named entity recognition model.

[0181] The entity boundary feature vector includes an entity start position mark vector and an entity length mark vector.

[0182] When extracting features of training data, multiple word segmentation features of the same named entity are normalized into features of the corresponding named entity, so as to train model parameters based on the features of the normalized named entity. When normalizing multiple character features of the same named entity, a weighted average method can be used, that is, multiple character features of the same named entity are weighted by a weight matrix to form features of the corresponding named entity. The weight matrix can be trained as a model parameter in model training.

[0183] In this optional implementation, since the training feature vector of the named entity recognition model includes an entity boundary feature vector, and the entity boundary feature vector represents the positional relationship of the corresponding named entity in the context, it is possible to solve the problem of low accuracy in named entity recognition caused by the entity boundary problem in the existing character-based named entity recognition model, thereby improving the performance of the named entity recognition model, thereby improving the accuracy of named entity recognition, and the improvement in the accuracy of named entity recognition can improve the performance of the trained BERT model and improve the predicted text summary output by the BERT model; in addition, the training feature vector of the named entity recognition model, in addition to the entity boundary feature vector of the training data, can also include the character vector of the training data and the named entity label vector, so that the trained named entity recognition model can further improve the recognition accuracy of the named entity based on the character vector of the input data to be recognized.

[0184] The training module 202 is used to generate training text based on the corpus text and the corresponding first named entity, and train the BERT model based on multiple training texts.

[0185] After acquiring multiple corpus texts and extracting the first named entity in each corpus text, the electronic device generates a training text based on each corpus text and the first named entity in the corpus text. The multiple training texts constitute a training set, and the BERT model is trained based on the training set.

[0186] In an optional implementation, the training module 202 generates a training text based on the corpus text and the corresponding first named entity, including:

[0187] Determine the first position of each character in each of the named entities in the corresponding corpus text;

[0188] Determine a second position of the named entity in the corresponding corpus text according to the first position;

[0189] According to the preset identifier, the corpus text and the corresponding named entity are concatenated with the position character corresponding to the second position to obtain a training text.

[0190] The character corresponding to the named entity and the position character corresponding to its position are concatenated to the end of the corpus text, and a preset identifier SEP is added on both sides of the character corresponding to the named entity and the position character corresponding to its position to indicate that this is a named entity. For example, assuming the position is (2, 4), the position character corresponding to the position is "24".

[0191] In the prior art, the BERT model is directly based on the corpus text as the input, that is, the BERT model is trained based on the corpus text, but the lack of domain information in the corpus text is ignored, so the prediction accuracy of the BERT model trained by the traditional method is poor. This embodiment uses the corpus text and the named entity as the input of the BERT model at the same time, which can not only retain the text information in the corpus text, but also add the named entity to assist the BERT model in identifying the named entity in the corpus text, thereby improving the prediction accuracy of the BERT model.

[0192] The acquisition module 203 is used to obtain the predicted text summary output by the BERT model, and obtain the second named entity in the predicted text summary.

[0193] The output of the BERT model is a generative summary text.

[0194] When training the BERT model, the BERT model needs to be fine-tuned to make the BERT model more suitable for downstream tasks. The downstream tasks in the present invention refer to text summary generation tasks in a specific field.

[0195] The first generating module 204 is used to generate an overall risk loss value according to the first named entity, the predicted text summary and the second named entity.

[0196] Usually when fine-tuning the BERT model, cross entropy is used to measure the gap between the predicted text summary and the true text summary, and the generation quality of the model is improved by reducing the cross entropy loss function.

[0197] This implementation determines the overall risk loss not only by the loss between the predicted text summary and the real text summary, but also by the loss between the first named entity in the corpus text and the corresponding second named entity in the predicted text summary.

[0198] In an optional implementation, the first generating module 204 generates an overall risk loss value according to the first named entity, the predicted text summary and the second named entity, including:

[0199] Calculating a first risk loss value according to the predicted text summary and the corresponding real text summary;

[0200] Calculate a second risk loss value according to the first named entity and the corresponding second named entity;

[0201] An overall risk loss value is calculated based on the first risk loss value and the second risk loss value.

[0202] The real text summary is a text summary of the corpus text extracted manually. A first risk loss value is calculated based on the predicted text summary and the real text summary of each corpus text to evaluate the closeness between the predicted text summary and the real text summary.

[0203] In this optional implementation, in order to improve the quality of the named entities in the predicted text summary and reduce the error rate of the named entities, the error rate of the named entities is added to the overall loss function, as shown below:

[0204] Loss=CE(y pred ,y label )+λ*Loss ner ,

[0205] Loss ner =CE(ner(y pred ),ner(y label )).

[0206] loss=CE(y pred ,y label )+λ*loss ner loss ner =CE(ner(y pred ),ner(y label )) Among them, CE is cross entropy, y pred Represents the predicted text summary, y label Represents the true text summary, Loss nerRepresents the error rate of named entities in text summaries, which is used to measure how different the named entities in the predicted text summaries are from those in the actual text summaries. ner The weight is a hyperparameter, which indicates how much penalty should be given for misidentifying named entities in the text summarization task. The larger the hyperparameter, the greater the penalty should be. ner(.) represents the named entity recognition model.

[0207] The optimization module 205 is used to optimize the BERT model based on the overall risk loss value to obtain a text summary generation model.

[0208] The gradient descent method can be used to optimize the BERT model to obtain a text summary generation model.

[0209] The second generating module 206 is used to generate a text summary of the target text using the text summary generation model.

[0210] The target text refers to the text that needs to be extracted from the text summary.

[0211] The target text is input into a text summary generation model, and a text summary of the target text is output through the text summary generation model.

[0212] The text summary generation device provided by the present invention is used to extract the first named entity in each acquired corpus text, thereby generating a training text based on the corpus text and the corresponding first named entity, and training a BERT model based on multiple training texts, and outputting a predicted text summary through the trained BERT model. After obtaining the second named entity in the predicted text summary, an overall risk loss value is generated according to the first named entity, the predicted text summary and the second named entity, thereby optimizing the BERT model based on the overall risk loss value to obtain a text summary generation model, and finally using the text summary generation model to generate a text summary of the target text. The present invention can automatically extract important content that can cover the core idea of ​​the original text from an electronic text, and use a condensed text summary to represent the original lengthy text without losing any important meaning and information of the source document, providing an effective and quick way for people to quickly browse information and lock in their own points of interest, and by introducing named entities, effectively reducing the situation of named entity errors in the generated text summary, and improving the accuracy of the generated text summary.

[0213] Embodiment 3

[0214] This embodiment provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps in the above-mentioned text summary generation method embodiment are implemented, such as Figure 1 S11-S15 shown:

[0215] S11, obtaining a plurality of corpus texts, and extracting a first named entity in each of the corpus texts;

[0216] S12, generating training texts based on the corpus texts and the corresponding first named entities, and training a BERT model based on a plurality of the training texts;

[0217] S13, obtaining a predicted text summary output by the BERT model, and obtaining a second named entity in the predicted text summary;

[0218] S14, generating an overall risk loss value according to the first named entity, the predicted text summary and the second named entity;

[0219] S15, optimizing the BERT model based on the overall risk loss value to obtain a text summary generation model;

[0220] S16, using the text summary generation model to generate a text summary of the target text.

[0221] Alternatively, when the computer program is executed by a processor, the functions of each module / unit in the above-mentioned device embodiment are realized, for example Figure 2 Modules 201-206:

[0222] The extraction module 201 is used to obtain multiple corpus texts and extract the first named entity in each of the corpus texts;

[0223] The training module 202 is used to generate training texts based on the corpus texts and the corresponding first named entities, and train the BERT model based on the plurality of training texts;

[0224] The acquisition module 203 is used to acquire the predicted text summary output by the BERT model, and acquire the second named entity in the predicted text summary;

[0225] The first generating module 204 is used to generate an overall risk loss value according to the first named entity, the predicted text summary and the second named entity;

[0226] The optimization module 205 is used to optimize the BERT model based on the overall risk loss value to obtain a text summary generation model;

[0227] The second generating module 206 is used to generate a text summary of the target text using the text summary generation model.

[0228] Embodiment 4

[0229] See also Figure 3FIG. 2 is a schematic diagram of the structure of an electronic device provided in Embodiment 3 of the present invention. In a preferred embodiment of the present invention, the electronic device 3 includes a memory 31 , at least one processor 32 , at least one communication bus 33 and a transceiver 34 .

[0230] Those skilled in the art should understand that Figure 3 The structure of the electronic device shown does not constitute a limitation of the embodiments of the present invention, and may be a bus structure or a star structure. The electronic device 3 may also include more or less other hardware or software than shown in the figure, or a different component arrangement.

[0231] In some embodiments, the electronic device 3 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits, programmable gate arrays, digital processors, and embedded devices. The electronic device 3 may also include client devices, which include but are not limited to any electronic product that can interact with a client through a keyboard, mouse, remote control, touchpad, or voice-controlled device, such as a personal computer, tablet computer, smart phone, digital camera, etc.

[0232] It should be noted that the electronic device 3 is only an example, and other existing or future electronic products that are suitable for the present invention should also be included in the protection scope of the present invention and included here by reference.

[0233] In some embodiments, the memory 31 stores a computer program, and when the computer program is executed by the at least one processor 32, all or part of the steps in the text summary generation method as described above are implemented. The memory 31 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data.

[0234] Furthermore, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc.

[0235] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.

[0236] In some embodiments, the at least one processor 32 is the control core (ControlUnit) of the electronic device 3, and uses various interfaces and lines to connect various components of the entire electronic device 3, and executes various functions and processes data of the electronic device 3 by running or executing programs or modules stored in the memory 31, and calling data stored in the memory 31. For example, when the at least one processor 32 executes the computer program stored in the memory, it implements all or part of the steps of the text summary generation method described in the embodiment of the present invention; or implements all or part of the functions of the text summary generation device. The at least one processor 32 can be composed of an integrated circuit, for example, it can be composed of a single packaged integrated circuit, or it can be composed of multiple integrated circuits with the same function or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and various control chips.

[0237] In some embodiments, the at least one communication bus 33 is configured to implement connection and communication between the memory 31 and the at least one processor 32, etc.

[0238] Although not shown, the electronic device 3 may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 32 through a power management device, so that the power management device can manage charging, discharging, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device 3 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0239] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium and includes a number of instructions for enabling a computer device (which can be a personal computer, electronic device, or network device, etc.) or a processor to execute a part of the method described in each embodiment of the present invention.

[0240] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0241] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0242] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.

[0243] It is obvious to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the present invention can be implemented in other specific forms without departing from the spirit or essential features of the present invention. Therefore, from any point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present invention is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any figure mark in the claims should not be regarded as limiting the claims involved. In addition, it is obvious that the word "including" does not exclude other units or, and the singular does not exclude the plural. Multiple units or devices stated in the specification may also be implemented by one unit or device through software or hardware. The words first, second, etc. are used to indicate names, and do not indicate any particular order.

[0244] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.

Claims

1. A text summary generation method, characterized in that: The method comprises: Acquire multiple corpus texts, and extract the first named entity in each of the corpus texts, including: determining the selected corpus texts in the corpus texts as a training set; preprocessing each corpus text in the training set; annotating the preprocessed corpus texts with named entities to obtain a named entity label vector, and using the corpus texts and the named entity label vector as an annotated corpus; constructing a neural network model based on BiLSTM-CRF and an attention mechanism; training the neural network model based on the annotated corpus to obtain a named entity recognition model; using the named entity recognition model to recognize the named entities of the corpus texts that are not selected by the user in the corpus texts to obtain the first named entity; wherein, the preprocessing of each corpus text in the training set includes: performing word segmentation processing on the corpus text to obtain multiple keywords; obtaining the word vector of each keyword in the corpus text using a preset word embedding model; training the neural network model based on the annotated corpus to obtain The named entity recognition model includes: constructing an entity boundary feature vector, the entity boundary feature vector includes an entity start position mark vector and an entity length mark vector; splicing the word vector of the corpus text, the named entity label vector, the entity start position mark vector and the entity length mark vector and inputting them into the input layer of the neural network model; inputting the word vector obtained from the input layer into the BiLSTM layer and the attention mechanism layer of the neural network model; obtaining the bidirectional feature vector of the word vector in the BiLSTM layer; splicing the position vector representing the order of the word vector and the bidirectional feature vector in the attention mechanism layer and assigning weight coefficients to obtain a feature vector; obtaining the label sequence calculated by the feature vector in the CRF layer of the neural network model; outputting the label sequence in the output layer of the neural network model; iteratively training the neural network model based on the label sequence until a preset number of iterations is reached or the model loss value meets a preset condition, thereby obtaining the named entity recognition model; Generating a training text based on the corpus text and the corresponding first named entity includes: determining a first position of each character in each of the named entities in the corresponding corpus text; determining a second position of the named entity in the corresponding corpus text according to the first position; and concatenating the corpus text and the corresponding named entity with the position character corresponding to the second position according to a preset identifier to obtain a training text; Training a BERT model based on a plurality of the training texts; Obtain a predicted text summary output by the BERT model, and obtain a second named entity in the predicted text summary; generating an overall risk loss value according to the first named entity, the predicted text summary, and the second named entity; Optimizing the BERT model based on the overall risk loss value to obtain a text summary generation model; Generate a text summary of the target text using the text summary generation model.

2. The text summary generation method according to claim 1, characterized in that: The word segmentation process of the corpus text is performed to obtain a plurality of keywords including: Segmenting the corpus text according to a preset dictionary to obtain multiple segmentation paths and multiple segmentation words corresponding to each segmentation path; Calculating a path score for each segmentation path according to the segmentation weight of each segmentation word in the preset dictionary; According to the path score, a plurality of keywords of the corpus text are determined.

3. The text summary generation method according to claim 2, characterized in that: Before segmenting the corpus text according to the preset dictionary, the method further includes: Acquire a domain text set, wherein the domain text set includes a plurality of domain texts and a plurality of domain keywords; Calculate the keyword quantity of each of the field keywords in the plurality of field texts; Calculating the importance of each of the domain keywords according to the number of the keywords and the number of the plurality of domain texts; The word segmentation weight of each of the domain keywords is calculated according to the importance of the domain keywords.

4. The text summary generation method according to any one of claims 1 to 3, characterized in that: Generating an overall risk loss value according to the first named entity, the predicted text summary, and the second named entity comprises: Calculating a first risk loss value according to the predicted text summary and the corresponding real text summary; Calculate a second risk loss value according to the first named entity and the corresponding second named entity; An overall risk loss value is calculated based on the first risk loss value and the second risk loss value.

5. A text summary generation device, characterized in that: The device comprises: The extraction module is used to obtain multiple corpus texts and extract the first named entity in each of the corpus texts, including: determining the selected corpus texts in the corpus texts as a training set; preprocessing each corpus text in the training set; annotating the preprocessed corpus texts with named entities to obtain a named entity label vector, and using the corpus texts and the named entity label vector as a labeled corpus; constructing a neural network model based on BiLSTM-CRF and an attention mechanism; training the neural network model based on the labeled corpus to obtain a named entity recognition model; using the named entity recognition model to recognize the named entities of the corpus texts that are not selected by the user in the corpus texts to obtain the first named entity; wherein the preprocessing of each corpus text in the training set includes: performing word segmentation processing on the corpus text to obtain multiple keywords; using a preset word embedding model to obtain a word vector for each keyword in the corpus text; and training the neural network model based on the labeled corpus to obtain a named entity recognition model. The training to obtain a named entity recognition model includes: constructing an entity boundary feature vector, the entity boundary feature vector includes an entity start position mark vector and an entity length mark vector; splicing the word vector of the corpus text, the named entity label vector, the entity start position mark vector and the entity length mark vector and inputting them into the input layer of the neural network model; inputting the word vector obtained from the input layer into the BiLSTM layer and the attention mechanism layer of the neural network model; obtaining a bidirectional feature vector of the word vector in the BiLSTM layer; splicing the position vector representing the order of the word vector and the bidirectional feature vector in the attention mechanism layer and assigning weight coefficients to obtain a feature vector; obtaining a label sequence calculated by the feature vector in the CRF layer of the neural network model; outputting the label sequence in the output layer of the neural network model; iteratively training the neural network model based on the label sequence until a preset number of iterations is reached or the model loss value meets a preset condition, thereby obtaining the named entity recognition model; A training module, for generating a training text based on the corpus text and the corresponding first named entity, comprising: determining a first position of each character in each of the named entities in the corresponding corpus text; determining a second position of the named entity in the corresponding corpus text according to the first position; concatenating the corpus text and the corresponding named entity with the position character corresponding to the second position according to a preset identifier to obtain a training text; the training module is also used to train a BERT model based on a plurality of the training texts; An acquisition module, configured to acquire a predicted text summary output by the BERT model, and acquire a second named entity in the predicted text summary; A first generating module, configured to generate an overall risk loss value according to the first named entity, the predicted text summary and the second named entity; An optimization module, used for optimizing the BERT model based on the overall risk loss value to obtain a text summary generation model; The second generation module is used to generate a text summary of the target text using the text summary generation model.

6. An electronic device, characterized in that: The electronic device includes a processor and a memory, and the processor is used to implement the text summary generation method according to any one of claims 1 to 4 when executing the computer program stored in the memory.

7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the text summary generation method according to any one of claims 1 to 4 is implemented.