Episode explanation text generation method and device, equipment and medium

Through text recognition and audio feature extraction, combined with large language models and target explanation styles, the problem of lack of personalization and low efficiency in explanation text generation in the existing technology is solved, and a method of quickly generating personalized explanation text is realized.

CN118734804APending Publication Date: 2024-10-01HANGZHOU HUACE FILM & TELEVISION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410878461.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-02
Publication Date
2024-10-01

AI Technical Summary

Technical Problem

In the existing technology, the method for generating episode commentary text lacks portability and cannot effectively and conveniently generate personalized commentary text. Especially when new dialogue appears in the video, the model needs to be retrained.

Method used

The line text is obtained through the text recognition model, and the target commentary text is generated through audio feature extraction and gender classification, combined with the large language model and the pre-selected target commentary style, avoiding the need for multiple trainings and realizing the rapid generation of personalized commentary text.

Benefits of technology

It realizes the ability to quickly generate personalized explanation text according to user needs, improves the efficiency and adaptability of explanation text, and users can independently choose the generated explanation style.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118734804A_ABST
    Figure CN118734804A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses an episode explanation text generation method and device, equipment and a medium. The method comprises the following steps: performing format conversion on line texts recognized by a to-be-explained video through a character recognition model to obtain subtitle files; performing feature extraction on the audio of the to-be-explained video to obtain audio features corresponding to the line text, and performing gender classification on the audio features through a preset classifier to obtain line classification texts; and inputting the subtitle file and the line classification text into a large language model, and generating a target explanation text according to the large language model and a pre-selected target explanation style. By implementing the method provided by the embodiment of the invention, the problem that the personalized explanation text cannot be effectively generated for the episode in the prior art can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of language processing, and in particular to a method, device, equipment and medium for generating a drama commentary text. Background Art

[0002] With the development of science and technology, people's pace of life has gradually become faster, and they rarely have time to watch a complete drama or a series of movies. Therefore, the commentary of film and television dramas has gradually become an important way for people to understand film and television dramas. In the prior art, long short-term memory networks or deep learning methods are often used to obtain the text of the video to be explained, and the cleaned text data is put into the neural network through training to generate the corresponding commentary text. However, this traditional commentary text generation method is not portable, resulting in the need to train the model for generating commentary text again when a new dialogue is generated in the video, making it impossible to effectively and conveniently generate personalized commentary text for the drama in the prior art. Summary of the invention

[0003] The embodiments of the present invention provide a method, device, equipment and medium for generating a drama commentary text, aiming to solve the problem in the prior art that it is impossible to effectively generate a personalized commentary text for a drama.

[0004] In a first aspect, an embodiment of the present invention provides a method for generating a drama commentary text, which comprises: converting the format of a dialogue text recognized by a video to be explained through a text recognition model to obtain a subtitle file; extracting features of the audio of the video to be explained to obtain audio features corresponding to the dialogue text, and classifying the audio features by gender through a preset classifier to obtain a dialogue classification text; inputting the subtitle file and the dialogue classification text into a large language model, and generating a target commentary text according to the large language model and a pre-selected target commentary style.

[0005] In a second aspect, an embodiment of the present invention further provides a drama commentary text device, which comprises: a conversion unit, used to convert the format of the dialogue text recognized by the video to be explained through a text recognition model to obtain a subtitle file; a classification unit, used to obtain audio features corresponding to the dialogue text by extracting features from the audio of the video to be explained, and classifying the audio features by gender through a preset classifier to obtain a dialogue classification text; a generation unit, used to input the subtitle file and the dialogue classification text into a large language model, and generate a target commentary text according to the large language model and a pre-selected target commentary style.

[0006] In a third aspect, an embodiment of the present invention further provides a computer device, which includes a memory and a processor, wherein a computer program is stored in the memory, and the processor implements the above method when executing the computer program.

[0007] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, wherein the storage medium stores a computer program, wherein the computer program includes program instructions, and the program instructions can implement the above method when executed by a processor.

