CN114676669A - Method and device for generating event abstract text, electronic equipment and storage medium - Google Patents

Method and device for generating event abstract text, electronic equipment and storage medium Download PDF

Info

Publication number
CN114676669A
CN114676669A CN202210399705.XA CN202210399705A CN114676669A CN 114676669 A CN114676669 A CN 114676669A CN 202210399705 A CN202210399705 A CN 202210399705A CN 114676669 A CN114676669 A CN 114676669A
Authority
CN
China
Prior art keywords
sequence
event
text
sample
structured
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210399705.XA
Other languages
Chinese (zh)
Inventor
李锋
邹武合
张伟东
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202210399705.XA priority Critical patent/CN114676669A/en
Publication of CN114676669A publication Critical patent/CN114676669A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/12Use of codes for handling textual entities
    • G06F40/126Character encoding
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/30Semantic analysis

Abstract

The application provides a method and a device for generating an event summary text, electronic equipment and a storage medium, and the method and the device are used for acquiring an event structured information sequence which comprises a plurality of event description information and an event description type to which each event description information belongs; inputting the event structured information sequence into a pre-trained text generation model so that the text generation model outputs a predicted text sequence corresponding to each event description information, and determining the text sequence of a plurality of predicted text sequences according to the event description type; and splicing the plurality of predicted text sequences according to the text sequence of each predicted text sequence to obtain the event summary text. According to the method and the device, the acquired event structured information sequence is directly input into the text generation model, the predicted text sequence is obtained through the processing of the structured data by the text generation model, and then the event text abstract is obtained, so that the steps of generating natural language by data and the data processing amount are reduced, and the text generation efficiency is improved.

Description

