A subtitle line level alignment method, electronic device and storage medium
By combining deep semantic understanding and multi-level rule repair, a subtitle line-level alignment method is developed, which solves the problem of misalignment in subtitle translation, achieves high accuracy and robustness in subtitle alignment, adapts to multilingual translation scenarios, and supports subtitle alignment tasks in multiple languages.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- FUZHOU CHANGXIN INFORMATION TECH CO LTD
- Filing Date
- 2026-04-02
- Publication Date
- 2026-07-03
AI Technical Summary
Existing subtitle alignment technologies are prone to misalignment during translation, especially when splitting, merging, or adjusting sentence order. Timestamp-based methods fail, while text length- or rule-based methods have low accuracy. Methods based on statistical machine translation models are highly dependent on data and lack semantic understanding, making it difficult to handle complex alignment relationships.
A subtitle line-level alignment method is adopted, which compares the number of sentences in the source language and target language texts, performs intelligent sentence segmentation and semantic similarity matrix calculation, combines a pre-trained bilingual semantic embedding model for global and local alignment, introduces a length ratio penalty factor, uses punctuation marks and word segmentation to handle blank lines, and progressively repairs the alignment results.
It achieves highly robust and accurate subtitle alignment, capable of handling translation scenarios ranging from simple to extremely complex. Adaptive processing requires no manual intervention, and the output results are natural and meet the requirements of the subtitle file. It supports alignment tasks for multiple languages.
Smart Images