[0008] The embodiment of the present invention provides a method, device, equipment and medium for generating a drama commentary text. The method includes: converting the format of the lines text recognized by the video to be explained by a text recognition model to obtain a subtitle file; extracting features of the audio of the video to be explained to obtain the audio features corresponding to the lines text, and classifying the audio features by gender through a preset classifier to obtain a line classification text; inputting the subtitle file and the line classification text into a large language model, and generating a target commentary text according to the large language model and a pre-selected target commentary style. The embodiment of the present invention obtains the lines text in the video to be explained by a text recognition model to determine the subtitle file, and classifies the lines text by gender to obtain the lines classification text to lay the foundation for personalized commentary text, and then combines the target commentary style expected by the user to generate the target commentary text through the large language model, and generates the commentary text in the target commentary style by using the trained large language model to avoid multiple training of the model and allowing the user to independently choose the style of generating the commentary, so as to quickly and effectively generate personalized commentary text for the drama. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0010] Figure 1 A schematic diagram of a flow chart of a method for generating a drama commentary text according to an embodiment of the present invention;

[0011] Figure 2 A schematic diagram of a sub-process of a method for generating a drama commentary text provided by an embodiment of the present invention;

[0012] Figure 3 A schematic diagram of a sub-process of a method for generating a drama commentary text provided by an embodiment of the present invention;

[0013] Figure 4 A schematic diagram of a sub-process of a method for generating a drama commentary text provided by an embodiment of the present invention;

[0014] Figure 5 A schematic diagram of a sub-process of a method for generating a drama commentary text provided by an embodiment of the present invention;

[0015] Figure 6 A schematic diagram of a sub-process of a method for generating a drama commentary text provided by an embodiment of the present invention;

[0016] Figure 7 A schematic block diagram of a device for generating a drama commentary text according to an embodiment of the present invention;

[0017] Figure 8 A schematic block diagram of a computer device provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0018] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0019] It should be understood that when used in this specification and the appended claims, the terms "include" and "comprises" indicate the presence of described features, integers, steps, operations, elements and / or components, but do not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0020] It should also be understood that the terms used in this specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. As used in the specification of the present invention and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0021] It should be further understood that the term "and / or" used in the present description and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.

[0022] See also Figure 1 , Figure 1 A flow chart of a method for generating a drama commentary text provided by an embodiment of the present invention. The drama commentary text generation method in this embodiment can be applied to a program for generating drama commentary text. If the existing commentary text generation method is used, the generated commentary text does not have a personalized style and is inefficient. However, when using a drama commentary generation APP with the method of the present invention, the user only needs to import the video to be commented on and select the position where the subtitles appear in the video and the style of the commentary text to be obtained. The present invention can quickly generate personalized commentary text by itself.

[0023] Figure 11 is a flow chart of a method for generating a drama commentary text according to an embodiment of the present invention. As shown in the figure, the method includes the following steps S110-S130.

[0024] S110, converting the format of the dialogue text recognized from the narration video by a text recognition model to obtain a subtitle file.

[0025] In this embodiment, the text recognition model is an optical character recognition (Optical Character Recognition) model, and the text recognition model can convert the text information in the image into an editable and searchable text format by analyzing it. The video to be explained is a video selected by the user for which an explanation text needs to be generated. The subtitle file is an SRT file with all the subtitle content and subtitle timestamps in the video to be explained, that is, the format of the subtitle file is SRT, where SRT refers to the SubRip text format, which is a movie subtitle file format. The text recognition model can identify the lines in the video to be explained and generate the line text, and then convert the line text into a subtitle file in the movie subtitle format. The text recognition model can efficiently identify the text information in the video to be explained, and generate an accurate subtitle file, which provides a data basis for the subsequent generation of the target explanation script.

[0026] In one embodiment, if Figure 2 As shown, the step S110 also includes steps S111-S112.

[0027] S111, using the text recognition model to recognize the lines to be recognized in the target text box in the video to be explained to generate a line text;

[0028] S112: Convert the format of the dialogue text by a preset format conversion method to obtain the subtitle file.