Method and device for generating event abstract text, electronic equipment and storage medium
Technical Field
The present application relates to the field of data processing technologies, and in particular, to a method and an apparatus for generating an event summary text, an electronic device, and a storage medium.
Background
With the popularization of various sports, various events can be held in different season around the world, and how to report the progress of the events and the event results by forming effective characters is a problem to be solved urgently.
At present, with the development of deep learning technology and big data technology, the technology of automatically generating the abstract of the warfare newspaper is gradually mature, but in the process of generating the warfare newspaper by using a model, scattered event data needs to be converted into a natural language containing structured information in advance and then input into a prediction model for text generation, which means that a large amount of templates and data processing are needed to generate the natural language containing structured information meeting the model input standard, so that the data processing amount is large, and the text generation efficiency is low.
Disclosure of Invention
In view of the above, an object of the present application is to provide a method and an apparatus for generating an event summary text, an electronic device, and a storage medium, in which an acquired event structured information sequence is directly input into a text generation model, and a predicted text sequence is obtained by processing structured data through the text generation model, so as to obtain an event text summary, thereby reducing steps of generating natural language from data and data processing amount, and facilitating to improve text generation efficiency.
In a first aspect, an embodiment of the present application provides a method for generating an event summary text, where the method includes:
acquiring an event structured information sequence; the event structured information sequence comprises a plurality of event description information and an event description type of each event description information; the event description type comprises at least one of an event result type, an event participant type and an event time type;
inputting the event structured information sequence into a pre-trained text generation model, so that the text generation model outputs a predicted text sequence corresponding to each event description information according to each event description type and each event description information, and determines the text sequence of a plurality of predicted text sequences according to the event description types;
and splicing the plurality of predicted text sequences according to the obtained text sequence of each predicted text sequence to obtain an event summary text so as to obtain key information of the event according to the event summary text.
In one possible embodiment, the text generation model includes a sequence embedding layer, a sequence coding layer and a predicted text sequence output layer; the inputting the event structured information sequence into a pre-trained text generation model to enable the text generation model to output a predicted text sequence corresponding to each event description information according to each event description type and each event description information includes:
inputting the event structured information sequence into the sequence embedding layer, so that the sequence embedding layer respectively encodes the event description types, the event description information and the positions of the event keywords in the event structured information sequence, and outputs a coding sequence corresponding to each event description information;
for each coding sequence, inputting the coding sequence into the sequence coding layer so that the sequence coding layer processes the coding sequence, predicting context information of event description information included in the coding sequence according to the event description type in the coding sequence, and outputting at least one candidate text sequence corresponding to the coding sequence according to the context information and the event description information;
and for each coding sequence, inputting at least one candidate text sequence corresponding to the coding sequence into the predicted text sequence output layer, so that the predicted text sequence output layer screens out the predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence.
In a possible embodiment, the predicted text sequence corresponding to the coding sequence is selected from the at least one candidate text sequence by:
determining a candidate text sequence with the highest prediction score in the at least one candidate text sequence as a predicted text sequence; or;
and determining the candidate text sequence meeting the prediction requirement in the at least one candidate text sequence as the predicted text sequence according to the predicted text requirement.
In one possible embodiment, the predicted-text requirement includes at least one of:
predicted text length, predicted text sentence pattern, and event text expression mode.
In one possible embodiment, the text order of the predicted text sequence is determined by:
and for each predicted text sequence, determining the text sequence of the predicted text sequence according to the text association sequence between the event description type corresponding to the predicted text sequence and other event description types.
In one possible embodiment, the text generation model is trained by:
acquiring a plurality of sample event structured sequences and sample abstract texts corresponding to the sample event structured sequences; each sample event structured sequence comprises a plurality of sample event description information and an event description type to which each sample event description information belongs;
determining a reference sample sequence corresponding to each sample event structured sequence; the reference sample sequence comprises a plurality of reference identification information, and the number of the reference identifications is the same as the number of the sample event description information in the sample event structured sequence;
inputting the plurality of sample event structured sequences, the plurality of reference sample sequences and the plurality of sample abstract texts into a pre-constructed language model, so that the language model is converted into tasks of the sample abstract texts through the sample event structured sequences and the tasks of the sample abstract texts into the sample event structured sequences, learning the context information of the description information of each sample event, and determining that the language model is trained to obtain the text generation model when the loss of the language model is less than a preset threshold value.
In one possible embodiment, the learning the context information of the description information of each sample event by the task of converting the language model into the sample summary text through the sample event structured sequence and the task of converting the sample summary text into the sample event structured sequence includes:
inputting the plurality of sample event structured sequences, the plurality of reference sample sequences and the plurality of sample abstract texts into a sequence embedding layer of the language model, so that the sequence embedding layer outputs a structured coding sequence corresponding to each sample event structured sequence, a reference coding sequence corresponding to each reference sample sequence and a text code corresponding to each sample abstract text;
and inputting the determined multiple structural coding sequences, the multiple reference coding sequences and the text codes into a sequence coding layer of the language model, so that the sequence coding layer predicts the target codes according to a sequence obtained by shielding at least one target code in the text codes and/or the structural coding sequences in a preset identification matrix, and determines the context information of the description information of each sample event.
In a possible embodiment, the event description type includes a fixed description type and a variable description type, and the generating method further includes:
and inputting the prediction sequence output by the sequence coding layer into an information copying layer of the language model aiming at each variable description type and the corresponding sample event description information, so that the information copying layer performs prediction learning on the sample event description information and adjusts the context information of the sample event description information corresponding to the variable description type.
In a possible embodiment, the preset identification matrix is used for representing a visible relation between the structured coding sequence, the reference coding sequence and the text coding; fitting and learning the context information of the event description information of each sample according to the visible relation among the structured coding sequence, the reference coding sequence and the text code;
in the process of training the language model, aiming at each coded data in each structured coded sequence, each data can obtain other coded data;
aiming at each reference encoding data in each reference encoding sequence, each reference encoding data can obtain a corresponding text code;
for each text encoding data in each text encoding, each text data can acquire the text encoding data positioned before the text data in the sequence;
where the invisible encoded data is the data to be predicted.
In one possible embodiment, the loss of the language model is determined by:
aiming at a task of converting a sample event structured sequence into a sample abstract text, calculating by combining the coded data in each sample event structured sequence and the shielded codes in the text codes corresponding to the sample abstract text and model parameters, and determining a first loss value;
for the task of converting the sample abstract text into the sample event structured sequence, calculating by combining the coded data in each sample event structured sequence, the shielded codes in the text codes corresponding to the sample abstract text and the shielded codes in the reference coding sequence and model parameters, and determining a second loss value;
and performing weighted calculation on the first loss value and the second loss value to determine the loss of the language model.
In a possible embodiment, the generating method further includes:
performing semantic analysis on the event abstract text to determine at least one event keyword;
and performing the reply analysis on the event based on the at least one event keyword and a preset event analysis rule.
In a second aspect, an embodiment of the present application further provides an apparatus for generating an event summary text, where the apparatus includes:
the information sequence acquisition module is used for acquiring an event structured information sequence; the event structured information sequence comprises a plurality of event description information and an event description type of each event description information; the event description type comprises at least one of an event result type, an event participant type and an event time type;
the text sequence generation module is used for inputting the event structured information sequence into a pre-trained text generation model so that the text generation model outputs a predicted text sequence corresponding to each event description information according to each event description type and each event description information, and determines the text sequence of a plurality of predicted text sequences according to the event description types;
and the summary text generation module is used for splicing the plurality of predicted text sequences according to the obtained text sequence of each predicted text sequence to obtain an event summary text so as to obtain key information of the event according to the event summary text.
In a third aspect, an embodiment of the present application further provides an electronic device, including: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, when the electronic device runs, the processor and the storage medium communicate with each other through the bus, and the processor executes the machine-readable instructions to execute the steps of the method for generating the event summary text according to any one of the first aspect.
In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, where the computer program is executed by a processor to perform the steps of the method for generating an event summary text according to any one of the first aspect.
According to the method, the device, the electronic equipment and the storage medium for generating the event summary text, an event structured information sequence containing a plurality of event description information and an event description type to which each event description information belongs is obtained; inputting the event structured information sequence into a pre-trained text generation model, so that the text generation model outputs a prediction text sequence corresponding to each event description information according to each event description type and each event description information, and determines the text sequence of a plurality of prediction text sequences according to the event description types; and splicing the plurality of predicted text sequences according to the obtained text sequence of each predicted text sequence to obtain an event summary text so as to obtain key information of the event according to the event summary text. In the embodiment of the application, the acquired event structured information sequence is directly input into the text generation model, the text generation model is used for processing structured data to obtain a predicted text sequence, and then an event text abstract is obtained, so that steps of generating natural language by data and data processing amount are reduced, the text generation efficiency is improved, and meanwhile, the context information of the information event information can be better analyzed according to the discretized event structured information sequence, and the text generation accuracy is improved.
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
To more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present application and therefore should not be considered as limiting the scope, and those skilled in the art can also obtain other related drawings based on the drawings without inventive efforts.
Fig. 1 is a flowchart of a method for generating an event summary text according to an embodiment of the present disclosure;
fig. 2 is a flowchart of another method for generating an event summary text according to an embodiment of the present disclosure;
fig. 3 is a flowchart of another method for generating a summary text of an event according to an embodiment of the present application;
FIG. 4 is a schematic diagram of an identification matrix in a training process according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of an apparatus for generating an event summary text according to an embodiment of the present disclosure;
fig. 6 is a second schematic structural diagram of an apparatus for generating a summary text of an event according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all the embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. Every other embodiment that can be obtained by a person skilled in the art without making creative efforts based on the embodiments of the present application falls within the protection scope of the present application.
First, an application scenario to which the present application is applicable will be described. The method and the device can be applied to the technical field of data processing. With the popularization of various sports, various events can be held in different season around the world, and how to report the progress of the events and the event results by forming effective characters is a problem to be solved urgently.
At present, with the development of deep learning technology and big data technology, the technology of automatically generating the war paper abstract is gradually mature, but in the process of generating the war paper by using a model, scattered event data needs to be converted into natural language containing structured information in advance and then input into a prediction model for text generation, which means that a large amount of templates and data processing are needed to generate the natural language containing the structured information meeting the model input standard, and the data processing amount is large, and the text generation efficiency is low.
Based on this, the embodiment of the application provides a method for generating an event summary text, so as to improve the text generation efficiency and the text generation accuracy.
Referring to fig. 1, fig. 1 is a flowchart illustrating a method for generating a summary text of an event according to an embodiment of the present disclosure. As shown in fig. 1, a method for generating an event summary text provided in an embodiment of the present application includes:
s101, acquiring a structured event information sequence; the event structured information sequence comprises a plurality of event description information and an event description type of each event description information; the event description type includes at least one of an event result type, an event participant type, and an event time type.
S102, inputting the event structured information sequence into a pre-trained text generation model, so that the text generation model outputs a predicted text sequence corresponding to each event description information according to each event description type and each event description information, and determines the text sequence of a plurality of predicted text sequences according to the event description types.
S103, splicing the plurality of predicted text sequences according to the obtained text sequence of each predicted text sequence to obtain an event summary text, and obtaining key information of the event according to the event summary text.
According to the method for generating the event abstract text, the acquired event structured information sequence is directly input into the text generation model, the structured data is processed through the text generation model, the predicted text sequence is obtained, and then the event text abstract is obtained, the steps of generating natural language by data and the data processing amount are reduced, the text generation efficiency is improved, meanwhile, the context information of the information event information can be better analyzed according to the discretized event structured information sequence, and the text generation accuracy is improved.
The following describes exemplary steps in an embodiment of the present application:
s101, acquiring a structured event information sequence; the event structured information sequence comprises a plurality of event description information and an event description type of each event description information;
wherein the event description type comprises at least one of an event result type, an event participant type, and an event time type.
In the embodiment of the present application, all the data constituting the event structured information sequence are a plurality of independent structured data in the course of an event, and the entire event structured information sequence may represent one action in one event or a plurality of actions in one event.
In one possible embodiment, event description information may be included in the event structured information sequence to characterize the event information described by the entire event structured information sequence, and each different event description information may appear in the event structured information sequence in combination with the corresponding event description type. The event description type includes at least one of an event result type, an event participant type, and an event time type.
For example, taking an example that the event is a football event, multiple pieces of information about the football event can be acquired from a live game sticker and the like in the football event, and taking an example that a piece of event structured information sequence represents a shooting action, multiple pieces of independent structured information can be extracted for the shooting work: assailant (race participant type): A. shooter (event participant type): B. goal (event result type), time (event time type): friday at 10 am.
Then the event structured information sequence for this shooting action may be represented as { attacker: A. shooting: B. goal, time: friday at 10 am }.
S102, inputting the event structured information sequence into a pre-trained text generation model, so that the text generation model outputs a predicted text sequence corresponding to each event description information according to each event description type and each event description information, and determines the text sequence of a plurality of predicted text sequences according to the event description types.
In this embodiment of the application, the event structured information sequence obtained in step S101 is input into a text generation model trained in advance, and the text generation model may output a predicted text sequence containing a context that is expected to be corresponding to each event description according to each event description type and each event description information included in the event structured information sequence, and determine a text sequence of each predicted text in a summary to be generated finally.
In one possible implementation, the text generation model includes a sequence embedding layer, a sequence encoding layer, and a predictive text sequence output layer.
In a possible implementation manner, the trained text generation model may directly perform natural language processing according to the input event structured information sequence to obtain context information of each event description information, and then combine into a corresponding predicted text sequence, and further may form an event summary text describing key information of the entire event through the predicted text sequences of a plurality of event description information, and then the process of processing the event structured information sequence by the text generation model to generate a plurality of predicted text sequences and further obtain the event summary text will be specifically introduced below.
Referring to fig. 2, fig. 2 is a flowchart illustrating another method for generating a summary text of an event according to an embodiment of the present disclosure. As shown in fig. 2, the step "inputting the event structured information sequence into a text generation model trained in advance, so that the text generation model outputs a predicted text sequence corresponding to each event description information according to each event description type and each event description information" includes:
s201, inputting the event structured information sequence into the sequence embedding layer, so that the sequence embedding layer respectively encodes the event description types, the event description information and the positions of the event keywords in the event structured information sequence, and outputs a coding sequence corresponding to each event description information.
In the embodiment of the application, the event structured information sequence is input into the sequence embedding layer, the event description type, the event description information and the position of the event keyword in the event structured information sequence, which are included in the event structured information sequence, are respectively encoded in the sequence embedding layer, and after the encoding, the sequence embedding layer outputs the encoding sequence corresponding to each event description information.
In one possible embodiment, the purpose of encoding the event structured information sequence is to represent the event structured information sequence by discretization embedding, so that accurate information can be captured, and the accuracy of the subsequent generation of the predicted text sequence is facilitated.
In one possible embodiment, the sequence embedding layer of the text generation model may be a transform block used as an encoder.
Specifically, for each piece of structural data in the event structured information sequence, one-hot (onehot) coding can be directly used for coding as token embedding, and a coded coding sequence is obtained.
Corresponding to the above example, for a football event, when encoding each structured data in the event structured information sequence, a preset number of event keywords (keys) may be set in advance: shooter, attack assistant, defender, result, shooting position, shooting type, time, whether to shoot far away, whether to shoot dead angle, whether to shoot one dragon, whether to cut inwards, whether to be small angle; for the above-mentioned event keywords, the corresponding values are generally limited except for the names of players in the event participant type and the event time type, and when the value-limited keys are encoded, the actual token encoding is not used but the discretization encoding of [ unused _ xx ] is considered, and the rest is directly encoded from the vocab dictionary.
All keys of the structured data are onehot discrete coded using a subspace of size 13, and the position coding uses the same as the Unilm model. Therefore, for each token, its embedding is expressed as embed ═ TE + PE + KE, where TE is token embedding, PE is position embedding, and KE is key embedding.
S202, aiming at each coding sequence, inputting the coding sequence into the sequence coding layer so that the sequence coding layer processes the coding sequence, predicting context information of event description information included in the coding sequence according to the event description type in the coding sequence, and outputting at least one candidate text sequence corresponding to the coding sequence according to the context information and the event description information.
In the embodiment of the present application, for the coded sequence after the sequence embedding layer coding processing in step S201, the coded sequence is input into a sequence coding layer, the sequence coding layer processes the coded sequence, after the coded sequence is processed (coded and decoded), context information of event description information included in the coded sequence is predicted according to an event description type in the coded sequence, and at least one candidate text sequence corresponding to the coded sequence is output according to the determined context information and the event description information.
For each coding sequence, the candidate text sequence predicted by decoding the sequence coding layer is the event description information containing the coding sequence, and is filled with the text sequence of the corresponding word.
Corresponding to the example above, the corresponding event structured information sequence before one code sequence is { attacker: A. shooting: B. goal, time: 10 am friday, then a candidate text sequence corresponding to the code sequence may be { player B breaks at 10 am friday with the aid of player a to goal.
And S203, aiming at each coding sequence, inputting at least one candidate text sequence corresponding to the coding sequence into the predicted text sequence output layer, so that the predicted text sequence output layer screens out the predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence.
In this embodiment of the present application, for each coding sequence, after context prediction, more than one corresponding candidate text sequence may be generated, and at this time, at least one candidate text sequence needs to be analyzed to obtain a predicted text sequence that best meets prediction requirements, specifically, for each coding sequence, after at least one candidate text sequence is obtained by performing encoding and decoding on a sequence encoding layer, at least one candidate text sequence is screened through a predicted text sequence output layer to obtain a predicted text sequence corresponding to the coding sequence.
In one possible embodiment, the predicted text sequence corresponding to the coding sequence is screened from the at least one candidate text sequence by:
a 1: and determining the candidate text sequence with the highest prediction score in the at least one candidate text sequence as a predicted text sequence.
Specifically, when each coding sequence is predicted by a sequence coding layer, when each candidate text sequence is generated, a corresponding prediction score is calculated for each candidate text sequence, and the prediction score can reflect the quality of each predicted text sequence considered by the model to a certain extent, so that a candidate text sequence with the highest prediction score can be screened out from at least one candidate text sequence and determined as a predicted text sequence.
a 2: and determining the candidate text sequence meeting the prediction requirement in the at least one candidate text sequence as the predicted text sequence according to the predicted text requirement.
Specifically, for different prediction scenarios (different prediction event levels, different prediction event prediction times, and the like), there may also be a certain difference in the demand for text generation each time, and therefore, when at least one prediction text is screened, a candidate text sequence satisfying the prediction demand may be determined as a prediction text sequence from at least one candidate text sequence according to the demand for the prediction text.
Wherein predicting text requirements comprises at least one of: predicted text length, predicted text sentence pattern, and event text expression mode.
Specifically, the predicted text length may be limited in the number of words of the text when the summary of the event text is generated, so that the number of words is controlled as much as possible when the single sentence text is generated; the predicted text sentence pattern can be an expression form of a text, which is also related to the overall style requirement of the event text abstract, and the overall event text abstract is probably in a concise narrative style, so that the sentence pattern for displaying the narrative sentence can be selected to express when a single sentence text is generated; the event text expression mode refers to the language adopted by the whole event text abstract, and the text generation model in the embodiment of the application supports the generation of the multi-language abstract, so that if the event text abstract needs to be generated into an English version, a candidate text sequence of the English version can be determined as a predicted text sequence when a single sentence text is generated.
S103, splicing the plurality of predicted text sequences according to the obtained text sequence of each predicted text sequence to obtain an event summary text, and obtaining key information of the event according to the event summary text.
In the embodiment of the application, the plurality of predicted text sequences obtained in step S102 are spliced according to the text sequence corresponding to each predicted text sequence to obtain the event summary text, and the event summary text is analyzed according to the obtained event summary text to obtain the key information of the event.
In a possible implementation, when a plurality of predicted texts are spliced, the predicted texts need to be spliced in sequence to ensure the readability of the obtained event summary text.
Specifically, the text order of the predicted text sequence is determined by:
b 1: and for each predicted text sequence, determining the text sequence of the predicted text sequence according to the text association sequence between the event description type corresponding to the predicted text sequence and other event description types.
In this embodiment of the application, for each predicted text sequence, the text sequence of the predicted text sequence may be determined according to a text association sequence between event description types corresponding to the preset text sequence.
Specifically, when generating the event summary text, it is generally necessary to introduce the event participants, the event time, and the event results, and since the event description information of the event result type is generally located relatively behind each sentence in the entire event summary, when concatenating a plurality of predicted text sequences, the predicted text sequence corresponding to the event result type is also concatenated at a later position.
For the above example, one predictive text sequence screened out is { player B completes a goal half way through the game on the course of play with the help of player a }; another predictive text sequence is { in the second half, the player C assists the player D to shoot into the dead angle to balance out }, then, the spliced abstract can be that "the player B finishes the goal in the first half of the game under the attack of the player a, and in the second half, the player C assists the player D to shoot into the dead angle to balance out and play when entering into the dead angle".
In a possible real-time manner, after an event summary text is generated by concatenating a plurality of predicted text sequences, event key information may be obtained from the event summary text, and specifically, the generation method provided in the embodiment of the present application further includes:
c 1: and performing semantic analysis on the event abstract text to determine at least one event keyword.
In the embodiment of the application, after the event abstract text is obtained, a plurality of event keywords can be screened out from the event abstract text through natural semantic analysis, and the event keywords are helpful for analyzing the progress of the event.
In a possible implementation manner, the event keywords to be extracted may be set in advance according to the event analysis requirements, when the event abstract text is analyzed, calculation may be performed according to the similarity between each vocabulary in the event abstract text and the preset event keywords, and the vocabulary with the similarity greater than the preset similarity threshold is determined as the event keywords in the event abstract text.
Specifically, the event keywords include, but are not limited to: the event result, the event score, the name of the player who has shot the most in the whole course, the time of the shot and the like.
c 2: and performing the reply analysis on the event based on the at least one event keyword and a preset event analysis rule.
In the embodiment of the present application, the whole game is analyzed according to the at least one event keyword extracted from the event summary text in step c1 and the preset event analysis rule.
The analyzed angle and direction include, but are not limited to, the result of the event, whether the team lost or won in the event, the specific score, who the player in the opponent team performed better in the event, etc.
In a possible implementation manner, a text generation model for converting event structured information into an event abstract text needs to be trained according to a language model, and a training process for the text generation model in the embodiment of the present application will be specifically described below:
specifically, please refer to fig. 3, fig. 3 is a flowchart of another method for generating a summary text of an event according to an embodiment of the present disclosure. As shown in FIG. 3, the text generation model is trained by:
s301, obtaining a plurality of sample event structured sequences and sample abstract texts corresponding to the sample event structured sequences; each event structured information sequence comprises a plurality of sample event description information and the event description type of each sample event description information.
In the embodiment of the application, when a text generation model is trained, a plurality of sample event structured sequences and a sample abstract text corresponding to each sample event structured sequence need to be acquired, similarly, in order to enable a constructed language model to better learn a conversion relationship between the event structured sequences and an event text abstract, similarly, each sample event structured sequence also includes a plurality of sample event description information and an event description type to which each sample event description information belongs.
S302, determining a reference sample sequence corresponding to the sample event structured sequence aiming at each sample event structured sequence; the reference sample sequence comprises a plurality of reference identification information, and the number of the reference identifications is the same as the number of the sample event description information in the sample event structured sequence.
In an embodiment of the present application, for each sample event structured sequence, a reference sample sequence corresponding to the sample event structured sequence is determined.
The sample event structured sequence comprises a plurality of sample event description information, wherein the reference sample sequence comprises a plurality of reference identifier information, the number of the reference identifiers is the same as the number of the sample event description information included in the sample event structured sequence, and specifically, the reference identifiers included in the sample reference sequence may be [ MASK ].
In the embodiment of the application, in order to ensure the accuracy of a trained text generation model, when a language model is trained, not only the context information in the process of converting a structured sequence into a text abstract is learned by the language model, but also the context information in the process of converting the text abstract into the structured sequence needs to be obtained, and the purpose of obtaining a reference sample sequence in the training process is to assist in learning the context information in the process of converting the text abstract into the structured sequence.
And S303, inputting the plurality of sample event structured sequences, the plurality of reference sample sequences and the plurality of sample abstract texts into a pre-constructed language model, so that the language model is converted into tasks of the sample abstract texts through the sample event structured sequences and the tasks of the sample abstract texts into the sample event structured sequences, learning the context information of the description information of each sample event, and determining that the language model is trained to obtain the text generation model when the loss of the language model is less than a preset threshold value.
In the embodiment of the application, the acquired multiple sample event structured sequences, multiple reference sample sequences and multiple sample abstract texts are input into a pre-constructed language model, so that the language model learns the context information of the description information of each sample event through a task of converting the sample event structured sequences into the sample abstract texts and a task of converting the sample abstract texts into the sample event structured sequences according to the multiple sample event structured sequences, the multiple reference sample sequences and the multiple sample abstract texts, and meanwhile, the loss value in the process of each learning task is calculated.
In one possible embodiment, the language model also includes a sequence embedding layer and a sequence coding layer, and the step "makes the language model convert the sample event structured sequence into the sample abstract text and convert the sample abstract text into the sample event structured sequence, and learns the context information of the description information of each sample event" includes:
d 1: and inputting the plurality of sample event structured sequences, the plurality of reference sample sequences and the plurality of sample abstract texts into a sequence embedding layer of the language model, so that the sequence embedding layer outputs a structured coding sequence corresponding to each sample event structured sequence, a reference coding sequence corresponding to each reference sample sequence and a text coding corresponding to each sample abstract text.
In the embodiment of the application, the obtained sample event structured sequences, the reference sample sequences and the plurality of sample abstract texts are correspondingly input into a sequence embedding layer of a language model, and the sample event structured sequences, the reference sample sequences and the plurality of sample abstract texts are respectively encoded in the sequence embedding layer to obtain a structured coding sequence corresponding to each sample event structured sequence, a reference coding sequence corresponding to each reference sample sequence and a text code corresponding to each sample abstract text.
In one possible implementation, the language model used for training in the embodiments of the present application may be a unified language model.
In particular, a transformer block may be used as a sequence embedding layer, for example, assuming that the input vector after embedding is { x }1,x2…,xk},k=2m+n,H0=[x1,x2,…,xk]The coding of the ith layer is expressed as
Figure BDA0003599259840000181
Hi+1=TransformerBloack(Hi) For the ith layer, the output A of the multi-head attention is represented as:
Figure BDA0003599259840000182
Figure BDA0003599259840000183
Figure BDA0003599259840000184
wherein the content of the first and second substances,
Figure BDA0003599259840000185
is a learnable parameter, and M represents a matrix of attentions.
d 2: and inputting the determined multiple structured coding sequences, multiple reference coding sequences and text codes into a sequence coding layer of the language model, so that the sequence coding layer predicts the target codes according to a sequence obtained by shielding at least one target code in the text codes and/or the structured coding sequences in a preset identification matrix, and determines the context information of the event description information of each sample.
In this embodiment of the application, the multiple structured coding sequences, the multiple reference coding sequences, and the text codes determined in step d1 are input into a sequence coding layer of the natural coding language model, and the sequence coding layer is controlled to predict at least one target code in the text codes and/or the structured coding sequences according to a sequence that is obtained by blocking at least one target code in a preset identification matrix, so as to predict the context information of the event description information of each sample according to the learned context information.
In one possible embodiment, the preset identification matrix is used for representing the visible relation among the structured coding sequence, the reference coding sequence and the text coding; and fitting and learning the context information of the event description information of each sample according to the visible relation among the structured coding sequence, the reference coding sequence and the text code.
In this case, the visible and invisible relationship between sequences can be characterized by a MASK matrix.
Specifically, in the process of training the language model, aiming at each coded data in each structured coded sequence, each data can obtain other coded data; aiming at each reference coding data in each reference coding sequence, each reference coding data can obtain a corresponding text code; for each text encoding data in each text encoding, each text data can acquire the text encoding data positioned before the text data in the sequence; where the invisible encoded data is the data to be predicted.
Referring to fig. 4, fig. 4 is a schematic diagram of an identification matrix in a training process according to an embodiment of the present application, as shown in fig. 4, S1Structuring a sequence for the input sample events; s2Is an input reference sample sequence; s3Is the input sample abstract text. S input during training of natural coding language model1Is a token, S which can bidirectionally see each position of the user3Can unidirectionally see the token before the position of the user and can also see the S1All tokens. However, for S2Is a virtual input, S, constructed by the present algorithm2Only S is visible3All tokens.
In a possible implementation manner, for each event description type, a fixed description type and a variable description type may be divided, specifically, the fixed description type may be event field description information such as an event result, a limited number of description information such as win, loss, goal, and the like is generally used for the event result type, and is not fixed for the event participant type and the event time type, and therefore, for the variable description type, a copy layer may be added when training the language model to strengthen learning of corresponding context information.
Specifically, the generating method further includes:
f 1: and for each variable description type and corresponding sample event description information, outputting the prediction sequence output by the sequence coding layer to an information copying layer of the language model, so that the information copying layer performs prediction learning on the sample event description information and adjusts the context information of the sample event description information corresponding to the variable description type.
In the embodiment of the application, for each variable description type and corresponding sample event description information, the prediction sequence output by the sequence coding layer is input to the information replication layer of the language model again, prediction learning is performed on the sample event description information in the information replication layer, and then context information of the sample event description information corresponding to the variable description type is adjusted, so that the context information of the sample event description information corresponding to the variable description type is learned more accurately.
It is worth noting that after the training of the language model is finished, the generated text generates a model, and when the model prediction is performed, the MASK matrix is a matrix of attentions of a seq2seq model of a normal UniLM, and according to the input event structured information sequence, the corresponding context information can be predicted, so as to obtain a corresponding predicted text sequence.
In a possible implementation, when the language model is trained, the language model needs to be determined according to the loss value in the training process, because the two tasks of converting the sample event structured sequence into the sample abstract text and converting the sample abstract text into the sample event structured sequence are used for training the language model, so that the loss of the two tasks needs to be comprehensively considered when the loss value of the language model is calculated.
Specifically, the loss of the language model is determined by:
g 1: and aiming at the task of converting the sample event structured sequence into the sample abstract text, calculating by combining the coded data in each sample event structured sequence and the shielded codes in the text codes corresponding to the sample abstract text and the model parameters, and determining a first loss value.
Specifically, the first loss value may be calculated by the following formula:
loss1=∑ρ(S3,i+1|S1,S3,1:i,θ);
wherein the above formula is an autoregressive generation form of seq2seq, and for the (i + 1) th token, the information learning is carried out after the information learning is carried out by all the sample event structured sequences and the information before the (i + 1) th of the sample abstract text, and theta is a parameter of the model.
g 2: and aiming at the task of converting the sample abstract text into the sample event structured sequence, calculating by combining the coded data in each sample event structured sequence, the shielded codes in the text codes corresponding to the sample abstract text and the shielded codes in the reference coding sequence and model parameters, and determining a second loss value.
Specifically, the second loss value may be calculated by the following formula:
loss2=ρ(S1|S3,S2,θ);
where θ is a parameter of the model.
g 3: and performing weighted calculation on the first loss value and the second loss value to determine the loss of the language model.
Specifically, the loss of the language model can be calculated by the following formula:
loss=loss1+λloss2
wherein λ is a hyper-parameter for adjusting the weight of the multitask, and may be specifically set according to the emphasis on model training among the multitasks and the training requirement on the model.
In a possible implementation manner, the text prediction result of the model after the text subjected to natural semantic processing is input in the prior art is compared with the text prediction result of the model after the discretized event structured information sequence is input in the embodiment of the present application, and the text prediction result of the model can be known, so that the accuracy of the scheme in the embodiment of the present application is significantly improved.
For example, the obtained event structured information sequence is: { "shooter": Player Br "," team ": team B", "assistor": Player Abe "," result ": goal", "time": 8:27 "}; { "shooter": player Va "," team ": team A", "result": shooting "," time ": time of complement 47:37" }; { "shooter": player Da "," team ": team A", "result": center pillar "," time ": 55:51" }; "shooter": player Abe "," team ": B team", "assistor": player Fi "," result ": goal", "types": single knife "," time ": 58" }; { "shooter": Player Mar "," team ": team A", "assistor": Player Da "," result ": goal", "types": corner "], time": 64:58 "}.
After the text generation model in the embodiment of the application is processed, the obtained event summary text is as follows: in the first half, the broken door of the player Br is designed for the head of the team B, and the broken door of the player Va in the time supplementing stage is pulled to be flat than the score. In the second half, the player Da shoot unfortunately the doorpost, after 3 minutes, the player Fi assists the attack player Abe to break the door with a single knife and leads the score again, and the player Da assists the attack player Mar to shoot into the dead angle and pull the score flat. The whole field is war strike, and team A2: 2 war strike team B.
According to the method for generating the event summary text, an event structured information sequence containing a plurality of event description information and the event description type of each event description information is obtained; inputting the event structured information sequence into a pre-trained text generation model, so that the text generation model outputs a prediction text sequence corresponding to each event description information according to each event description type and each event description information, and determines the text sequence of a plurality of prediction text sequences according to the event description types; and splicing the plurality of predicted text sequences according to the obtained text sequence of each predicted text sequence to obtain an event summary text so as to obtain key information of the event according to the event summary text. In the embodiment of the application, the acquired event structured information sequence is directly input into the text generation model, the text generation model is used for processing structured data to obtain a predicted text sequence, and then an event text abstract is obtained, so that steps of generating natural language by data and data processing amount are reduced, the text generation efficiency is improved, and meanwhile, the context information of the information event information can be better analyzed according to the discretized event structured information sequence, and the text generation accuracy is improved.
Based on the same inventive concept, the embodiment of the present application further provides a device for generating an event summary text corresponding to the method for generating an event summary text, and because the principle of solving the problem of the device in the embodiment of the present application is similar to the method for generating an event summary text described above in the embodiment of the present application, the implementation of the device may refer to the implementation of the method, and repeated details are omitted.
Referring to fig. 5 and fig. 6, fig. 5 is a first schematic structural diagram of an apparatus for generating an event summary text according to an embodiment of the present application, and fig. 6 is a second schematic structural diagram of an apparatus for generating an event summary text according to an embodiment of the present application. As shown in fig. 5, the generating means 500 comprises:
an information sequence obtaining module 510, configured to obtain an event structured information sequence; the event structured information sequence comprises a plurality of event description information and an event description type of each event description information; the event description type comprises at least one of an event result type, an event participant type and an event time type;
a text sequence generating module 520, configured to input the event structured information sequence into a pre-trained text generating model, so that the text generating model outputs a predicted text sequence corresponding to each event description information according to each event description type and each event description information, and determines a text sequence of multiple predicted text sequences according to the event description types;
and the abstract text generating module 530 is configured to splice the plurality of predicted text sequences according to the obtained text sequence of each predicted text sequence to obtain an event abstract text, so as to obtain key information of the event according to the event abstract text.
In a possible implementation, as shown in fig. 6, the generating apparatus 500 further includes a model training module 540, and the model training module 540 is configured to:
acquiring a plurality of sample event structured sequences and sample abstract texts corresponding to the sample event structured sequences; each sample event structured sequence comprises a plurality of sample event description information and an event description type to which each sample event description information belongs;
determining a reference sample sequence corresponding to each sample event structured sequence; the reference sample sequence comprises a plurality of reference identification information, and the number of the reference identifications is the same as the number of the sample event description information in the sample event structured sequence;
inputting the plurality of sample event structured sequences, the plurality of reference sample sequences and the plurality of sample abstract texts into a pre-constructed language model, so that the language model is converted into tasks of the sample abstract texts through the sample event structured sequences and the tasks of the sample abstract texts into the sample event structured sequences, learning the context information of the description information of each sample event, and determining that the language model is trained to obtain the text generation model when the loss of the language model is less than a preset threshold value.
In one possible implementation, as shown in fig. 6, the generating apparatus 500 further includes an information learning module 550, and the information learning module 550 is configured to:
and inputting the prediction sequence output by the sequence coding layer into an information copying layer of the language model aiming at each variable description type and the corresponding sample event description information, so that the information copying layer performs prediction learning on the sample event description information and adjusts the context information of the sample event description information corresponding to the variable description type.
In one possible implementation, as shown in fig. 6, the generating device 500 further includes an event analysis module 560, and the event analysis module 560 is configured to:
performing semantic analysis on the event abstract text to determine at least one event keyword;
and performing the reply analysis on the event based on the at least one event keyword and a preset event analysis rule.
In a possible implementation manner, the text generation model includes a sequence embedding layer, a sequence coding layer, and a predicted text sequence output layer, and when the text sequence generation module 520 is configured to input the event structured information sequence into a pre-trained text generation model, so that the text generation model outputs a predicted text sequence corresponding to each event description information according to each event description type and each event description information, the text sequence generation module 520 is configured to:
inputting the event structured information sequence into the sequence embedding layer, so that the sequence embedding layer respectively encodes the event description types, the event description information and the positions of the event keywords in the event structured information sequence, and outputs a coding sequence corresponding to each event description information;
for each coding sequence, inputting the coding sequence into the sequence coding layer so that the sequence coding layer processes the coding sequence, predicting context information of event description information included in the coding sequence according to the event description type in the coding sequence, and outputting at least one candidate text sequence corresponding to the coding sequence according to the context information and the event description information;
and for each coding sequence, inputting at least one candidate text sequence corresponding to the coding sequence into the predicted text sequence output layer, so that the predicted text sequence output layer screens out the predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence.
In a possible implementation, the text sequence generating module 520 is configured to screen the at least one candidate text sequence for a predicted text sequence corresponding to the coding sequence by:
determining a candidate text sequence with the highest prediction score in the at least one candidate text sequence as a predicted text sequence; or;
and determining the candidate text sequence meeting the prediction requirement in the at least one candidate text sequence as the predicted text sequence according to the predicted text requirement.
In one possible embodiment, the predicted-text requirement includes at least one of:
predicted text length, predicted text sentence pattern, and event text expression mode.
In one possible implementation, the text sequence generation module 520 is configured to determine the text order of the predicted text sequence by:
and for each predicted text sequence, determining the text sequence of the predicted text sequence according to the text association sequence between the event description type corresponding to the predicted text sequence and other event description types.
In one possible implementation, when the model training module 540 is configured to learn the context information of the description information of each sample event in the task of converting the language model to the sample summary text through the sample event structured sequence and the task of converting the sample summary text to the sample event structured sequence, the model training module 540 is configured to:
inputting the plurality of sample event structured sequences, the plurality of reference sample sequences and the plurality of sample abstract texts into a sequence embedding layer of the language model, so that the sequence embedding layer outputs a structured coding sequence corresponding to each sample event structured sequence, a reference coding sequence corresponding to each reference sample sequence and a text code corresponding to each sample abstract text;
and inputting the determined multiple structured coding sequences, multiple reference coding sequences and text codes into a sequence coding layer of the language model, so that the sequence coding layer predicts the target codes according to a sequence obtained by shielding at least one target code in the text codes and/or the structured coding sequences in a preset identification matrix, and determines the context information of the event description information of each sample.
In a possible embodiment, the preset identification matrix is used for representing a visible relation among the structured coding sequence, the reference coding sequence and the text coding; fitting and learning the context information of the event description information of each sample according to the visible relation among the structured coding sequence, the reference coding sequence and the text code;
in the process of training the language model, aiming at each coded data in each structured coded sequence, each data can obtain other coded data;
aiming at each reference encoding data in each reference encoding sequence, each reference encoding data can obtain a corresponding text code;
aiming at each text encoding data in each text encoding, each text data can obtain the text encoding data positioned before the text data in the sequence;
where the invisible encoded data is the data to be predicted.
In one possible implementation, the model training module 540 is configured to determine the loss of the language model by:
aiming at a task of converting a sample event structured sequence into a sample abstract text, calculating by combining the coded data in each sample event structured sequence and the shielded codes in the text codes corresponding to the sample abstract text and model parameters, and determining a first loss value;
for the task of converting the sample abstract text into the sample event structured sequence, calculating by combining the coded data in each sample event structured sequence, the shielded codes in the text codes corresponding to the sample abstract text and the shielded codes in the reference coding sequence and model parameters, and determining a second loss value;
and performing weighted calculation on the first loss value and the second loss value to determine the loss of the language model.
The device for generating the event summary text, provided by the embodiment of the application, acquires an event structured information sequence comprising a plurality of event description information and an event description type to which each piece of event description information belongs; inputting the event structured information sequence into a pre-trained text generation model, so that the text generation model outputs a prediction text sequence corresponding to each event description information according to each event description type and each event description information, and determines the text sequence of a plurality of prediction text sequences according to the event description types; and splicing the plurality of predicted text sequences according to the obtained text sequence of each predicted text sequence to obtain an event summary text so as to obtain key information of the event according to the event summary text. In the embodiment of the application, the acquired event structured information sequence is directly input into the text generation model, the text generation model is used for processing structured data to obtain a predicted text sequence, and then an event text abstract is obtained, so that steps of generating natural language by data and data processing amount are reduced, the text generation efficiency is improved, and meanwhile, the context information of the information event information can be better analyzed according to the discretized event structured information sequence, and the text generation accuracy is improved.
Referring to fig. 7, fig. 7 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. As shown in fig. 7, the electronic device 700 includes: a processor 710, a storage medium 720 and a bus 730, wherein the storage medium 720 stores machine-readable instructions executable by the processor 710, when the electronic device executes a control method as in the embodiment, the processor 710 communicates with the storage medium 720 through the bus 730, the processor 710 executes the machine-readable instructions, and the processor 710 executes a preamble of the method item to perform the following steps:
acquiring an event structured information sequence; the event structured information sequence comprises a plurality of event description information and an event description type of each event description information; the event description type comprises at least one of an event result type, an event participant type and an event time type;
inputting the event structured information sequence into a pre-trained text generation model, so that the text generation model outputs a predicted text sequence corresponding to each event description information according to each event description type and each event description information, and determines the text sequence of a plurality of predicted text sequences according to the event description types;
and splicing the plurality of predicted text sequences according to the obtained text sequence of each predicted text sequence to obtain an event summary text so as to obtain key information of the event according to the event summary text.
In one possible embodiment, the text generation model includes a sequence embedding layer, a sequence coding layer and a predicted text sequence output layer, and when the processor 710 is configured to input the event structured information sequence into a pre-trained text generation model, so that the text generation model outputs a predicted text sequence corresponding to each event description information according to each event description type and each event description information, the processor 710 is configured to:
inputting the event structured information sequence into the sequence embedding layer, so that the sequence embedding layer respectively encodes the event description types, the event description information and the positions of the event keywords in the event structured information sequence, and outputs a coding sequence corresponding to each event description information;
for each coding sequence, inputting the coding sequence into the sequence coding layer so that the sequence coding layer processes the coding sequence, predicting context information of event description information included in the coding sequence according to the event description type in the coding sequence, and outputting at least one candidate text sequence corresponding to the coding sequence according to the context information and the event description information;
and for each coding sequence, inputting at least one candidate text sequence corresponding to the coding sequence into the predicted text sequence output layer, so that the predicted text sequence output layer screens out the predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence.
In one possible embodiment, the processor 710 is configured to screen the at least one candidate text sequence for a predicted text sequence corresponding to the coding sequence by:
determining a candidate text sequence with the highest prediction score in the at least one candidate text sequence as a predicted text sequence; or;
and determining the candidate text sequence meeting the prediction requirement in the at least one candidate text sequence as the predicted text sequence according to the predicted text requirement.
In one possible embodiment, the predicted-text requirement includes at least one of:
predicted text length, predicted text sentence pattern, and event text expression mode.
In one possible embodiment, the processor 710 is configured to determine the text order of the predicted text sequence by:
and for each predicted text sequence, determining the text sequence of the predicted text sequence according to the text association sequence between the event description type corresponding to the predicted text sequence and other event description types.
In one possible embodiment, the processor 710 is configured to train the text generation model by:
acquiring a plurality of sample event structured sequences and sample abstract texts corresponding to the sample event structured sequences; each sample event structured sequence comprises a plurality of sample event description information and an event description type to which each sample event description information belongs;
determining a reference sample sequence corresponding to each sample event structured sequence; the reference sample sequence comprises a plurality of reference identification information, and the number of the reference identifications is the same as the number of the sample event description information in the sample event structured sequence;
inputting the plurality of sample event structured sequences, the plurality of reference sample sequences and the plurality of sample abstract texts into a pre-constructed language model, so that the language model is converted into tasks of the sample abstract texts through the sample event structured sequences and the tasks of the sample abstract texts into the sample event structured sequences, learning the context information of the description information of each sample event, and determining that the language model is trained to obtain the text generation model when the loss of the language model is less than a preset threshold value.
In one possible embodiment, the processor 710, when being configured to learn the context information of the respective sample event description information in a task of converting the language model to the sample event structured sequence through the sample event structured sequence and a task of converting the sample event text to the sample event structured sequence, the processor 710 is configured to:
inputting the plurality of sample event structured sequences, the plurality of reference sample sequences and the plurality of sample abstract texts into a sequence embedding layer of the language model, so that the sequence embedding layer outputs a structured coding sequence corresponding to each sample event structured sequence, a reference coding sequence corresponding to each reference sample sequence and a text code corresponding to each sample abstract text;
and inputting the determined multiple structured coding sequences, multiple reference coding sequences and text codes into a sequence coding layer of the language model, so that the sequence coding layer predicts the target codes according to a sequence obtained by shielding at least one target code in the text codes and/or the structured coding sequences in a preset identification matrix, and determines the context information of the event description information of each sample.
In one possible embodiment, the event description types include a fixed description type and a variable description type, and the processor 710 is further configured to:
and inputting the prediction sequence output by the sequence coding layer into an information copying layer of the language model aiming at each variable description type and the corresponding sample event description information, so that the information copying layer performs prediction learning on the sample event description information and adjusts the context information of the sample event description information corresponding to the variable description type.
In one possible embodiment, the predetermined identification matrix is used to characterize the visual relationship between the structured coding sequence, the reference coding sequence, and the text code; fitting and learning the context information of the event description information of each sample according to the visible relation among the structured coding sequence, the reference coding sequence and the text code;
in the process of training the language model, aiming at each coded data in each structured coded sequence, each data can obtain other coded data;
aiming at each reference encoding data in each reference encoding sequence, each reference encoding data can obtain a corresponding text code;
for each text encoding data in each text encoding, each text data can acquire the text encoding data positioned before the text data in the sequence;
where the invisible encoded data is the data to be predicted.
In one possible embodiment, the processor 710 is configured to determine the loss of the language model by:
aiming at a task of converting a sample event structured sequence into a sample abstract text, calculating by combining the coded data in each sample event structured sequence and the shielded codes in the text codes corresponding to the sample abstract text and model parameters, and determining a first loss value;
for the task of converting the sample abstract text into the sample event structured sequence, calculating by combining the coded data in each sample event structured sequence, the shielded codes in the text codes corresponding to the sample abstract text and the shielded codes in the reference coding sequence and model parameters, and determining a second loss value;
and performing weighted calculation on the first loss value and the second loss value to determine the loss of the language model.
In one possible embodiment, the processor 710 is further configured to:
performing semantic analysis on the event abstract text to determine at least one event keyword;
and performing the reply analysis on the event based on the at least one event keyword and a preset event analysis rule.
According to the method, a plurality of event description information and each event description type of related events can be accurately obtained through the obtained event structured information sequence, the event structured information sequence is directly input into the text generation model, the text generation model is used for processing the structured data to obtain a prediction text sequence, and then an event text abstract is obtained, so that the steps of generating natural language by data and the data processing amount are reduced, the text generation efficiency is improved, meanwhile, the context information of the information event information can be better analyzed according to the discretized event structured information sequence, and the text generation accuracy is improved; meanwhile, in the process of training the text generation model, the relation between the sequence and the text is learned in a two-way mode through the task of converting the sample event structured sequence into the sample abstract text and the task of converting the sample abstract text into the sample event structured sequence, so that the accuracy of obtaining the event abstract text through the event structured sequence is improved.
An embodiment of the present application further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the processor performs the following steps:
acquiring an event structured information sequence; the event structured information sequence comprises a plurality of event description information and an event description type of each event description information; the event description type comprises at least one of an event result type, an event participant type and an event time type;
inputting the event structured information sequence into a pre-trained text generation model, so that the text generation model outputs a predicted text sequence corresponding to each event description information according to each event description type and each event description information, and determines the text sequence of a plurality of predicted text sequences according to the event description types;
and splicing the plurality of predicted text sequences according to the obtained text sequence of each predicted text sequence to obtain an event abstract text so as to obtain key information of the event according to the event abstract text.
In one possible embodiment, the text generation model includes a sequence embedding layer, a sequence coding layer and a predicted text sequence output layer, and the processor, when being configured to input the event structured information sequence into a pre-trained text generation model so that the text generation model outputs a predicted text sequence corresponding to each event description information according to each event description type and each event description information, is configured to:
inputting the event structured information sequence into the sequence embedding layer, so that the sequence embedding layer respectively encodes the event description types, the event description information and the positions of the event keywords in the event structured information sequence, and outputs a coding sequence corresponding to each event description information;
for each coding sequence, inputting the coding sequence into the sequence coding layer so that the sequence coding layer processes the coding sequence, predicting context information of event description information included in the coding sequence according to the event description type in the coding sequence, and outputting at least one candidate text sequence corresponding to the coding sequence according to the context information and the event description information;
and for each coding sequence, inputting at least one candidate text sequence corresponding to the coding sequence into the predicted text sequence output layer, so that the predicted text sequence output layer screens out the predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence.
In one possible embodiment, the processor is configured to screen the at least one candidate text sequence for a predicted text sequence corresponding to the coding sequence by:
determining a candidate text sequence with the highest prediction score in the at least one candidate text sequence as a predicted text sequence; or;
and determining the candidate text sequence meeting the prediction requirement in the at least one candidate text sequence as the predicted text sequence according to the predicted text requirement.
In one possible embodiment, the predicted-text requirement includes at least one of:
predicted text length, predicted text sentence pattern, and event text expression mode.
In one possible embodiment, the processor is configured to determine the text order of the predicted text sequence by:
and for each predicted text sequence, determining the text sequence of the predicted text sequence according to the text association sequence between the event description type corresponding to the predicted text sequence and other event description types.
In one possible embodiment, the processor is configured to train the text generation model by:
acquiring a plurality of sample event structured sequences and sample abstract texts corresponding to the sample event structured sequences; each sample event structured sequence comprises a plurality of sample event description information and an event description type to which each sample event description information belongs;
determining a reference sample sequence corresponding to each sample event structured sequence; the reference sample sequence comprises a plurality of reference identification information, and the number of the reference identifications is the same as the number of the sample event description information in the sample event structured sequence;
and inputting the plurality of sample event structured sequences, the plurality of reference sample sequences and the plurality of sample abstract texts into a pre-constructed language model, so that the language model is converted into a task of the sample abstract text through the sample event structured sequences and a task of the sample abstract text converted into the sample event structured sequences, the context information of the description information of each sample event is learned, and when the loss of the language model is smaller than a preset threshold value, the language model is determined to be trained completely, and the text generation model is obtained.
In one possible embodiment, the processor, when being configured to learn the context information for each sample event description information in a task of converting the language model to the sample summary text through the sample event structured sequence and a task of converting the sample summary text to the sample event structured sequence, is configured to:
inputting the plurality of sample event structured sequences, the plurality of reference sample sequences and the plurality of sample abstract texts into a sequence embedding layer of the language model, so that the sequence embedding layer outputs a structured coding sequence corresponding to each sample event structured sequence, a reference coding sequence corresponding to each reference sample sequence and a text code corresponding to each sample abstract text;
and inputting the determined multiple structural coding sequences, the multiple reference coding sequences and the text codes into a sequence coding layer of the language model, so that the sequence coding layer predicts the target codes according to a sequence obtained by shielding at least one target code in the text codes and/or the structural coding sequences in a preset identification matrix, and determines the context information of the description information of each sample event.
In one possible embodiment, the event description types include a fixed description type and a variable description type, and the processor is further configured to:
and inputting the prediction sequence output by the sequence coding layer into an information copying layer of the language model aiming at each variable description type and the corresponding sample event description information, so that the information copying layer performs prediction learning on the sample event description information and adjusts the context information of the sample event description information corresponding to the variable description type.
In one possible embodiment, the predetermined identification matrix is used to characterize the visual relationship between the structured coding sequence, the reference coding sequence, and the text coding; fitting and learning the context information of the event description information of each sample according to the visible relation among the structured coding sequence, the reference coding sequence and the text code;
in the process of training the language model, aiming at each coded data in each structured coded sequence, each data can obtain other coded data;
aiming at each reference encoding data in each reference encoding sequence, each reference encoding data can obtain a corresponding text code;
for each text encoding data in each text encoding, each text data can acquire the text encoding data positioned before the text data in the sequence;
where the invisible encoded data is the data to be predicted.
In one possible embodiment, the processor is configured to determine the loss of the language model by:
aiming at a task of converting a sample event structured sequence into a sample abstract text, calculating by combining the coded data in each sample event structured sequence and the shielded codes in the text codes corresponding to the sample abstract text and model parameters, and determining a first loss value;
for the task of converting the sample abstract text into the sample event structured sequence, calculating by combining the coded data in each sample event structured sequence, the shielded codes in the text codes corresponding to the sample abstract text and the shielded codes in the reference coding sequence and model parameters, and determining a second loss value;
and performing weighted calculation on the first loss value and the second loss value to determine the loss of the language model.
In one possible embodiment, the processor is further configured to:
performing semantic analysis on the event abstract text to determine at least one event keyword;
and performing the reply analysis on the event based on the at least one event keyword and a preset event analysis rule.
According to the method, a plurality of event description information and each event description type of related events can be accurately obtained through the obtained event structured information sequence, the event structured information sequence is directly input into the text generation model, the text generation model is used for processing the structured data to obtain a prediction text sequence, and then an event text abstract is obtained, so that the steps of generating natural language by data and the data processing amount are reduced, the text generation efficiency is improved, meanwhile, the context information of the information event information can be better analyzed according to the discretized event structured information sequence, and the text generation accuracy is improved; meanwhile, in the process of training the text generation model, the relation between the sequence and the text is learned in a two-way mode through the task of converting the sample event structured sequence into the sample abstract text and the task of converting the sample abstract text into the sample event structured sequence, so that the accuracy of obtaining the event abstract text through the event structured sequence is improved.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described systems, apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed system, apparatus and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
Finally, it should be noted that: the above-mentioned embodiments are only specific embodiments of the present application, and are used for illustrating the technical solutions of the present application, but not limiting the same, and the scope of the present application is not limited thereto, and although the present application is described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: any person skilled in the art can modify or easily conceive the technical solutions described in the foregoing embodiments or equivalent substitutes for some technical features within the technical scope disclosed in the present application; such modifications, changes or substitutions do not depart from the spirit and scope of the exemplary embodiments of the present application, and are intended to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (14)