Figure CN122334192A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of film and television post-production technology, and in particular to a subtitle line alignment method, electronic device, and storage medium. Background Technology
[0002] Subtitle translation is an essential step in the cross-border dissemination of multimedia content such as films, television dramas, and online videos. The translated subtitle text needs precise line-level alignment with the original subtitle text to ensure timeline and content matching during playback. Existing main alignment technologies include: 1. Timestamp-based precise matching: This method relies on the precise start and end timestamps of each line of text embedded in the subtitle file. The system aligns the source language subtitles and target language subtitles by directly matching their timestamp information. The process can be summarized as follows: parse the source language subtitle file and extract the timestamp sequence; parse the target language subtitle file and extract the timestamp sequence; pair lines with the same or closest timestamps to form the alignment result. However, during translation, sentence splitting, merging, and word order adjustments frequently occur, causing the line count and timestamp structure of the target language subtitles to not directly correspond to the source language. In this case, timestamp-based matching will completely fail, resulting in numerous misalignments.
[0003] 2. Heuristic Matching Based on Text Length or Rules: When timestamp information is missing or unreliable, such as when only a plain text script is available, text feature-based matching methods are typically used. Common approaches include: calculating the character and word count ratios of lines in the source and target languages and performing a simple one-to-one correspondence; or using punctuation marks and line breaks as sentence boundaries for block matching based on paragraphs or sentences. However, this method cannot understand the semantic content of the text. When the translation is not a word-for-word translation but involves interpretation, additions, deletions, or cultural adaptation, relying solely on surface features such as length and punctuation cannot make a correct judgment, resulting in low alignment accuracy. It also struggles to handle complex, non-one-to-one alignment relationships.
[0004] 3. Lexical Alignment Based on Statistical Machine Translation Models: This method borrows word alignment techniques from statistical machine translation. It requires pre-training a translation alignment model on a bilingual parallel corpus. During alignment, the model analyzes the co-occurrence probabilities or latent variable relationships between source and target language lines to infer the most likely line correspondences. Its core is using lexical-level statistical features to drive sentence-level matching. However, this method is highly data-dependent, requiring large-scale, high-quality bilingual parallel corpora for model training. For languages with scarce resources or specific professional domains, obtaining sufficient data is difficult. Its semantic understanding is lacking, primarily relying on surface-level lexical co-occurrence statistics, with limited ability to capture deep semantic similarity, and susceptible to interference from synonyms and antonyms. It also suffers from insufficient flexibility; due to the typically fixed model structure, it is difficult to integrate specific post-processing logic for subtitle alignment tasks. Summary of the Invention
[0005] To help improve the problems of low accuracy and over-reliance on existing data in current subtitle alignment, this application provides a subtitle line-level alignment method, electronic device, and storage medium.
[0006] Firstly, this application provides a subtitle line-level alignment method for use in multilingual translation subtitle alignment, employing the following technical solution: Obtain the source language text and the translated target language text, and compare the number of sentences in the two texts; If they are inconsistent, the target language text is intelligently segmented according to its language habits, and then the number of sentences after intelligent segmentation is verified to be consistent with the number of sentences in the source language text. If there is a discrepancy, a pre-trained large-scale bilingual semantic embedding model is used to convert each sentence of the source language text and the target language text into a high-dimensional semantic vector; the semantic similarity matrix between all sentence pairs is calculated, and an initial alignment path with the highest semantic similarity that allows deletion, insertion, and matching operations is found globally; a local window is defined centered on the initial alignment path, within which the algorithm allows other alignment types; a length ratio penalty factor is introduced to balance semantic similarity and sentence length reasonableness; after alignment is completed, it is checked whether there are blank lines on the target language side that have not matched any content. If blank lines exist, locate the text line that caused the blank line and its adjacent area, and segment the sentence of the preceding target language text according to the common punctuation marks of that language to organize sentence fragments and eliminate the blank lines.
[0007] By adopting the above technical solution and employing a "coarse-to-fine, progressive" processing strategy, an alignment result with no blank lines and reasonable semantic matching can be output.
[0008] Secondly, this application provides an electronic device that adopts the following technical solution: An electronic device comprising: At least one processor; Memory; At least one application, wherein the at least one application is stored in memory and configured to be executed by at least one processor, the at least one application being configured to: execute the caption line alignment method as described above.
[0009] Thirdly, this application provides a computer-readable storage medium, which adopts the following technical solution: A computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, causes the computer to perform any of the subtitle line alignment methods provided in the first aspect.
[0010] In summary, this application includes at least one of the following beneficial technical effects: High robustness and high accuracy: This method combines deep semantic understanding and multi-level rule repair, which can effectively handle various translation alignment scenarios from simple to extremely complex, and has strong adaptability to fluctuations in translation quality. Adaptive processing: This method automatically diagnoses alignment quality through "blank line detection" and intelligently selects the granularity of subsequent processing without manual intervention or preset complex parameters; Reliable output: This method ensures, through a guarantee mechanism, that the final output has no blank lines and that each line of content is relatively natural, meeting the actual usage requirements of subtitle files; Cross-language universality: This method can flexibly support subtitle alignment tasks in multiple languages through language-adaptive word segmentation and punctuation processing modules. Attached Figure Description
[0011] Figure 1 This is a flowchart illustrating a subtitle line-level alignment method provided in an embodiment of this application; Figure 2 This is a schematic diagram of a module of an electronic device provided in an embodiment of this application. Detailed Implementation
[0012] To make the purpose, technical solution, and advantages of this application clearer, the following description is provided in conjunction with the appendix. Figure 1 , 2 The present application will be further described in detail below with reference to embodiments. It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the application.
[0013] This application provides a subtitle line-level alignment method for use in a video bilingual translation subtitle alignment system.
[0014] This embodiment uses Chinese and English bilingual subtitles as an application example to specifically illustrate the above method. In actual implementation, the above method can also be used for subtitles in other languages, and this embodiment does not limit this application.
[0015] Specific reference Figure 1 A subtitle line-level alignment method for use in multilingual translation subtitle alignment, the method includes: Receive plain text subtitles in the source and target languages, and perform data cleaning and structuring; the structuring includes: segmenting the text into dialogue units according to the speaker; S10: Obtain the source language text and the translated target language text, and compare the number of sentences in the two texts; S20: If they are inconsistent, perform intelligent sentence segmentation based on the language habits of the target language text, and then verify whether the number of sentences after intelligent segmentation is consistent with the number of sentences in the source language text; among them, intelligent sentence segmentation based on language habits is performed through semantic segmentation model or based on punctuation and tone rules. S30: If there is no consistency, a pre-trained large-scale bilingual semantic embedding model is used to convert each sentence of the source language text and the target language text into a high-dimensional semantic vector; the semantic similarity matrix between all sentence pairs is calculated, and an initial alignment path with the highest semantic similarity that allows deletion, insertion, and matching operations is found globally; a local window is defined with the initial alignment path as the center, and other alignment types are allowed within the window; a length ratio penalty factor is introduced to balance semantic similarity and sentence length rationality, and to capture complex correspondences in translation; after alignment is completed, it is checked whether there are blank lines on the target language side that have not been matched with any content. S40: If blank lines exist, locate the text line that generated the blank line and its adjacent area, and segment the sentence of the preceding target language text according to the common punctuation marks of that language to organize sentence segments and eliminate blank lines. S50: If eliminating blank lines fails, the target language text sentence preceding the blank line is segmented into words using language adaptation, and the resulting word sequence and the corresponding source language text sentence are returned to step S30 for processing.
[0016] S60: If blank lines still exist, collect all target language words in the continuous region containing the blank lines, and then evenly distribute them to the target language positions corresponding to each line in the region to forcibly eliminate the blank lines.
[0017] S70: Check if there is insufficient content in the last line due to splitting; if so, move some words from the end of the previous line to the next line to make the content distribution between lines more even. Finally, the alignment results are formatted and output.
[0018] Based on this embodiment, further, before step S10, the method includes the following steps: analyzing the features of the text segment using a lightweight prediction model to predict its alignment difficulty; when the prediction difficulty is low, only steps S10 and S20 are executed; when the prediction difficulty is high, steps S30 and S40 are executed. Specifically, when analyzing the text, the lightweight prediction model analyzes the length difference ratio between the source language text and the target language text, the number of special symbols, and language equivalence to predict its alignment difficulty.
[0019] Understandably, this method dynamically skips certain intermediate processing layers based on the predicted difficulty level. For example, if the prediction is "easy," only the first and second layers might be used; if the prediction is "complex," it directly proceeds to the third, fifth, and sixth layers. The subsequent blank line detection mechanism is still retained, but serves as a secondary check within each layer. This approach introduces a pre-emptive intelligent prediction mechanism, allocating computational resources before the process begins, avoiding the need to perform full seven-layer processing on all text, thus potentially improving overall efficiency.
[0020] Furthermore, in actual deployment, parameters need to be adjusted according to the characteristics of the language pair. For example, in Chinese-English bilingual programming, emphasis should be placed on word segmentation accuracy, while in English-German bilingual programming, attention should be paid to the decomposition of compound words. For low-resource languages, semi-supervised methods combined with back-translation can be used to enhance the data.
[0021] The technical solution of this invention achieves intelligent alignment of multilingual subtitles through a "progressive multi-granularity" alignment process, which starts with checking the number of sentences, and then proceeds through intelligent sentence segmentation, sentence-level semantic alignment, punctuation assistance, lexical-level semantic alignment, equal segmentation, and word fine-tuning.
[0022] This technical solution utilizes a "two-stage dynamic programming alignment algorithm based on cross-linguistic semantic embedding" for sentence-level and lexical-level alignment, particularly its specific design of defining the scope of global coarse alignment, allowing complex types for local fine alignment, and incorporating a length penalty factor. Its core driver for anomaly detection and granularity switching mechanism is the use of empty lines in the target language. Specifically, it leverages the explicit indicator of empty lines to trigger the system to automatically switch from the current processing granularity to the next finer granularity, thereby achieving adaptive anomaly repair.
[0023] Another embodiment of the present invention provides an alignment method comprising: First, the data is input into the preprocessing module, which is responsible for receiving the plain text of the subtitles in the source language and the target language, and performing basic cleaning and structuring, such as segmenting them into dialogue units according to the speaker.
[0024] Text preprocessing is achieved through the following techniques: Word segmentation: Use language-specific tools (spaCy for English, Jieba or Jieba for Chinese). Cleaning: Remove stop words, punctuation, and numbers; unify capitalization. Standardization: English uses stemming extraction, while Chinese uses character standardization; Output: Clean word segmentation sequence.
[0025] The subsequent alignment steps are as follows: First layer: Sentence count consistency check. For each dialogue unit, directly compare the number of sentences in the source language with the number of sentences in the target language. If they are equal, it is considered aligned and output directly; if they are not equal, it is judged as an abnormal case that needs to be processed, and proceeds to the second layer.
[0026] For example: We have the following Chinese subtitles and their English translations that need to be aligned: original: Chapter 1 [1] Xiang Ling: (Episode 1) Call me over now (Xiang Ling) (Xiang Ling) made me marry without saying a word. Xiang Sheng: Do you know the Sun family? Xiang Ling: Sun Family The Sun family in the east of the city Xiang Sheng: (Xiang Sheng) Besides this one Where in this city is the Sun family still located? Xiang Ling: I heard you say this when I was little Our Xiang family used to They were servants of the Sun family. The English translation is: Chapter 1 Willow: (Episode 1) You call me all the way over here... (Willow)(Willow) just to tell me to get married? Brandon: Do you know of the Bradley family? Willow: The Bradley family? The Bradleys from the east side of town? Brandon: (Brandon) Besides them, is there any other Bradley family in this city? Willow: I remember you telling me when I was a kid that the Francisfamily used to be servants for the Bradley family.” At this point, the original Chinese text has 11 sentences, and the English translation has 6 sentences. The number of sentences in the two paragraphs is not equal, so we proceed to the second step.
[0027] The second layer: Intelligent sentence segmentation and immediate verification. This layer uses a semantic segmentation model or rules based on punctuation and tone to intelligently segment the target language text into sentences that conform to its linguistic conventions, aiming to match the number of sentences in the source language. The number of sentences is verified immediately after segmentation; if a match is found, it is output; otherwise, the process proceeds to the third layer. This step is understandably designed to address the sentence merging or splitting issues caused by translation.
[0028] This function intelligently segments the original target language text into sentences, for example: "Willow:(Episode 1)You call me all the way over here... (Willow)(Willow) just to tell me to get married?" It becomes: Willow: (Episode 1) You call me all the way over here... (Willow) (Willow) just to tellme to get married?” If the number of sentences after clause segmentation is the same, return directly; otherwise, proceed to the next level.
[0029] The third layer: Sentence-level alignment based on cross-lingual semantic embedding, which is the core algorithm layer. First, using a pre-trained large-scale bilingual semantic embedding model (in this embodiment, the laBSE model is used), each sentence in the source and target languages is converted into a high-dimensional semantic vector. Then, a two-stage dynamic programming alignment algorithm is executed. The first stage is global coarse alignment, which calculates the semantic similarity matrix between all sentence pairs and searches for an optimal initial alignment path globally that allows three basic operations: "1-0" (deletion), "0-1" (insertion), and "1-1" (matching). This stage quickly determines the approximate correspondences. "Optimal" here refers to maximizing word similarity and phrase similarity.
[0030] The second stage is local fine-tuning alignment, which defines a local window centered on the alignment path from the first stage. Within this window, the algorithm allows for more complex alignment types, such as "1-2" (one sentence matches two sentences), "2-1" (two sentences match one sentence), and "2-2" (two sentences match two sentences). A length ratio penalty factor is also introduced to strike a balance between semantic similarity and reasonable sentence length, thereby accurately capturing complex correspondences in translation. It is understandable that in actual operation, similarity has a probability; the larger or smaller the ratio difference, the lower the probability. This embodiment only uses the combination with the highest similarity probability, and only employs a few preset combinations that achieve the best similarity.
[0031] After alignment, check if there are blank lines on the target language side. It should be noted that blank lines at this point represent lines that have not been matched with any content. If there are no blank lines, output the result; if blank lines exist, locate the source language line that caused the blank line and its adjacent regions, and proceed to the fourth level.
[0032] Taking the above content as an example, sentence semantic alignment is performed here.
[0033] Source language: Xiang Ling: (Episode 1) Call me over now (Xiang Ling) (Xiang Ling) made me marry without saying a word. Target language: Willow: (Episode 1) You call me all the way over here... (Willow) (Willow) just to tell me to get married? ” At this point, dynamic programming will be used to match sentence semantic similarity, such as 1-1, 1-2, 2-1, and NN matching.
[0034] This is: "Xiang Ling: (Episode 1) Call me over now (Xiang Ling)" and "Willow: (Episode 1) and You call me all the way over here..." matched successfully; "(Xiang Ling) made me marry without saying a word" and "(Willow) (Willow) just to tell me to get married?" The match was successful.
[0035] However, in reality, blank lines may appear after matching, so this solution introduces subsequent steps to continue processing.
[0036] The following technical means were used in the implementation of this technical solution: Cross-lingual embedding representations – using pre-trained cross-lingual models (such as LaBSE, XLM-R) Generate text cell vectors: Word level: `embedding = model.get_word_embedding(token)` Sentence level: `embedding = model.encode(sentence)` Output: English vector set $E = \{e_1...e_m}$, Chinese vector set $C = \{c_1...c_n}$* Semantic space mapping: Optimize embedding space consistency: Use an orthogonal mapping matrix (MUSE method) to map English vectors to the Chinese space.
[0037] It can also use adversarial training (VecMap) to improve the performance of low-resource languages.
[0038] Similarity calculation: Construct a cosine similarity matrix, perform nearest neighbor search, build a Chinese vector index, and retrieve the top three results for each English item.
[0039] Fourth layer: Punctuation-based auxiliary alignment. For the blank line regions generated in the third layer, the preceding target language sentence is segmented according to common punctuation marks of that language, such as commas in English and pauses in Japanese. The sentence fragments are then attempted to be reorganized to eliminate the blank lines. If successful, the result is output; otherwise, proceed to the fifth layer.
[0040] Taking the above content as an example, when a blank line is detected in the target language, an attempt is made to use punctuation to assist in segmentation of the sentence preceding the blank line. for example original: "Xiang Sheng: (Xiang Sheng) Besides this..." Where in this city is the Sun family still located? Translation: 'Brandon:(Brandon) Besides them, is there any other Bradley family in this city?' '' " At this point, a blank line is detected, and the solution adds a line to the blank line: "Brandon: (Brandon) Besides them, is there any other Bradley family in this city?" This question is then segmented into... Brandon: (Brandon) Besides them, is there any other Bradley family in this city?" Then, dynamic programming similarity matching is performed with the original text. Xiang Sheng: (Xiang Sheng) Besides this --> Brandon: (Brandon) + Besides them, Where else in this city is the Bradley family? Layer 5: Lexical-level semantic alignment based on word segmentation. The target language sentence preceding the blank line is segmented using language-adaptive methods, such as segmenting English by spaces, Chinese by characters, and Japanese using a morphological analyzer. The resulting word sequence is then compared with the corresponding source language sentence or fragment using a two-stage dynamic programming algorithm based on semantic vectors from Layer 3 for fine-grained alignment at the word level. This ensures words are appropriately distributed across different lines. Finally, the blank lines are checked for elimination.
[0041] Another possible scenario is that the previous sentence cannot be split by punctuation marks.
[0042] In this case, our solution will prioritize lexical-level semantic alignment based on word segmentation, that is: "Xiang Ling: I heard you mention this when I was little" and "Willow:I remember you telling me when I was a kid that the Francisfamily used to" matches; "They were servants of the Sun family" and "be servants for the Bradley family." matches.
[0043] Sixth layer: Equal division with a safety net strategy. If blank lines still exist after the fifth layer, a safety net strategy is adopted. All target language words in the continuous region containing blank lines are collected and then evenly distributed to the target language positions corresponding to each line in that region, ensuring that each line has content, thereby forcibly eliminating blank lines.
[0044] If blank lines still exist after lexical-level semantic alignment, then proceed to the sixth step: the equal segmentation as a safety net strategy. Divide the sentence before the blank line in the translation into equal parts: "Willow:I remember you telling me when I was a kid that the Francisfamily used to" is split into two lines: "Willow:I remember you telling me when I was a kid that the Francis family used to” The alignment optimization described above was achieved using the following techniques: bidirectional filtering; pre-screening similarity thresholds, for example, deleting items when the maximum value is less than 0.7; Context consistency check, sentence-level alignment: if abs(len(en_sent) - len(cn_sent))>max_length_diff: adjust_similarity *= 0.8 # Length difference penalty.
[0045] Level 7: Word-level fine-tuning. As a final polish, check for unnatural situations such as insufficient content at the end of the line due to equal splitting. If necessary, move a small number of words from the end of the previous line, such as a single word, to the next line to make the content distribution between lines more balanced and natural.
[0046] Results output module: Formats and outputs the final alignment results.
[0047] It was implemented using the following techniques: Word alignment: Post-processing after BPE word segmentation (e.g., "playing" → "play##ing") Probabilistic calibration: Iterative optimization of alignment probabilities using Expectation Maximization (EM) Visual enhancement: Add CLIP multimodal constraints to multimedia content This scheme employs dynamic hybrid granularity alignment, anti-regularization, gradient inversion layer (GRL) to reduce language-specific features, and incremental alignment learning to achieve efficient and accurate alignment.
[0048] This solution combines deep semantic understanding with multi-level rule repair, effectively handling various translation alignment scenarios ranging from simple to extremely complex. It exhibits strong adaptability to fluctuations in translation quality, demonstrating high robustness and accuracy. The system automatically diagnoses alignment quality through "blank line detection" and intelligently selects the granularity of subsequent processing, requiring no manual intervention or preset complex parameters. Through the safeguards in steps S60 and S70, the final output is ensured to be free of blank lines, with each line displaying relatively natural content, meeting the actual requirements for subtitle files. Furthermore, the language-adaptive word segmentation and punctuation processing modules flexibly support subtitle alignment tasks in multiple languages.
[0049] In another embodiment of this scheme, multiple aligners of different granularities can be launched simultaneously for parallel processing, such as sentence-level, phrase-level, and vocabulary-level aligners. Each aligner independently outputs an alignment result and a confidence score. An "arbitration module" is added, which comprehensively compares the results of each granularity aligner: prioritizing results with higher confidence; when results conflict, a decision can be made according to preset rules or a lightweight neural network, such as "sentence-level results take precedence over vocabulary-level results, unless the vocabulary-level confidence is extremely high," ultimately outputting a unified alignment result. This approach changes "serial progressive processing" to "parallel arbitration," reducing serial latency caused by upper-level processing failures and improving processing speed.
[0050] This application also provides an electronic device, such as... Figure 2 As shown, Figure 2 The illustrated electronic device 700 includes a processor 701 and a memory 703. The processor 701 and the memory 703 are connected, for example, via a bus 702. Optionally, the electronic device 700 may also include a transceiver 704. It should be noted that in practical applications, the transceiver 704 is not limited to one type, and the structure of this electronic device 700 does not constitute a limitation on the embodiments of this application.
[0051] Processor 701 may be a CPU (Central Processing Unit), a general-purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), or other programmable logic devices, transistor logic devices, hardware components, or any other combination thereof. It can implement or execute the various exemplary logic blocks, modules, and circuits described in conjunction with the disclosure of this application. Processor 701 may also be a combination that implements computing functions, such as including one or more microprocessor combinations, a combination of a DSP and a microprocessor, etc.
[0052] Bus 702 may include a pathway for transmitting information between the aforementioned components. Bus 702 may be a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus, etc. Bus 702 can be divided into address bus, data bus, etc. For ease of representation, Figure 2 The bus is represented by a single thick line, but this does not mean that there is only one bus or one type of bus.
[0053] The memory 703 may be ROM (Read Only Memory) or other types of static storage devices capable of storing static information and instructions, RAM (Random Access Memory) or other types of dynamic storage devices capable of storing information and instructions, or EEPROM (Electrically Erasable Programmable Read Only Memory), magnetic disk storage media or other magnetic storage devices, or any other medium capable of carrying or storing desired program code in the form of instructions or data structures and accessible by a computer, but not limited thereto.
[0054] The memory 703 is used to store application code that executes the solution of this application, and its execution is controlled by the processor 701. The processor 701 is used to execute the application code stored in the memory 703 to implement the content shown in the foregoing method embodiments.
[0055] Electronic devices include, but are not limited to: mobile terminals such as mobile phones, laptops, PDAs (personal digital assistants), and PADs (tablet computers), as well as fixed terminals such as digital TVs and desktop computers. Servers can also be included. Figure 2 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.
[0056] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed in a computer, causes the computer to execute a subtitle line alignment method provided in the above embodiments.
[0057] It should be understood that although the steps in the flowcharts in the accompanying drawings are shown sequentially as indicated by the arrows, these steps are not necessarily performed in the order indicated by the arrows. Unless otherwise expressly stated herein, there is no strict order in which these steps are performed, and they may be performed in other orders.
[0058] The above are only some embodiments of this application. It should be noted that for those skilled in the art, several improvements and modifications can be made without departing from the principle of this application, and these improvements and modifications should also be considered within the scope of protection of this application.
Claims
1. A method for subtitle line level alignment, the method comprising: For multilingual translation subtitle alignment, the method includes: S10: Obtain the source language text and the translated target language text, and compare the number of sentences in the two texts; S20: If they are inconsistent, perform intelligent sentence segmentation of the target language text according to its language habits, and then verify whether the number of sentences after intelligent segmentation is consistent with the number of sentences in the source language text. S30: If there is a discrepancy, a pre-trained large-scale bilingual semantic embedding model is used to convert each sentence of the source language text and the target language text into a high-dimensional semantic vector. Calculate the semantic similarity matrix between all sentence pairs, and find an initial alignment path with the best semantic similarity that allows deletion, insertion, and matching operations globally; A local window is defined centered on the initial alignment path. Within the window, the algorithm allows other alignment types. A length ratio penalty factor is introduced to balance semantic similarity and sentence length rationality. After alignment is complete, check the target language side for any blank lines that do not match any content; S40: If blank lines exist, locate the text line that generated the blank line and its adjacent area, and segment the sentence of the preceding target language text according to the common punctuation marks of that language to organize sentence fragments and eliminate blank lines.
2. The subtitle line level alignment method of claim 1, wherein, Following step S40, the following is also included: S50: If the removal of blank lines fails, the target language text sentence before the blank line is segmented into words using language adaptation, and the resulting word sequence and the corresponding source language text sentence are returned to step S30 for processing.
3. The subtitle line level alignment method of claim 2, wherein, The process after step S50 also includes: S60: If blank lines still exist, collect all target language words in the continuous region containing the blank lines, and then evenly distribute them to the target language positions corresponding to each line in the region to forcibly eliminate the blank lines.
4. The subtitle line level alignment method of claim 3, wherein, The process after step S60 also includes: S70: Check if there is a situation where the content of the last line is too short due to the split; if so, move some words from the end of the previous line to the next line to make the content distribution between lines more even.
5. The subtitle line level alignment method of claim 1, wherein, Before step S10, the method further includes the following steps: analyzing the features of the text segment using a lightweight prediction model to predict its alignment difficulty; when the prediction difficulty is low, only steps S10 and S20 are executed; when the prediction difficulty is high, steps S30 and S40 are executed.
6. The subtitle line level alignment method of claim 5, wherein, When analyzing text, the lightweight prediction model analyzes the length difference ratio, the number of special symbols, and / or language equivalence between the source and target language texts to predict the alignment difficulty.
7. The subtitle line alignment method according to claim 1, characterized in that, In step S20, intelligent sentence segmentation based on language habits is performed using a semantic segmentation model or based on punctuation and tone rules.
8. The subtitle line alignment method according to claim 1, characterized in that, Before step S10, the method further includes: receiving plain text subtitles in the source language and target language, and performing data cleaning and structuring; the structuring includes: segmenting the text into dialogue units according to the speaker; After step S40, the method further includes: formatting and outputting the alignment results.
9. An electronic device, characterized in that, The electronic device includes: At least one processor; Memory; At least one application, wherein the at least one application is stored in memory and configured to be executed by at least one processor, said at least one application being configured to: perform the subtitle line alignment method according to any one of claims 1 to 7.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed in a computer, it causes the computer to perform the subtitle line alignment method according to any one of claims 1 to 7.