[0029] In this embodiment, the target text box is a task box selected by the user at the client according to the position of the lines to be recognized in the video to be explained, and the lines to be recognized will appear in the target text box. The text recognition model is used to recognize the lines to be recognized at the target text box to obtain video subtitles, and save them as lines text, wherein the format of the lines text is TXT. The lines text in TXT format is converted into a subtitle file in SRT format by the preset format conversion method. The preset format conversion method is a method that can convert a file in TXT format to a file in SRT format. For example, the format of the lines text can be converted by a python script conversion method to obtain the subtitle file. The specific conversion method is not limited, and the TXT text can be converted into an SRT file. By identifying the lines to be recognized at the target text box to generate the lines text, the subtitle detection process can be omitted and the text unrelated to the subtitle can be filtered out, so as to quickly obtain an accurate subtitle file.

[0030] In one embodiment, the method further includes a step of training the text recognition model. Specifically, the text recognition model is trained by using a variety of data sets, and the model structure and parameters of the text recognition model are optimized according to the training results. Specifically, the data set can be determined by increasing the sample size and sample randomness in the data set. By optimizing the text recognition model, it can perform text recognition more accurately and quickly.

[0031] S120, extracting features of the audio of the video to be explained to obtain audio features corresponding to the dialogue text, and classifying the audio features by gender using a preset classifier to obtain a dialogue classification text.

[0032] In this embodiment, the audio is the sound corresponding to the lines to be identified in the video to be explained. The audio feature is the result of numerically representing a certain attribute of the audio signal. It can be understood that the audio features of different people speaking are different. The audio corresponding to each line of the video to be explained is subjected to feature extraction. Specifically, the audio feature can be extracted by methods such as the Fbank feature of the filter group and linear prediction analysis (LPC), and the extracted audio feature is subjected to gender classification by the preset classifier, wherein the preset classifier is a generalized linear classifier that performs binary classification of data in a supervised learning manner. Specifically, the preset classifier can be an SVM classifier. The audio feature is classified by the preset classifier, that is, the gender to which the audio feature belongs is distinguished, and the gender to which it belongs is marked in the lines corresponding to the audio feature to obtain the line classification text, wherein the gender to which the lines belong can be marked in the line text to obtain the line classification text. By performing gender classification on the audio features of the audio corresponding to the lines to obtain the line classification text with the gender marked, it is convenient to generate personalized commentary text according to gender.

[0033] In one embodiment, if Figure 3 As shown, the step S120 also includes steps S121-S122.

[0034] S121, obtaining a time period in which the lines to be recognized appear through the text recognition model, and saving the audio corresponding to the lines to be recognized according to the time period;

[0035] S122. Extract features of the audio through Mel-frequency cepstral coefficients to obtain the audio features.

[0036] In this embodiment, the Mel Frequency Cepstrum Coefficient (MFCC) is proposed based on the auditory characteristics of the human ear, and it has a nonlinear corresponding relationship with the Hz frequency. The Mel Frequency Cepstrum Coefficient (MFCC) is a Hz spectrum feature calculated by using this relationship between them. It simulates the auditory characteristics of the human ear by transforming the frequency of the audio signal into the Mel scale to extract the audio features. The time period when the words to be recognized appear when the text recognition model recognizes the words to be recognized can be obtained. For example, the time period when the words to be recognized appear can be obtained according to the timestamp of the words, and the audio appearing in the time period is saved to obtain the audio corresponding to the words to be recognized, and the audio features of the audio are extracted by Mel Frequency Cepstrum Coefficient (MFCC) to obtain the audio features corresponding to the audio. The audio features can be sent to a preset classifier, such as an SVM classifier, to identify the gender of the speaker corresponding to the audio. By obtaining the audio features corresponding to the audio, it is convenient to identify the gender of the speaker corresponding to the words, so as to generate personalized commentary text according to the gender of the speaker.

[0037] S130, inputting the subtitle file and the line classification text into a large language model, and generating a target commentary text according to the large language model and a pre-selected target commentary style.

[0038] In this embodiment, the large language model (LLM) is an artificial intelligence technology that trains massive text data to learn the structure, rules and semantics of a language, so that a text with a natural language style can be generated or the meaning of a natural language text can be understood. The target interpretation style is the interpretation style of the interpretation text selected by the user on the client. For example, the target interpretation style may be: "Look carefully, this man who is banging on the door crazily is called Xiao Shuai..." The large language model receives the subtitle file and the line classification text, and generates an interpretation text of the same style according to the prompt words of the target interpretation style. A large language model can generate a variety of interpretation texts based on the subtitle file, the line classification text and the target interpretation style to meet the needs of different users.