1. A method for generating an event summary text, the method comprising:
acquiring an event structured information sequence; the event structured information sequence comprises a plurality of event description information and an event description type of each event description information; the event description type comprises at least one of an event result type, an event participant type and an event time type;
inputting the event structured information sequence into a pre-trained text generation model, so that the text generation model outputs a predicted text sequence corresponding to each event description information according to each event description type and each event description information, and determines the text sequence of a plurality of predicted text sequences according to the event description types;
and splicing the plurality of predicted text sequences according to the obtained text sequence of each predicted text sequence to obtain an event summary text so as to obtain key information of the event according to the event summary text.
2. The generation method according to claim 1, wherein the text generation model includes a sequence embedding layer, a sequence coding layer, and a predicted text sequence output layer; the inputting the event structured information sequence into a pre-trained text generation model to enable the text generation model to output a predicted text sequence corresponding to each event description information according to each event description type and each event description information includes:
inputting the event structured information sequence into the sequence embedding layer, so that the sequence embedding layer respectively encodes the event description types, the event description information and the positions of the event keywords in the event structured information sequence, and outputs a coding sequence corresponding to each event description information;
for each coding sequence, inputting the coding sequence into the sequence coding layer so that the sequence coding layer processes the coding sequence, predicting context information of event description information included in the coding sequence according to the event description type in the coding sequence, and outputting at least one candidate text sequence corresponding to the coding sequence according to the context information and the event description information;
and for each coding sequence, inputting at least one candidate text sequence corresponding to the coding sequence into the predicted text sequence output layer, so that the predicted text sequence output layer screens out the predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence.
3. The method of claim 2, wherein the predicted-text sequence corresponding to the coding sequence is selected from the at least one candidate-text sequence by:
determining a candidate text sequence with the highest prediction score in the at least one candidate text sequence as a predicted text sequence; or;
and determining the candidate text sequence meeting the prediction requirement in the at least one candidate text sequence as the predicted text sequence according to the predicted text requirement.
4. The generation method of claim 3, wherein the predicted-text requirement comprises at least one of:
predicted text length, predicted text sentence pattern and event text expression mode.
5. The generation method according to claim 1, characterized in that the text order of the predicted text sequence is determined by:
and for each predicted text sequence, determining the text sequence of the predicted text sequence according to the text association sequence between the event description type corresponding to the predicted text sequence and other event description types.
6. The generation method of claim 1, wherein the text generation model is trained by:
acquiring a plurality of sample event structured sequences and sample abstract texts corresponding to the sample event structured sequences; each sample event structured sequence comprises a plurality of sample event description information and an event description type to which each sample event description information belongs;
determining a reference sample sequence corresponding to each sample event structured sequence; the reference sample sequence comprises a plurality of pieces of reference identification information, and the number of the reference identifications is the same as the number of the sample event description information in the sample event structured sequence;
inputting the plurality of sample event structured sequences, the plurality of reference sample sequences and the plurality of sample abstract texts into a pre-constructed language model, so that the language model is converted into tasks of the sample abstract texts through the sample event structured sequences and the tasks of the sample abstract texts into the sample event structured sequences, learning the context information of the description information of each sample event, and determining that the language model is trained to obtain the text generation model when the loss of the language model is less than a preset threshold value.
7. The method according to claim 6, wherein the step of learning the context information of the description information of each sample event by converting the language model into the task of the sample event structured sequence and converting the task of the sample summary text into the task of the sample event structured sequence comprises:
inputting the plurality of sample event structured sequences, the plurality of reference sample sequences and the plurality of sample abstract texts into a sequence embedding layer of the language model, so that the sequence embedding layer outputs a structured coding sequence corresponding to each sample event structured sequence, a reference coding sequence corresponding to each reference sample sequence and a text code corresponding to each sample abstract text;
and inputting the determined multiple structural coding sequences, the multiple reference coding sequences and the text codes into a sequence coding layer of the language model, so that the sequence coding layer predicts the target codes according to a sequence obtained by shielding at least one target code in the text codes and/or the structural coding sequences in a preset identification matrix, and determines the context information of the description information of each sample event.
8. The generation method according to claim 6, wherein the event description types include a fixed description type and a variable description type, the generation method further comprising:
and inputting the prediction sequence output by the sequence coding layer into an information copying layer of the language model aiming at each variable description type and the corresponding sample event description information, so that the information copying layer performs prediction learning on the sample event description information and adjusts the context information of the sample event description information corresponding to the variable description type.
9. The generation method according to claim 6, wherein the preset identification matrix is used for representing a visible relationship among the structured coding sequence, the reference coding sequence and the text coding; fitting and learning the context information of the event description information of each sample according to the visible relation among the structured coding sequence, the reference coding sequence and the text code;
in the process of training the language model, aiming at each coded data in each structured coded sequence, each data can obtain other coded data;
aiming at each reference encoding data in each reference encoding sequence, each reference encoding data can obtain a corresponding text code;
for each text encoding data in each text encoding, each text data can acquire the text encoding data positioned before the text data in the sequence;
where the invisible encoded data is the data to be predicted.
10. The generation method according to claim 7, characterized in that the loss of the language model is determined by:
aiming at a task of converting a sample event structured sequence into a sample abstract text, calculating by combining the coded data in each sample event structured sequence and the shielded codes in the text codes corresponding to the sample abstract text and model parameters, and determining a first loss value;
for the task of converting the sample abstract text into the sample event structured sequence, calculating by combining the coded data in each sample event structured sequence, the shielded codes in the text codes corresponding to the sample abstract text and the shielded codes in the reference coding sequence and model parameters, and determining a second loss value;
and performing weighted calculation on the first loss value and the second loss value to determine the loss of the language model.
11. The generation method according to claim 1, characterized in that the generation method further comprises:
performing semantic analysis on the event abstract text to determine at least one event keyword;
and performing the reply analysis on the event based on the at least one event keyword and a preset event analysis rule.
12. An apparatus for generating a summary text of an event, the apparatus comprising:
the information sequence acquisition module is used for acquiring an event structured information sequence; the event structured information sequence comprises a plurality of event description information and an event description type of each event description information; the event description type comprises at least one of an event result type, an event participant type and an event time type;
the text sequence generation module is used for inputting the event structured information sequence into a pre-trained text generation model so that the text generation model outputs a predicted text sequence corresponding to each event description information according to each event description type and each event description information, and determines the text sequence of a plurality of predicted text sequences according to the event description types;
and the summary text generation module is used for splicing the plurality of predicted text sequences according to the obtained text sequence of each predicted text sequence to obtain an event summary text so as to obtain key information of the event according to the event summary text.
13. An electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, when the electronic device is running, the processor and the storage medium communicate with each other through the bus, and the processor executes the machine-readable instructions to perform the steps of the method for generating the event summary text according to any one of claims 1 to 11.
14. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the steps of the method for generating an event summary text according to any one of claims 1 to 11.
CN202210399705.XA 2022-04-15 2022-04-15 Method and device for generating event abstract text, electronic equipment and storage medium Pending CN114676669A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210399705.XA CN114676669A (en) 2022-04-15 2022-04-15 Method and device for generating event abstract text, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210399705.XA CN114676669A (en) 2022-04-15 2022-04-15 Method and device for generating event abstract text, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114676669A true CN114676669A (en) 2022-06-28

