Method, device, electronic device and storage medium for generating event summary text
By directly inputting the structured information of the event into the text generation model and generating the event summary, the problems of large data processing volume and low efficiency in the existing technology are solved, and the text generation efficiency and accuracy are improved.
Patent Information
- Application Number
- CN202210399705.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-15
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2042-04-15
AI Technical Summary
When generating event summary, the prior art needs to convert scattered event data into natural language of structured information, resulting in large data processing volume and low text generation efficiency.
Directly input the event structured information sequence into the pre-trained text generation model, and use the text generation model to process it to generate a predicted text sequence to obtain the event summary, reducing the steps and data processing of data generation in natural language.
It improves text generation efficiency, and better analyzes the context information of the information event information through discrete event structured information, improving the accuracy of text generation.
Smart Images

Figure CN114676669B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a method, device, electronic device and storage medium for generating a match summary text. Background Art
[0002] With the popularity of various sports, various competitions are held all over the world in different seasons. How to effectively report the progress and results of the competitions in text so that users can understand the competitions effectively and timely has become an urgent problem to be solved.
[0003] At present, with the development of deep learning technology and big data technology, the technology for automatically generating battle report summaries has gradually matured. However, in the process of using models to generate battle reports, scattered event data needs to be converted into natural language containing structured information in advance, and then input into the prediction model for text generation. This means that a large number of templates and data processing are required to generate natural language containing structured information that meets the model input standards. The data processing volume is large and the text generation efficiency is low. Summary of the invention
[0004] In view of this, the purpose of the present application is to provide a method, device, electronic device and storage medium for generating a match summary text, directly inputting the acquired match structured information sequence into a text generation model, and obtaining a predicted text sequence through processing of the structured data by the text generation model, thereby obtaining a match text summary, thereby reducing the steps of generating natural language from data and the amount of data processing, and helping to improve text generation efficiency.
[0005] In a first aspect, an embodiment of the present application provides a method for generating a competition summary text, the generating method comprising:
[0006] Acquire a competition structured information sequence; the competition structured information sequence includes a plurality of competition description information and a competition description type to which each competition description information belongs; the competition description type includes at least one of a competition result type, a competition participant type, and a competition time type;
[0007] 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 order of multiple predicted text sequences according to the event description type;
[0008] According to the obtained text order of each predicted text sequence, multiple predicted text sequences are spliced to obtain a match summary text, so as to obtain key information of the match according to the match summary text.
[0009] In a possible embodiment, the text generation model includes a sequence embedding layer, a sequence encoding layer, and a predicted text sequence output layer; the step of 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, including:
[0010] Inputting the event structured information sequence into the sequence embedding layer, so that the sequence embedding layer encodes the position of each event description type, each event description information and each event keyword in the event structured information sequence, and outputs the encoding sequence corresponding to each event description information;
[0011] For each coding sequence, the coding sequence is input to the sequence coding layer, so that the sequence coding layer processes the coding sequence, and predicts context information of the event description information included in the coding sequence according to the event description type in the coding sequence, and outputs at least one candidate text sequence corresponding to the coding sequence according to the context information and the event description information;
[0012] For each coding sequence, at least one candidate text sequence corresponding to the coding sequence is input into the predicted text sequence output layer, so that the predicted text sequence output layer selects the predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence.
[0013] In a possible embodiment, the predicted text sequence corresponding to the coding sequence is screened out from the at least one candidate text sequence by the following steps:
[0014] Determine the candidate text sequence with the highest prediction score among at least one candidate text sequence as the predicted text sequence; or;
[0015] According to the prediction text requirement, a candidate text sequence that meets the prediction requirement in at least one candidate text sequence is determined as a prediction text sequence.
[0016] In a possible embodiment, the predictive text requirement includes at least one of the following:
[0017] Predict text length, predict text sentence structure, and event text expression method.
[0018] In one possible embodiment, the text order of the predicted text sequence is determined by the following steps:
[0019] For each predicted text sequence, the text order of the predicted text sequence is determined according to the text association order between the event description type corresponding to the predicted text sequence and other event description types.
[0020] In one possible embodiment, the text generation model is trained by the following steps:
[0021] Acquire multiple sample event structured sequences and sample summary texts corresponding to the multiple sample event structured sequences; each sample event structured sequence includes multiple sample event description information and the event description type to which each sample event description information belongs;
[0022] For each sample event structured sequence, determine a reference sample sequence corresponding to the sample event structured sequence; the reference sample sequence includes a plurality of reference identification information, and the number of the reference identifications is the same as the number of sample event description information included in the sample event structured sequence;
[0023] The multiple sample event structured sequences, multiple reference sample sequences and multiple sample summary texts are input into a pre-built language model, so that the language model learns the context information of each sample event description information through the task of converting the sample event structured sequence to the sample summary text and the task of converting the sample summary text to the sample event structured sequence. When the loss of the language model is less than a preset threshold, it is determined that the language model training is completed, and the text generation model is obtained.
[0024] In a possible embodiment, the task of enabling the language model to convert the sample event structured sequence into the sample summary text and the task of converting the sample summary text into the sample event structured sequence, and learning the context information of each sample event description information, includes:
[0025] Input the multiple sample event structured sequences, multiple reference sample sequences, and multiple sample summary texts into the 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 summary text;
[0026] The determined multiple structured coding sequences, multiple reference coding sequences and text coding are input into the sequence coding layer of the language model, so that the sequence coding layer predicts the target coding according to the sequence after masking at least one target coding in the text coding and / or structured coding sequence in a preset identification matrix, and determines the context information of each sample event description information.
[0027] In a possible embodiment, the event description type includes a fixed description type and a variable description type, and the generation method further includes:
[0028] For each of the variable description types and the corresponding sample event description information, the prediction sequence output by the sequence encoding layer is input into the information replication layer of the language model, so that the information replication layer performs predictive learning on the sample event description information and adjusts the context information of the sample event description information corresponding to the variable description type.
[0029] In a possible embodiment, the preset identification matrix is used to characterize the visible relationship between the structured coding sequence, the reference coding sequence and the text coding; according to the visible relationship between the structured coding sequence, the reference coding sequence and the text coding, the context information of each sample event description information is fitted and learned;
[0030] In the process of training the language model, for each coded data in each structured coding sequence, each data can obtain other coded data;
[0031] For each reference code data in each reference code sequence, each reference code data can obtain a corresponding text code;
[0032] For each text encoding data in each text encoding, each text data can obtain the text encoding data located before the text data in the sequence;
[0033] The invisible coded data is the data to be predicted.
[0034] In one possible embodiment, the loss of the language model is determined by the following steps:
[0035] For the task of converting the sample event structured sequence into the sample summary text, the first loss value is determined by calculating the coded data in each sample event structured sequence and the occluded code in the text code corresponding to the sample summary text in combination with the model parameters;
[0036] For the task of converting the sample summary text into the sample event structured sequence, the second loss value is determined by calculating the encoding data in each sample event structured sequence, the obscured encoding in the text encoding corresponding to the sample summary text, and the obscured encoding in the reference encoding sequence in combination with the model parameters;
[0037] The first loss value and the second loss value are weightedly calculated to determine the loss of the language model.
[0038] In a possible embodiment, the generating method further includes:
[0039] Performing semantic analysis on the event summary text to determine at least one event keyword;
[0040] Based on the at least one event keyword and preset event analysis rules, a review analysis of the event is performed.
[0041] In a second aspect, an embodiment of the present application further provides a device for generating a competition summary text, the device comprising:
[0042] An information sequence acquisition module, used to acquire a structured event information sequence; the structured event information sequence includes a plurality of event description information and an event description type to which each event description information belongs; the event description type includes at least one of an event result type, an event participant type, and an event time type;
[0043] A text sequence generation module, 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 order of multiple predicted text sequences according to the event description type;
[0044] The summary text generation module is used to splice multiple prediction text sequences according to the text order of each prediction text sequence obtained to obtain a competition summary text, so as to obtain key information of the competition according to the competition summary text.
[0045] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the method for generating an event summary text as described in any one of the first aspects.
[0046] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method for generating an event summary text as described in any one of the first aspects are executed.
[0047] The method, device, electronic device and storage medium for generating a match summary text provided in the embodiment of the present application obtain a match structured information sequence containing multiple match description information and a match description type to which each match description information belongs; input the match structured information sequence into a pre-trained text generation model so that the text generation model outputs a predicted text sequence corresponding to each match description information according to each match description type and each match description information, and determines the text order of multiple predicted text sequences according to the match description type; splices multiple predicted text sequences according to the text order of each predicted text sequence obtained to obtain a match summary text, so as to obtain key information of the match according to the match summary text. In the embodiment of the present application, the obtained match structured information sequence is directly input into the text generation model, and the predicted text sequence is obtained through the processing of the structured data by the text generation model, and then the match text summary is obtained, which reduces the steps of generating natural language from data and the amount of data processing, and helps to improve the efficiency of text generation. At the same time, the contextual information of the information match information can be better analyzed according to the discretized match structured information sequence, thereby improving the accuracy of text generation.
[0048] In order to make the above-mentioned objects, features and advantages of the present application more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0049] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.
[0050] Figure 1 A flowchart of a method for generating a competition summary text provided in an embodiment of the present application;
[0051] Figure 2 A flowchart of another method for generating a competition summary text provided in an embodiment of the present application;
[0052] Figure 3 A flowchart of another method for generating a competition summary text provided in an embodiment of the present application;
[0053] Figure 4 A schematic diagram of an identification matrix during a training process provided in an embodiment of the present application;
[0054] Figure 5 This is one of the structural schematic diagrams of a device for generating a competition summary text provided in an embodiment of the present application;
[0055] Figure 6 The second structural diagram of a device for generating a competition summary text provided in an embodiment of the present application;
[0056] Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0057] To make the purpose, technical scheme and advantages of the embodiments of the present application clearer, the technical scheme in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The components of the embodiments of the present application usually described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present application provided in the drawings is not intended to limit the scope of the application claimed for protection, but merely represents the selected embodiments of the present application. Based on the embodiments of the present application, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present application.
[0058] First, the application scenarios to which this application can be applied are introduced. This application can be applied to the field of data processing technology. With the popularity of various sports, various events are held all over the world in different seasons. How to effectively report the progress and results of the events in text so that users can effectively and timely understand the events has become an urgent problem to be solved.
[0059] At present, with the development of deep learning technology and big data technology, the technology for automatically generating battle report summaries has gradually matured. However, in the process of using models to generate battle reports, scattered event data needs to be converted into natural language containing structured information in advance, and then input into the prediction model for text generation. This means that a large number of templates and data processing are required to generate natural language containing structured information that meets the model input standards. The data processing volume is large and the text generation efficiency is low.
[0060] Based on this, an embodiment of the present application provides a method for generating a match summary text to improve the efficiency and accuracy of text generation.
[0061] See also Figure 1 , Figure 1 This is a flow chart of a method for generating a competition summary text provided in an embodiment of the present application. Figure 1 As shown in , the method for generating a match summary text provided in the embodiment of the present application includes:
[0062] S101, obtaining a competition structured information sequence; the competition structured information sequence includes a plurality of competition description information and a competition description type to which each competition description information belongs; the competition description type includes at least one of a competition result type, a competition participant type and a competition time type.
[0063] 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 order of multiple predicted text sequences according to the event description type.
[0064] S103 . According to the obtained text order of each predicted text sequence, multiple predicted text sequences are spliced to obtain a match summary text, so as to obtain key information of the match according to the match summary text.
[0065] The method for generating a match summary text provided in the embodiment of the present application directly inputs the acquired match structured information sequence into a text generation model, and obtains a predicted text sequence through processing of structured data by the text generation model, thereby obtaining a match text summary, thereby reducing the steps of generating natural language from data and the amount of data processing, and helping to improve text generation efficiency. At the same time, according to the discretized match structured information sequence, the contextual information of the match information can be better analyzed, thereby improving the accuracy of text generation.
[0066] The following is a description of the exemplary steps of the present application embodiment:
[0067] S101, obtaining a competition structured information sequence; the competition structured information sequence includes a plurality of competition description information and a competition description type to which each competition description information belongs;
[0068] The event description type includes at least one of an event result type, an event participant type, and an event time type.
[0069] In the embodiment of the present application, all the data constituting the event structured information sequence are multiple independent structured data during the event. The entire event structured information sequence can represent an action in an event, or multiple actions in an event.
[0070] In a possible implementation, the event structured information sequence may include event description information, which is used to characterize the event information described by the entire event structured information, and each different event description information will appear in combination with a corresponding event description type in the event structured information sequence. The event description type includes at least one of an event result type, an event participant type, and an event time type.
[0071] For example, taking a football match as an example, in a football match, multiple pieces of information about the football match can be obtained from the live broadcast of the match. Taking a sequence of structured information of a match representing a shooting action as an example, multiple independent structured information can be extracted for this shooting work: assist person (match participant type): A, shooter (match participant type): B, goal (match result type), time (match time type): Friday at 10 am.
[0072] Then the event structured information sequence of this shooting action can be expressed as {assistant: A, shooter: B, goal, time: Friday morning 10}.
[0073] 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 order of multiple predicted text sequences according to the event description type.
[0074] In an embodiment of the present application, the event structured information sequence obtained in step S101 is input into a pre-trained text generation model. The text generation model can output a predicted text sequence containing context corresponding to each event description type and each event description information included in the event structured information sequence, and determine the text order of each predicted text in the summary to be generated.
[0075] In one possible implementation, the text generation model includes a sequence embedding layer, a sequence encoding layer, and a predicted text sequence output layer.
[0076] In one possible implementation, the trained text generation model can directly perform natural language processing based on the input event structured information sequence to obtain the context information of each event description information, and then combine them into a corresponding prediction text sequence. Through multiple prediction text sequences of event description information, an event summary text describing the key information of the entire event can be constructed. The following specifically introduces the process of the text generation model processing the event structured information sequence, generating multiple prediction text sequences, and then obtaining the event summary text.
[0077] See also Figure 2 , Figure 2 This is a flow chart of another method for generating a competition summary text provided in an embodiment of the present application. Figure 2As shown in , the step of "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" includes:
[0078] S201. Input the event structured information sequence into the sequence embedding layer, so that the sequence embedding layer encodes the position of each event description type, each event description information and each event keyword in the event structured information sequence, and outputs the encoding sequence corresponding to each event description information.
[0079] In an embodiment of the present application, the event structured information sequence is input into the sequence embedding layer, and the event description type, each event description information and the position of each event keyword in the event structured information sequence included in the event structured information sequence are encoded in the sequence embedding layer. After encoding, the sequence embedding layer outputs the encoding sequence corresponding to each event description information.
[0080] In a possible implementation, the purpose of encoding the event structured information sequence is to more accurately capture the event structured information sequence through a discretized embedding representation, which helps to improve the accuracy of the subsequent generation of a predicted text sequence.
[0081] In one possible embodiment, the sequence embedding layer of the text generation model can use transformerblock as an encoder.
[0082] Specifically, for each structured data in the event structured information sequence, one-hot encoding can be used to directly encode it as a token embedding to obtain an encoded encoding sequence.
[0083] Corresponding to the above example, for football matches, when encoding each structured data in the structured information sequence of the match, a preset number of match keywords (key) can be pre-set: shooter, assister, defender, result, shot position, shot type, time, whether it is a long shot, whether it is a blind spot, whether it is a one-stop shooter, whether it is an inside cut, whether it is a small angle; for the above match keywords, except for the names of the players in the match participant type and the match time type, the corresponding values are generally limited. When encoding keys with limited values, instead of using real token encoding, consider using [unused_xx] discretized encoding, and the rest are directly encoded from the vocab dictionary.
[0084] All keys of structured data are one-hot discretely encoded using a subspace of size 13, and the position encoding is consistent with the Unilm model. Therefore, for each token, its embedding is expressed as embed = TE + PE + KE, where TE is the token embedding, PE is the position embedding, and KE is the key embedding.
[0085] S202. For each coding sequence, the coding sequence is input into the sequence coding layer so that the sequence coding layer processes the coding sequence, and predicts the context information of the event description information included in the coding sequence according to the event description type in the coding sequence, and outputs at least one candidate text sequence corresponding to the coding sequence according to the context information and the event description information.
[0086] In an embodiment of the present application, for the coded sequence after the sequence embedding layer encoding processing in step S201, the coded sequence is input into the sequence encoding layer, and the sequence encoding layer processes the coded sequence. After processing (encoding and decoding) the coded sequence, the context information of the event description information included in the coded sequence is predicted according to the event description type in the coded sequence, and at the same time, based on the determined context information and event description information, at least one candidate text sequence corresponding to the coded sequence is output.
[0087] Among them, for each coding sequence, the candidate text sequence after decoding and prediction by the sequence coding layer is a text sequence containing the event description information of the coding sequence and filled with corresponding words.
[0088] Corresponding to the above example, the event structured information sequence corresponding to a coding sequence is {assistant: A, shooter: B, goal, time: Friday at 10 am}, then a candidate text sequence corresponding to the coding sequence can be {player B scored a goal at 10 am on Friday with the assist of player A}.
[0089] S203. For each coding sequence, input 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 selects the predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence.
[0090] In an embodiment of the present application, for each coding sequence, more than one corresponding candidate text sequence may be generated after context prediction. At this time, it is necessary to analyze at least one candidate text sequence to obtain a predicted text sequence that best meets the prediction requirements. Specifically, for each coding sequence, after encoding and decoding through the sequence coding layer to obtain at least one candidate text sequence, the at least one candidate text sequence is screened through the predicted text sequence output layer to obtain a predicted text sequence corresponding to the coding sequence.
[0091] In a possible implementation, the predicted text sequence corresponding to the coding sequence is screened out from the at least one candidate text sequence by the following steps:
[0092] a1: Determine the candidate text sequence with the highest prediction score among at least one candidate text sequence as the predicted text sequence.
[0093] Specifically, for each coding sequence, when prediction is performed through the sequence encoding layer, when each candidate text sequence is generated, a corresponding prediction score is calculated for each candidate text sequence. This prediction score can reflect to a certain extent the quality of each predicted text sequence as considered by the model itself. Therefore, the candidate text sequence with the highest prediction score can be screened out from at least one candidate text sequence and determined as the predicted text sequence.
[0094] a2: According to the prediction text requirement, a candidate text sequence that meets the prediction requirement in at least one candidate text sequence is determined as a prediction text sequence.
[0095] Specifically, for different prediction scenarios (different prediction event levels, different prediction event prediction times, etc.), there may be certain differences in the requirements for each text generation. Therefore, when screening at least one predicted text, the candidate text sequence that meets the prediction requirements can be determined as the predicted text sequence from at least one candidate text sequence based on the predicted text requirements.
[0096] The predicted text requirements include at least one of the following: predicted text length, predicted text sentence structure, and event text expression method.
[0097] Specifically, the predicted text length may be that when generating an event text summary, there may be certain restrictions on the number of words in the text. Therefore, when generating a single-sentence text, the number of words will be controlled as much as possible; the predicted text sentence pattern may refer to the expression form of the text, which is also related to the overall style requirements of the event text summary. The overall event text summary may be a concise narrative style, so when generating a single-sentence text, a declarative sentence pattern will also be selected for expression; the event text expression method refers to the language used in the entire event text summary. The text generation model in the embodiment of the present application supports the generation of multi-language summaries. Therefore, if it is necessary to generate an English version of the event text summary, then when generating a single-sentence text, the candidate text sequence of the English version will also be determined as the predicted text sequence.
[0098] S103 . According to the obtained text order of each predicted text sequence, multiple predicted text sequences are spliced to obtain a match summary text, so as to obtain key information of the match according to the match summary text.
[0099] In the embodiment of the present application, the multiple predicted text sequences obtained in step S102 are concatenated according to the text order corresponding to each predicted text sequence to obtain a match summary text, and the obtained match summary text is analyzed to obtain key information of the match.
[0100] In a possible implementation, when splicing multiple prediction texts, they need to be spliced in sequence to ensure the readability of the obtained event summary text.
[0101] Specifically, the text order of the predicted text sequence is determined by the following steps:
[0102] b1: For each predicted text sequence, determine the text order of the predicted text sequence according to the text association order between the event description type corresponding to the predicted text sequence and other event description types.
[0103] In the embodiment of the present application, for each predicted text sequence, the text order of the predicted text sequence may be determined according to the text association order between the event description types corresponding to the preset text sequence.
[0104] Specifically, when generating a match summary text, it is generally necessary to introduce the match participants, match time and match results. Generally speaking, the match description information of the match result type is at a relatively later position in each sentence of the entire match summary. Therefore, when splicing multiple prediction text sequences, the prediction text sequence corresponding to the match result type should also be spliced at a later position.
[0105] For the above example, one predicted text sequence is filtered out as {Player B scored a goal in the first half of the game with the assistance of Player A}; another predicted text sequence is {In the second half, Player C assisted Player D to shoot into the dead corner to equalize the score}. Then, the spliced summary can be "Player B scored a goal in the first half of the game with the assistance of Player A, and in the second half, Player C assisted Player D to shoot into the dead corner to equalize the score and enter overtime", etc.
[0106] In a possible real-time manner, after a match summary text is generated by splicing multiple prediction text sequences, key match information can be obtained from the match summary text. Specifically, the generation method provided in the embodiment of the present application further includes:
[0107] c1: Perform semantic analysis on the event summary text to determine at least one event keyword.
[0108] In an embodiment of the present application, after obtaining the event summary text, a plurality of event keywords can be screened out from the event summary text through natural semantic analysis, and these event keywords are helpful for analyzing the progress of the game.
[0109] In a possible implementation, the event keywords to be extracted may be pre-set according to the event analysis requirements. When analyzing the event summary text, the similarity between each word in the event summary text and the pre-set event keywords may be calculated, and the words having a similarity greater than a preset similarity threshold may be determined as event keywords in the event summary text.
[0110] Specifically, the game keywords include but are not limited to: game results, game scores, names of players who scored the most goals in the game, time of goals scored, etc.
[0111] c2: Based on the at least one event keyword and preset event analysis rules, re-analyze the event.
[0112] In the embodiment of the present application, the entire game is analyzed according to at least one game keyword extracted from the game summary text in step c1 and preset game analysis rules.
[0113] The angles and directions of the analysis include but are not limited to the results of the game, whether the team lost or won the game, the specific score, who was the better player in the opponent's team, etc.
[0114] In a possible implementation, a text generation model for converting event structured information into event summary text needs to be trained based on a language model. The training process of the text generation model in the embodiment of the present application is specifically described below:
[0115] Specifically, see Figure 3 , Figure 3 This is a flow chart of another method for generating a competition summary text provided in an embodiment of the present application. Figure 3 As shown in , the text generation model is trained by the following steps:
[0116] S301, obtaining multiple sample event structured sequences and sample summary texts corresponding to the multiple sample event structured sequences; each event structured information sequence includes multiple sample event description information and the event description type to which each sample event description information belongs.
[0117] In an embodiment of the present application, when training a text generation model, it is necessary to obtain multiple sample event structured sequences and sample summary texts corresponding to each sample event structured sequence. Similarly, in order to construct a language model that can better learn the conversion relationship between the event structured sequence and the event text summary, each sample event structured sequence also includes multiple sample event description information and the event description type to which each sample event description information belongs.
[0118] S302. For each sample event structured sequence, determine a reference sample sequence corresponding to the sample event structured sequence; the reference sample sequence includes a plurality of reference identification information, and the number of the reference identifications is the same as the number of sample event description information included in the sample event structured sequence.
[0119] In the embodiment of the present application, for each sample event structured sequence, a reference sample sequence corresponding to the sample event structured sequence is determined.
[0120] The reference sample sequence includes a plurality of reference identification information, and the number of the reference identification information is the same as the number of sample event description information included in the sample event structured sequence. Specifically, the reference identification included in the sample reference sequence may be [MASK].
[0121] In an embodiment of the present application, in order to ensure the accuracy of the trained text generation model, when training the language model, it is necessary not only to let the language model learn the context information in the process of converting from a structured sequence to a text summary, but also to obtain the context information in the process of converting the text summary to a structured sequence. The purpose of obtaining the reference sample sequence during the training process is to assist in learning the context information when converting the text summary to a structured sequence.
[0122] S303, inputting the multiple sample event structured sequences, multiple reference sample sequences and multiple sample summary texts into a pre-built language model, so that the language model learns the context information of each sample event description information through the task of converting the sample event structured sequence to the sample summary text and the task of converting the sample summary text to the sample event structured sequence. When the loss of the language model is less than a preset threshold, it is determined that the language model training is completed, and the text generation model is obtained.
[0123] In an embodiment of the present application, multiple sample event structured sequences, multiple reference sample sequences, and multiple sample summary texts are obtained and input into a pre-constructed language model, so that the language model learns the context information of each sample event description information according to the multiple sample event structured sequences, multiple reference sample sequences, and multiple sample summary texts through the task of converting the sample event structured sequences to the sample summary texts and the task of converting the sample summary texts to the sample event structured sequences, and at the same time calculates the loss value in the process of each learning task. When the loss of the language model is less than a preset threshold, it is determined that the language model training is completed and the text generation model is obtained.
[0124] In a possible implementation, the language model also includes a sequence embedding layer and a sequence encoding layer, and the step of "enabling the language model to learn the context information of each sample event description information through the task of converting the sample event structured sequence to the sample summary text and the task of converting the sample summary text to the sample event structured sequence" includes:
[0125] d1: Input the multiple sample event structured sequences, multiple reference sample sequences and multiple sample summary texts into the 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 summary text.
[0126] In an embodiment of the present application, the acquired sample event structured sequence, reference sample sequence and multiple sample summary texts are correspondingly input into the sequence embedding layer of the language model, and the sample event structured sequence, reference sample sequence and multiple sample summary 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 coding corresponding to each sample summary text.
[0127] In a possible implementation, the language model used for training in the embodiments of the present application may be a language model of a unified framework.
[0128] Specifically, the transformer block can be used as a sequence embedding layer. For example, suppose the input vector after embedding is {x1,x2…,x k}, k = 2m + n, H 0 =[x1,x2,…,x k ], the encoding of the i-th layer is expressed as H i+1 = TransformerBloack(H i ), for the lth layer, the output A of the multi-head attention is expressed as:
[0129]
[0130]
[0131]
[0132] in, is a learnable parameter, and M represents the attention matrix.
[0133] d2: Input the determined multiple structured coding sequences, multiple reference coding sequences and text coding into the sequence coding layer of the language model, so that the sequence coding layer predicts the target coding according to the sequence after masking at least one target coding in the text coding and / or structured coding sequence in the preset identification matrix, and determines the context information of each sample event description information.
[0134] In an embodiment of the present application, the multiple structured coding sequences, multiple reference coding sequences and text coding determined in step d1 are input into the sequence coding layer of the natural coding language model, and the sequence coding layer is controlled to predict the target coding according to the sequence after masking at least one target coding in the text coding and / or structured coding sequence in the preset identification matrix, so as to predict the context information of each sample event description information according to the learned context information.
[0135] In a possible implementation, a preset identification matrix is used to characterize the visible relationship between the structured coding sequence, the reference coding sequence, and the text coding; and based on the visible relationship between the structured coding sequence, the reference coding sequence, and the text coding, the context information of each sample event description information is fitted and learned.
[0136] Among them, a MASK matrix can be used to represent the visible and invisible relationship between sequences.
[0137] Specifically, in the process of training the language model, for each encoded data in each structured encoding sequence, each data can obtain other encoded data; for each reference encoded data in each reference encoding sequence, each reference encoded data can obtain the corresponding text encoding; for each text encoded data in each text encoding, each text data can obtain the text encoded data that is located before the text data in the sequence; wherein, the invisible encoded data is the data to be predicted.
[0138] See also Figure 4 , Figure 4 A schematic diagram of the identification matrix in the training process provided by the embodiment of the present application, such as Figure 4 As shown in the figure, S1 is the input sample event structured sequence; S2 is the input reference sample sequence; S3 is the input sample summary text. In the process of training the natural coding language model, the input S1 can see the tokens of each position of itself in both directions, and S3 can see the tokens before its position in one direction, and can also see all the tokens of S1. However, S2 is a virtual input constructed by this algorithm, and S2 can only see all the tokens of S3.
[0139] In a possible implementation, each event description type can be divided into a fixed description type and a variable description type. Specifically, the fixed description type can be event description information such as event results. For event result types, there are generally a limited number of description information such as victory, defeat, and goal, while for event participant types and event time types, they are not fixed. Therefore, for variable description types, an additional copy layer can be added when training the language model to strengthen the learning of the corresponding context information.
[0140] Specifically, the generating method further includes:
[0141] f1: For each of the variable description types and the corresponding sample event description information, the prediction sequence output by the sequence encoding layer is output to the information replication layer of the language model, so that the information replication layer performs predictive learning on the sample event description information and adjusts the context information of the sample event description information corresponding to the variable description type.
[0142] In an embodiment of the present application, for each variable description type and the corresponding sample event description information, the prediction sequence output by the sequence encoding layer is input again into the information replication layer of the language model, and the sample event description information is predicted and learned in the information replication layer, and then the context information of the sample event description information corresponding to the variable description type is adjusted to more accurately learn the context information of the sample event description information corresponding to the variable description type.
[0143] It is worth noting that after the language model training is completed, the generated text generation model, when performing model prediction, the MASK matrix is a normal UniLM seq2seq model attention matrix. According to the input event structured information sequence, the corresponding context information can be predicted, and then the corresponding predicted text sequence can be obtained.
[0144] In a possible implementation, when training a language model, it is necessary to determine the language model based on the loss value during the training process. Because when training the language model, there are two tasks: converting a sample event structured sequence into a sample summary text and converting the sample summary text into a sample event structured sequence. Therefore, when calculating the loss value of the language model, it is necessary to comprehensively consider the losses of the above two tasks.
[0145] Specifically, the loss of the language model is determined by the following steps:
[0146] g1: For the task of converting sample event structured sequences into sample summary texts, the first loss value is determined by calculating the encoding data in each sample event structured sequence and the occluded encoding in the text encoding corresponding to the sample summary text in combination with the model parameters.
[0147] Specifically, the first loss value can be calculated by the following formula:
[0148] loss1=∑ρ(S 3,i+1 |S1,S 3,1:i ,θ);
[0149] The above formula is a seq2seq autoregressive generation form. For the i+1th token, the information before and after the i+1th information of the sample event structured sequence and the sample summary text is learned, and θ is the parameter of the model.
[0150] g2: For the task of converting the sample summary text into the sample event structured sequence, the second loss value is determined by calculating the encoding data in each sample event structured sequence, the occluded encoding in the text encoding corresponding to the sample summary text, and the occluded encoding in the reference encoding sequence in combination with the model parameters.
[0151] Specifically, the second loss value can be calculated by the following formula:
[0152] loss2 = ρ(S1|S3,S2,θ);
[0153] Here, θ is the parameter of the model.
[0154] g3: Perform weighted calculation on the first loss value and the second loss value to determine the loss of the language model.
[0155] Specifically, the loss of the language model can be calculated by the following formula:
[0156] loss = loss1 + λloss2;
[0157] Among them, λ is a hyperparameter used to adjust the weights of multiple tasks. It can be set according to the emphasis of model training among multiple tasks and the training requirements of the model.
[0158] In one possible implementation, by comparing the text prediction results of the model after inputting text that has been processed by natural semantics in the prior art, and the text prediction results of the model after inputting a discretized event structured information sequence as described in the embodiments of the present application, it can be seen that the scheme in the embodiments of the present application has a relatively significant improvement in accuracy.
[0159] 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":"Shot","time":"Additional time 47:37"}; {"shooter":"Player Da","team":"Team A","result":"Hit the post","time":"55:51"}; {"shooter":"Player Abe","team":"Team B","assistor":"Player Fi","result":"Goal","types":"Single-handed","time":"58:58"}; {"shooter":"Player Mar","team":"Team A","assistor":"Player Da","result":"Goal","types":["Dead corner"],"time":"64:58"}.
[0160] After being processed by the text generation model in the embodiment of the present application, the obtained match summary text is: In the first half, player Br scored a goal for Team B to take the lead, and player Va scored a goal in the stoppage time to tie the score. In the second half, player Da's shot unfortunately hit the post, and 3 minutes later, player Fi assisted player Abe to score a goal and lead the score again. Player Da assisted player Mar to shoot into the dead corner to tie the score. At the end of the game, Team A tied Team B 2:2.
[0161] The method for generating a match summary text provided in the embodiment of the present application obtains a match structured information sequence including multiple match description information and a match description type to which each match description information belongs; the match structured information sequence is input into a pre-trained text generation model, so that the text generation model outputs a predicted text sequence corresponding to each match description information according to each match description type and each match description information, and determines the text order of multiple predicted text sequences according to the match description type; according to the text order of each predicted text sequence obtained, multiple predicted text sequences are spliced to obtain a match summary text, so as to obtain key information of the match according to the match summary text. In the embodiment of the present application, the obtained match structured information sequence is directly input into the text generation model, and the predicted text sequence is obtained through the processing of the structured data by the text generation model, and then the match text summary is obtained, which reduces the steps of generating natural language from data and the amount of data processing, and helps to improve the efficiency of text generation. At the same time, the contextual information of the information match information can be better analyzed according to the discretized match structured information sequence, thereby improving the accuracy of text generation.
[0162] Based on the same inventive concept, the embodiment of the present application also provides a device for generating a match summary text corresponding to the method for generating a match summary text. Since the principle of solving the problem by the device in the embodiment of the present application is similar to the method for generating a match summary text in the embodiment of the present application, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0163] See also Figure 5 , Figure 6 , Figure 5 This is one of the structural schematic diagrams of a device for generating a competition summary text provided in an embodiment of the present application. Figure 6 This is a second structural diagram of a device for generating a competition summary text provided in an embodiment of the present application. Figure 5 As shown in , the generating device 500 includes:
[0164] The information sequence acquisition module 510 is used to acquire a structured event information sequence; the structured event information sequence includes a plurality of event description information and an event description type to which each event description information belongs; the event description type includes at least one of an event result type, an event participant type, and an event time type;
[0165] A text sequence generation module 520 is used 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, and determines the text order of multiple predicted text sequences according to the event description type;
[0166] The summary text generation module 530 is used to splice multiple prediction text sequences according to the text order of each prediction text sequence obtained to obtain a game summary text, so as to obtain key information of the game according to the game summary text.
[0167] In a possible implementation, Figure 6 As shown, the generating device 500 further includes a model training module 540, and the model training module 540 is used to:
[0168] Acquire multiple sample event structured sequences and sample summary texts corresponding to the multiple sample event structured sequences; each sample event structured sequence includes multiple sample event description information and the event description type to which each sample event description information belongs;
[0169] For each sample event structured sequence, determine a reference sample sequence corresponding to the sample event structured sequence; the reference sample sequence includes a plurality of reference identification information, and the number of the reference identifications is the same as the number of sample event description information included in the sample event structured sequence;
[0170] The multiple sample event structured sequences, multiple reference sample sequences and multiple sample summary texts are input into a pre-built language model, so that the language model learns the context information of each sample event description information through the task of converting the sample event structured sequence to the sample summary text and the task of converting the sample summary text to the sample event structured sequence. When the loss of the language model is less than a preset threshold, it is determined that the language model training is completed, and the text generation model is obtained.
[0171] In a possible implementation, Figure 6 As shown, the generating device 500 further includes an information learning module 550, and the information learning module 550 is used to:
[0172] For each of the variable description types and the corresponding sample event description information, the prediction sequence output by the sequence encoding layer is input into the information replication layer of the language model, so that the information replication layer performs predictive learning on the sample event description information and adjusts the context information of the sample event description information corresponding to the variable description type.
[0173] In a possible implementation, Figure 6 As shown, the generating device 500 further includes a competition analysis module 560, and the competition analysis module 560 is used to:
[0174] Performing semantic analysis on the event summary text to determine at least one event keyword;
[0175] Based on the at least one event keyword and preset event analysis rules, a review analysis of the event is performed.
[0176] In a possible implementation, the text generation model includes a sequence embedding layer, a sequence encoding layer, and a predicted text sequence output layer. When the text sequence generation module 520 is used 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 used to:
[0177] Inputting the event structured information sequence into the sequence embedding layer, so that the sequence embedding layer encodes the position of each event description type, each event description information and each event keyword in the event structured information sequence, and outputs the encoding sequence corresponding to each event description information;
[0178] For each coding sequence, the coding sequence is input to the sequence coding layer, so that the sequence coding layer processes the coding sequence, and predicts context information of the event description information included in the coding sequence according to the event description type in the coding sequence, and outputs at least one candidate text sequence corresponding to the coding sequence according to the context information and the event description information;
[0179] For each coding sequence, at least one candidate text sequence corresponding to the coding sequence is input into the predicted text sequence output layer, so that the predicted text sequence output layer selects the predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence.
[0180] In a possible implementation, the text sequence generation module 520 is used to select a predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence through the following steps:
[0181] Determine the candidate text sequence with the highest prediction score among at least one candidate text sequence as the predicted text sequence; or;
[0182] According to the prediction text requirement, a candidate text sequence that meets the prediction requirement in at least one candidate text sequence is determined as a prediction text sequence.
[0183] In a possible implementation manner, the predictive text requirement includes at least one of the following:
[0184] Predict text length, predict text sentence structure, and event text expression method.
[0185] In a possible implementation, the text sequence generation module 520 is used to determine the text order of the predicted text sequence through the following steps:
[0186] For each predicted text sequence, the text order of the predicted text sequence is determined according to the text association order between the event description type corresponding to the predicted text sequence and other event description types.
[0187] In a possible implementation, when the model training module 540 is used to enable the language model to learn the context information of each sample event description information through the task of converting the sample event structured sequence into the sample summary text and the task of converting the sample summary text into the sample event structured sequence, the model training module 540 is used to:
[0188] Input the multiple sample event structured sequences, multiple reference sample sequences, and multiple sample summary texts into the 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 summary text;
[0189] The determined multiple structured coding sequences, multiple reference coding sequences and text coding are input into the sequence coding layer of the language model, so that the sequence coding layer predicts the target coding according to the sequence after masking at least one target coding in the text coding and / or structured coding sequence in a preset identification matrix, and determines the context information of each sample event description information.
[0190] In a possible implementation, the preset identification matrix is used to characterize the visible relationship between the structured coding sequence, the reference coding sequence, and the text coding; according to the visible relationship between the structured coding sequence, the reference coding sequence, and the text coding, the context information of each sample event description information is fitted and learned;
[0191] In the process of training the language model, for each coded data in each structured coding sequence, each data can obtain other coded data;
[0192] For each reference code data in each reference code sequence, each reference code data can obtain a corresponding text code;
[0193] For each text encoding data in each text encoding, each text data can obtain the text encoding data located before the text data in the sequence;
[0194] The invisible coded data is the data to be predicted.
[0195] In a possible implementation, the model training module 540 is used to determine the loss of the language model through the following steps:
[0196] For the task of converting the sample event structured sequence into the sample summary text, the first loss value is determined by calculating the coded data in each sample event structured sequence and the occluded code in the text code corresponding to the sample summary text in combination with the model parameters;
[0197] For the task of converting the sample summary text into the sample event structured sequence, the second loss value is determined by calculating the encoding data in each sample event structured sequence, the obscured encoding in the text encoding corresponding to the sample summary text, and the obscured encoding in the reference encoding sequence in combination with the model parameters;
[0198] The first loss value and the second loss value are weightedly calculated to determine the loss of the language model.
[0199] The generation device of the event summary text provided in the embodiment of the present application obtains an event structured information sequence containing multiple event description information and the event description type to which each event description information belongs; the event structured information sequence is input 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 order of multiple predicted text sequences according to the event description type; according to the text order of each predicted text sequence obtained, multiple predicted text sequences are spliced 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 present application, the obtained event structured information sequence is directly input into the text generation model, and the predicted text sequence is obtained through the processing of the structured data by the text generation model, and then the event text summary is obtained, which reduces the steps of data generation of natural language and the amount of data processing, and helps to improve the efficiency of text generation. At the same time, the contextual information of the information event information can be better analyzed according to the discretized event structured information sequence, thereby improving the accuracy of text generation.
[0200] See also Figure 7 , Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present application. Figure 7As shown in , the electronic device 700 includes: a processor 710, a storage medium 720 and a bus 730, the storage medium 720 stores machine-readable instructions executable by the processor 710, when the electronic device runs 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, the processor 710 method item preamble part, to perform the following steps:
[0201] Acquire a competition structured information sequence; the competition structured information sequence includes a plurality of competition description information and a competition description type to which each competition description information belongs; the competition description type includes at least one of a competition result type, a competition participant type, and a competition time type;
[0202] 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 order of multiple predicted text sequences according to the event description type;
[0203] According to the obtained text order of each predicted text sequence, multiple predicted text sequences are spliced to obtain a match summary text, so as to obtain key information of the match according to the match summary text.
[0204] In a feasible implementation scheme, the text generation model includes a sequence embedding layer, a sequence encoding layer, and a predicted text sequence output layer. When the processor 710 is used 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 used to:
[0205] Inputting the event structured information sequence into the sequence embedding layer, so that the sequence embedding layer encodes the position of each event description type, each event description information and each event keyword in the event structured information sequence, and outputs the encoding sequence corresponding to each event description information;
[0206] For each coding sequence, the coding sequence is input to the sequence coding layer, so that the sequence coding layer processes the coding sequence, and predicts context information of the event description information included in the coding sequence according to the event description type in the coding sequence, and outputs at least one candidate text sequence corresponding to the coding sequence according to the context information and the event description information;
[0207] For each coding sequence, at least one candidate text sequence corresponding to the coding sequence is input into the predicted text sequence output layer, so that the predicted text sequence output layer selects the predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence.
[0208] In a feasible implementation manner, the processor 710 is configured to select a predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence by the following steps:
[0209] Determine the candidate text sequence with the highest prediction score among at least one candidate text sequence as the predicted text sequence; or;
[0210] According to the prediction text requirement, a candidate text sequence that meets the prediction requirement in at least one candidate text sequence is determined as a prediction text sequence.
[0211] In a feasible implementation scheme, the predictive text requirement includes at least one of the following:
[0212] Predict text length, predict text sentence structure, and event text expression method.
[0213] In a feasible implementation, the processor 710 is configured to determine the text order of the predicted text sequence by the following steps:
[0214] For each predicted text sequence, the text order of the predicted text sequence is determined according to the text association order between the event description type corresponding to the predicted text sequence and other event description types.
[0215] In a feasible implementation scheme, the processor 710 is used to train the text generation model through the following steps:
[0216] Acquire multiple sample event structured sequences and sample summary texts corresponding to the multiple sample event structured sequences; each sample event structured sequence includes multiple sample event description information and the event description type to which each sample event description information belongs;
[0217] For each sample event structured sequence, determine a reference sample sequence corresponding to the sample event structured sequence; the reference sample sequence includes a plurality of reference identification information, and the number of the reference identifications is the same as the number of sample event description information included in the sample event structured sequence;
[0218] The multiple sample event structured sequences, multiple reference sample sequences and multiple sample summary texts are input into a pre-built language model, so that the language model learns the context information of each sample event description information through the task of converting the sample event structured sequence to the sample summary text and the task of converting the sample summary text to the sample event structured sequence. When the loss of the language model is less than a preset threshold, it is determined that the language model training is completed, and the text generation model is obtained.
[0219] In a feasible implementation, when the processor 710 is used to enable the language model to learn context information of each sample event description information through the task of converting the sample event structured sequence into the sample summary text and the task of converting the sample summary text into the sample event structured sequence, the processor 710 is used to:
[0220] Input the multiple sample event structured sequences, multiple reference sample sequences, and multiple sample summary texts into the 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 summary text;
[0221] The determined multiple structured coding sequences, multiple reference coding sequences and text coding are input into the sequence coding layer of the language model, so that the sequence coding layer predicts the target coding according to the sequence after masking at least one target coding in the text coding and / or structured coding sequence in a preset identification matrix, and determines the context information of each sample event description information.
[0222] In a feasible implementation scheme, the event description type includes a fixed description type and a variable description type, and the processor 710 is further configured to:
[0223] For each of the variable description types and the corresponding sample event description information, the prediction sequence output by the sequence encoding layer is input into the information replication layer of the language model, so that the information replication layer performs predictive learning on the sample event description information and adjusts the context information of the sample event description information corresponding to the variable description type.
[0224] In a feasible implementation scheme, the preset identification matrix is used to characterize the visible relationship between the structured coding sequence, the reference coding sequence and the text coding; according to the visible relationship between the structured coding sequence, the reference coding sequence and the text coding, the context information of each sample event description information is fitted and learned;
[0225] In the process of training the language model, for each coded data in each structured coding sequence, each data can obtain other coded data;
[0226] For each reference code data in each reference code sequence, each reference code data can obtain a corresponding text code;
[0227] For each text encoding data in each text encoding, each text data can obtain the text encoding data located before the text data in the sequence;
[0228] The invisible coded data is the data to be predicted.
[0229] In a feasible implementation manner, the processor 710 is configured to determine the loss of the language model by following steps:
[0230] For the task of converting the sample event structured sequence into the sample summary text, the first loss value is determined by calculating the coded data in each sample event structured sequence and the occluded code in the text code corresponding to the sample summary text in combination with the model parameters;
[0231] For the task of converting the sample summary text into the sample event structured sequence, the second loss value is determined by calculating the encoding data in each sample event structured sequence, the obscured encoding in the text encoding corresponding to the sample summary text, and the obscured encoding in the reference encoding sequence in combination with the model parameters;
[0232] The first loss value and the second loss value are weightedly calculated to determine the loss of the language model.
[0233] In a feasible implementation, the processor 710 is further configured to:
[0234] Performing semantic analysis on the event summary text to determine at least one event keyword;
[0235] Based on the at least one event keyword and preset event analysis rules, a review analysis of the event is performed.
[0236] Through the above method, the obtained event structured information sequence can accurately obtain multiple event description information and each event description type of the relevant event, and by directly inputting the event structured information sequence into the text generation model, the text generation model processes the structured data to obtain a predicted text sequence, and then obtains the event text summary, which reduces the steps of data generation natural language and the amount of data processing, and helps to improve the text generation efficiency. At the same time, according to the discretized event structured information sequence, the contextual information of the event information can be better analyzed, thereby improving the text generation accuracy; at the same time, in the process of training the text generation model, through the task of converting the sample event structured sequence to the sample summary text and the task of converting the sample summary text to the sample event structured sequence, the relationship between the sequence and the text is bidirectionally learned, which helps to improve the accuracy of obtaining the event summary text from the event structured sequence.
[0237] The embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored. The computer program is executed when a processor is running, and the processor performs the following steps:
[0238] Acquire a competition structured information sequence; the competition structured information sequence includes a plurality of competition description information and a competition description type to which each competition description information belongs; the competition description type includes at least one of a competition result type, a competition participant type, and a competition time type;
[0239] 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 order of multiple predicted text sequences according to the event description type;
[0240] According to the obtained text order of each predicted text sequence, multiple predicted text sequences are spliced to obtain a match summary text, so as to obtain key information of the match according to the match summary text.
[0241] In a feasible implementation scheme, the text generation model includes a sequence embedding layer, a sequence encoding layer, and a predicted text sequence output layer. When the processor is used 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 is used to:
[0242] Inputting the event structured information sequence into the sequence embedding layer, so that the sequence embedding layer encodes the position of each event description type, each event description information and each event keyword in the event structured information sequence, and outputs the encoding sequence corresponding to each event description information;
[0243] For each coding sequence, the coding sequence is input to the sequence coding layer, so that the sequence coding layer processes the coding sequence, and predicts context information of the event description information included in the coding sequence according to the event description type in the coding sequence, and outputs at least one candidate text sequence corresponding to the coding sequence according to the context information and the event description information;
[0244] For each coding sequence, at least one candidate text sequence corresponding to the coding sequence is input into the predicted text sequence output layer, so that the predicted text sequence output layer selects the predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence.
[0245] In a feasible implementation manner, the processor is used to select a predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence by the following steps:
[0246] Determine the candidate text sequence with the highest prediction score among at least one candidate text sequence as the predicted text sequence; or;
[0247] According to the prediction text requirement, a candidate text sequence that meets the prediction requirement in at least one candidate text sequence is determined as a prediction text sequence.
[0248] In a feasible implementation scheme, the predictive text requirement includes at least one of the following:
[0249] Predict text length, predict text sentence structure, and event text expression method.
[0250] In one feasible embodiment, the processor is used to determine the text order of the predicted text sequence by the following steps:
[0251] For each predicted text sequence, the text order of the predicted text sequence is determined according to the text association order between the event description type corresponding to the predicted text sequence and other event description types.
[0252] In a feasible embodiment, the processor is used to train the text generation model by the following steps:
[0253] Acquire multiple sample event structured sequences and sample summary texts corresponding to the multiple sample event structured sequences; each sample event structured sequence includes multiple sample event description information and the event description type to which each sample event description information belongs;
[0254] For each sample event structured sequence, determine a reference sample sequence corresponding to the sample event structured sequence; the reference sample sequence includes a plurality of reference identification information, and the number of the reference identifications is the same as the number of sample event description information included in the sample event structured sequence;
[0255] The multiple sample event structured sequences, multiple reference sample sequences and multiple sample summary texts are input into a pre-built language model, so that the language model learns the context information of each sample event description information through the task of converting the sample event structured sequence to the sample summary text and the task of converting the sample summary text to the sample event structured sequence. When the loss of the language model is less than a preset threshold, it is determined that the language model training is completed, and the text generation model is obtained.
[0256] In a feasible implementation, when the processor is used to enable the language model to learn context information of each sample event description information through the task of converting the sample event structured sequence into the sample summary text and the task of converting the sample summary text into the sample event structured sequence, the processor is used to:
[0257] Input the multiple sample event structured sequences, multiple reference sample sequences, and multiple sample summary texts into the 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 summary text;
[0258] The determined multiple structured coding sequences, multiple reference coding sequences and text coding are input into the sequence coding layer of the language model, so that the sequence coding layer predicts the target coding according to the sequence after masking at least one target coding in the text coding and / or structured coding sequence in a preset identification matrix, and determines the context information of each sample event description information.
[0259] In a feasible implementation scheme, the event description type includes a fixed description type and a variable description type, and the processor is further configured to:
[0260] For each of the variable description types and the corresponding sample event description information, the prediction sequence output by the sequence encoding layer is input into the information replication layer of the language model, so that the information replication layer performs predictive learning on the sample event description information and adjusts the context information of the sample event description information corresponding to the variable description type.
[0261] In a feasible implementation scheme, the preset identification matrix is used to characterize the visible relationship between the structured coding sequence, the reference coding sequence and the text coding; according to the visible relationship between the structured coding sequence, the reference coding sequence and the text coding, the context information of each sample event description information is fitted and learned;
[0262] In the process of training the language model, for each coded data in each structured coding sequence, each data can obtain other coded data;
[0263] For each reference code data in each reference code sequence, each reference code data can obtain a corresponding text code;
[0264] For each text encoding data in each text encoding, each text data can obtain the text encoding data located before the text data in the sequence;
[0265] The invisible coded data is the data to be predicted.
[0266] In one feasible embodiment, the processor is used to determine the loss of the language model by following steps:
[0267] For the task of converting the sample event structured sequence into the sample summary text, the first loss value is determined by calculating the coded data in each sample event structured sequence and the occluded code in the text code corresponding to the sample summary text in combination with the model parameters;
[0268] For the task of converting the sample summary text into the sample event structured sequence, the second loss value is determined by calculating the encoding data in each sample event structured sequence, the obscured encoding in the text encoding corresponding to the sample summary text, and the obscured encoding in the reference encoding sequence in combination with the model parameters;
[0269] The first loss value and the second loss value are weightedly calculated to determine the loss of the language model.
[0270] In one possible embodiment, the processor is further configured to:
[0271] Performing semantic analysis on the event summary text to determine at least one event keyword;
[0272] Based on the at least one event keyword and preset event analysis rules, a review analysis of the event is performed.
[0273] Through the above method, the obtained event structured information sequence can accurately obtain multiple event description information and each event description type of the relevant event, and by directly inputting the event structured information sequence into the text generation model, the text generation model processes the structured data to obtain a predicted text sequence, and then obtains the event text summary, which reduces the steps of data generation natural language and the amount of data processing, and helps to improve the text generation efficiency. At the same time, according to the discretized event structured information sequence, the contextual information of the event information can be better analyzed, thereby improving the text generation accuracy; at the same time, in the process of training the text generation model, through the task of converting the sample event structured sequence to the sample summary text and the task of converting the sample summary text to the sample event structured sequence, the relationship between the sequence and the text is bidirectionally learned, which helps to improve the accuracy of obtaining the event summary text from the event structured sequence.
[0274] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0275] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, and the indirect coupling or communication connection of devices or units can be electrical, mechanical or other forms.
[0276] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0277] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0278] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or in other words, the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0279] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-mentioned embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-mentioned embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be based on the protection scope of the claims.
Claims
1. A method for generating a competition summary text, characterized in that: The generation method comprises: Acquire a competition structured information sequence; the competition structured information sequence includes a plurality of competition description information and a competition description type to which each competition description information belongs; the competition description type includes at least one of a competition result type, a competition participant type, and a competition 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 order of multiple predicted text sequences according to the event description type; the text generation model includes a sequence embedding layer, a sequence encoding layer and a predicted text sequence output layer; According to the obtained text order of each predicted text sequence, multiple predicted text sequences are spliced to obtain a match summary text, so as to obtain key information of the match according to the match summary text.
2. The generation method according to claim 1, characterized in that: The step of 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, comprises: Inputting the event structured information sequence into the sequence embedding layer, so that the sequence embedding layer encodes the position of each event description type, each event description information and each event keyword in the event structured information sequence, and outputs the encoding sequence corresponding to each event description information; For each coding sequence, the coding sequence is input to the sequence coding layer, so that the sequence coding layer processes the coding sequence, and predicts context information of the event description information included in the coding sequence according to the event description type in the coding sequence, and outputs at least one candidate text sequence corresponding to the coding sequence according to the context information and the event description information; For each coding sequence, at least one candidate text sequence corresponding to the coding sequence is input into the predicted text sequence output layer, so that the predicted text sequence output layer selects the predicted text sequence corresponding to the coding sequence from the at least one candidate text sequence.
3. The generation method according to claim 2, characterized in that: The predicted text sequence corresponding to the coding sequence is screened out from the at least one candidate text sequence by the following steps: Determine the candidate text sequence with the highest prediction score among at least one candidate text sequence as the predicted text sequence; or; According to the prediction text requirement, a candidate text sequence that meets the prediction requirement in at least one candidate text sequence is determined as a prediction text sequence.
4. The generation method according to claim 3, characterized in that: The predictive text requirement includes at least one of the following: Predict text length, predict text sentence structure, and event text expression method.
5. The generation method according to claim 1, characterized in that: The text order of the predicted text sequence is determined by the following steps: For each predicted text sequence, the text order of the predicted text sequence is determined according to the text association order between the event description type corresponding to the predicted text sequence and other event description types.
6. The generation method according to claim 1, characterized in that: The text generation model is trained by the following steps: Acquire multiple sample event structured sequences and sample summary texts corresponding to the multiple sample event structured sequences; each sample event structured sequence includes multiple sample event description information and the event description type to which each sample event description information belongs; For each sample event structured sequence, determine a reference sample sequence corresponding to the sample event structured sequence; The reference sample sequence includes a plurality of reference identification information, and the number of the reference identification information is the same as the number of sample event description information included in the sample event structured sequence; The multiple sample event structured sequences, multiple reference sample sequences and multiple sample summary texts are input into a pre-built language model, so that the language model learns the context information of each sample event description information through the task of converting the sample event structured sequence to the sample summary text and the task of converting the sample summary text to the sample event structured sequence. When the loss of the language model is less than a preset threshold, it is determined that the language model training is completed, and the text generation model is obtained.
7. The generation method according to claim 6, characterized in that: The task of enabling the language model to convert the sample event structured sequence into the sample summary text and the task of converting the sample summary text into the sample event structured sequence, and learning the context information of each sample event description information, includes: Input the multiple sample event structured sequences, multiple reference sample sequences, and multiple sample summary texts into the 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 summary text; The determined multiple structured coding sequences, multiple reference coding sequences and text coding are input into the sequence coding layer of the language model, so that the sequence coding layer predicts the target coding according to the sequence after masking at least one target coding in the text coding and / or structured coding sequence in a preset identification matrix, and determines the context information of each sample event description information.
8. The generation method according to claim 7, characterized in that: The event description type includes a fixed description type and a variable description type, and the generation method further includes: For each of the variable description types and the corresponding sample event description information, the prediction sequence output by the sequence encoding layer is input into the information replication layer of the language model, so that the information replication layer performs predictive 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 7, characterized in that: The preset identification matrix is used to characterize the visible relationship between the structured coding sequence, the reference coding sequence and the text coding; according to the visible relationship between the structured coding sequence, the reference coding sequence and the text coding, the context information of each sample event description information is fitted and learned; In the process of training the language model, for each coded data in each structured coding sequence, each data can obtain other coded data; For each reference code data in each reference code sequence, each reference code data can obtain a corresponding text code; For each text encoding data in each text encoding, each text data can obtain the text encoding data located before the text data in the sequence; Among them, the invisible coded 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 the following steps: For the task of converting the sample event structured sequence into the sample summary text, the first loss value is determined by calculating the coded data in each sample event structured sequence and the occluded code in the text code corresponding to the sample summary text in combination with the model parameters; For the task of converting the sample summary text into the sample event structured sequence, the second loss value is determined by calculating the encoding data in each sample event structured sequence, the obscured encoding in the text encoding corresponding to the sample summary text, and the obscured encoding in the reference encoding sequence in combination with the model parameters; The first loss value and the second loss value are weightedly calculated to determine the loss of the language model.
11. The generation method according to claim 1, characterized in that: The generating method further comprises: Performing semantic analysis on the event summary text to determine at least one event keyword; Based on the at least one event keyword and preset event analysis rules, a review analysis of the event is performed.
12. A device for generating a competition summary text, characterized in that: The generating device comprises: An information sequence acquisition module, used to acquire a structured event information sequence; the structured event information sequence includes a plurality of event description information and an event description type to which each event description information belongs; the event description type includes at least one of an event result type, an event participant type, and an event time type; A text sequence generation module, 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 order of multiple predicted text sequences according to the event description type; the text generation model includes a sequence embedding layer, a sequence encoding layer and a predicted text sequence output layer; The summary text generation module is used to splice multiple prediction text sequences according to the text order of each prediction text sequence obtained to obtain a competition summary text, so as to obtain key information of the competition according to the competition summary text.
13. An electronic device, characterized in that: include: 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 through the bus, and the processor executes the machine-readable instructions to perform the steps of the method for generating a match summary text as described in any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the method for generating a match summary text according to any one of claims 1 to 11 are executed.
Citation Information
Patent Citations
An abstract text generation method based on fusion coding
CN109522403A
A method for generating sports event warnings by using real-time data
CN109740123A