A method, device and medium for extracting speech of news figures
Through joint hierarchical annotation and multi-task learning methods, a news figure speech extraction model was established, which solved the problems of inaccurate speech extraction and poor generalization ability in the existing technology, and realized the accurate structured extraction and analysis of news figure speech. .
Patent Information
- Application Number
- CN202410576750.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-10
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2044-05-10
AI Technical Summary
The existing methods of extracting comments from news figures lack structured extraction capabilities, inaccurate identification, poor generalization capabilities, and difficult to accurately match the relationships between arguments, especially when dealing with many-to-many correspondence relationships.
Using joint hierarchical annotation and multi-task learning methods, the content and sentence processing of news text data is generated, the argument information triple data is spliced with these data through preset speech extraction templates, and a character speech extraction model is established. Perform parameter training and update, and improve the processing capability of the model through alternating training.
It realizes accurate extraction and structured output of the speech of news characters, improves the accuracy of the extraction results and the generalization ability of the model, and can better understand and analyze the relevant information of the speech of characters.
Smart Images

Figure CN118504551B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of speech information extraction, and in particular to a method, device and medium for extracting speech of news figures. Background Art
[0002] The speeches of news figures play an important role in public opinion analysis, and their speeches and opinions can have a profound impact on public opinion. Extracting and structuring the opinions of news figures can help users obtain the speech content of relevant figures from massive news documents and reduce the difficulty of obtaining knowledge related to news figures. However, traditional methods for extracting characters' speeches lack the ability to structure complex characters' speeches, and adopt a multi-stage output method, which also leads to errors between multi-stage tasks. For example, if the trigger word recognition is inaccurate, the task cannot be recognized, and the tasks do not share the same model, so the errors cannot be propagated and corrected overall.
[0003] At present, more information extraction methods based on deep learning have been proposed, but there are still some deficiencies in the task of extracting news figures' speeches. From the perspective of mainstream information extraction methods, the common information extraction method is to use sequence labeling, which is suitable for news sentences containing multiple characters and multiple trigger words, and can solve the problem of multiple answer prediction. However, this method has difficulties in dealing with the many-to-many correspondence between arguments, resulting in the inability to accurately match the relationship between arguments. Another mainstream method, the information extraction method based on MRC (Machine Reading Comprehension) can solve the problems of entity nesting and entity relationship overlap, and extract arguments through multiple rounds of question and answer, which can capture the hierarchical dependency between trigger words and other arguments. However, the MRC-based method usually takes the entire sentence as input, and when making predictions, it can only output a triplet of information globally, so it is only applicable to news sentences containing only one argument information triplet. Summary of the invention
[0004] The embodiments of the present application provide a method, device and medium for extracting the speech of a news figure, which are used to solve the following technical problems: the existing extraction of the speech of news figures is relatively difficult, lacks structured extraction capabilities, and the speech recognition is inaccurate, and the generalization ability of argument extraction is poor, which is not conducive to the public opinion analysis of the person's speech.
[0005] The present application embodiment adopts the following technical solutions:
[0006] On the one hand, an embodiment of the present application provides a method for extracting the speech of a news figure, comprising: performing content sentence processing on the collected news text data to obtain news sentence data; performing joint hierarchical annotation and splitting processing on the news sentence data through a preset text annotation tool to obtain a number of argument information triple data; splicing a preset speech extraction template with the argument information triple data to generate a speech extraction training sample; establishing a character speech extraction model according to the recognition types of the argument information triple data; wherein the recognition types include: speech trigger word recognition, speech holder recognition and content fragment recognition; performing data set enhancement processing on the speech extraction training samples, and batch alternating the speech extraction training samples to complete the parameter training update of the character speech extraction model; extracting speech events from the news text to be extracted by training the updated character speech extraction model to obtain the result triple data of the news text to be extracted.
[0007] The embodiment of the present application can extract the speech of the character and output it in a structured manner, which helps users better understand and analyze the relevant information of the character's speech. The joint hierarchical annotation and multi-task learning method can capture the relationship and dependency between arguments, and improve the accuracy of the extraction results. At the same time, alternating training of different argument samples can improve the character speech extraction model's ability to process different arguments, further improving the accuracy of character speech extraction.
[0008] In a feasible implementation manner, the collected news text data is processed into content sentences to obtain news sentence data, specifically including: based on the report link of the target news website, generating an invokable document for the web page structure of the target news website; performing character matching on the news content text in the invokable document through preset punctuation matching to obtain a plurality of sentence texts; and determining the divided plurality of sentence texts as the news sentence data.
[0009] The embodiment of the present application can effectively obtain the speech content of relevant characters from a large number of news documents by automatically extracting the characters' speeches in news reports, thereby reducing the difficulty for users to obtain knowledge related to news characters.
[0010] In a feasible implementation manner, the news sentence data is jointly labeled and split at a hierarchical level through a preset text annotation tool to obtain a number of argument information triplet data, specifically including: based on the arguments and argument roles in the news speech, determining the branch triplet type; wherein the branch triplet type includes: person-speech trigger word-speech holder type and content fragment-speech trigger word-speech content type; the person and the speech trigger word are both arguments, and the speech holder represents the argument role relationship between the person and the speech trigger word; the content fragment and the speech trigger word are both arguments, and the speech content represents the argument role relationship between the content fragment and the speech trigger word; through the text annotation tool, the news The selected text spans in the news sentence data are labeled, and the labeled text span content is screened for argument categories through the branch triple type, and the argument role relationship corresponding to the argument is determined; the text span is annotated according to the argument and the argument role relationship, and the argument information triple is determined; wherein the argument information triple includes: characters, speech trigger words and content fragments; based on the different arguments in the argument information triple, the annotated news sentence data is split based on the label; the news sentence data containing the argument information triple is split into multiple news sentence samples with the same text content and the annotated content as a single argument, and determined as the argument information triple data.
[0011] The embodiment of the present application can extract the speech of the character and output it in a structured form, presenting it in the form of character-speech trigger word-content fragment. This helps users better understand and analyze the relevant information of the character's speech. It also adopts a joint hierarchical annotation and multi-task learning method, which can simultaneously model the three tasks of speech trigger word recognition, speech holder character recognition and content fragment recognition. In this way, the relationship and dependency between arguments can be captured, improving the accuracy of the extraction results.
[0012] In a feasible implementation, a preset speech extraction template is spliced with the argument information triple data to generate speech extraction training samples, specifically including: establishing the speech extraction template based on multiple recognition templates; wherein the multiple recognition templates include: speech trigger word recognition template, speech holder character recognition template and content fragment recognition template; through the speech extraction template, a number of the argument information triple data are subjected to template matching processing under the relevant argument label to obtain data to be matched; the data to be matched is correspondingly spliced with the speech extraction template to generate the speech extraction training samples for model training.
[0013] In a feasible implementation, according to the recognition types of the argument information triple data, a character speech extraction model is established, which specifically includes: generating a data input sequence based on the identifiers in the historical speech sample library, and completing the word segmentation configuration of the input layer based on the data input sequence; wherein the identifiers include at least: Chinese characters, symbols, numbers and punctuation marks; based on the preset natural language addition technology, the data input sequence is converted into an initial vector, and the same-name characters in the initial vector are positioned by the preset positive integer position coding to complete the splicing of the position vector in the embedding layer and the data input sequence; through the pre-trained language model The feature dimension embedding layer in the historical speech sample library performs feature conversion under vector representation, and the speech text is trained under language representation through the Transformer layer in the pre-trained language model to complete the encoding configuration of the encoding layer; through the recognition type, the speech text is linearly classified according to the type of character label, and through the input channel connected to the encoding layer, the decoding configuration of the task decoding layer is completed; according to the input layer, the embedding layer, the encoding layer and the task decoding layer, and based on the multi-task joint training method of the preset ERNIE model, the character speech extraction model is configured and generated.
[0014] The embodiment of the present application eliminates the possible influence of repeated words in the question template by introducing additional position coding, and ensures the correct correspondence between arguments. Position coding is used to indicate the position of each character in a sentence, ensuring that the position relationship between characters is determined.
[0015] In a feasible implementation, the speech extraction training samples are subjected to data set enhancement processing, specifically including: classifying the speech extraction training samples according to the labeled argument information triple data to obtain sparse character speech types; wherein the sparse character speech types include: overlapping speech sentences, nested speech sentences and flat speech sentences; classifying and duplicating speech data sets for the sparse character speech types so that the total number of duplicated speech data sets is equal to half of the number of remaining speech data sets in the news sentence data; and obtaining data-enhanced speech extraction training samples based on the duplicated speech data sets.
[0016] The embodiment of the present application uses data enhancement technology to expand the labeled data during the model training process, thereby improving the diversity of data and the generalization ability of the model. At the same time, an alternating training method is also used to alternately train different argument samples, which can improve the model's ability to process different arguments.
[0017] In a feasible implementation, the speech extraction training samples are batch-interleaved to complete the parameter training and updating of the character speech extraction model, specifically including: extracting all speech sentences in the speech extraction training samples; according to different argument information in the speech extraction training samples, alternating the extraction order of all the speech sentences to determine the extraction order of speech sentence training samples; performing alternating extraction processing on the speech trigger words, speech holding characters and content fragments in each of the speech sentences in a priority order to obtain the subtask training sample extraction order; wherein the subtask includes: the speech trigger words, the speech holding characters and the content fragments; through the speech sentence training sample extraction order and the subtask training sample extraction order, the speech extraction training samples are subjected to directional propagation error calculation based on cross entropy loss to obtain error result data; the error result is fed back to the character speech extraction model, and the parameter training and updating of the character speech extraction model is performed.
[0018] The embodiment of the present application uses repeated sampling to perform data enhancement on sparse training samples, replicates existing minority character speech samples, and increases their number in the data set, which helps improve the training effect of the model. At the same time, by alternately extracting the order of training samples corresponding to different arguments and the order of subtasks, the model can adapt to the extraction of multiple arguments, thereby improving the performance of the model.
[0019] In a feasible implementation, by training an updated character speech extraction model, speech events are extracted from the news text to be extracted to obtain result triple data of the news text to be extracted, specifically including: inputting the news text to be extracted into the trained and updated character speech extraction model to obtain a predicted label and a predicted label sequence for each character in each speech text; extracting the text span between the start character label and the end character label of different arguments in the speech event according to the predicted label and the predicted label sequence; outputting the text content in the text span in triples to obtain the result triple data of the news text to be extracted.
[0020] In a second aspect, an embodiment of the present application also provides a device for extracting the speech of a news figure, the device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, so that the at least one processor can execute a method for extracting the speech of a news figure as described in any of the above-mentioned embodiments.
[0021] In a third aspect, an embodiment of the present application further provides a non-volatile computer storage medium, characterized in that the storage medium is a non-volatile computer-readable storage medium, and the non-volatile computer-readable storage medium stores at least one program, each of which includes instructions, and when the instructions are executed by a terminal, the terminal executes a method for extracting the speech of a news figure described in any of the above-mentioned embodiments.
[0022] The present application provides a method, device and medium for extracting the speech of a news figure. Compared with the prior art, the embodiments of the present application have the following beneficial technical effects:
[0023] The embodiment of the present application can extract the speech of the character and output it in a structured manner, which helps users better understand and analyze the relevant information of the character's speech. The joint hierarchical annotation and multi-task learning method can capture the relationship and dependency between arguments, and improve the accuracy of the extraction results. At the same time, alternating training of different argument samples can improve the character speech extraction model's ability to process different arguments, further improving the accuracy of character speech extraction. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings required for use in the embodiments or the prior art descriptions are briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. In the drawings:
[0025] Figure 1 A flow chart of a method for extracting the speech of a news figure provided in an embodiment of the present application;
[0026] Figure 2 A schematic diagram of the structure of a news figure's speech extraction device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0027] In order to enable those skilled in the art to better understand the technical solutions in this application, the technical solutions in the embodiments of this application will be clearly and completely described below in conjunction with the drawings in the embodiments of this application. Obviously, the described embodiments are only part of the embodiments of this application, not all of them. Based on the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this application.
[0028] The present application embodiment provides a method for extracting the speech of a news figure, such as Figure 1As shown, the method for extracting the speech of a news figure specifically includes steps S101-S106:
[0029] S101, performing content sentence processing on the collected news text data to obtain news sentence data.
[0030] Specifically, based on the report link of the target news website, the webpage structure of the target news website is used to generate a callable document. The news content text in the callable document is character matched by preset punctuation matching to obtain a number of sentence texts; and the divided sentence texts are determined as news sentence data.
[0031] In one embodiment, news report links of target news websites can be collected and formed into callable documents, and a request can be sent to the target news website using a network request library to obtain the HTML content of the webpage, and parse the HTML structure of the webpage to extract the news content therein. Character matching is then performed based on punctuation marks to achieve sentence segmentation of the news content.
[0032] Preferably, the URLs of news reports can also be collected: first, using the API interface to obtain the text data of the target news report without crawling the web page. Second, using the API provided by the search engine, such as the Google News API or the Bing News API, to perform keyword searches and obtain relevant news texts.
[0033] S102: Using a preset text annotation tool, perform joint-level annotation and splitting processing on the news sentence data to obtain a number of argument information triples.
[0034] Specifically, we first need to determine the branch triple type based on the arguments and argument roles in the news speech. Among them, the branch triple types include: person-speech trigger word-speech holder type and content fragment-speech trigger word-speech content type. Both the person and the speech trigger word are arguments, and the speech holder represents the argument role relationship between the person and the speech trigger word. Both the content fragment and the speech trigger word are arguments, and the speech content represents the argument role relationship between the content fragment and the speech trigger word.
[0035] In one embodiment, it is necessary to define the argument information triple in the character's speech: character-speech trigger word-content fragment. Among them, the character is the person who makes the speech, the speech trigger word is the predicate used by the character when publishing the content fragment, and the content fragment is the content expressed by the character through the speech trigger word. Two types of branch triples are defined using arguments and argument roles, including:
[0036] 1) Character-speech trigger word-speech holder: Among them, the character and speech trigger word are arguments, and the speech holder represents the argument role relationship between the character and the speech trigger word.
[0037] 2) Content fragment-speech trigger word-speech content: Among them, the content fragment and speech trigger word are arguments, and the speech content represents the argument role relationship between the content fragment and the speech trigger word.
[0038] Furthermore, the selected text spans in the news sentence data are labeled through text annotation tools, and the labeled text span content is screened for argument categories through branch triple types, and the argument role relationship corresponding to the argument is determined.
[0039] Furthermore, the text span is annotated according to the arguments and the argument role relationship to determine the argument information triples, wherein the argument information triples include: characters, speech trigger words and content fragments.
[0040] Furthermore, based on different arguments in the argument information triplet, the annotated news sentence data is split based on the label.
[0041] Furthermore, the news sentence data containing the argument information triples are split into a plurality of news sentence samples with the same text content and the marked content being a single argument, and are determined as the argument information triples data.
[0042] In one embodiment, the news sentence data to be annotated is opened in the open source text annotation tool doccano, and a certain span of text to be annotated is selected with the mouse cursor to add a label, and then the label type corresponding to a certain argument in the triple is selected, and the remaining arguments in the triple are selected in the same way and their categories are selected, that is, the argument role relationship corresponding to the argument is determined, and finally the arguments in the triple are selected by the mouse to connect to determine the argument role relationship between the arguments, and then the argument role type is selected to complete the annotation of an argument information triple. Then, the operation is repeated until all the argument information triples to be annotated in the news sentence data are annotated.
[0043] Preferably, when implementing joint hierarchical annotation, existing open source text annotation tools such as Labelbox, Prodigy, etc. can be used to quickly annotate information about a person's speech or add labels to text spans.
[0044] In one embodiment, the marked news sentences are copied and labeled according to different argument extraction tasks, and the news sentences containing argument information triples are split into multiple news sentence samples with the same text content and a single argument as the marked content, so as to achieve joint hierarchical labeling and determine them as argument information triple data.
[0045] S103, splicing the preset speech extraction template, news text and argument information triple data to generate speech extraction training samples.
[0046] Specifically, it is necessary to first establish a speech extraction template based on a variety of recognition templates, wherein the multiple recognition templates include: speech trigger word recognition template, speech holder person recognition template and content segment recognition template.
[0047] Furthermore, through the speech extraction template, template matching processing is performed on a number of argument information triples under relevant argument labels to obtain data to be matched.
[0048] Furthermore, the data to be matched is concatenated with the speech extraction template to generate speech extraction training samples for model training.
[0049] In one embodiment, a question template consisting of natural language corresponding to the arguments to be extracted is predefined, namely, a speech extraction template, wherein the question template for questions about characters and trigger words contains the position information of the corresponding trigger word text span. Then, by splicing the annotated news sentences (or news text) and the speech extraction template, a question-answering training sample for model training, namely, a speech extraction training sample, is generated.
[0050] Preferably, regarding the generated question template: the question template may be generated based on a rule-based method, or a question template for character speech extraction may be automatically generated based on an existing grammatical pattern and question template library, that is, a speech extraction template may be automatically generated.
[0051] As a feasible implementation method, the predefined question template (speech extraction template) is in the form of: Q = {q t ,q p ,q c},t i ∈q p ,t i ∈q c ; Among them, q t is the speech trigger word recognition template, q t = "What are the speech triggers in the sentence?"; q p is the speech holder identification template, q p = "The speech trigger word t starting with the mth character in the sentence i What are the names of the holders of ? ", m is less than the overall length of the clause; q c is the content fragment identification template, q c = "The speech trigger word t starting with the mth character in the sentence i What is the content of the sentence? ", m is less than the overall length of the sentence.
[0052] S104. Establish a character speech extraction model based on the recognition types of a number of argument information triplet data; wherein the recognition types include: speech trigger word recognition, speech holder character recognition and content fragment recognition.
[0053] It should be noted that the character speech extraction model mainly includes: input layer, embedding layer, encoding layer, and task decoding layer. The character speech extraction model is based on the ERNIE model, on which multi-task joint training is realized. The character speech extraction model uses the joint hierarchical question-answering annotation method to simultaneously model three tasks, namely, speech trigger word recognition, speech holder recognition, and content fragment recognition.
[0054] Preferably, regarding the embedding layer and the encoding layer: other pre-trained language models, such as BERT, GPT, etc., can be used, on this basis, for joint multi-task training.
[0055] Specifically, based on the identifiers in the historical speech sample library, a data input sequence is generated, and based on the data input sequence, the word segmentation configuration of the input layer is completed. The identifiers include at least: Chinese characters, symbols, numbers and punctuation marks.
[0056] As a feasible implementation method, the input layer uses manual word segmentation to treat Chinese characters, symbols, numbers and punctuation marks in the training samples as single tokens (identifiers) to generate a data input sequence. It can ensure that characters and annotations correspond to each other, and perform vector conversion on training samples in units of characters. When decoding, characters are used as units rather than word segmentation. Joint hierarchical annotation is not only for a single sentence, but also for annotating the characters in the entire input sequence, and a multi-level approach is used to realize the extraction of complex arguments and the determination of dependencies between arguments.
[0057] It is necessary to convert the data input sequence into an initial vector based on the preset natural language addition technology, and to locate the position relationship of the characters with the same name in the initial vector through the preset positive integer position encoding, so as to complete the splicing processing of the position vector in the embedding layer and the data input sequence.
[0058] As a feasible implementation method, the embedding layer uses a natural language-based addition method to concatenate the positive integer position codes from 1 to n with the data input sequence, and convert the tokens in the data input sequence into initial vectors. Among them, the positive integer position codes from 1 to n are used to represent the position of each character in the sentence. In the news sentence segmentation, there are speech holders and speech trigger words with the same name, that is, characters with the same name, etc., which lead to incorrect prompt information in the question template. Introducing additional position codes in the question template can eliminate the possible impact of repeated words and ensure the correct correspondence between arguments.
[0059] It is necessary to use the feature dimension embedding layer in the pre-trained language model to transform the features of the speech text in the historical speech sample library under vector representation, and to use the Transformer layer in the pre-trained language model to learn and train the speech text under language representation to complete the encoding configuration of the encoding layer.
[0060] As a feasible implementation, the encoding layer uses a pre-trained language model as an encoder, specifically including 3 Embedding layers with a feature dimension of 768, which are used to convert the input speech text in the historical speech sample library into a vector representation. Then, 12 Transformer layers with a feature dimension of 768 are used to learn and express language representation. Each Transformer layer contains a multi-head self-attention mechanism and a forward propagation network.
[0061] It is necessary to perform linear classification processing on the speech text according to the type of character labels by identifying the type, and complete the decoding configuration of the task decoding layer through the input channel connected to the encoding layer.
[0062] As a feasible implementation method, the task decoding layer adopts a linear classification layer and Softmax, the number of input channels is 768, and the number of output channels is the total number of character label types in all speech text data, that is, the output predicted argument label.
[0063] Furthermore, according to the input layer, embedding layer, encoding layer and task decoding layer, and based on the multi-task joint training method of the preset ERNIE model, a character speech extraction model is configured and generated.
[0064] S105, performing data set enhancement processing on the speech extraction training samples, and performing batch alternation on the speech extraction training samples to complete parameter training and updating of the character speech extraction model.
[0065] Specifically, according to the labeled argument information triple data, the speech extraction training samples are classified to obtain sparse character speech types. Among them, the sparse character speech types include: overlapping speech sentences, nested speech sentences and flat speech sentences. The sparse character speech types are processed by classification and replication of speech data sets, so that the total number of replicated speech data sets is equal to half of the number of remaining speech data sets in the news sentence data. Based on the replicated speech data sets, speech extraction training samples after data enhancement are obtained.
[0066] As a feasible implementation method, repeated sampling is used to enhance the data of sparse training samples, copy the existing minority character speech samples, increase their number in the data set, classify and summarize the news character speeches in the speech extraction training samples, and obtain the sparse character speech types, including:
[0067] 1) Overlapping speech sentences: used to describe the situation where two or more characters speak together. Its specific definition is that the character's speech contains multiple character-speech trigger word-content fragment triplets, and these triplets have the same trigger word and content fragment, and the characters are different.
[0068] 2) Nested speech sentences: used to describe the situation where the same person makes multiple speeches in one sentence. Its specific definition is that the person's speech contains multiple person-speech trigger word-content fragment triplets. These triplets have the same person but different content fragments.
[0069] 3) Flat speech sentences: used to describe the situation where multiple characters make multiple speeches in the same news sentence. Its specific definition is that the character's speech contains multiple character-speech trigger word-content fragment triplets, and the characters and content fragments in these triplets are different.
[0070] In one embodiment, by copying the above three sparse character speech types, the total number of the copied speech data sets is equal to half of the remaining speech data sets in the news sentence data. Since the number of argument information triplets contained in the sparse character speech type is greater than or equal to 2, when generating joint hierarchical samples, the number of training samples generated by a sparse speech sentence is usually twice that of a general character speech sentence, and training samples are extracted from the speech after the generated data is enhanced.
[0071] Furthermore, all speech sentences in the speech extraction training sample are extracted. Then, according to the different argument information in the speech extraction training sample, the extraction order of all speech sentences is changed alternately to determine the extraction order of speech sentence training samples. The speech trigger words, speech holder characters and content fragments in each speech sentence are extracted alternately according to the priority order to obtain the extraction order of subtask training samples. Among them, the subtasks include: speech trigger words, speech holder characters and content fragments.
[0072] As a feasible implementation method, the order of speech sentence training sample extraction is carried out within each batch, and the speech sentences are extracted in different orders, that is, the order of speech sentence training sample extraction is determined. When extracting character speech arguments, the batch is constructed with samples of speech trigger words, speech holder characters, and content fragments. Then the order of extraction of the three subtasks is alternating, and the priority of the three subtasks of speech trigger word recognition, speech holder character recognition, and speech content recognition is adjusted by combining the forward and reverse processes, and finally the order of extraction of subtask training samples is determined. The forward and reverse processes are as follows:
[0073] Positive: trigger words, trigger words-speech holder-character, trigger words-speech content-content fragment, that is, ask questions about trigger words first, and then use trigger words to ask questions about characters and content fragments.
[0074] Reverse: character, character-speech holder-trigger word; content fragment, content fragment-speech content-trigger word, that is, first extract the character or content fragment, and then use the character and content fragment to extract the trigger word.
[0075] The forward process is based on trigger words, using the trigger word information to ask questions about characters and content fragments; the reverse process is based on the priority extraction of characters or content fragments, using the characters or content fragment information to ask questions about trigger words, and then using the trigger words to ask questions about the remaining arguments. Since there is no argument role relationship between characters and content fragments when setting argument roles, the two cannot ask questions directly to each other.
[0076] Furthermore, through the order of extracting speech sentence training samples and the order of extracting subtask training samples, the speech extraction training samples are subjected to directional propagation error calculation based on cross entropy loss to obtain error result data. The error result is fed back to the character speech extraction model, and the parameters of the character speech extraction model are trained and updated. In other words, the back propagation error can be calculated through cross entropy, and the error is back propagated to the character speech extraction model, and the parameter update of the model is finally completed.
[0077] S106. Extract speech events from the news text to be extracted by training the updated character speech extraction model, and obtain result triplet data of the news text to be extracted.
[0078] Specifically, the news text to be extracted is input into the trained and updated character speech extraction model to obtain the predicted label and predicted label sequence of each character in each speech text.
[0079] Furthermore, based on the predicted labels and the predicted label sequences, the text span between the start character labels and the end character labels of different arguments in the speech event is extracted.
[0080] Furthermore, the text content in the text span is output in triple form to obtain result triple data of the news text to be extracted.
[0081] In one embodiment, the news text to be extracted needs to be first input into the trained character speech extraction model to obtain the predicted label of each character in the text sequence and the predicted label sequence. Then the text span between the starting character label and the ending character label of different arguments is extracted as the prediction result of the argument in the news character's speech, and output in the form of triples. That is to say, through the character speech extraction model, the predicted label of each character in the news sentence and the predicted label sequence output by the character speech extraction model are obtained, and the text span corresponding to different arguments is extracted by character matching, and finally the result triple data of the news text to be extracted is output, and the accurate speech extraction of the news character is completed.
[0082] In addition, the present application embodiment also provides a news figure speech extraction device, such as Figure 2 As shown, the speech extraction device of the news figure specifically includes:
[0083] At least one processor 201. And a memory 202 in communication with the at least one processor 201. The memory 202 stores instructions that can be executed by the at least one processor 201, so that the at least one processor 201 can execute:
[0084] Performing content sentence processing on the collected news text data to obtain news sentence data;
[0085] Through the preset text annotation tool, the news sentence data is jointly annotated and split to obtain a number of argument information triples;
[0086] The preset speech extraction template is spliced with the argument information triple data to generate speech extraction training samples;
[0087] According to the recognition types of several argument information triplet data, a character speech extraction model is established; wherein the recognition types include: speech trigger word recognition, speech holder recognition and content fragment recognition;
[0088] Performing data set enhancement processing on speech extraction training samples and performing batch alternation on speech extraction training samples to complete parameter training and updating of the character speech extraction model;
[0089] By training the updated character speech extraction model, speech events are extracted from the news text to be extracted, and the result triplet data of the news text to be extracted is obtained.
[0090] This application provides a method, device and medium for extracting the speech of a news figure. By extracting the speech of the figure, it can also output it in a structured manner, which helps users better understand and analyze the relevant information of the speech of the figure. By adopting the method of joint hierarchical annotation and multi-task learning, the relationship and dependency between arguments can be captured, and the accuracy of the extraction results can be improved. At the same time, alternating training of different argument samples can improve the processing ability of the character speech extraction model for different arguments, further improving the accuracy of character speech extraction.
[0091] Each embodiment in this application is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device and medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiments.
[0092] The devices and media provided in the embodiments of the present application correspond one-to-one to the methods. Therefore, the devices and media also have similar beneficial technical effects as the corresponding methods. Since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media will not be repeated here.
[0093] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0094] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0095] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0096] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0097] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0098] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0099] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0100] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0101] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included within the scope of the specification of the present application.
Claims
1. A method for extracting the speech of a news figure, characterized in that: The method comprises: Performing content sentence processing on the collected news text data to obtain news sentence data; By using a preset text annotation tool, the news sentence data is jointly annotated and split to obtain a number of argument information triples, including: Based on the arguments and argument roles in the news speech, the branch triple type is determined; wherein the branch triple type includes: person-speech trigger word-speech holder type and content segment-speech trigger word-speech content type; the person and the speech trigger word are both arguments, and the speech holder represents the argument role relationship between the person and the speech trigger word; the content segment and the speech trigger word are both arguments, and the speech content represents the argument role relationship between the content segment and the speech trigger word; By means of the text annotation tool, the selected text span in the news sentence data is labeled, and the labeled text span content is screened for argument categories by means of the branch triple type, and the argument role relationship corresponding to the argument is determined; According to the arguments and the argument role relationships, the text span is annotated to determine an argument information triple; wherein the argument information triple includes: a person, a speech trigger word, and a content fragment; Based on different arguments in the argument information triple, the annotated news sentence data is split based on the label; Splitting the news sentence data containing the argument information triples into a plurality of news sentence samples having the same text content and a single argument as the marked content, and determining them as the argument information triples data; splicing the preset speech extraction template with the triplet data of the argument information to generate speech extraction training samples; According to the recognition types of the argument information triple data, a character speech extraction model is established; wherein the recognition types include: speech trigger word recognition, speech holder character recognition and content segment recognition; Performing data set enhancement processing on the speech extraction training samples, and performing batch alternation on the speech extraction training samples to complete parameter training and updating of the character speech extraction model; By training the updated character speech extraction model, speech events are extracted from the news text to be extracted, and result triplet data of the news text to be extracted is obtained.
2. A method for extracting speech of a news figure according to claim 1, characterized in that: The collected news text data is processed into content sentences to obtain news sentence data, which specifically includes: Based on the report link of the target news website, generating a callable document for the web page structure of the target news website; Through preset punctuation matching, the news content text in the callable document is character matched to obtain a plurality of sentence texts; and the divided plurality of sentence texts are determined as the news sentence data.
3. The method for extracting speech of a news figure according to claim 1, characterized in that: The preset speech extraction template is spliced with the triple data of the argument information to generate speech extraction training samples, specifically including: Based on multiple recognition templates, the speech extraction template is established; wherein the multiple recognition templates include: speech trigger word recognition template, speech holder person recognition template and content segment recognition template; Using the speech extraction template, a number of the argument information triple data are subjected to template matching processing under the relevant argument labels to obtain data to be matched; The data to be matched is concatenated with the speech extraction template to generate the speech extraction training samples for model training.
4. The method for extracting the speech of a news figure according to claim 1, characterized in that: According to the recognition types of the argument information triplet data, a character speech extraction model is established, which specifically includes: Based on the identifiers in the historical speech sample library, a data input sequence is generated, and based on the data input sequence, word segmentation configuration of the input layer is completed; wherein the identifiers include at least: Chinese characters, symbols, numbers and punctuation marks; Based on a preset natural language addition technology, the data input sequence is converted into an initial vector, and the characters with the same name in the initial vector are positioned according to their positional relationship through a preset positive integer position encoding, so as to complete the splicing process of the position vector in the embedding layer and the data input sequence; The speech text in the historical speech sample library is subjected to feature conversion under vector representation through the feature dimension embedding layer in the pre-trained language model, and the speech text is subjected to learning training under language representation through the Transformer layer in the pre-trained language model to complete the encoding configuration of the encoding layer; Through the recognition type, the speech text is subjected to linear classification processing of the character label types, and the decoding configuration of the task decoding layer is completed through the input channel connected to the encoding layer; According to the input layer, the embedding layer, the encoding layer and the task decoding layer, and based on the multi-task joint training method of the preset ERNIE model, the character speech extraction model is configured and generated.
5. The method for extracting speech of a news figure according to claim 1, characterized in that: The speech extraction training samples are subjected to data set enhancement processing, specifically including: According to the labeled triplet data of the argument information, the speech extraction training samples are classified to obtain sparse character speech types; wherein the sparse character speech types include: overlapping speech sentences, nested speech sentences and flat speech sentences; Classify and copy speech data sets for the sparse speech types of the characters, so that the total number of the copied speech data sets is equal to half of the number of the remaining speech data sets in the news sentence data; Based on the copied speech dataset, the speech extraction training samples with data enhancement are obtained.
6. A method for extracting speech of a news figure according to claim 5, characterized in that: The speech extraction training samples are batch-alternated to complete the parameter training update of the character speech extraction model, specifically including: Extract all speech sentences in the speech extraction training sample; According to different argument information in the speech extraction training samples, the extraction order of all the speech sentences is changed alternately to determine the extraction order of the speech sentence training samples; Extract the speech trigger words, speech holder characters and content fragments in each of the speech sentences in an alternating manner according to the priority order to obtain the subtask training sample extraction order; wherein the subtask includes: the speech trigger words, the speech holder characters and the content fragments; According to the extraction order of the speech sentence training samples and the extraction order of the subtask training samples, the directional propagation error calculation based on the cross entropy loss is performed on the speech extraction training samples to obtain error result data; The error result is fed back to the character speech extraction model, and the parameters of the character speech extraction model are trained and updated.
7. The method for extracting speech of a news figure according to claim 1, characterized in that: By training the updated character speech extraction model, speech events are extracted from the news text to be extracted, and the result triple data of the news text to be extracted is obtained, which specifically includes: Input the news text to be extracted into the trained and updated character speech extraction model to obtain the predicted label and predicted label sequence of each character in each speech text; Extracting the text span between the start character label and the end character label of different arguments in the speech event according to the predicted label and the predicted label sequence; The text content in the text span is output in triple form to obtain the result triple data of the news text to be extracted.
8. A device for extracting speech from news figures, characterized in that: The device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, so that the at least one processor can execute the method for extracting the speech of a news figure according to any one of claims 1-7.
9. A non-volatile computer storage medium, characterized in that: The storage medium is a non-volatile computer-readable storage medium, which stores at least one program. Each of the programs includes instructions, and when the instructions are executed by a terminal, the terminal executes a method for extracting the speech of a news figure according to any one of claims 1-7.
