Text translation method and electronic device
Patent Information
- Application Number
- CN202611316318.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-27
- Publication Date
- 2026-10-20
AI Technical Summary
但是,在上游模块生成最终的完整文本语句之前,上游模块传输的流式文本会不断更新并递增,基于此,翻译系统不同时刻获得的流式文本的内容会不断变化并逐步递增,导致不同时刻翻译出的译文差别较大,甚至可能出现译文错误,从而导致输出的译文会出现频繁抖动或者大幅变化等情况,影响到用户对译文的阅读
Smart Images

Figure FT_1 
Figure FT_2 
Figure FT_3
Abstract
Description
Technical Field
[0001] This application relates to the field of natural language processing technology, and more particularly to a text translation method and electronic device. Background Technology
[0002] Translation systems based on streaming text input require real-time translation of the streaming text generated by upstream modules. These upstream modules can be speech recognition modules, conference transcription modules, or optical character recognition (OCR) modules, etc.
[0003] To reduce translation latency, translation systems typically translate the streaming text immediately upon receiving it and display the translated text to the user. However, before the upstream module generates the final complete text sentence, the streaming text transmitted by the upstream module is continuously updated and incremented. Consequently, the content of the streaming text received by the translation system at different times changes and gradually increases, leading to significant differences in the translated text at different times, and potentially even translation errors. This results in frequent fluctuations or large changes in the output translation, affecting the user's reading experience. Summary of the Invention
[0004] On the one hand, this application provides a text translation method, including:
[0005] Obtain text, wherein the text is transmitted via streaming.
[0006] The text is subjected to semantic integrity detection to obtain integrity detection results, which are used to characterize whether the text can express complete semantics;
[0007] In response to the integrity detection result indicating that the text can express complete semantics, the text translation process is performed;
[0008] Output the translation result of the text.
[0009] In one possible implementation, the text translation method also includes:
[0010] In response to the integrity detection result indicating that the text cannot express complete semantics, a target subtext that can express complete semantics is determined from the text, wherein the target subtext consists of at least one consecutive character including the first character of the text;
[0011] In response to the existence of the target subtext, the translation process of the target subtext is performed;
[0012] Output the translation result of the target subtext.
[0013] In another possible implementation, the integrity detection result includes: the integrity result corresponding to the characters at each position in the text, wherein the integrity result of the characters represents whether the subtext formed from the first character of the text to the characters can express complete semantics;
[0014] The step of determining the target subtext from the text that can express complete semantics includes:
[0015] Based on the integrity results corresponding to the characters at each position in the text, the target subtext that can express complete semantics in the text is determined.
[0016] In another possible implementation, determining the target subtext capable of expressing complete semantics from the text includes:
[0017] Generate at least one subtext corresponding to the text, wherein the subtext consists of at least one consecutive character including the first character of the text; the lengths of the different subtexts are different;
[0018] From the at least one subtext, determine the target subtext that can express complete semantics.
[0019] In another possible implementation, generating at least one subtext corresponding to the text includes:
[0020] Based on at least one of the syntactic relationship features between characters in the text and the interval duration between different characters, determine at least one segmentation point in the text;
[0021] Based on the at least one segmentation point, at least one subtext of the text is constructed, the subtext consisting of at least one consecutive character from the first character of the text to a segmentation point.
[0022] In yet another possible implementation, determining the target subtext from the text that can express complete semantics includes at least one of the following:
[0023] Identify the longest target subtext from the text that can express complete semantics;
[0024] From the text, determine the target subtext with a length not less than the reference length and capable of expressing complete semantics, where the reference length is the length corresponding to the historical text of the previous translation process.
[0025] In another possible implementation, the semantic integrity detection of the text includes:
[0026] The text is subjected to semantic integrity detection using a detection model, and the integrity detection result output by the detection model is obtained.
[0027] The detection model is trained based on text samples and the sample integrity results of the text sample annotations. The sample integrity results characterize whether the text sample can express complete semantics. The text sample belongs to at least a part of a complete text sentence and consists of at least one consecutive character including the first character of the complete text sentence.
[0028] In yet another possible implementation, the step of performing translation processing of the target subtext in response to the existence of the target subtext includes:
[0029] In response to the existence of the target subtext and the target subtext not belonging to the historical text that has been translated, the translation processing of the target subtext is performed;
[0030] The text translation method further includes:
[0031] The target subtext is recorded as translated historical text.
[0032] In another possible implementation, the integrity detection result includes: the integrity category corresponding to the text and the confidence level corresponding to the integrity category, wherein the integrity category belongs to one of the two categories of semantic integrity and semantic incompleteness;
[0033] The step of performing text translation processing in response to the integrity detection result indicating that the text can express complete semantics includes:
[0034] In response to the text having a semantic integrity category and a confidence level corresponding to the text's integrity category not being lower than a set threshold, the text is translated.
[0035] In another aspect, this application also provides an electronic device, including: a processor and a display module;
[0036] The processor is configured to obtain text transmitted via streaming; perform semantic integrity detection on the text to obtain an integrity detection result, the integrity detection result being used to characterize whether the text can express complete semantics; and, in response to the integrity detection result characterizing that the text can express complete semantics, perform translation processing on the text.
[0037] The display module is used to output the translation result of the text. Attached Figure Description
[0038] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0039] Figure 1 A flowchart illustrating the text translation method provided in this application;
[0040] Figure 2 Another flowchart illustrating the text translation method provided in this application;
[0041] Figure 3 Another flowchart illustrating the text translation method provided in this application;
[0042] Figure 4 This is an example diagram of one implementation framework of the solution in this application;
[0043] Figure 5 Another flowchart illustrating the text translation method provided in this application;
[0044] Figure 6 A schematic diagram of the composition structure of an electronic device provided in this application. Detailed Implementation
[0045] The solution proposed in this application is applicable to scenarios involving real-time translation of text input via streaming, such as translating text output by a streaming speech recognition module (e.g., the streaming speech recognition module continuously recognizes and converts user-input speech into text), translating real-time converted meeting text from speeches during meetings, translating streaming text continuously input via an input method, or translating text converted using Optical Character Recognition (OCR).
[0046] The solution proposed in this application can reduce the occurrence of significant changes or even errors in the translated text due to continuous changes in the text during the translation process of streaming input text. This reduces the occurrence of significant changes in the output translation, and naturally reduces the occurrence of issues such as regression, flickering, or jittering in the output translation due to large differences between adjacent output translations, which affect the user's reading experience.
[0047] The embodiments of this application are described below with reference to the accompanying drawings. The terminology used in the implementation section of this application is for explaining specific embodiments only and is not intended to limit the scope of this application.
[0048] As will be known to those skilled in the art, with the development of technology and the emergence of new scenarios, the technical solutions provided in the embodiments of this application are also applicable to similar technical problems.
[0049] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such terms are interchangeable where appropriate; this is merely a way of distinguishing objects with the same attributes in the embodiments of this application. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion, so that a process, method, system, product, or apparatus that comprises a series of elements is not necessarily limited to those elements, but may include other elements not explicitly listed or inherent to those processes, methods, products, or apparatuses.
[0050] like Figure 1 This is a flowchart illustrating a text translation method provided in this application. The method in this embodiment can be applied to electronic devices, such as mobile phones, laptops, tablets, or desktop computers, as well as intelligent translation devices or other intelligent devices, without limitation.
[0051] The method in this embodiment may include:
[0052] S101, Obtain text, which is text transmitted via streaming.
[0053] Text transmitted via streaming refers to text generated and transmitted using a streaming method.
[0054] The text can be generated by a functional module within this electronic device, or by a corresponding functional module in other electronic devices, without restriction. For example, the text can be generated by a streaming speech recognition application module in the local operating system or local application of the electronic device, or by a meeting transcription module used to transcribe meeting recordings or images into text during a meeting, or by an OCR recognition module that continuously performs text recognition on images, etc.
[0055] When the text generator uses streaming transmission, it continuously generates and outputs text over time before finally generating a complete text (such as a complete text statement). As time increases, the number of characters in the generated text (the text length increases), and some characters within the text also change. Correspondingly, before obtaining a complete text, the character length and specific characters contained in the text obtained by the electronic device at different times will also continuously change over time.
[0056] For example:
[0057] The text generated by the text generator can be divided into two categories: the final text result and the temporary text result.
[0058] The final text result refers to the complete text generated by the text generator, such as a complete text statement or a text segment consisting of at least one complete text statement. This final text result is text that the text generator has confirmed will not be changed. Typically, the generator can add a marker to the final text result to indicate that it is complete text: "Final".
[0059] Temporary text results are texts generated temporarily before the final text result is generated, which still require correction or modification. Before generating the final text result, the text generator produces one or more temporary text results in a streaming manner until the final text result is confirmed. For example, at the first moment, the temporary text result generated and output by the generator is: "If tomorrow," at the second moment, the temporary text generated and output by the generator is: "If it rains tomorrow," at the third moment, the temporary text generated and output is: "If it rains tomorrow, we will," and so on, until the final text result "If it rains tomorrow, we will change the meeting to an online meeting" is generated. It can be seen that the text generated by the generator in a streaming manner will continuously increase and may also change in content, so that the text received by the electronic device at different times will also be constantly changing.
[0060] Typically, the generator can add a flag to the temporary text result to indicate that it does not belong to the final complete text: Partial.
[0061] S102, Perform semantic integrity detection on the text and obtain the integrity detection results.
[0062] Among them, the integrity detection result is used to characterize whether the text can express complete semantics.
[0063] A text's ability to express complete semantics, or semantic integrity, means that it can form a relatively complete semantic unit in terms of syntactic structure and semantic expression. Based on this, the integrity test result can be determined by analyzing the syntactic and grammatical structures of the text.
[0064] For example, we can determine whether a text can express complete meaning based on whether it is a complete sentence, clause, or phrase, or whether it contains missing objects, missing content after conjunctions, or missing predicates. For instance, the text "I think this" lacks an object, thus failing to express complete meaning. Conversely, the text "I think this solution" does not lack an object and can express complete meaning.
[0065] Specifically, if the text is a complete text statement or a text fragment composed of at least one complete text statement, the text can express complete semantics. For example, the text "I think this solution needs further optimization" is a complete text statement and can express complete semantics. Based on this, if the text is detected to carry a marker that indicates it is complete text (such as "Final" mentioned above), it can be determined that the text can express complete semantics. If the text is an incomplete text statement or other incomplete text, further analysis using syntax or grammar is needed to determine whether the text can express complete semantics. For example, in the previous example, "I think this solution" is not a complete text statement, but it can express complete semantics.
[0066] S103, in response to the integrity detection result indicating that the text can express complete semantics, perform text translation processing.
[0067] For example, the text can be input into a text translation module to perform translation and obtain the translation result. This translation module can be a model, agent, or program capable of processing text translation, without any specific restrictions.
[0068] S104 outputs the translation result of the text.
[0069] As can be seen from the above, in this embodiment, after obtaining the text input via streaming, the semantic integrity of the text is first checked. Only when the text can express complete semantics will the translation process be performed. This can effectively improve the accuracy and reliability of each text translation, reduce the text translation errors caused by incomplete text semantics, and thus reduce the frequent rollbacks or large changes in translation results caused by the continuous changes in text during streaming text transmission. Naturally, this can reduce the impact of translation rollbacks, jitter, or flickering on user reading.
[0070] To facilitate understanding of the benefits of this embodiment, the following is a simple explanation using a Chinese-to-English translation and examples:
[0071] Suppose the following two texts are transmitted sequentially using streaming:
[0072] Text 1: "If tomorrow";
[0073] Text 2: "If it rains tomorrow";
[0074] Text 3: "If it rains tomorrow, we will move the meeting online."
[0075] Before adopting the solution in this application, each time the electronic device received text transmitted via streaming, it would directly translate the currently received text. Thus, after receiving text 1, translating text 1 would output the translation "If tomorrow"; after receiving text 2, translating text 2 would output the translation "If it rains tomorrow". It can be seen that because the output translations of text 1 and text 2 are quite different, the user sees a significant change in the output translations between the two. If the user happens to be reading "tomorrow" in the first output translation, and then the translation of text 2 is output, it will appear to the user that "tomorrow" has been replaced with other English words, causing the overall English translation to jitter. As a result, the user may need to reread the newly output translation, leading to a poor reading experience.
[0076] After adopting the solution of this application, since the semantic integrity of the text needs to be checked first after obtaining it, and since "if tomorrow" cannot express a complete meaning, after obtaining text 1, the translation of text 1 can be omitted. If a historical translation exists, the previously output translation will not be changed. After obtaining text 2, assuming that text 2 can express a complete meaning, text 2 will be translated and the translation "If it rains tomorrow" will be output. After obtaining text 3, since text 3 can also express a complete meaning, text 3 can be translated and the translation "If it rains tomorrow, we will move the meeting" will be output.
[0077] As can be seen, after adopting the solution of this application, since both text 2 and text 3 can express complete semantics, the English translation of text 2 is relatively accurate. The translation of text 3 is only based on the translation of text 2 with some added content. There is no translation rollback or jitter. On this basis, even if the translation of text 3 is output while the user is reading the translation of text 2, the user can still continue to read the translation. There is no need to reread the translation due to significant changes in the translation.
[0078] In this application, the integrity check result can take many forms, and there is no specific limitation. For ease of understanding, several possible scenarios for the integrity check result are illustrated below:
[0079] In the first possible scenario, the integrity detection result can be divided into two types: semantic integrity and semantic incompleteness. Semantic integrity indicates that the text can express complete semantics, while semantic incompleteness indicates that the text cannot express complete semantics. For example, the integrity detection result can be either 0 or 1, where 0 represents semantic incompleteness and 1 represents semantic integrity.
[0080] In the second possible scenario, the integrity detection result may include the integrity result corresponding to each character at each position in the text. The character integrity result indicates whether the subtext formed from the first character of the text to that character can express complete semantics. In this case, since the subtext corresponding to the last character in the text is the text itself, the integrity result corresponding to the last character in the text indicates that the text can express complete semantics, and therefore the text has semantic integrity; otherwise, the text does not have semantic integrity.
[0081] For example, 0 and 1 can be used to represent semantic incompleteness and semantic completeness, respectively. If a text has 10 characters, then a sequence of numbers consisting of 0 and 1 can be obtained. If the last character of the text corresponds to the number 1, then the text has semantic completeness; otherwise, the text does not have semantic completeness.
[0082] In practical applications, the integrity detection result can also be a combination of the above two situations. For example, the integrity detection result can be divided into: semantic integrity, semantic incompleteness, and semantic partial integrity. In the case of semantic partial integrity, the second possible situation can be used to mark the integrity result corresponding to the characters at each position in the text, so that it can be analyzed later to see which parts of the text have semantic integrity. This will be introduced in detail later and will not be elaborated here.
[0083] There are several possible implementation methods for determining the text integrity detection results in this application. For example, detection rules for detecting semantic integrity can be constructed based on syntax and sentence structure, and the text can be semantic integrity detected based on these rules.
[0084] In one possible implementation, to improve the efficiency and accuracy of semantic integrity detection, a detection model can be used to perform semantic integrity detection on the text, and the integrity detection results output by the detection model can be obtained.
[0085] The detection model is trained based on text samples and the sample integrity results of the text sample annotations. The sample integrity results characterize whether the text sample can express complete semantics. For example, based on supervised training, combined with the sample integrity results of the text sample annotations, the detection model is iteratively trained using at least one text sample so that the detection model can identify whether the text sample has semantic integrity.
[0086] The text sample is at least a part of the complete text statement, and the text sample consists of at least one consecutive character including the first character of the complete text statement. That is, the text sample includes at least one consecutive character starting from the first character of the complete text statement.
[0087] For example, a complete text statement can be segmented into sub-text statements of varying lengths, starting from the first character, using various segmentation methods. For instance, the first to the fifth character of the complete text statement could be one sub-text statement; the first to the tenth character could be another. Correspondingly, each sub-text statement can be treated as a text sample.
[0088] The complete text statement used to construct the text sample can be a complete text statement obtained from a real meeting through meeting transcription, a complete text statement generated by streaming speech recognition during a real call, or a complete text statement generated in other streaming text generation scenarios, without any restrictions.
[0089] The sample integrity results of text sample annotation can be manually annotated.
[0090] The sample integrity result of this text sample can also be determined by combining the translation result of the text sample with the annotation of the sample integrity result using a smart device. For example, the text sample is translated, and the matching degree between the translated text corresponding to the text sample and the translated text corresponding to the complete text sentence to which the text sample belongs is determined. This matching degree can reflect the stability of the translation obtained by translating only the text sample relative to the translated text sentence, such as whether there is at least partial repetition of the same translated content. Accordingly, if the matching degree exceeds a set threshold, the text sample is labeled as having semantic integrity; otherwise, the text sample is labeled as not having semantic integrity.
[0091] In this application, the detection model can have a variety of possibilities. Since the detection model only needs to determine whether the text has semantic integrity, it can adopt a lightweight model.
[0092] For example, in one scenario, the detection model can be a binary or multi-class classification model. This could be a text encoder using a BERT model, BERT variants (such as TinyBERT or MobileBERT), or a small multilingual encoder, combined with a classification layer. In this case, the integrity result obtained by the detection model for text integrity detection falls into one of two categories: semantic integrity or semantic incompleteness.
[0093] In another scenario, the detection model can be a lightweight sequence labeling model. This model performs integrity checks on text and outputs the integrity results for each character. These character-specific integrity results determine whether the subtext from the first character to that character accurately expresses complete semantics, i.e., whether the subtext possesses semantic integrity. For details, please refer to the introduction of the second possible scenario for integrity detection results above; further elaboration is unnecessary here.
[0094] In this application, if the integrity detection result of the text indicates that the text cannot express complete semantics, the translation process of the text may not be performed, and the translation result of the previous output may remain unchanged.
[0095] Furthermore, in order to ensure the real-time nature of the translation as much as possible and reduce translation waiting time, this application can also translate parts of the text that can express complete sentences. The following is combined with... Figure 2 Please provide an explanation, such as Figure 2 This illustration shows another flowchart of the text translation method provided in this application. The method in this embodiment may include:
[0096] S201, Obtain text, which is text transmitted via streaming.
[0097] S202, Perform semantic integrity detection on the text and obtain the integrity detection results.
[0098] The integrity check result is used to characterize whether the text can express complete semantics. The specific format of the integrity check result can be found in the previous introduction, and will not be repeated here.
[0099] S203, in response to the integrity detection result indicating that the text can express complete semantics, perform text translation processing.
[0100] S204, Output the translation result of this text.
[0101] The above steps can be found in the relevant descriptions of the previous embodiments, and will not be repeated here.
[0102] S205, in response to the integrity detection result indicating that the text cannot express complete semantics, determine the target subtext that can express complete semantics from the text.
[0103] The target subtext consists of at least one consecutive character, including the first character of the text. In other words, the target subtext includes at least one consecutive character from the text, and this at least one character includes the first character of the text.
[0104] For example, the text "If it rains tomorrow, we'll move the meeting online and then" ends with "and then," lacking follow-up content, resulting in an incomplete overall semantic meaning. However, the phrase "If it rains tomorrow, we'll move the meeting online" is a subtext that expresses complete semantics, and this subtext can be identified as the target subtext.
[0105] In this embodiment, the target subtext can be any length of subtext that can express complete semantics and includes the first character of the text, without any specific limitation.
[0106] Furthermore, in order to translate as much content as possible in the text and avoid re-translating already translated content, the determination of target subtext from the text in this embodiment may include at least one of the following two implementation methods:
[0107] In one implementation, the longest target subtext capable of expressing complete semantics can be determined from the text. In this possible implementation, selecting the longest subtext from the text that expresses complete semantics, starting from the first character, as the target subtext maximizes the translation coverage while ensuring the stability of the translated text. It also effectively reduces the possibility that the target subtext is historical text that has already been translated before the last translation process, thus reducing duplicate translations. Here, the historical text can be either historical text obtained by an electronic device or a subtext determined from obtained historical text; there are no specific limitations.
[0108] In another possible implementation, a target subtext with a length not less than a reference length and capable of expressing complete semantics can be determined from the text. This reference length is the length of the historical text from the previous translation process. For example, if the historical text from the previous translation process consists of 10 consecutive characters starting from the first character, then the target subtext determined from this text will be a subtext with a length not less than 10 characters starting from the first character and capable of expressing complete semantics. This ensures that the length of the target subtext is longer than the length of the historical text from the previous translation process, effectively avoiding the need to re-translate previously translated text and maximizing the translation coverage.
[0109] S206, In response to the existence of the target subtext in the text, perform translation processing on the target subtext.
[0110] For example, calling the translation module to translate the target subtext is a process that will not be elaborated upon here.
[0111] In one possible implementation, before performing translation processing on the target subtext, it can be further determined whether the target subtext belongs to previously translated historical text. As mentioned earlier, this historical text can be previously obtained text or a subtext determined from previously obtained text. Translation processing of the target subtext is only performed in response to the existence of a target subtext that does not belong to previously translated historical text. If the target subtext exists but belongs to previously translated historical text, its translation may be omitted to avoid duplicate translation.
[0112] Furthermore, after performing translation processing on the target subtext, this application can also record the target subtext as translated historical text to avoid repeated translation of the same content in the future.
[0113] S207, output the translation result of the target subtext.
[0114] Understandably, if there is no target subtext in the text that can express complete semantics, the translation result of the previous translation output can remain unchanged.
[0115] In this embodiment, when the overall semantic expression of the text is incomplete, by extracting the target subtext that can express the complete semantics from the text and performing translation processing, the inaccuracy caused by translating the incomplete text can be reduced, thus preventing frequent fluctuations in the output translation. At the same time, the timeliness of the translation can be improved, and the waiting time for users to wait for the text translation can be reduced.
[0116] In this embodiment, there are several possible implementations for determining the target subtext that can express complete semantics from the text. These are described below in different cases:
[0117] In one possible scenario, the integrity detection result determined in step S202 includes: the integrity result corresponding to the characters at each position in the text. The integrity result of a character indicates whether the subtext formed from the first character of the text to that character can express complete semantics. In this case, the target subtext in the text that can express complete semantics can be determined based on the integrity result corresponding to the characters at each position in the text.
[0118] Among them, the integrity result corresponding to the last character in the target subtext is semantic integrity, that is, the target subtext consisting of the first character of the text to the last character of the target subtext can express complete semantics.
[0119] For example, the integrity detection results can be divided into three cases: complete semantics, incomplete semantics, and partially complete semantics. For instance, an integrity detection result of 0 represents incomplete semantics, indicating that the text cannot express complete semantics; an integrity detection result of 1 represents complete semantics, meaning that the text can express complete semantics; and an integrity detection result of 2 represents that some content in the text can express complete semantics.
[0120] When the integrity detection result is partially complete semantics, the integrity detection result can include the integrity result corresponding to the characters at each position in the text. The integrity result corresponding to the characters can be divided into complete semantics and incomplete semantics. Complete semantics indicates that the subtext composed of the first character of the text can express complete semantics; conversely, incomplete semantics indicates that the subtext composed of the first character of the text cannot express complete semantics.
[0121] For example, a text with a length of 5 has an integrity check result of 2, and the integrity result for each character is 00100. This indicates that the text as a whole cannot express complete semantics, but the subtext consisting of the first three characters of the text can express complete semantics. Therefore, this subtext is the target subtext. For instance, the text "I think this" as a whole cannot express complete semantics, but "I think" can express complete semantics, so "I think" can be identified as the target subtext.
[0122] Of course, the integrity check result can also include only the integrity result corresponding to the characters at each position in the text, as described above, and will not be repeated here.
[0123] In one alternative approach, if there are multiple subtexts in the text that can express complete semantics, the target subtext that can express complete semantics and has the longest length can be determined, as described above; or, the target subtext that can express complete semantics and has a length not less than a reference length can be determined, where the reference length is the length of the historical text from the previous translation process.
[0124] In another possible scenario for determining the target subtext, at least one subtext corresponding to the text can be generated. Each subtext consists of at least one consecutive character, including the first character of the text, and the lengths of the different subtexts vary. Accordingly, the target subtext capable of expressing complete semantics is determined from these at least one subtext.
[0125] In this process, at least one subtext corresponding to the generated text can be obtained by segmenting the text to obtain at least one segmentation point; based on this, each character from the first character of the text to a segmentation point can constitute a subtext, thus obtaining at least one subtext.
[0126] Furthermore, in order to improve the rationality of text segmentation and reduce unnecessary segmentation that leads to an excessive number of subtexts, thereby increasing the complexity of determining the target subtext, this application can determine at least one segmentation point in the text based on at least one of the syntactic relationship features between characters in the text and the interval duration between different characters. Accordingly, at least one subtext of the text can be constructed based on at least one segmentation point, and each subtext consists of at least one consecutive character from the first character of the text to a segmentation point.
[0127] Among them, grammatical relation features can be the relationships between characters, words, or phrases in the text, as well as the grammatical relation structures they satisfy, without any specific restrictions. Based on grammatical relation features, it is possible to determine which words in the text are suitable to form a word, which words can form a clause, and which sentences have dependency relationships, etc. Therefore, based on the grammatical relation structure, it is possible to determine the points where characters in the text are suitable for segmentation.
[0128] The interval between characters refers to the time interval between the timestamps corresponding to each character in the text. The timestamp of a character represents the time when that character was recognized and generated. The interval between characters can reflect the locations of pauses in the text. Based on this, combined with grammatical relationship features and the interval between characters, it is possible to reasonably determine the positions in the text suitable as segmentation points.
[0129] In this possible scenario of determining the target subtext, if there are multiple subtexts, the target subtext with the longest length or no less than the reference length, which can express complete semantics, can also be selected.
[0130] To facilitate understanding, the following section introduces a specific implementation of a method for segmenting text based on segmentation points and determining target subtexts. For example... Figure 3 This is another flowchart illustrating the text translation method provided in this application. The method in this embodiment may include:
[0131] S301, Obtain text, which is text transmitted via streaming.
[0132] S302, Perform semantic integrity detection on the text to determine whether the text can express complete semantics. If yes, proceed to step S303; otherwise, proceed to step S304.
[0133] For semantic integrity detection of text, please refer to the relevant descriptions in the previous embodiments, and there are no limitations thereon.
[0134] In one example, a detection model can be used to perform semantic integrity detection on text, and the integrity detection result can characterize whether the text can express complete semantics.
[0135] S303, perform text translation processing and output the translation result of the text.
[0136] In one example, after the text has been translated, it can be stored as a translated historical text.
[0137] S304, Based on at least one of the grammatical relationship features between characters in the text and the interval duration between different characters, determine at least one segmentation point in the text.
[0138] S305, based on the at least one segmentation point, construct at least one subtext of the text.
[0139] A subtext consists of at least one consecutive character from the first character of the text to a split point. Different subtexts have different lengths.
[0140] For example, by combining grammatical relationship features and the duration of intervals between different characters in the text, punctuation marks such as commas or pauses can be used as segmentation points, or the positions in the text that represent pauses or silences in corresponding speech can be used as segmentation points.
[0141] S306, detect whether there is a target subtext that can express complete semantics and has the longest length. If yes, proceed to step S307; otherwise, maintain the translation result of the previous output unchanged.
[0142] One approach is to determine whether a subtext can express complete semantics by performing semantic integrity detection on it. The specific implementation of semantic integrity detection for subtext is similar to that of semantic integrity detection for text, as detailed in the preceding introduction. For example, a detection model can be used to perform integrity detection on the subtext to obtain the integrity detection result, which is used to characterize whether the subtext can express complete semantics.
[0143] For example, suppose the text is "I think this solution is generally acceptable, but it still needs some adjustments." Based on grammatical relationships, this text can be segmented into the following subtexts: "I think," "I think this solution," "I think this solution is generally acceptable," and "I think this solution is generally acceptable, but it still needs adjustments." The predicate of "I think this solution is generally acceptable, but it still needs adjustments" lacks an object or complement, therefore, this text cannot express complete semantics. "I think this solution is generally acceptable," however, expresses complete semantics and is the longest subtext that does so. This subtext can then be further processed.
[0144] There are several ways to specifically determine the target subtext from at least one subtext. For example, one could first identify at least one candidate subtext that can express complete semantics from at least one subtext, and then identify the longest target subtext among these candidate subtexts. To reduce data processing, candidate subtexts can be identified sequentially in descending order of length from the at least one subtext. Semantic integrity checks can then be performed on the currently identified candidate subtexts. If a candidate subtext has semantic integrity, it is identified as the target subtext, eliminating the need to analyze the semantic integrity of other subtexts.
[0145] Understandably, if there is no target subtext in the text that can express complete semantics, then in order to reduce the translation errors caused by blindly translating the text, resulting in translation rollback or jitter, this application can keep the previous output translation result unchanged.
[0146] It should be noted that this embodiment takes the target subtext as the longest subtext in the text that can express complete semantics as an example. The same applies to the case where the target subtext is a subtext that can express complete semantics and whose length is not less than the reference length of the historical text in the previous translation process, and will not be elaborated here.
[0147] S307, Detect whether the target subtext belongs to the historical text that has been translated and processed. If yes, keep the translation result of the previous output unchanged; if no, proceed to step S308.
[0148] By detecting whether the target subtext is historical text that has already been translated, duplicate translations can be avoided. For example, if the target subtext is historical text that was previously translated, then there is no need to translate the target subtext again, and the translation result from the previous output remains unchanged.
[0149] S308, perform translation processing on the target subtext and output the translation result of the target subtext.
[0150] In one example, after performing translation processing on the target subtext, the target subtext can be stored as historical translated text.
[0151] In this embodiment, by combining grammatical relation features and temporal features to determine the segmentation point, the semantic boundaries in the text that can serve as segmentation points can be found more accurately. This allows for a more reasonable determination of at least one candidate subtext, and further enables a more accurate identification of the target subtext that can express complete semantics and has the longest length. Naturally, this can maximize the translation coverage of the text while reducing translation waiting time.
[0152] To better understand the benefits of this embodiment, the following examples illustrate the point:
[0153] For ease of description, we will still use the example of text in Chinese that needs to be translated into English.
[0154] Suppose the following text is transmitted sequentially via streaming:
[0155] Text a: "I think";
[0156] Text b: "I think this solution..."
[0157] Text c: "I think the overall solution is fine, but...";
[0158] Text d: "I think the overall solution is fine, but the second paragraph needs to be adjusted."
[0159] After obtaining text 'a', it is detected that "I think" can express complete semantics, so the English version of "I think" can be output as "I think".
[0160] After obtaining text b, it is detected that "I think this solution" cannot express complete semantics. This application can further detect whether there is a target subtext in "I think this solution" that can fully express semantics and has the longest length. If the target subtext "I think" is detected, but since the text a has already been translated in the past, that is, this target subtext is a historical text that has been translated in the past, there is no need to translate it again, and the "I think" output by the display unit remains unchanged.
[0161] After obtaining text c, because the sentence "I think this solution is fine overall, but..." lacks specific content following the transition word, text c cannot express complete semantics. If text c is not translated, then after performing translation processing on text a, there will be a long delay before translation processing is performed, and the output translation result will not contain any new content. This will cause users to have to wait a long time for the translation result, and the real-time translation cannot be effectively guaranteed.
[0162] The solution in this embodiment further determines whether there is a subtext in text c that can express complete semantics, and selects the longest target subtext from these subtexts. It can be determined that the target subtext is "I think this plan is fine overall", and the target subtext does not belong to the historical text that has been translated and processed. Then the target subtext can be translated and output: "I think this plan is fine overall", which allows users to see the new translation results in a more timely manner and reduces translation waiting time.
[0163] Furthermore, because the target subtext can express complete semantics, the probability of errors in the translation result is relatively low. The likelihood of needing significant adjustments to the translation of that target subtext in subsequent translations is also relatively low, naturally reducing the possibility of large changes, regressions, or inconsistencies in the translation result. For example, after obtaining text d, since text d can express complete semantics, it can be translated directly, resulting in the translation: "I think this plan is fine overall, but the second section needs some further adjustment." This ensures that adjacent translations only involve adding content to the latter part, without any regression or major readjustment. Users can continue reading the latest, incrementally added translation based on the previous result, without significantly impacting their reading experience.
[0164] To further understand this embodiment and the previous ones Figure 1 Differences between the embodiments, and understanding that this embodiment is relative to Figure 1 The advantages of this implementation example are briefly illustrated below using the text "If it rains tomorrow, we'll move the meeting online and then..."
[0165] If the above is adopted Figure 1 In the example, because the word "then" in the text "If it rains tomorrow, we'll move the meeting online and then" lacks specific content, the text as a whole cannot express complete semantics. Therefore, the following approach is adopted: Figure 1 The implementation method does not translate the text, which can reduce jitter in the output translation due to unclear semantics. However, if the text is not translated this time and translation can only be performed after the next text is obtained, translation delay will occur, and the translation waiting time will be relatively increased.
[0166] By adopting the solution of this embodiment, the longest target subtext that can express complete semantics can be determined from the text "If it rains tomorrow, we will move the meeting online and then": "If it rains tomorrow, we will move the meeting online". The target subtext can be translated first, which can reduce translation waiting time and avoid abnormal situations such as jitter or regression in subsequent translations due to unclear text semantics.
[0167] It is understood that, in the above embodiments of this application, after obtaining the text, the text can be preprocessed to make it conform to the set standard format. For example, removing repeated spaces in the text, unifying the capitalization of characters in the text, filtering out noisy words in the text, etc., without any specific limitations.
[0168] To provide a more intuitive understanding of the text processing procedures in this application, the following section combines... Figure 4 A brief explanation is provided. Figure 4 This is an example block diagram illustrating the implementation of the solution in this application.
[0169] Depend on Figure 4 As can be seen, the streaming text input module can obtain text generated by streaming from local devices or other electronic devices, and input the obtained text into the text preprocessing module.
[0170] The text preprocessing module performs preprocessing on the text, such as removing noise words or unifying capitalization, and then inputs the preprocessed text into the semantic integrity detection module.
[0171] This semantic integrity detection module can perform semantic integrity checks on the text and obtain the integrity detection results. For example, this semantic integrity detection module can be the detection model mentioned earlier.
[0172] The translation decision module obtains the semantic integrity detection result. If the integrity detection result indicates that the text can express complete semantics or that there are subtexts in the text that can express complete semantics, then the translation decision module can instruct the text translation module to translate the text or the subtexts in the text.
[0173] The translated text obtained by the text translation module will be displayed and output through the translation display module.
[0174] In any of the embodiments described above, the integrity detection result may include: the integrity category corresponding to the text and the confidence level corresponding to the integrity category. The integrity category belongs to one of two categories: semantic completeness and semantic incompleteness. The confidence level is used to characterize the degree of credibility that the text belongs to the integrity category. Therefore, if the integrity category of the text is semantically complete and the confidence level corresponding to the text's integrity category is not lower than a set threshold, text translation processing is performed. This ensures that text translation is only performed when the credibility of the text in expressing complete semantics is high, further reducing translation errors caused by the text's inability to express semantics. Naturally, this further reduces anomalies such as jitter, regression, or significant changes that occur during streaming text translation processing.
[0175] In the above embodiments of this application, if the text is a complete text (such as a complete text statement), it means that the text can express complete semantics. In this case, in order to reduce the resource consumption caused by detecting semantic integrity, this application can perform semantic integrity detection on the text only if the text is not a complete text (such as a non-complete text statement) after obtaining the text.
[0176] The following is combined Figure 5 This will be explained using a specific implementation example. Figure 5 This is another flowchart illustrating the text translation method provided in this application. The method in this embodiment may include:
[0177] S501, Obtain text, which is text transmitted via streaming.
[0178] S502, check whether the text is a complete text statement. If not, proceed to step S503; if yes, proceed to step S505.
[0179] For example, if a text carries the flag "final" to indicate that it is a complete text statement, then the text is a complete text statement; if the text carries the flag "partial", then the text is a partial text statement, and the text is not the final text that the generator ultimately determines will not change.
[0180] This embodiment uses a complete text statement as an example. The same principle applies if the complete text statement is replaced with a complete text consisting of at least one complete text statement.
[0181] S503 uses a detection model to perform semantic integrity detection on text, and obtains the output integrity detection category and confidence level.
[0182] S504, determine whether the integrity detection category indicates that the text has semantic integrity and the confidence level is not lower than the set threshold. If yes, proceed to step S505; otherwise, proceed to step S506.
[0183] S505, perform the translation processing of the text and output the translation result of the text.
[0184] In one example, after the text has been translated, it can be stored as a translated historical text.
[0185] S506, based on at least one of the grammatical relationship features between characters in the text and the interval duration between different characters, the text is segmented to construct at least one subtext of the text.
[0186] For example, based on at least one of the grammatical relationship features between characters in the text and the interval duration between different characters, at least one segmentation point in the text is determined, and at least one subtext is constructed based on the at least one segmentation point, as described above, and will not be repeated here.
[0187] A subtext consists of at least one consecutive character starting from the first character of the text. Different subtexts have different lengths.
[0188] S507, determine the longest candidate subtext that has not yet been processed from the at least one subtext in descending order of length.
[0189] S508, Use the detection model to perform semantic integrity detection on the candidate subtext. Based on the integrity detection result of the output candidate subtext, determine whether the candidate subtext can express complete semantics. If not, proceed to step S509; if yes, proceed to step S510.
[0190] S509, detect whether there are still unprocessed subtexts in at least one subtext of the text. If yes, return to step S507; if no, keep the translation result of the previous output unchanged.
[0191] S510, the candidate subtext is identified as the target subtext, the translation processing of the target subtext is performed, and the translation result of the target subtext is output.
[0192] Of course, after identifying the target subtext, it is also possible to check whether the target subtext belongs to the historical text that has been translated and processed. If the target subtext belongs to the historical text that has been translated and processed, the translation result of the previous output can also be maintained unchanged. For details, please refer to the previous introduction, which will not be repeated here.
[0193] This application also provides an electronic device in its embodiments. For example... Figure 6 As shown, a schematic diagram of the composition structure of the electronic device is presented, which includes at least a processor 601 and a display module 602.
[0194] The processor 601 is used to obtain text, which is transmitted via streaming; to perform semantic integrity detection on the text, and to obtain an integrity detection result, which is used to characterize whether the text can express complete semantics; in response to the integrity detection result characterizing that the text can express complete semantics, to perform text translation processing.
[0195] The display module 602 is used to output the translation results of the text.
[0196] For details on the specific operations performed by the processor and display module, please refer to the relevant descriptions in the preceding text translation method embodiments, which will not be repeated here.
[0197] Furthermore, the electronic device may also include a memory 603 for storing programs required by the processor to perform operations.
[0198] It is understood that the electronic device may also include more or fewer components such as the input unit 604, without limitation.
[0199] This application also provides a computer program product, including computer-readable instructions, which, when executed on an electronic device, cause the electronic device to implement any of the text translation methods provided in this application.
[0200] This application also provides a computer-readable storage medium that carries one or more computer programs. When the one or more computer programs are executed by an electronic device, the electronic device can implement any of the text translation methods provided in this application.
[0201] It should also be noted that the device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. In addition, in the device embodiment drawings provided in this application, the connection relationship between modules indicates that they have a communication connection, which can be implemented as one or more communication buses or signal lines.
[0202] Through the above description of the embodiments, those skilled in the art can clearly understand that this application can be implemented by means of software plus necessary general-purpose hardware, or it can be implemented by special-purpose hardware including application-specific integrated circuits, special-purpose CPUs, special-purpose memory, special-purpose components, etc. Generally, any function performed by a computer program can be easily implemented by corresponding hardware, and the specific hardware structure used to implement the same function can also be diverse, such as analog circuits, digital circuits, or special-purpose circuits. However, for this application, software program implementation is more often the preferred implementation method. Based on this understanding, the technical solution of this application, in essence or the part that has been contributed, can be embodied in the form of a software product. This computer software product is stored in a readable storage medium, such as a computer floppy disk, USB flash drive, mobile hard disk, ROM, RAM, magnetic disk, or optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, training equipment, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0203] In the above embodiments, the implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, in the form of a computer program product.
[0204] The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of this application are generated. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions may be transmitted from one website, computer, training device, or data center to another website, computer, training device, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that a computer can store or a data storage device such as a training device or data center that integrates one or more available media. The available media may be magnetic media (e.g., floppy disks, hard disks, magnetic tapes), optical media (e.g., DVDs), or semiconductor media (e.g., solid-state drives (SSDs)).
Claims
1. A text translation method, comprising: Obtain text, wherein the text is transmitted via streaming. The text is subjected to semantic integrity detection to obtain integrity detection results, which are used to characterize whether the text can express complete semantics; In response to the integrity detection result indicating that the text can express complete semantics, the text translation process is performed; Output the translation result of the text.
2. The text translation method according to claim 1 further includes: In response to the integrity detection result indicating that the text cannot express complete semantics, a target subtext that can express complete semantics is determined from the text, wherein the target subtext consists of at least one consecutive character including the first character of the text; In response to the existence of the target subtext, the translation process of the target subtext is performed; Output the translation result of the target subtext.
3. The text translation method according to claim 2, wherein the integrity detection result includes: The integrity result corresponding to the characters at each position in the text, the integrity result of the characters represents whether the subtext formed from the first character of the text to the characters can express complete semantics; The step of determining the target subtext from the text that can express complete semantics includes: Based on the integrity results corresponding to the characters at each position in the text, the target subtext that can express complete semantics in the text is determined.
4. The text translation method according to claim 2, wherein determining a target subtext from the text that can express complete semantics includes: Generate at least one subtext corresponding to the text, wherein the subtext consists of at least one consecutive character including the first character of the text; the lengths of the different subtexts are different; From the at least one subtext, determine the target subtext that can express complete semantics.
5. The text translation method according to claim 4, wherein generating at least one subtext corresponding to the text comprises: Based on at least one of the syntactic relationship features between characters in the text and the interval duration between different characters, determine at least one segmentation point in the text; Based on the at least one segmentation point, at least one subtext of the text is constructed, the subtext consisting of at least one consecutive character from the first character of the text to a segmentation point.
6. The text translation method according to claim 2, wherein determining the target subtext capable of expressing complete semantics from the text includes at least one of the following: Identify the longest target subtext from the text that can express complete semantics; From the text, determine the target subtext with a length not less than the reference length and capable of expressing complete semantics, where the reference length is the length corresponding to the historical text of the previous translation process.
7. The text translation method according to claim 1, wherein the semantic integrity detection of the text includes: The text is subjected to semantic integrity detection using a detection model, and the integrity detection result output by the detection model is obtained. The detection model is trained based on text samples and the sample integrity results of the text sample annotations. The sample integrity results characterize whether the text sample can express complete semantics. The text sample belongs to at least a part of a complete text sentence and consists of at least one consecutive character including the first character of the complete text sentence.
8. The text translation method according to claim 2, wherein the step of performing translation processing of the target subtext in response to the existence of the target subtext includes: In response to the existence of the target subtext and the target subtext not belonging to the historical text that has been translated, the translation processing of the target subtext is performed; The text translation method further includes: The target subtext is recorded as translated historical text.
9. The text translation method according to claim 1, wherein the integrity detection result includes: The text corresponds to an integrity category and a confidence level for that integrity category, wherein the integrity category belongs to one of two categories: semantic completeness and semantic incompleteness. The step of performing text translation processing in response to the integrity detection result indicating that the text can express complete semantics includes: In response to the text having a semantic integrity category and a confidence level corresponding to the text's integrity category not being lower than a set threshold, the text is translated.
10. An electronic device, comprising: Processor and display module; The processor is configured to obtain text transmitted via streaming; perform semantic integrity detection on the text to obtain an integrity detection result, the integrity detection result being used to characterize whether the text can express complete semantics; and, in response to the integrity detection result characterizing that the text can express complete semantics, perform translation processing on the text. The display module is used to output the translation result of the text.