[0039] In one embodiment, if Figure 4 As shown, the step S130 also includes steps S131-S132.

[0040] S131, integrating the target commentary style with the subtitle file and the line classification text through the prompt word module to obtain a style guidance text;

[0041] S132: Generate the target explanation text by using the large language model and the style guidance text.

[0042] In this embodiment, the prompt word module is a module that can integrate information to generate a guide file. Specifically, a number of commentary styles are pre-designed for user selection, and style prompt words are obtained according to the target commentary style selected by the user, and the style prompt words are integrated with the target commentary style and the subtitle file to generate a style guide text, wherein the style guide file is a guide file of the commentary text, for example, the subtitle is "Ziwei, Ziwei, where are you", and the identified speaker is male, and the target commentary style can be: "Look carefully, this *** man is called ***..." The funny style, then the style guide text generated after the prompt word module in the large language model is integrated is: Look carefully, this crazy shouting man is called Xiaoshuai. It can be understood that the style guide text is a generated section of the target commentary text, which determines the style required by the user, and guides the remaining existing text lines so that the large language model generates the target commentary text. By generating the style guidance text according to the target commentary style, the subtitle file and the dialogue classification text, guidance is added on the basis of the selected target commentary style, and the target commentary text is generated through strong guidance, so that the style of the commentary text is consistent with the target commentary style to meet user needs.

[0043] In one embodiment, the step S130 further includes a step S133.

[0044] S133, synchronizing the instantly generated commentary text with the modal information of the video to be explained by using a multimodal data processing method and the dialogue timestamp, so as to obtain the target commentary text generated according to the dialogue time.

[0045] In this embodiment, the multimodal data processing refers to a data processing technology that combines multiple data modes for processing. It combines multiple data modes, such as text, images, voice, video, etc., to form a complete data processing system to meet the user's demand for information. It can help improve the efficiency of data processing, thereby improving the accuracy and reliability of information. Among them, the subtitle file is in SRT format, which is a movie subtitle file format. It can be understood that the SRT format file not only has the text content of the dialogue, but also has the time point when each line appears, that is, the timestamp, wherein the timestamp is a way of recording time, indicating the length of time from a fixed time point to the present, usually calculated in seconds. The modal information refers to the attitude, emotion or intention shown by the speaker when using language and context to express and convey content in information transmission. Specifically, in this embodiment, the modal information can be the lines in the video. In the process of generating the target commentary text, the generated commentary text is synchronized with the corresponding modal information according to the timestamp of the lines in combination with the multimodal data processing method, that is, each commentary has a corresponding line text, so as to generate the target commentary text according to the line time and the lines are synchronized with the commentary. By generating the target commentary text synchronized with the modal information according to the timestamp and the multimodal data processing method, the situation where the generated commentary text does not correspond to the lines is avoided, and it is convenient for users to quickly sort out and understand the target commentary text.

[0046] In one embodiment, if Figure 5 As shown, the step S130 also includes steps S134-S135.

[0047] S134, dividing the video to be explained by splitting the video into several subtitle files according to the segmentation requirement;

[0048] S135, generating a plurality of sub-narration scripts according to the sub-subtitle file, the line classification text and the large language model, and merging the sub-narration scripts according to chronological order to obtain the target narration text.