Family

ID=82078875

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210399705.XA Pending CN114676669A (en) 2022-04-15 2022-04-15 Method and device for generating event abstract text, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114676669A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115757551A (en) * 2022-11-30 2023-03-07 肇庆市智云体育信息科技有限公司 Method for mining and predicting key information of events
CN116757254A (en) * 2023-08-16 2023-09-15 阿里巴巴(中国)有限公司 Task processing method, electronic device and storage medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115757551A (en) * 2022-11-30 2023-03-07 肇庆市智云体育信息科技有限公司 Method for mining and predicting key information of events
CN115757551B (en) * 2022-11-30 2023-08-25 肇庆市智云体育信息科技有限公司 Event key information mining and predicting method
CN116757254A (en) * 2023-08-16 2023-09-15 阿里巴巴(中国)有限公司 Task processing method, electronic device and storage medium
CN116757254B (en) * 2023-08-16 2023-11-14 阿里巴巴(中国)有限公司 Task processing method, electronic device and storage medium

Similar Documents

Publication Publication Date Title
Kanerva et al. Turku neural parser pipeline: An end-to-end system for the CoNLL 2018 shared task
Zhou et al. A visual attention grounding neural model for multimodal machine translation
CN114676669A (en) Method and device for generating event abstract text, electronic equipment and storage medium
CN111104512B (en) Game comment processing method and related equipment
CN108463815A (en) The name Entity recognition of chat data
Banerjee et al. Exploring transformer based models to identify hate speech and offensive content in english and indo-aryan languages
US11704506B2 (en) Learned evaluation model for grading quality of natural language generation outputs
Wada et al. Unsupervised cross-lingual word embedding by multilingual neural language models
US11551002B2 (en) Learned evaluation model for grading quality of natural language generation outputs
CN113132368B (en) Chat data auditing method and device and computer equipment
CN110852066B (en) Multi-language entity relation extraction method and system based on confrontation training mechanism
CN116628161A (en) Answer generation method, device, equipment and storage medium
Zhang et al. Masking and purifying inputs for blocking textual adversarial attacks
CN113420545B (en) Abstract generation method, device, equipment and storage medium
KR102439165B1 (en) Statements credibility assessing system using commonsense knowledge and linguistic patterns and the method thereof
Yao et al. Oracle performance for visual captioning
CN114707491A (en) Quantity extraction method and system based on natural language processing
CN115083386A (en) Audio synthesis method, electronic device, and storage medium
CN112307181A (en) Corpus-specific-corpus-based corpus extraction method and corpus extractor
CN115114904B (en) Language model optimization method and device and electronic equipment
KR102188553B1 (en) The System For Providing Korean Language Education System with Animation
CN115186820B (en) Event coreference resolution method, device, terminal and computer readable storage medium
KR102422844B1 (en) Method of managing language risk of video content based on artificial intelligence
KR102445497B1 (en) Apparatus for generating lexical pattern and training sentence and operating method thereof
CN113420143B (en) Method, device, equipment and storage medium for generating document abstract

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination