Subtitle translation method, device and device for subtitle translation
By merging source language subtitles to form complete semantic sentences to be translated, the problem of incomplete source language subtitle lines in machine translation of subtitle scenes is solved, and more accurate and smooth subtitle translation results are achieved.
Patent Information
- Application Number
- CN202110742660.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-30
- Publication Date
- 2024-10-29
- Estimated Expiration
- 2041-06-30
AI Technical Summary
Due to the character number and duration limitations of the existing subtitle scene machine translation system, the source language subtitle line is not a complete meaning group, which affects the accuracy and fluency of the translation results of the machine translation model.
Source language subtitle files are obtained and merged to form complete semantic sentences to be translated. After translation processing, they are then split into target language subtitle lines corresponding to the source language subtitle lines to ensure the accuracy and fluency of the translation results. .
It improves the accuracy and fluency of subtitle translation, ensures that the target language subtitle lines are aligned with the source language subtitle lines, and improves users' understanding of audio and video content.
Smart Images

Figure CN113343720B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer technology, and in particular to a subtitle translation method, a subtitle translation device and a subtitle translation device. Background Art
[0002] With the rapid development of science and technology, people have more and more opportunities to be exposed to international things, especially more and more foreign movies, reality shows, talk shows and other multimedia content. Due to the different languages of different countries, it is easy to cause viewers to have difficulty understanding. Therefore, subtitle translation for multimedia content has become a necessary part of the multimedia content processing process.
[0003] In order to further improve the efficiency of subtitle translation, with the advancement of machine translation technology, machine translation technology has gradually been introduced into the field of subtitle translation. At present, the existing subtitle scene machine translation systems translate one by one according to the source language subtitle line. Due to the limitations of the number of characters and duration, a source language subtitle line is not a complete meaning group, which in turn affects the accuracy and fluency of the translation results of the machine translation model. Summary of the invention
[0004] The embodiments of the present invention provide a subtitle translation method, a device and a device for subtitle translation, which can ensure the accuracy and fluency of the translation result and help improve the translation performance.
[0005] In order to solve the above problem, an embodiment of the present invention discloses a subtitle translation method, which includes:
[0006] Acquire a source language subtitle file, wherein the source language subtitle file includes at least two source language subtitle line texts;
[0007] Merging the source language subtitle lines to obtain sentences to be translated, wherein the sentences to be translated include complete semantics;
[0008] Translating the sentence to be translated to obtain a target sentence;
[0009] The target sentence is split to obtain target language subtitle line texts, and the target language subtitle line texts correspond to the source language subtitle line texts one by one.
[0010] Optionally, the merging of the source language subtitle lines to obtain sentences to be translated includes:
[0011] Performing semantic analysis on the source language subtitle line text one by one to determine whether the semantics of the current source language subtitle line text is complete;
[0012] If the semantics of the current source language subtitle line text is complete, the current source language subtitle line text is used as the sentence to be translated, and the semantics of the next source language subtitle line text is determined to be complete;
[0013] If the semantics of the current source language subtitle line text is incomplete, merging the current source language subtitle line text with a context subtitle line text semantically associated with the current source language subtitle line text to obtain a merged source language subtitle line text, and further determining whether the semantics of the merged source language subtitle line text is complete;
[0014] Until the last source language subtitle line text processing is completed, the sentence to be translated corresponding to the source language subtitle file is obtained.
[0015] Optionally, the merging of the current source language subtitle line text and the context subtitle line text semantically associated with the current source language subtitle line text to obtain a merged source language subtitle line text includes:
[0016] Determining a context subtitle line text semantically associated with the current source language subtitle line text;
[0017] Determine the meaning groups corresponding to each word segment in the current source language subtitle line text and the context subtitle line text;
[0018] The continuous segmented words belonging to the same meaning group in the current source language subtitle line text and the context subtitle line text are merged to obtain a sentence to be translated.
[0019] Optionally, the source language subtitle file further includes the start and end time corresponding to the source language subtitle line text, and the merging process of the source language subtitle line text to obtain the sentence to be translated includes:
[0020] Predicting the punctuation labels corresponding to each source language subtitle line text in sequence according to the start and end time, and obtaining a punctuation sequence corresponding to each source language subtitle line text, wherein the punctuation sequence includes the punctuation labels corresponding to each word segment in the at least two source language subtitle line texts;
[0021] The source language subtitle line texts are merged based on the punctuation tags to obtain sentences to be translated.
[0022] Optionally, the merging of the source language subtitle line texts based on the punctuation tags to obtain sentences to be translated includes:
[0023] Traversing the punctuation sequence corresponding to each source language subtitle line text one by one, and determining whether the punctuation tag of the last participle of the current source language subtitle line text is a sentence-end punctuation;
[0024] If the punctuation tag of the last participle of the current source language subtitle line text is not a sentence-end punctuation, the current source language subtitle line text is merged with the next source language subtitle line text to obtain a merged source language subtitle text, and further determine whether the punctuation tag of the last participle of the merged source language subtitle text is a sentence-end punctuation;
[0025] If the punctuation tag of the last participle of the current source language subtitle line text is the sentence-end punctuation, the merging is terminated to obtain the sentence to be translated.
[0026] Optionally, the step of splitting the target sentence to obtain target language subtitle line text includes:
[0027] Determining breakpoint identifiers in the target sentence based on a pre-trained sentence segmentation model;
[0028] According to the breakpoint identifiers, the target sentence is segmented into target language subtitle line texts aligned with the source language subtitle line texts.
[0029] Optionally, the step of dividing the target sentence into target language subtitle line texts aligned with the source language subtitle line texts according to the breakpoint identifiers includes:
[0030] Determining whether there is a second breakpoint identifier corresponding to the first breakpoint identifier in the target sentence, where the second breakpoint identifier is located before the first breakpoint identifier;
[0031] If there is a second breakpoint identifier corresponding to the first breakpoint identifier in the target sentence, extracting each word segment between the first breakpoint identifier and the second breakpoint identifier from the target sentence, and merging the extracted words to obtain a subtitle line text in a target language;
[0032] If the target sentence does not contain a second breakpoint identifier corresponding to the first breakpoint identifier, extract each participle between the first participle of the target sentence and the first breakpoint identifier from the target sentence, and merge the extracted participles to obtain a target language subtitle line text.
[0033] Optionally, the method further comprises:
[0034] Acquire a sentence segmentation training sample set, wherein the sentence segmentation training sample set includes a source language subtitle line text, a time axis corresponding to the source language subtitle line text, and a target language subtitle line text;
[0035] The sentence segmentation model is iteratively trained based on the sentence segmentation training sample set until an iteration stop condition is met to obtain a trained sentence segmentation model.
[0036] On the other hand, an embodiment of the present invention discloses a subtitle translation device, the device comprising:
[0037] A subtitle line acquisition module, used to acquire a source language subtitle file, wherein the source language subtitle file includes at least two source language subtitle line texts;
[0038] A merging module, used for merging the source language subtitle line texts to obtain sentences to be translated, wherein the sentences to be translated include complete semantics;
[0039] A translation module, used for translating the sentence to be translated to obtain a target sentence;
[0040] The splitting module is used to split the target sentence to obtain target language subtitle line text, and the target language subtitle line text corresponds to the source language subtitle line text one by one.
[0041] Optionally, the merging module includes:
[0042] A semantic analysis submodule, used to perform semantic analysis on the source language subtitle line text one by one to determine whether the semantics of the current source language subtitle line text is complete;
[0043] A first semantic judgment submodule is used to, if the semantics of the current source language subtitle line text is complete, use the current source language subtitle line text as a sentence to be translated, and continue to judge whether the semantics of the next source language subtitle line text is complete;
[0044] The second semantic judgment submodule is used for merging the current source language subtitle line text with the context subtitle line text semantically associated with the current source language subtitle line text to obtain a merged source language subtitle line text, and further judging whether the semantics of the merged source language subtitle line text are complete if the semantics of the current source language subtitle line text are incomplete;
[0045] The text processing submodule is used to complete the text processing of the last source language subtitle line to obtain the sentence to be translated corresponding to the source language subtitle file.
[0046] Optionally, the second semantic judgment submodule includes:
[0047] An associated subtitle line determination unit, used to determine a context subtitle line text semantically associated with the current source language subtitle line text;
[0048] A meaning group determination unit, used to determine the meaning groups corresponding to each word segment in the current source language subtitle line text and the context subtitle line text;
[0049] The first merging unit is used to merge the continuous segmented words belonging to the same meaning group in the current source language subtitle line text and the context subtitle line text to obtain a sentence to be translated.
[0050] Optionally, the source language subtitle file further includes the start and end time corresponding to the source language subtitle line text, and the merging module includes:
[0051] a punctuation prediction submodule, configured to predict the punctuation labels corresponding to each source language subtitle line text in sequence according to the start and end time, and obtain a punctuation sequence corresponding to each source language subtitle line text, wherein the punctuation sequence includes the punctuation labels corresponding to each word segment in the at least two source language subtitle line texts;
[0052] The merging processing submodule is used to merge the source language subtitle line text based on the punctuation tags to obtain the sentence to be translated.
[0053] Optionally, the merging processing submodule includes:
[0054] A punctuation sequence traversal unit, used to traverse the punctuation sequence corresponding to each source language subtitle line text one by one, and determine whether the punctuation tag of the last participle of the current source language subtitle line text is a sentence-end punctuation;
[0055] The second merging unit is used to merge the current source language subtitle line text with the next source language subtitle line text to obtain a merged source language subtitle text if the punctuation tag of the last participle of the current source language subtitle line text is not a sentence-end punctuation, and continue to determine whether the punctuation tag of the last participle of the merged source language subtitle text is a sentence-end punctuation;
[0056] The third merging unit is used to terminate the merging if the punctuation tag of the last participle of the current source language subtitle line text is the sentence-end punctuation, so as to obtain the sentence to be translated.
[0057] Optionally, the splitting module includes:
[0058] A breakpoint identification determination submodule, used to determine the breakpoint identification in the target sentence based on a pre-trained sentence segmentation model;
[0059] The splitting submodule is used to split the target sentence into target language subtitle line texts aligned with the source language subtitle line texts according to the breakpoint identifiers.
[0060] Optionally, the splitting submodule includes:
[0061] a breakpoint determination unit, configured to determine whether there is a second breakpoint identifier corresponding to the first breakpoint identifier in the target sentence, wherein the second breakpoint identifier is located before the first breakpoint identifier;
[0062] A first splitting unit is configured to extract each word between the first breakpoint identifier and the second breakpoint identifier from the target sentence if a second breakpoint identifier corresponding to the first breakpoint identifier exists in the target sentence, and merge the extracted word segments to obtain a target language subtitle line text;
[0063] The second splitting unit is used to extract each participle between the first participle of the target sentence and the first breakpoint identifier from the target sentence if there is no second breakpoint identifier corresponding to the first breakpoint identifier in the target sentence, and merge the extracted participles to obtain a target language subtitle line text.
[0064] Optionally, the device further comprises:
[0065] A sample acquisition module, used to acquire a sentence segmentation training sample set, wherein the sentence segmentation training sample set includes a source language subtitle line text, a time axis corresponding to the source language subtitle line text, and a target language subtitle line text;
[0066] The model training module is used to iteratively train the sentence segmentation model based on the sentence segmentation training sample set until an iteration stop condition is met to obtain a trained sentence segmentation model.
[0067] On the other hand, an embodiment of the present invention discloses a device for subtitle translation, which includes a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for executing one or more of the subtitle translation methods described above.
[0068] In yet another aspect, an embodiment of the present invention discloses a machine-readable medium having instructions stored thereon, which, when executed by one or more processors, enables a device to perform one or more of the subtitle translation methods described above.
[0069] The embodiments of the present invention include the following advantages:
[0070] After obtaining the source language subtitle file, the embodiment of the present invention merges the source language subtitle line texts therein to obtain a sentence to be translated, the sentence to be translated includes complete semantics, and then further translates the sentence to be translated to obtain a target sentence, and splits the target sentence to obtain a target language subtitle line text, the target language subtitle line text corresponds one to one with the source language subtitle line text. The embodiment of the present invention merges the source language subtitle line texts and then translates them, so that the merged sentence to be translated contains complete semantics, which can ensure the accuracy and fluency of the translation result and is conducive to improving the translation performance; and, after translating the sentence to be translated to obtain the target sentence, the embodiment of the present invention can further split the target sentence into target language subtitle line texts corresponding one to one with the source language subtitle line text, so that when presenting the subtitle line, the output target language subtitle line text is aligned with the source language subtitle line text, which is conducive to the user's understanding of the audio and video content corresponding to the subtitle line. BRIEF DESCRIPTION OF THE DRAWINGS
[0071] 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 of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only 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 creative labor.
[0072] Figure 1 is a flowchart of steps of an embodiment of a subtitle translation method of the present invention;
[0073] Figure 2 It is a structural block diagram of an embodiment of a subtitle translation device of the present invention;
[0074] Figure 3 is a block diagram of a device 800 for subtitle translation of the present invention;
[0075] Figure 4 It is a schematic diagram of the structure of the server in some embodiments of the present invention. DETAILED DESCRIPTION
[0076] 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.
[0077] Method Embodiment
[0078] Reference Figure 1, shows a flowchart of a subtitle translation method embodiment of the present invention, the method may specifically include the following steps:
[0079] Step 101: Obtain a source language subtitle file, where the source language subtitle file contains at least two source language subtitle line texts.
[0080] Step 102: merge the source language subtitle lines to obtain sentences to be translated, where the sentences to be translated include complete semantics.
[0081] Step 103: Translate the sentence to be translated to obtain a target sentence.
[0082] Step 104: split the target sentence to obtain target language subtitle line text, where the target language subtitle line text corresponds to the source language subtitle line text one by one.
[0083] The subtitle translation method provided in the embodiment of the present invention can be applied to an audio and video processing device with subtitle translation capability, which can be a terminal device or a server. The terminal device can be, for example, an intelligent terminal, a computer, a personal digital assistant (PDA), a tablet computer, a vehicle-mounted device, etc.
[0084] It should be noted that, in the embodiment of the present invention, the source language subtitle file may include a subtitle file that comes with the audio or video file stored on the electronic device or terminal, or a subtitle file that matches the audio or video file on the Internet or a server.
[0085] If the source language subtitle file is a subtitle file that comes with the audio and video file stored on an electronic device or terminal, when obtaining the source language subtitle file, the subtitle line text that comes with the audio and video file can be recognized based on text recognition technology. For example, the ORC (Optical Character Recognition) recognition algorithm can be used to convert the image information of the video file into text information, recognize the subtitle line text in the video file, and thus obtain the subtitle file corresponding to the video file. In addition, in order to avoid recognizing and extracting the text contained in the video scene, such as the billboard text that appears in the video screen, the scope of timely recognition and text content extraction based on text recognition can be pre-defined. The scope can be specifically a subtitle area, such as the top or bottom of the video screen. Based on the ORC text recognition technology, the subtitle line text in the preset subtitle area of the current video frame is recognized to obtain the subtitle line text in the current video frame.
[0086] Subtitle line texts are usually short sentences of a certain length, and often have semantic associations with other subtitle line texts. If the source language subtitle line text is directly translated, the accuracy of the translation result is not high, and the coherence between the target language subtitle line texts obtained by translation is not high, which is not conducive to the user's understanding of the audio and video content. Therefore, in order to ensure the accuracy and coherence of the translation result, the embodiment of the present invention first merges the acquired source language subtitle line texts before translating the source language subtitle line text to obtain the sentence to be translated, and translates the sentence to be translated to obtain the target sentence. Among them, the sentence to be translated is a complete sentence, containing complete semantics.
[0087] In an embodiment of the present invention, a translation process can be performed on a sentence to be translated based on a pre-trained translation model to obtain a target sentence. Wherein, the translation model is used to translate the sentence to be translated from one language into another language, and can be pre-trained based on a neural network, such as a convolutional neural network or a recurrent neural network. It should be noted that the pre-trained translation model can be a translation model with a fixed source language and a fixed target language, and can only be used to translate the sentence to be translated from a preset source language of the translation model into a preset target language. The multi-language real-time translation of the subtitle line of an audio and video file can be achieved by pre-training a plurality of translation models with fixed source languages and target languages. Of course, the pre-trained translation model can also be a multi-language translation model. In addition, in an embodiment of the present invention, the target language can also be determined according to the operation instruction issued by the user, and then the translation process can be performed on the sentence to be translated according to the target language selected by the user to obtain the target sentence, and the language of the target sentence is the target language selected by the user.
[0088] The generated target sentence is the translation result of multiple source language subtitle line texts. In order to facilitate the presentation of subtitle lines in the target language and facilitate the user to understand the audio and video content, in an embodiment of the present invention, the translated target sentence is further split to obtain target language subtitle line texts aligned with the source language subtitle line texts. In order to ensure the rationality of the split and obtain target language subtitle line texts that are easy to understand, a segmentation model for target sentence splitting can be pre-trained, and the target sentence can be input into the segmentation model for splitting to obtain the target language subtitle line text.
[0089] Among them, before the target sentence is split based on the pre-trained segmentation model, the segmentation model can be first constructed based on the neural network, and then a large amount of annotated corpus can be used to train the constructed segmentation model; or when the corpus is insufficient, the sequence annotation model can be iteratively trained using the subtitle corpus on the basis of the general sequence annotation model, and the model parameters can be adjusted until a sequence annotation model that meets the convergence conditions is obtained, and the sequence annotation model that meets the convergence conditions is used as the segmentation model in the embodiment of the present invention. Among them, the sequence annotation model can use the BERT (Bidirectional Encoder Representations from Transformers, a bidirectional encoder based on a multi-layer attention mechanism) model, or other neural network models that are good at sequence annotation.
[0090] In an optional embodiment of the present invention, the step 102 of merging the source language subtitle lines to obtain sentences to be translated includes:
[0091] Step S11, performing semantic analysis on the source language subtitle line text one by one to determine whether the semantics of the current source language subtitle line text is complete;
[0092] Step S12: If the semantics of the current source language subtitle line text is complete, the current source language subtitle line text is used as the sentence to be translated, and the semantics of the next source language subtitle line text is determined to be complete;
[0093] Step S13: if the semantics of the current source language subtitle line text is incomplete, the current source language subtitle line text and the context subtitle line text semantically associated with the current source language subtitle line text are merged to obtain a merged source language subtitle line text, and whether the semantics of the merged source language subtitle line text are complete is further determined;
[0094] Step S14: until the last source language subtitle line is processed, the sentence to be translated corresponding to the source language subtitle file is obtained.
[0095] In an embodiment of the present invention, the source language subtitle line text can be merged by semantic analysis. Specifically, the source language subtitle line text in the acquired source language subtitle file is semantically analyzed one by one to determine whether the semantics of the current source language subtitle line text is complete, and then determine whether to merge the current source language subtitle line text according to the determination result. If the semantics of the current source language subtitle line text is complete, there is no need to merge the current source language subtitle line, and the current source language subtitle line text can be directly used as a sentence to be translated, and continue to determine whether the semantics of the next source language subtitle line text is complete; if the semantics of the current source language subtitle line text is incomplete, it is necessary to merge the current source language subtitle line text, specifically, merge the current source language subtitle line with the next source language subtitle line text to obtain the merged source language subtitle line text, and continue to determine whether the semantics of the merged current source language subtitle line text is complete. In this way, the analysis is performed one by one until the last source language subtitle line text in the source language subtitle file is processed, and all the sentences to be translated corresponding to the source language subtitle file are obtained.
[0096] For example, suppose the acquired source language subtitle file contains six consecutive source language subtitle lines, which are:
[0097] Subtitle line A1: He only took four years
[0098] Subtitle A2: Let Gu Group successfully transform into
[0099] Subtitle row A3: Spanning publishing and advertising
[0100] Subtitle A4: New Media Group of New Media
[0101] Subtitle line A5: He also established
[0102] Subtitle row A6: Nebula Animation has won numerous awards at home and abroad
[0103] Semantic analysis is performed on subtitle lines A1 to A6 one by one. If it is determined that the semantics of subtitle line A1 is incomplete, subtitle line A1 is merged with subtitle line A2 to obtain merged subtitle line B1: "He successfully transformed Gu's Group into a company that spans publishing and advertising in just four years". Semantic analysis is continued on subtitle line B1. If it is found that the semantics of subtitle line B1 is incomplete, subtitle line B1 is merged with subtitle line A3 to obtain subtitle line B2: "He successfully transformed Gu's Group into a company that spans publishing and advertising in just four years". Semantic analysis is continued on merged subtitle line B2. If it is found that the semantics of subtitle line B2 is still incomplete, subtitle line B2 is merged with subtitle line A4 to obtain merged subtitle line B3: "He successfully transformed Gu's Group into a company that spans publishing, advertising and new media in just four years". Semantic analysis is performed on merged subtitle line B3. If it is determined that the semantics of subtitle line B3 is complete, subtitle line B3 is taken as a sentence to be translated. The semantic analysis of subtitle line A5 is continued, and it is determined that the semantics of subtitle line A5 is incomplete, so subtitle line A5 is merged with subtitle line A6 to obtain the merged subtitle line B4: "He also single-handedly established the award-winning Nebula Animation at home and abroad." The semantic analysis of the merged subtitle line B4 is continued, and it is determined that the semantics of subtitle line B4 is complete, so subtitle line B4 is used as a sentence to be translated. After the above subtitle lines A1 to A6 are merged, two semantically complete sentences to be translated are obtained.
[0104] The semantic analysis of the source language subtitle line text can be performed based on a pre-trained semantic analysis model to determine the semantic integrity of the source language subtitle line. The semantic analysis model can select a neural network model that is good at semantic analysis in the field, and then train the selected semantic analysis model based on the subtitle corpus until the convergence condition is met to obtain a trained semantic analysis model.
[0105] In an optional embodiment of the present invention, the step S13 of merging the current source language subtitle line text with the context subtitle line text semantically associated with the current source language subtitle line text to obtain the merged source language subtitle line text includes:
[0106] Sub-step S131, determining a context subtitle line text semantically associated with the current source language subtitle line text;
[0107] Sub-step S132, determining the meaning groups corresponding to each segmentation in the current source language subtitle line text and the context subtitle line text;
[0108] Sub-step S133: merging the continuous segmented words belonging to the same meaning group in the current source language subtitle line text and the context subtitle line text to obtain a sentence to be translated.
[0109] Among them, a semantic group refers to each text component divided according to semantics and text structure, and each text component is a semantic group. A semantic group can include at least one segmentation word. The segmentations in the same semantic group are closely related to each other and cannot be split arbitrarily, otherwise it is easy to cause semantic confusion and / or loss of text structure.
[0110] It should be noted that the word segmentation in the embodiment of the present invention is a collective term for words and phrases, including words (including single words and compound words) and phrases (also known as phrases), which are the smallest word group structure form units that make up sentences and articles. If the language of the text sequence is Chinese, the word segmentation can be characters, words, phrases, etc.; if the language of the text sequence is English, the word segmentation can be English words, etc.
[0111] There is a sequence between the subtitle line texts in the subtitle line file, and the continuous subtitle line texts are often semantically related. Therefore, in an embodiment of the present invention, if the semantics of the current source language subtitle line text is incomplete, the context subtitle line text semantically related to the current source language subtitle line text can be determined in the source language subtitle file. For example, for the above-mentioned subtitle lines A1 to A6, it can be determined that the subtitle lines A1 to A4 are semantically related, and the subtitle line A5 and the subtitle line A6 are semantically related. Then, according to the semantics and text structure of the source language subtitle line text, the meaning group to which each segment in the source language subtitle line text and the context subtitle line text belongs is determined, and then the continuous segmentations belonging to the same meaning group are merged to obtain the sentence to be translated. For example, for the source language subtitle line text A7, it contains segmentations M1, M2, and M3, and the context subtitle line text A8 semantically related to it contains segmentations M4 and M5. Assuming that segmentations M2 to M4 belong to the same meaning group, segmentations M2 to M4 are merged to obtain the sentence to be translated. The sentences to be translated contain complete semantics and text structure, which can ensure the accuracy and fluency of the translation results and help improve translation performance.
[0112] In an optional embodiment of the present invention, the source language subtitle file further includes the start and end time corresponding to the source language subtitle line text, and the step 102 of merging the source language subtitle line text to obtain the sentence to be translated includes:
[0113] Step S21, predicting the punctuation labels corresponding to each source language subtitle line text in sequence according to the start and end time, and obtaining a punctuation sequence corresponding to each source language subtitle line text, wherein the punctuation sequence includes the punctuation labels corresponding to each word segment in the at least two source language subtitle line texts;
[0114] Step S22: merging the source language subtitle lines based on the punctuation tags to obtain sentences to be translated.
[0115] In an embodiment of the present invention, in addition to performing semantic analysis on the source language subtitle line text and merging the source language subtitle line text based on the semantic integrity of the source language subtitle line text, punctuation prediction can also be performed on the source language subtitle line text, and the source language subtitle line text can be merged based on the punctuation tags corresponding to each word in the source language subtitle line text.
[0116] It should be noted that an audio and video file often corresponds to multiple subtitle lines, each of which has a corresponding start and end time. During the playback of the audio and video text, the corresponding subtitle lines are output in sequence according to the start and end times for the user to view. Subtitle lines with consecutive start and end times often have a correlation in semantics and text structure. Therefore, punctuation prediction can be performed on the source language subtitle line text in sequence according to the start and end times to obtain the punctuation sequence corresponding to each source language subtitle line text in the source language subtitle file.
[0117] The punctuation tags may include sentence-end punctuation and non-sentence-end punctuation. The sentence-end punctuation may be ".", "?", "!", etc., and the non-sentence-end punctuation may be ",", "," "——", etc. The punctuation tags corresponding to different languages may be different.
[0118] By merging the subtitle line text based on the punctuation tags, the sentence to be translated can be obtained. Specifically, each source language subtitle line text in the source language subtitle file is merged according to the start and end time to obtain a text sequence corresponding to the source language subtitle file, and the text sequence contains each source language subtitle line text in the source language subtitle file; identify the target participle whose punctuation tag in the text sequence is the sentence end punctuation; if there are other target participles before the target participle, then merge the participles between the target participle and the previous target participle to obtain the sentence to be translated; if there are no other target participles before the target participle, then merge the participles between the target participle and the first participle of the text sequence to obtain the sentence to be translated.
[0119] Alternatively, it is also possible to judge whether the punctuation tag corresponding to the last participle of each source language subtitle line text is a sentence-end punctuation. In an optional embodiment of the present invention, the step S22 of merging the source language subtitle line text based on the punctuation tag to obtain the sentence to be translated includes:
[0120] Sub-step S221, traversing the punctuation sequence corresponding to each source language subtitle line text one by one, and determining whether the punctuation tag of the last participle of the current source language subtitle line text is a sentence-end punctuation;
[0121] Sub-step S222: if the punctuation tag of the last participle of the current source language subtitle line text is not a sentence-end punctuation, merge the current source language subtitle line text with the next source language subtitle line text to obtain a merged source language subtitle text, and continue to determine whether the punctuation tag of the last participle of the merged source language subtitle text is a sentence-end punctuation;
[0122] Sub-step S223: If the punctuation tag of the last participle of the current source language subtitle line text is a sentence-end punctuation, the merging is terminated to obtain a sentence to be translated.
[0123] In the embodiment of the present invention, the punctuation sequences corresponding to the source language subtitle lines in the acquired source language subtitle file are traversed one by one, and it is determined in turn whether the punctuation tag of the last participle of the current source language subtitle line is the sentence end punctuation.
[0124] If the punctuation tag of the last participle of the current source language subtitle line text is not the sentence-end punctuation, then merge the current source language subtitle line text with the next source language subtitle line text to obtain the merged source language subtitle line text, and continue to determine whether the punctuation tag of the last participle of the merged source language subtitle line text is the sentence-end punctuation. If the punctuation tag of the last participle of the merged source language subtitle line text is not the sentence-end punctuation, then continue to merge the merged source language subtitle line text with the subsequent source language subtitle line text; if the punctuation tag of the last participle of the merged source language subtitle line text is the sentence-end punctuation, then use the merged source language subtitle line text as the sentence to be translated, and continue to traverse other source language subtitle line texts in the source language subtitle file.
[0125] If the punctuation tag of the last participle of the current source language subtitle line text is the end-of-sentence punctuation, there is no need to merge the current source language subtitle line text. The current source language subtitle line text can be directly used as the sentence to be translated, and the punctuation tag of the last participle of the next source language subtitle line text can be determined to be the end-of-sentence punctuation.
[0126] Until the last source language subtitle line text processing in the source language subtitle file is completed, all the sentences to be translated corresponding to the source language subtitle file are obtained.
[0127] Taking the above subtitle lines A1 to A6 as an example, the punctuation tags corresponding to the text sequences of subtitle lines A1 to A6 are predicted in sequence to obtain the punctuation sequences corresponding to subtitle lines A1 to A6. Traverse the punctuation sequences corresponding to subtitle lines A1 to A6 one by one. Among them, the punctuation tag corresponding to the last word segmentation "time" in subtitle line A1 is ",", the punctuation tag corresponding to the last word segmentation "is" in subtitle line A2 is empty, the punctuation tag corresponding to the last word segmentation "advertising" in subtitle line A3 is "、", the punctuation tag corresponding to the last word segmentation "group" in subtitle line A4 is "。", the punctuation tag corresponding to the last word segmentation "le" in subtitle line A5 is empty, and the punctuation tag corresponding to the last word segmentation "animation" in subtitle line A6 is "。".
[0128] Since the punctuation tag of the last word segmentation in subtitle line A1 is a non-sentence-ending punctuation, subtitle line A1 and subtitle line A2 are merged to obtain the merged subtitle line B1: "He only took four years to successfully transform the Gu Group into". The punctuation tag of the last word segmentation in subtitle line B1 is a non-sentence-ending punctuation, and subtitle line B1 and subtitle line A3 are continuously merged to obtain subtitle line B2: "He only took four years to successfully transform the Gu Group into a new media group spanning publishing, advertising". The punctuation tag of the last word segmentation in subtitle line B2 is still a non-sentence-ending punctuation, and subtitle line B2 and subtitle line A4 are continuously merged to obtain the merged subtitle line B3: "He only took four years to successfully transform the Gu Group into a new media group spanning publishing, advertising, and new media". The punctuation tag of the last word segmentation in subtitle line B3 is a sentence-ending punctuation, so subtitle line B3 will not be merged any further and can be directly used as a sentence to be translated. Continuing to traverse, the punctuation tag of the last word segmentation in subtitle line A5 is a non-sentence-ending punctuation, so subtitle line A5 and subtitle line A6 are merged to obtain the merged subtitle line B4: "He also single-handedly established the Nebula Animation, which has won numerous awards at home and abroad". The punctuation tag of the last word segmentation in subtitle line B4 is a sentence-ending punctuation, so subtitle line B4 will not be merged any further and can be directly used as a sentence to be translated.
[0129] It should be noted that in the embodiment of the present invention, the punctuation tags corresponding to each word segmentation in the text of each source language subtitle line can be predicted through a pre-trained punctuation prediction model. The training process of the punctuation prediction model is similar to the training process of the aforementioned sentence segmentation model, and the embodiment of the present invention will not elaborate here.
[0130] In an alternative embodiment of the present invention, the step of splitting the target sentence to obtain the text of the target language subtitle line in step 104 includes:
[0131] Step S31: Determine the breakpoint identifier in the target sentence based on a pre-trained sentence segmentation model;
[0132] Step S32: according to the breakpoint identifiers, the target sentence is segmented into target language subtitle line texts aligned with the source language subtitle line texts.
[0133] In order to facilitate the presentation of subtitle line text in the target language and facilitate user understanding, in an embodiment of the present invention, the target sentence obtained by translation is further split to obtain the target language subtitle line text aligned with the source language subtitle line text. In order to ensure the rationality of the split and obtain the target language subtitle line text that is easy to understand, a segmentation model for target sentence segmentation can be pre-trained, the target sentence is input into the segmentation model to obtain the breakpoint mark of the target sentence, and then the target sentence is segmented into the target language subtitle line text corresponding to the source language subtitle line text according to the breakpoint mark.
[0134] Among them, the breakpoint mark is used to indicate the segmentation point of the target sentence, each breakpoint mark corresponds to a target language subtitle line text, and the word corresponding to the breakpoint mark can be the left boundary of the target language subtitle line text or the right boundary of the target language subtitle line text. The breakpoint mark can be pre-specified as the left boundary or the right boundary of the target language subtitle line text, so as to facilitate the determination of the target language subtitle line text to which the word corresponding to the breakpoint mark belongs when segmenting the target sentence. For example, for the sentence to be translated "He also built the internationally renowned Xinyun Animation." after translation, the target sentence obtained is "He also built the internationally renowned Xinyun Animation.", the target sentence is input into the pre-trained sentence segmentation model, and the word "built" is obtained as the segmentation point indicated by the breakpoint mark. The word corresponding to the breakpoint mark is pre-set as the right boundary of the target language subtitle line text, and two target language subtitle lines are obtained, namely: "He also built" and "the internationally renowned Xinyun Animation".
[0135] In an optional embodiment of the present invention, the step S32 of dividing the target sentence into target language subtitle line texts aligned with the source language subtitle line texts according to the breakpoint identifiers includes:
[0136] Sub-step S321, determining whether there is a second breakpoint identifier corresponding to the first breakpoint identifier in the target sentence, wherein the second breakpoint identifier is located before the first breakpoint identifier;
[0137] Sub-step S322: if the target sentence contains a second breakpoint identifier corresponding to the first breakpoint identifier, extracting each word segment between the first breakpoint identifier and the second breakpoint identifier from the target sentence, and merging the extracted words to obtain a subtitle line text in a target language;
[0138] Sub-step S323: If there is no second breakpoint identifier corresponding to the first breakpoint identifier in the target sentence, extract the participles between the first participle of the target sentence and the first breakpoint identifier from the target sentence, and merge the extracted participles to obtain the target language subtitle line text.
[0139] Taking the word segment corresponding to the breakpoint marker as the right boundary of the target language subtitle line text as an example, the target sentence contains two types of breakpoint markers: there is a corresponding second breakpoint marker, and there is no corresponding second breakpoint marker. Assuming that breakpoint marker A has a corresponding second breakpoint marker, recorded as breakpoint marker B, then extract each word segment between breakpoint marker B and breakpoint marker A from the target sentence, and then merge each extracted word segment according to the position of each word segment in the text sequence, and you can get the target language subtitle line text corresponding to breakpoint marker A. Among them, the extracted word segment includes the word segment corresponding to breakpoint marker A but does not include the word segment corresponding to breakpoint marker B, that is, each breakpoint marker corresponds to a target language subtitle line text, and the subtitle line text corresponding to breakpoint marker A only includes the word segment corresponding to breakpoint marker A.
[0140] Assuming that breakpoint marker A does not have a corresponding second breakpoint marker, there are also two situations: 1) There is only one breakpoint marker A in the target sentence, and no other breakpoint markers exist; 2) There are at least two breakpoint markers in the target sentence, but breakpoint marker A is the first breakpoint marker in the target sentence. In the case where there is only one breakpoint marker in the target sentence, the target sentence can be directly used as the target language subtitle line text; in the case where there are at least two breakpoint markers in the target sentence, each word between the starting word of the target sentence and breakpoint marker A is extracted from the target sentence, and each extracted word is merged according to the position of each word in the text sequence, so that the target language subtitle line text corresponding to breakpoint marker A can be obtained.
[0141] If the determined breakpoint identifier corresponding to the word segment is the left boundary of the target language subtitle line text, it is also determined whether there is a fourth breakpoint identifier corresponding to the third breakpoint identifier in the target sentence, and the fourth breakpoint identifier is located after the third breakpoint identifier; if there is a fourth breakpoint identifier corresponding to the third breakpoint identifier in the target sentence, each word segment between the third breakpoint identifier and the fourth breakpoint identifier is extracted from the target sentence, and each extracted word segment is merged to obtain the target language subtitle line text corresponding to the third breakpoint identifier; if there is no fourth breakpoint identifier corresponding to the third breakpoint identifier in the target sentence, each word segment between the third breakpoint identifier and the last word segment of the target sentence is extracted from the target sentence, and each extracted word segment is merged to obtain the target language subtitle line text corresponding to the third breakpoint identifier.
[0142] In the embodiment of the present invention, the breakpoint markers are used as the segmentation basis of the target sentence. Since the breakpoint markers are determined by performing segmentation analysis on the target sentence based on the segmentation detection model, the word segments indicated by the breakpoint markers correspond to the subtitle boundaries of the source language subtitle lines. Therefore, the target sentence is segmented into target language subtitle line texts based on the breakpoint markers, which can ensure that the target language subtitle line texts aligned with the source language subtitle line texts are obtained, which is conducive to generating a reasonable translated subtitle file or a bilingual subtitle file, and is convenient for users to understand the audio and video content corresponding to the subtitle line.
[0143] In an optional embodiment of the present invention, the method further includes:
[0144] Step S41, obtaining a sentence segmentation training sample set, wherein the sentence segmentation training sample set includes a source language subtitle line text, a time axis corresponding to the source language subtitle line text, and a target language subtitle line text;
[0145] Step S42: iteratively train the sentence segmentation model based on the sentence segmentation training sample set until an iteration stop condition is met to obtain a trained sentence segmentation model.
[0146] In an embodiment of the present invention, in order to improve the training efficiency of the segmentation model, the model parameters of the preset segmentation model can be adjusted based on the acquired training sample set to obtain a segmentation model that meets the requirements of the embodiment of the present invention. Among them, the preset segmentation model can use the BERT model, or other neural network models that are good at sequence labeling. In specific implementation, the various parameters of the preset segmentation model can be initialized first. In each round of training, the loss value of the segmentation model is calculated based on the output result of the source language text and the time axis and target text corresponding to the source language text in the training sample set, and the gradient of the node in the segmentation model is calculated based on the loss value, and then the model parameters of the corresponding node in the segmentation model are adjusted according to the gradient. After the parameters are adjusted, the next round of training is entered until the loss value meets the convergence condition to obtain a trained segmentation model.
[0147] Determining the breakpoint markers of the target sentence based on the trained segmentation model can better meet the needs of diversified scenarios, which is conducive to improving the efficiency of determining breakpoint markers and improving the generation effect of subtitle line text in the target language.
[0148] In summary, after obtaining the source language subtitle file, the embodiment of the present invention merges the source language subtitle line text therein to obtain a sentence to be translated, the sentence to be translated includes complete semantics, and then further translates the sentence to be translated to obtain a target sentence, and splits the target sentence to obtain a target language subtitle line text, the target language subtitle line text corresponds one to one with the source language subtitle line text. The embodiment of the present invention merges the source language subtitle line text and then translates it, so that the merged sentence to be translated contains complete semantics, which can ensure the accuracy and fluency of the translation result and is conducive to improving the translation performance; and, after translating the sentence to be translated to obtain the target sentence, the embodiment of the present invention can further split the target sentence into target language subtitle line texts that correspond one to one with the source language subtitle line text, so that when presenting the subtitle line, the output target language subtitle line text is aligned with the source language subtitle line text, which is conducive to the user's understanding of the audio and video content corresponding to the subtitle line.
[0149] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0150] Device Embodiment
[0151] Reference Figure 2 , shows a structural block diagram of an embodiment of a subtitle translation device of the present invention, the device may include:
[0152] A subtitle line acquisition module 201 is used to acquire a source language subtitle file, wherein the source language subtitle file includes at least two source language subtitle line texts;
[0153] A merging module 202 is used to merge the source language subtitle lines to obtain sentences to be translated, wherein the sentences to be translated include complete semantics;
[0154] The translation module 203 is used to translate the sentence to be translated to obtain a target sentence;
[0155] The splitting module 204 is used to split the target sentence to obtain target language subtitle line text, and the target language subtitle line text corresponds to the source language subtitle line text one by one.
[0156] Optionally, the merging module includes:
[0157] A semantic analysis submodule, used to perform semantic analysis on the source language subtitle line text one by one to determine whether the semantics of the current source language subtitle line text is complete;
[0158] A first semantic judgment submodule is used to, if the semantics of the current source language subtitle line text is complete, use the current source language subtitle line text as a sentence to be translated, and continue to judge whether the semantics of the next source language subtitle line text is complete;
[0159] The second semantic judgment submodule is used for merging the current source language subtitle line text with the context subtitle line text semantically associated with the current source language subtitle line text to obtain a merged source language subtitle line text, and further judging whether the semantics of the merged source language subtitle line text are complete if the semantics of the current source language subtitle line text are incomplete;
[0160] The text processing submodule is used to complete the text processing of the last source language subtitle line to obtain the sentence to be translated corresponding to the source language subtitle file.
[0161] Optionally, the second semantic judgment submodule includes:
[0162] An associated subtitle line determination unit, used to determine a context subtitle line text semantically associated with the current source language subtitle line text;
[0163] A meaning group determination unit, used to determine the meaning groups corresponding to each word segment in the current source language subtitle line text and the context subtitle line text;
[0164] The first merging unit is used to merge the continuous segmented words belonging to the same meaning group in the current source language subtitle line text and the context subtitle line text to obtain a sentence to be translated.
[0165] Optionally, the source language subtitle file further includes the start and end time corresponding to the source language subtitle line text, and the merging module includes:
[0166] a punctuation prediction submodule, configured to predict the punctuation labels corresponding to each source language subtitle line text in sequence according to the start and end time, and obtain a punctuation sequence corresponding to each source language subtitle line text, wherein the punctuation sequence includes the punctuation labels corresponding to each word segment in the at least two source language subtitle line texts;
[0167] The merging processing submodule is used to merge the source language subtitle line text based on the punctuation tags to obtain the sentence to be translated.
[0168] Optionally, the merging processing submodule includes:
[0169] A punctuation sequence traversal unit, used to traverse the punctuation sequence corresponding to each source language subtitle line text one by one, and determine whether the punctuation tag of the last participle of the current source language subtitle line text is a sentence-end punctuation;
[0170] The second merging unit is used to merge the current source language subtitle line text with the next source language subtitle line text to obtain a merged source language subtitle text if the punctuation tag of the last participle of the current source language subtitle line text is not a sentence-end punctuation, and continue to determine whether the punctuation tag of the last participle of the merged source language subtitle text is a sentence-end punctuation;
[0171] The third merging unit is used to terminate the merging if the punctuation tag of the last participle of the current source language subtitle line text is the sentence-end punctuation, so as to obtain the sentence to be translated.
[0172] Optionally, the splitting module includes:
[0173] A breakpoint identification determination submodule, used to determine the breakpoint identification in the target sentence based on a pre-trained sentence segmentation model;
[0174] The splitting submodule is used to split the target sentence into target language subtitle line texts aligned with the source language subtitle line texts according to the breakpoint identifiers.
[0175] Optionally, the splitting submodule includes:
[0176] a breakpoint determination unit, configured to determine whether there is a second breakpoint identifier corresponding to the first breakpoint identifier in the target sentence, wherein the second breakpoint identifier is located before the first breakpoint identifier;
[0177] A first splitting unit is configured to extract each word between the first breakpoint identifier and the second breakpoint identifier from the target sentence if a second breakpoint identifier corresponding to the first breakpoint identifier exists in the target sentence, and merge the extracted word segments to obtain a target language subtitle line text;
[0178] The second splitting unit is used to extract each participle between the first participle of the target sentence and the first breakpoint identifier from the target sentence if there is no second breakpoint identifier corresponding to the first breakpoint identifier in the target sentence, and merge the extracted participles to obtain a target language subtitle line text.
[0179] Optionally, the device further comprises:
[0180] A sample acquisition module, used to acquire a sentence segmentation training sample set, wherein the sentence segmentation training sample set includes a source language subtitle line text, a time axis corresponding to the source language subtitle line text, and a target language subtitle line text;
[0181] The model training module is used to iteratively train the sentence segmentation model based on the sentence segmentation training sample set until an iteration stop condition is met to obtain a trained sentence segmentation model.
[0182] In summary, the embodiment of the present invention merges the source language subtitle line texts before translating, and the merged sentence to be translated contains complete semantics, which can ensure the accuracy and fluency of the translation result and is beneficial to improving the translation performance; and, after the embodiment of the present invention translates the sentence to be translated to obtain the target sentence, the target sentence can be further split into target language subtitle line texts that correspond one-to-one to the source language subtitle line texts, so that when the subtitle line is presented, the output target language subtitle line text is aligned with the source language subtitle line text, which is beneficial for users to understand the audio and video content corresponding to the subtitle line.
[0183] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0184] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.
[0185] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0186] An embodiment of the present invention provides a device for subtitle translation, the device comprising a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for performing the following operations:
[0187] A11. Obtain a source language subtitle file, wherein the source language subtitle file includes at least two source language subtitle line texts;
[0188] A12, merging the source language subtitle lines to obtain sentences to be translated, wherein the sentences to be translated include complete semantics;
[0189] A13, translating the sentence to be translated to obtain a target sentence;
[0190] A14, splitting the target sentence to obtain target language subtitle line text, wherein the target language subtitle line text corresponds to the source language subtitle line text one by one.
[0191] Optionally, the merging of the source language subtitle lines to obtain sentences to be translated includes:
[0192] Performing semantic analysis on the source language subtitle line text one by one to determine whether the semantics of the current source language subtitle line text is complete;
[0193] If the semantics of the current source language subtitle line text is complete, the current source language subtitle line text is used as the sentence to be translated, and the semantics of the next source language subtitle line text is determined to be complete;
[0194] If the semantics of the current source language subtitle line text is incomplete, merging the current source language subtitle line text with a context subtitle line text semantically associated with the current source language subtitle line text to obtain a merged source language subtitle line text, and further determining whether the semantics of the merged source language subtitle line text is complete;
[0195] Until the last source language subtitle line text processing is completed, the sentence to be translated corresponding to the source language subtitle file is obtained.
[0196] Optionally, the merging of the current source language subtitle line text and the context subtitle line text semantically associated with the current source language subtitle line text to obtain a merged source language subtitle line text includes:
[0197] Determining a context subtitle line text semantically associated with the current source language subtitle line text;
[0198] Determine the meaning groups corresponding to each word segment in the current source language subtitle line text and the context subtitle line text;
[0199] The continuous segmented words belonging to the same meaning group in the current source language subtitle line text and the context subtitle line text are merged to obtain a sentence to be translated.
[0200] Optionally, the source language subtitle file further includes the start and end time corresponding to the source language subtitle line text, and the merging process of the source language subtitle line text to obtain the sentence to be translated includes:
[0201] Predicting the punctuation labels corresponding to each source language subtitle line text in sequence according to the start and end time, and obtaining a punctuation sequence corresponding to each source language subtitle line text, wherein the punctuation sequence includes the punctuation labels corresponding to each word segment in the at least two source language subtitle line texts;
[0202] The source language subtitle line texts are merged based on the punctuation tags to obtain sentences to be translated.
[0203] Optionally, the merging of the source language subtitle line texts based on the punctuation tags to obtain sentences to be translated includes:
[0204] Traversing the punctuation sequence corresponding to each source language subtitle line text one by one, and determining whether the punctuation tag of the last participle of the current source language subtitle line text is a sentence-end punctuation;
[0205] If the punctuation tag of the last participle of the current source language subtitle line text is not a sentence-end punctuation, the current source language subtitle line text is merged with the next source language subtitle line text to obtain a merged source language subtitle text, and further determine whether the punctuation tag of the last participle of the merged source language subtitle text is a sentence-end punctuation;
[0206] If the punctuation tag of the last participle of the current source language subtitle line text is the sentence-end punctuation, the merging is terminated to obtain the sentence to be translated.
[0207] Optionally, the step of splitting the target sentence to obtain target language subtitle line text includes:
[0208] Determining breakpoint identifiers in the target sentence based on a pre-trained sentence segmentation model;
[0209] According to the breakpoint identifiers, the target sentence is segmented into target language subtitle line texts aligned with the source language subtitle line texts.
[0210] Optionally, the step of dividing the target sentence into target language subtitle line texts aligned with the source language subtitle line texts according to the breakpoint identifiers includes:
[0211] Determining whether there is a second breakpoint identifier corresponding to the first breakpoint identifier in the target sentence, where the second breakpoint identifier is located before the first breakpoint identifier;
[0212] If there is a second breakpoint identifier corresponding to the first breakpoint identifier in the target sentence, extracting each word segment between the first breakpoint identifier and the second breakpoint identifier from the target sentence, and merging the extracted words to obtain a subtitle line text in a target language;
[0213] If the target sentence does not contain a second breakpoint identifier corresponding to the first breakpoint identifier, extract each participle between the first participle of the target sentence and the first breakpoint identifier from the target sentence, and merge the extracted participles to obtain a target language subtitle line text.
[0214] Optionally, the device is further configured to execute, by one or more processors, the one or more programs including instructions for performing the following operations:
[0215] Acquire a sentence segmentation training sample set, wherein the sentence segmentation training sample set includes a source language subtitle line text, a time axis corresponding to the source language subtitle line text, and a target language subtitle line text;
[0216] The sentence segmentation model is iteratively trained based on the sentence segmentation training sample set until an iteration stop condition is met to obtain a trained sentence segmentation model.
[0217] Figure 3 8 is a block diagram of a device 800 for subtitle translation according to an exemplary embodiment. For example, the device 800 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0218] Reference Figure 3 , the device 800 may include one or more of the following components: a processing component 802 , a memory 804 , a power component 806 , a multimedia component 808 , an audio component 810 , an input / output (I / O) interface 812 , a sensor component 814 , and a communication component 816 .
[0219] The processing component 802 generally controls the overall operation of the device 800, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 802 may include one or more processors 820 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 802 may include one or more modules to facilitate the interaction between the processing component 802 and other components. For example, the processing component 802 may include a multimedia module to facilitate the interaction between the multimedia component 808 and the processing component 802.
[0220] The memory 804 is configured to store various types of data to support operations on the device 800. Examples of such data include instructions for any application or method operating on the device 800, contact data, phone book data, messages, pictures, videos, etc. The memory 804 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0221] The power supply component 806 provides power to the various components of the device 800. The power supply component 806 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 800.
[0222] The multimedia component 808 includes a screen that provides an output interface between the device 800 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 808 includes a front camera and / or a rear camera. When the device 800 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0223] The audio component 810 is configured to output and / or input audio signals. For example, the audio component 810 includes a microphone (MIC), and when the device 800 is in an operating mode, such as a call mode, a recording mode, and a voice information processing mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 804 or sent via the communication component 816. In some embodiments, the audio component 810 also includes a speaker for outputting audio signals.
[0224] I / O interface 812 provides an interface between processing component 802 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: home button, volume button, start button, and lock button.
[0225] The sensor assembly 814 includes one or more sensors for providing various aspects of status assessment for the device 800. For example, the sensor assembly 814 can detect the open / closed state of the device 800, the relative positioning of components, such as the display and keypad of the device 800, the sensor assembly 814 can also detect the position change of the voice processing device 800 or a component of the device 800, the presence or absence of user contact with the device 800, the orientation or acceleration / deceleration of the device 800, and the temperature change of the device 800. The sensor assembly 814 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 814 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 814 may also include an accelerometer, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0226] The communication component 816 is configured to facilitate wired or wireless communication between the device 800 and other devices. The device 800 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 816 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 816 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency information processing (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0227] In an exemplary embodiment, the apparatus 800 may be implemented by one or more application specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to perform the above method.
[0228] In an exemplary embodiment, a non-transitory computer-readable storage medium including instructions is also provided, such as a memory 804 including instructions, and the instructions can be executed by the processor 820 of the device 800 to perform the above method. For example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0229] Figure 41 is a schematic diagram of the structure of the server in some embodiments of the present invention. The server 1900 may have relatively large differences due to different configurations or performances, and may include one or more central processing units (CPU) 1922 (for example, one or more processors) and memory 1932, and one or more storage media 1930 (for example, one or more mass storage devices) storing application programs 1942 or data 1944. Among them, the memory 1932 and the storage medium 1930 can be short-term storage or permanent storage. The program stored in the storage medium 1930 may include one or more modules (not shown in the figure), and each module may include a series of instruction operations in the server. Furthermore, the central processing unit 1922 can be configured to communicate with the storage medium 1930 and execute a series of instruction operations in the storage medium 1930 on the server 1900.
[0230] The server 1900 may also include one or more power supplies 1926, one or more wired or wireless network interfaces 1950, one or more input and output interfaces 1958, one or more keyboards 1956, and / or, one or more operating systems 1941, such as Windows ServerTM, Mac OS XTM, UnixTM, LinuxTM, FreeBSDTM, etc.
[0231] A non-transitory computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a device (server or terminal), enables the device to perform Figure 1 The subtitle translation method shown.
[0232] A non-temporary computer-readable storage medium, when the instructions in the storage medium are executed by a processor of a device (server or terminal), enables the device to execute a speech processing method, the method comprising: obtaining a source language subtitle file, the source language subtitle file comprising at least two source language subtitle line texts; merging the source language subtitle line texts to obtain a sentence to be translated, the sentence to be translated comprising complete semantics; translating the sentence to be translated to obtain a target sentence; splitting the target sentence to obtain a target language subtitle line text, the target language subtitle line text corresponding one-to-one to the source language subtitle line text.
[0233] Those skilled in the art will readily appreciate other embodiments of the invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed in this disclosure. The description and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0234] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
[0235] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
[0236] The above is a detailed introduction to a subtitle translation method, a subtitle translation device and a device for subtitle translation provided by the present invention. Specific examples are used in this article to illustrate the principle and implementation mode of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation mode and application scope. In summary, the content of this specification should not be understood as limiting the present invention.
Claims
1. A subtitle translation method, characterized in that: The method comprises: Acquire a source language subtitle file, wherein the source language subtitle file includes at least two source language subtitle line texts; Merging the source language subtitle lines to obtain sentences to be translated, wherein the sentences to be translated include complete semantics; Translating the sentence to be translated to obtain a target sentence; Splitting the target sentence to obtain target language subtitle line text, wherein the target language subtitle line text corresponds to the source language subtitle line text one by one; The step of splitting the target sentence to obtain a target language subtitle line text includes: Determining breakpoint identifiers in the target sentence based on a pre-trained sentence segmentation model; According to the breakpoint identifier, the target sentence is divided into target language subtitle line texts aligned with the source language subtitle line texts, wherein the segmentation words corresponding to the breakpoint identifiers are the left boundary or the right boundary of the target language subtitle line texts; The step of dividing the target sentence into target language subtitle line texts aligned with the source language subtitle line texts according to the breakpoint identifiers includes: In a case where the word segment corresponding to the breakpoint marker is the right boundary of the target language subtitle line text, determining whether there is a second breakpoint marker corresponding to the first breakpoint marker in the target sentence, the second breakpoint marker being located before the first breakpoint marker; If there is a second breakpoint identifier corresponding to the first breakpoint identifier in the target sentence, extracting each word segment between the first breakpoint identifier and the second breakpoint identifier from the target sentence, and merging the extracted words to obtain a subtitle line text in a target language; If the target sentence does not contain a second breakpoint identifier corresponding to the first breakpoint identifier, extract each participle between the first participle of the target sentence and the first breakpoint identifier from the target sentence, and merge the extracted participles to obtain a target language subtitle line text.
2. The method according to claim 1, characterized in that The merging process of the source language subtitle line texts to obtain the sentences to be translated includes: Performing semantic analysis on the source language subtitle line text one by one to determine whether the semantics of the current source language subtitle line text is complete; If the semantics of the current source language subtitle line text is complete, the current source language subtitle line text is used as the sentence to be translated, and the semantics of the next source language subtitle line text is determined to be complete; If the semantics of the current source language subtitle line text is incomplete, merging the current source language subtitle line text with a context subtitle line text semantically associated with the current source language subtitle line text to obtain a merged source language subtitle line text, and further determining whether the semantics of the merged source language subtitle line text is complete; Until the last source language subtitle line text processing is completed, the sentence to be translated corresponding to the source language subtitle file is obtained.
3. The method according to claim 2, characterized in that The merging of the current source language subtitle line text and the context subtitle line text semantically associated with the current source language subtitle line text to obtain the merged source language subtitle line text includes: Determining a context subtitle line text semantically associated with the current source language subtitle line text; Determine the meaning groups corresponding to each word segment in the current source language subtitle line text and the context subtitle line text; The continuous segmented words belonging to the same meaning group in the current source language subtitle line text and the context subtitle line text are merged to obtain a sentence to be translated.
4. The method according to claim 1, characterized in that: The source language subtitle file also includes the start and end time corresponding to the source language subtitle line text, and the merging process of the source language subtitle line text to obtain the sentence to be translated includes: Predicting the punctuation labels corresponding to each source language subtitle line text in sequence according to the start and end time, and obtaining a punctuation sequence corresponding to each source language subtitle line text, wherein the punctuation sequence includes the punctuation labels corresponding to each word segment in the at least two source language subtitle line texts; The source language subtitle line texts are merged based on the punctuation tags to obtain sentences to be translated.
5. The method according to claim 4, characterized in that The merging process of the source language subtitle line text based on the punctuation tags to obtain the sentence to be translated includes: Traversing the punctuation sequence corresponding to each source language subtitle line text one by one, and determining whether the punctuation tag of the last participle of the current source language subtitle line text is a sentence-end punctuation; If the punctuation tag of the last participle of the current source language subtitle line text is not a sentence-end punctuation, the current source language subtitle line text is merged with the next source language subtitle line text to obtain a merged source language subtitle text, and further determine whether the punctuation tag of the last participle of the merged source language subtitle text is a sentence-end punctuation; If the punctuation tag of the last participle of the current source language subtitle line text is the sentence-end punctuation, the merging is terminated to obtain the sentence to be translated.
6. The method according to claim 1, characterized in that The method further comprises: Acquire a sentence segmentation training sample set, wherein the sentence segmentation training sample set includes a source language subtitle line text, a time axis corresponding to the source language subtitle line text, and a target language subtitle line text; The sentence segmentation model is iteratively trained based on the sentence segmentation training sample set until an iteration stop condition is met to obtain a trained sentence segmentation model.
7. A subtitle translation device, characterized in that: The device comprises: A subtitle line acquisition module, used to acquire a source language subtitle file, wherein the source language subtitle file includes at least two source language subtitle line texts; A merging module, used for merging the source language subtitle line texts to obtain sentences to be translated, wherein the sentences to be translated include complete semantics; A translation module, used for translating the sentence to be translated to obtain a target sentence; A splitting module, used for splitting the target sentence to obtain a target language subtitle line text, wherein the target language subtitle line text corresponds to the source language subtitle line text one by one; The splitting module comprises: A breakpoint identification determination submodule, used to determine the breakpoint identification in the target sentence based on a pre-trained sentence segmentation model; A splitting submodule, configured to segment the target sentence into target language subtitle line texts aligned with the source language subtitle line texts according to the breakpoint identifiers, wherein the segmentation words corresponding to the breakpoint identifiers are the left boundary or the right boundary of the target language subtitle line texts; The splitting submodule comprises: a breakpoint determination unit, for determining, when the word segment corresponding to the breakpoint marker is the right boundary of the target language subtitle line text, whether there is a second breakpoint marker corresponding to the first breakpoint marker in the target sentence, the second breakpoint marker being located before the first breakpoint marker; A first splitting unit is configured to extract each word between the first breakpoint identifier and the second breakpoint identifier from the target sentence if a second breakpoint identifier corresponding to the first breakpoint identifier exists in the target sentence, and merge the extracted word segments to obtain a target language subtitle line text; The second splitting unit is used to extract each participle between the first participle of the target sentence and the first breakpoint identifier from the target sentence if there is no second breakpoint identifier corresponding to the first breakpoint identifier in the target sentence, and merge the extracted participles to obtain a target language subtitle line text.
8. The device according to claim 7, characterized in that The merging module comprises: A semantic analysis submodule, used to perform semantic analysis on the source language subtitle line text one by one to determine whether the semantics of the current source language subtitle line text is complete; A first semantic judgment submodule is used to, if the semantics of the current source language subtitle line text is complete, use the current source language subtitle line text as a sentence to be translated, and continue to judge whether the semantics of the next source language subtitle line text is complete; The second semantic judgment submodule is used for merging the current source language subtitle line text with the context subtitle line text semantically associated with the current source language subtitle line text to obtain a merged source language subtitle line text, and further judging whether the semantics of the merged source language subtitle line text are complete if the semantics of the current source language subtitle line text are incomplete; The text processing submodule is used to complete the text processing of the last source language subtitle line to obtain the sentence to be translated corresponding to the source language subtitle file.
9. The device according to claim 8, characterized in that The second semantic judgment submodule includes: An associated subtitle line determination unit, used to determine a context subtitle line text semantically associated with the current source language subtitle line text; A meaning group determination unit, used to determine the meaning groups corresponding to each word segment in the current source language subtitle line text and the context subtitle line text; The first merging unit is used to merge the continuous segmented words belonging to the same meaning group in the current source language subtitle line text and the context subtitle line text to obtain a sentence to be translated.
10. The device according to claim 7, characterized in that The source language subtitle file also includes the start and end time corresponding to the source language subtitle line text, and the merging module includes: a punctuation prediction submodule, configured to predict the punctuation labels corresponding to each source language subtitle line text in sequence according to the start and end time, and obtain a punctuation sequence corresponding to each source language subtitle line text, wherein the punctuation sequence includes the punctuation labels corresponding to each word segment in the at least two source language subtitle line texts; The merging processing submodule is used to merge the source language subtitle line text based on the punctuation tags to obtain the sentence to be translated.
11. The device according to claim 10, characterized in that The merging processing submodule includes: A punctuation sequence traversal unit, used to traverse the punctuation sequence corresponding to each source language subtitle line text one by one, and determine whether the punctuation tag of the last participle of the current source language subtitle line text is a sentence-end punctuation; The second merging unit is used to merge the current source language subtitle line text with the next source language subtitle line text to obtain a merged source language subtitle text if the punctuation tag of the last participle of the current source language subtitle line text is not a sentence-end punctuation, and continue to determine whether the punctuation tag of the last participle of the merged source language subtitle text is a sentence-end punctuation; The third merging unit is used to terminate the merging if the punctuation tag of the last participle of the current source language subtitle line text is the sentence-end punctuation, so as to obtain the sentence to be translated.
12. A device for subtitle translation, characterized in that: The device includes a memory and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by one or more processors. The one or more programs include instructions for executing the subtitle translation method according to any one of claims 1 to 6.
13. A machine-readable medium having instructions stored thereon, which, when executed by one or more processors, causes a device to perform the subtitle translation method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Subtitle processing method and device and storage medium
CN109614604A
Method and device for translating characters in picture, electronic equipment and storage medium
CN111368562A
Automatic sentence segmentation model establishing method and automatic sentence segmentation method
CN112464644A
Translation method and device, electronic equipment and storage medium
CN112711954A