[0049] In this embodiment, the segmentation requirement refers to the requirement determined by the duration of the video to be explained. For example, if the video to be explained is a 10-minute video, the video to be explained can quickly generate the corresponding explanation text without segmentation. If the video to be explained is a two-hour video, it needs to be segmented in order to quickly generate the explanation text. Specifically, the segmentation can be performed according to the storyboard of the video. For example, if the current shot is a green spring, and the next shot is a snowy scene, the segmentation can be started from the snowy scene. The segmented sub-videos to be explained are subjected to line recognition through a text recognition model to generate corresponding sub-subtitle files. The sub-subtitle files and the line classification text are then input into the large language model to generate several sub-explanation texts in combination with the target explanation style selected by the user, and the generated several sub-explanation texts are merged according to the chronological order to obtain the target explanation text. This embodiment also includes integrating the plurality of sub-subtitle files according to the time sequence to generate a subtitle file, and generating a plurality of sub-line classification texts according to the plurality of sub-videos to be explained, and merging them to obtain a total line classification text, and generating a target explanation text by combining the generated subtitle file with the line classification text and a large language model. By segmenting the video to be explained to generate the corresponding sub-subtitle files to generate the target explanation text, the time for generating the target explanation text can be saved, so that the target explanation text can be quickly fed back to the user.

[0050] In one embodiment, if Figure 6 As shown, the step S130 also includes steps S1301-S1303.

[0051] S1301, converting the keywords and the style prompt words in the target explanation text into keyword vectors and prompt word vectors by a word embedding conversion method;

[0052] S1302, calculating the cosine distance between the keyword vector and the prompt word vector to obtain style similarity;

[0053] S1303: Determine whether the style similarity is within a preset similarity range; if not, update and / or modify the decision logic of the prompt word module in the large language model.

[0054] In the present embodiment, the word embedding is a processing method in natural language processing. Word embedding can be used to convert text into vectors. Specifically. Each word is mapped into a vector, and this vector can be used to represent the semantics and features of this word. Specifically, the keywords that can represent the interpretation style in the target interpretation text are extracted, and the keywords are converted into corresponding keyword vectors through word embedding, and the prompt words of the target interpretation style are converted to generate corresponding prompt word vectors. It can be understood that the keyword vector and the prompt word vector are a set, which contains vectors converted from all keywords, and the prompt word vector is the same. The cosine distance between the keyword vector and the prompt word vector is calculated to obtain the style similarity, wherein the style similarity is the cosine distance between the two vectors. Specifically, the cosine distance between the two vectors can be calculated based on the cosine value of the vector angle. Determine whether the style similarity is within a preset similarity range, wherein the preset similarity range can be determined based on the range of the cosine distance value. For example, the range of the cosine distance is 0-2, and the smaller the cosine distance value, the more similar the two vectors are, and the larger the value, the less similar they are. The preset similarity range can be set to between 0-1, and a cosine distance exceeding 1 indicates that the styles are not similar enough. If the style similarity is not within the preset similarity range, update and / or modify the decision logic of the prompt word module in the large language model. By calculating the cosine distance between the keyword vector and the prompt word vector to obtain the style similarity, it is convenient to determine whether the generated target commentary script is consistent with the selected target commentary style. If not, adjust the large language model accordingly to generate a target commentary script that meets user needs.

[0055] Figure 7 2 is a schematic block diagram of a drama commentary text device 200 provided by an embodiment of the present invention. Figure 7 As shown, corresponding to the above drama commentary text generation method, the present invention also provides a drama commentary text device. The drama commentary text generation device includes a unit for executing the above drama commentary text generation method, and the device can be configured in a desktop computer, a tablet computer, a laptop computer, etc. Specifically, please refer to Figure 7 The drama commentary text generation device includes a conversion unit 210, a classification unit 220, and a generation unit 230.

[0056] The conversion unit 210 is used to convert the format of the dialogue text recognized from the video to be explained by using a text recognition model to obtain a subtitle file.

[0057] In one embodiment, the conversion unit 210 includes an identification unit and an acquisition unit.

[0058] A recognition unit, configured to recognize the lines to be recognized at the target text box in the video to be explained by using the text recognition model to generate a line text;

[0059] The acquisition unit is used to convert the format of the dialogue text by a preset format conversion method to acquire the subtitle file.

[0060] The classification unit 220 is used to obtain audio features corresponding to the dialogue text by extracting features from the audio of the video to be explained, and classify the audio features by gender using a preset classifier to obtain a dialogue classification text.

[0061] In one embodiment, the classification unit 220 includes a storage unit and a classification unit.

[0062] A storage unit, configured to obtain a time period in which the lines to be recognized appear through the text recognition model, and save the audio corresponding to the lines to be recognized according to the time period;

[0063] The feature unit is used to extract the features of the audio through Mel-frequency cepstral coefficients to obtain the audio features.

[0064] The generating unit 230 is used to input the subtitle file and the line classification text into a large language model, and generate a target commentary text according to the large language model and a pre-selected target commentary style.

[0065] In one embodiment, the generating unit 230 includes an integrating unit and a guiding unit.

[0066] An integration unit, used for integrating the target commentary style with the subtitle file and the line classification text through the prompt word module to obtain a style guidance text;

[0067] A guidance unit, used to generate the target explanation text through the large language model and the style guidance text

[0068] In one embodiment, the generating unit 230 includes a synchronization unit.

[0069] The synchronization unit is used to synchronize the instantly generated commentary text with the modal information of the video to be explained through a multimodal data processing method and the dialogue timestamp, so as to obtain the target commentary text generated according to the dialogue time.

[0070] In one embodiment, the generating unit 230 includes a segmenting unit and a merging unit.

[0071] A segmentation unit, used for segmenting the video to be explained by storyboards according to segmentation requirements to obtain a plurality of subtitle files;

[0072] A merging unit is used to generate a plurality of sub-narration scripts according to the sub-subtitle file, the line classification text and the large language model, and merge the sub-narration scripts according to the time sequence to obtain the target commentary text.

[0073] In one embodiment, the generating unit 230 includes a vector unit, a calculating unit and a judging unit.

[0074] A vector unit, used for converting the keywords and the style prompt words in the target explanation text into keyword vectors and prompt word vectors by word embedding conversion method;

[0075] A calculation unit, used for calculating the cosine distance between the keyword vector and the prompt word vector to obtain style similarity;

[0076] The judging unit is used to judge whether the style similarity is within a preset similarity range, and if it is not within the preset similarity range, update and / or modify the decision logic of the prompt word module in the large language model.

[0077] It should be noted that technicians in the relevant field can clearly understand that the specific implementation process of the above-mentioned drama commentary text generation device 200 and each unit can refer to the corresponding description in the aforementioned method embodiment, and for the convenience and brevity of description, it will not be repeated here.

[0078] The above-mentioned drama commentary text generating device can be implemented in the form of a computer program, and the computer program can be used in Figure 8 Runs on the computer device shown.

[0079] See also Figure 8 , Figure 8 5 is a schematic block diagram of a computer device provided in an embodiment of the present application. The computer device 500 may be a terminal or a server, wherein the terminal may be an electronic device with communication functions such as a smart phone, a tablet computer, a laptop computer, a desktop computer, a personal digital assistant, and a wearable device. The server may be an independent server or a server cluster composed of multiple servers.

[0080] See also Figure 8 The computer device 500 includes a processor 502 , a memory and a network interface 505 connected via a system bus 501 , wherein the memory may include a non-volatile storage medium 503 and an internal memory 504 .

[0081] The non-volatile storage medium 503 can store an operating system 5031 and a computer program 5032. The computer program 5032 includes program instructions, and when the program instructions are executed, the processor 502 can execute a method for generating a drama commentary text.

[0082] The processor 502 is used to provide computing and control capabilities to support the operation of the entire computer device 500 .

[0083] The internal memory 504 provides an environment for the operation of the computer program 5032 in the non-volatile storage medium 503. When the computer program 5032 is executed by the processor 502, the processor 502 can execute a method for generating a drama commentary text.

[0084] The network interface 505 is used to communicate with other devices over the network. Figure 8 The structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device 500 to which the solution of the present application is applied. The specific computer device 500 may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0085] The processor 502 is used to run a computer program 5032 stored in the memory to implement the steps of the above method.

[0086] It should be understood that in the embodiment of the present application, the processor 502 may be a central processing unit (CPU), and the processor 502 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0087] It can be understood by those skilled in the art that all or part of the processes in the method for implementing the above embodiment can be completed by instructing the relevant hardware through a computer program. The computer program includes program instructions, and the computer program can be stored in a storage medium, which is a computer-readable storage medium. The program instructions are executed by at least one processor in the computer system to implement the process steps of the embodiment of the above method.

[0088] Therefore, the present invention also provides a storage medium. The storage medium may be a computer-readable storage medium. The storage medium stores a computer program, wherein the computer program includes program instructions. When the program instructions are executed by a processor, the processor executes the steps of the above method.

[0089] The storage medium may be a USB flash drive, a mobile hard disk, a read-only memory (ROM), a magnetic disk, or an optical disk, etc., which are computer-readable storage media that can store program codes.

[0090] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0091] In the several embodiments provided by the present invention, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of each unit is only a logical function division, and 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.

[0092] The steps in the method of the embodiment of the present invention can be adjusted in order, combined and deleted according to actual needs. The units in the device of the embodiment of the present invention can be combined, divided and deleted according to actual needs. In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0093] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, terminal, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention.

[0094] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for generating a drama commentary text, characterized in that: The method comprises: The text recognition model is used to convert the text format of the lines recognized in the commentary video to obtain the subtitle file; Extracting features of the audio of the video to be explained to obtain audio features corresponding to the dialogue text, and classifying the audio features by gender using a preset classifier to obtain dialogue classification text; The subtitle file and the line classification text are input into a large language model, and a target commentary text is generated according to the large language model and a pre-selected target commentary style.

2. The method according to claim 1, characterized in that The step of converting the text of the lines recognized by the video to be explained by the text recognition model into a format to obtain a subtitle file comprises: Recognize the lines to be recognized in the target text box in the video to be explained by the text recognition model to generate line text; The format of the dialogue text is converted by a preset format conversion method to obtain the subtitle file.

3. The method according to claim 1, characterized in that The step of extracting features from the audio of the video to be explained to obtain audio features corresponding to the dialogue text includes: Acquire the time period in which the lines to be recognized appear through the text recognition model, and save the audio corresponding to the lines to be recognized according to the time period; The audio is subjected to feature extraction through Mel-frequency cepstral coefficients to obtain the audio features.

4. The method according to claim 1, characterized in that The large language model has a prompt word module, and the step of generating a target explanation text according to the large language model and a pre-selected target explanation style includes: Integrating the target commentary style with the subtitle file and the line classification text through the prompt word module to obtain a style guidance text; The target explanation text is generated by using the large language model and the style guidance text.

5. The method according to claim 1, characterized in that The lines in the subtitle file have corresponding line timestamps, and the step of generating a target commentary text according to the large language model and a pre-selected target commentary style includes: The instantaneously generated commentary text is synchronized with the modal information of the video to be explained through a multimodal data processing method and the dialogue timestamp, so as to obtain the target commentary text generated according to the dialogue time.

6. The method according to claim 1, characterized in that The step of generating a target explanation text according to the large language model and a pre-selected target explanation style also includes: According to the segmentation requirements, the video to be explained is segmented by storyboards to obtain a plurality of subtitle files; A plurality of sub-narration scripts are generated according to the sub-subtitle file, the line classification text and the large language model, and the sub-narration scripts are merged according to the chronological order to obtain the target commentary text.

7. The method according to claim 1, characterized in that The target explanation style includes style prompt words, and the steps of training the large language model include: Convert the keywords and the style prompt words in the target explanation text into keyword vectors and prompt word vectors by word embedding conversion method; Calculating the cosine distance between the keyword vector and the prompt word vector to obtain style similarity; It is determined whether the style similarity is within a preset similarity range, and if it is not within the preset similarity range, the decision logic of the prompt word module in the large language model is updated and / or modified.

8. A device for generating a drama commentary text, characterized in that: include: A conversion unit, used for converting the text of the lines recognized by the narration video through a text recognition model to obtain a subtitle file; A classification unit, configured to obtain audio features corresponding to the dialogue text by performing feature extraction on the audio of the video to be explained, and classify the audio features by gender using a preset classifier to obtain a dialogue classification text; A generating unit is used to input the subtitle file and the line classification text into a large language model, and generate a target commentary text according to the large language model and a pre-selected target commentary style.

9. A computer device, characterized in that: The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

10. A storage medium, characterized in that: The storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the method according to any one of claims 1 to 7 can be implemented.