Document translation method, device, storage medium, and program product

CN115906875BActive Publication Date: 2026-10-30BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202110982118.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-08-25
Publication Date
2026-10-30
Estimated Expiration
2041-08-25

AI Technical Summary

Technical Problem

[0004]本公开实施例提供一种文档翻译方法、设备、存储介质及程序产品,以克服在文档翻译过程中将源文档文本格式还原到译文文档中效率低下、准确性较低、成本较高的问题

Benefits of technology

[0021]本实施例提供的文档翻译方法、设备、存储介质及程序产品,通过在终端界面的第一区域显示待翻译的源文档的多个句段,且多个句段中的至少一个句段包括与该句段的格式类型对应的第一格式标签;获取多个句段对应的译文,并将多个句段对应的译文显示于终端界面的第二区域;接收格式标签插入指令,其中格式标签插入指令中包括第二格式标签在与至少一个句段对应的译文中的目标位置,第二格式标签与至少一个句段包括的第一格式标签类型相同;根据格式标签插入指令在与至少一个句段对应的译文中的目标位置插入并显示第二格式标签;根据每一句段对应的译文以及译文中插入的第二格式标签,生成与源文档格式相对应的译文文档。在本公开实施例中,在对源文档进行翻译过程中,用户无需关注源文档文本格式到底是什么,只需关注源文档各句段中包括的格式标签的种类和位置,在译文的对应位置处插入相同的格式标签即可,后续输出译文时可根据格式标签自动化恢复文档格式,保证译文文档与源文档格式相对应,提高处理效率和准确性,降低成本。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115906875B_ABST
    Figure CN115906875B_ABST
Patent Text Reader

Abstract

Embodiments of the present disclosure provide a document translation method and device, a storage medium and a program product. The method comprises: displaying a plurality of sentence segments of a source document to be translated in a first area of a terminal interface, wherein at least one of the sentence segments comprises a first format tag corresponding to a format type of the sentence segment; obtaining a translation of each of the sentence segments and displaying the translation in a second area of the terminal interface; receiving a format tag insertion instruction, the instruction comprising a target position of a second format tag in the translation corresponding to the at least one of the sentence segments, the second format tag being of the same type as the first format tag included in the at least one of the sentence segments; inserting and displaying the second format tag at the target position; and generating a translation document corresponding to a format of the source document according to the translation of each of the sentence segments and the second format tag in the translation. In the translation process, a user only needs to focus on the types and positions of the format tags in each of the sentence segments of the source document, and insert the same format tags at corresponding positions in the translation. The format of the document is automatically recovered according to the format tags, thereby improving processing efficiency and accuracy and reducing costs.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, and in particular to a document translation method, apparatus, storage medium, and program product. Background Technology

[0002] Document translation is a text processing procedure that translates sentences from one source language into sentences in another target language. With the deepening of globalization and the rapid development of the internet, the demand for document translation is increasing daily.

[0003] Existing translation methods typically include machine translation and human translation. Since the source document to be translated is usually not plain text but contains various text formatting elements, such as bold, italics, and background colors, the target document usually needs to have the same text formatting. Current techniques for restoring the source document's text formatting to the target document typically require manual setting of each text format, which is inefficient, inaccurate, and costly. Summary of the Invention

[0004] This disclosure provides a document translation method, device, storage medium, and program product to overcome the problems of low efficiency, low accuracy, and high cost in restoring the source document text format to the translation document during the document translation process.

[0005] In a first aspect, embodiments of this disclosure provide a document translation method, including:

[0006] The first area of ​​the terminal interface displays multiple sentence segments of the source document to be translated, and at least one of the multiple sentence segments includes a first format tag corresponding to the format type of the sentence segment;

[0007] Obtain the translations corresponding to the multiple sentence segments, and display the translations corresponding to the multiple sentence segments in the second area of ​​the terminal interface;

[0008] Receive a format tag insertion instruction, wherein the format tag insertion instruction includes a target position of a second format tag in the translation corresponding to the at least one sentence segment, and the second format tag is of the same type as the first format tag included in the at least one sentence segment;

[0009] The second format tag is inserted and displayed at the target position in the translation corresponding to the at least one sentence segment according to the format tag insertion instruction;

[0010] Based on the translation of each sentence and the second format tags inserted in the translation, a translation document corresponding to the format of the source document is generated.

[0011] Secondly, embodiments of this disclosure provide a document translation device, including:

[0012] The source document processing unit is used to display multiple sentence segments of the source document to be translated in a first area of ​​the terminal interface, and at least one of the multiple sentence segments includes a first format tag corresponding to the format type of the sentence segment;

[0013] The translation processing unit is used to obtain the translations corresponding to the multiple sentence segments and display the translations corresponding to the multiple sentence segments in the second area of ​​the terminal interface;

[0014] A tag setting unit is configured to receive a format tag insertion instruction, wherein the format tag insertion instruction includes a target position of a second format tag in the translation corresponding to the at least one sentence segment, and the second format tag is of the same type as the first format tag included in the at least one sentence segment; and to insert and display the second format tag at the target position in the translation corresponding to the at least one sentence segment according to the format tag insertion instruction.

[0015] The translation output unit is used to generate a translation document corresponding to the source document format based on the translation corresponding to each sentence and the second format tags inserted in the translation.

[0016] Thirdly, embodiments of this disclosure provide an electronic device, including: a display device, an input / output device, a memory, and at least one processor;

[0017] The memory stores computer-executed instructions; the input / output device is used for interacting with instructions and / or data; the display device is used for displaying the terminal interface;

[0018] The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the document translation method as described in the first aspect and various possible designs of the first aspect.

[0019] Fourthly, embodiments of this disclosure provide a computer-readable storage medium storing computer-executable instructions, which, when executed by a processor, implement the document translation method described in the first aspect and various possible designs of the first aspect.

[0020] Fifthly, embodiments of this disclosure provide a computer program product including computer execution instructions, which, when executed by a processor, implement the document translation method described in the first aspect and various possible designs of the first aspect.

[0021] The document translation method, device, storage medium, and program product provided in this embodiment display multiple sentence segments of the source document to be translated in a first area of ​​a terminal interface, wherein at least one of the multiple sentence segments includes a first format tag corresponding to the format type of the sentence segment; obtain the translations corresponding to the multiple sentence segments and display the translations corresponding to the multiple sentence segments in a second area of ​​the terminal interface; receive a format tag insertion instruction, wherein the format tag insertion instruction includes a target position of a second format tag in the translation corresponding to at least one sentence segment, and the second format tag is of the same type as the first format tag included in at least one sentence segment; insert and display the second format tag at the target position in the translation corresponding to at least one sentence segment according to the format tag insertion instruction; and generate a translation document corresponding to the format of the source document based on the translation corresponding to each sentence segment and the second format tag inserted in the translation. In this embodiment of the disclosure, during the translation of the source document, the user does not need to pay attention to the exact text format of the source document. The user only needs to pay attention to the types and positions of the format tags included in each sentence and paragraph of the source document. The same format tags are then inserted at the corresponding positions in the translation. When the translation is output later, the document format can be automatically restored according to the format tags to ensure that the format of the translation document corresponds to that of the source document, thereby improving processing efficiency and accuracy and reducing costs. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of this disclosure or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 This is an application scenario diagram of a document translation method provided in an embodiment of the present disclosure;

[0024] Figure 2 This is a schematic flowchart of a document translation method provided in an embodiment of the present disclosure;

[0025] Figure 3 This is a schematic diagram of a terminal interface provided in an embodiment of the present disclosure;

[0026] Figure 4 This is a schematic flowchart of a document translation method provided in another embodiment of the present disclosure;

[0027] Figure 5 This is a schematic flowchart of a document translation method provided in another embodiment of the present disclosure;

[0028] Figure 6 This is a schematic flowchart of a document translation method provided in another embodiment of the present disclosure;

[0029] Figure 7 This is a schematic flowchart of a document translation method provided in another embodiment of the present disclosure;

[0030] Figure 8 A structural block diagram of a document translation device provided in an embodiment of this disclosure;

[0031] Figure 9 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation

[0032] To make the objectives, technical solutions, and advantages of the embodiments of this disclosure clearer, the technical solutions of the embodiments of this disclosure will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this disclosure, and not all embodiments. Based on the embodiments of this disclosure, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this disclosure.

[0033] Existing translation methods typically include machine translation and human translation. Since the source document to be translated is usually not plain text but contains various text formatting elements such as bold, italics, and background colors, the target document usually needs to have the same text formatting. Current techniques for restoring the source document's text formatting to the target document often require manual setting of each text format. This might involve browsing the source document from beginning to end, locating content with a specific text format in the target document, and then setting the corresponding text format. Alternatively, during the translation process, the target document's text format needs to be set based on the text format of the currently translated segment. These existing methods are inefficient, have low accuracy, and are costly.

[0034] To address the aforementioned technical problems, this disclosure provides a document translation method. The method involves displaying multiple sentence segments of a source document to be translated in a first area of ​​a terminal interface, where at least one of the sentence segments includes a first format tag corresponding to the format type of that sentence segment; acquiring the translations corresponding to the multiple sentence segments and displaying them in a second area of ​​the terminal interface; receiving a format tag insertion instruction, wherein the instruction includes a target position of a second format tag in the translation corresponding to the at least one sentence segment, and the second format tag has the same type as the first format tag included in the at least one sentence segment; inserting and displaying the second format tag in the translation corresponding to the at least one sentence segment according to the insertion instruction; and generating a translation document corresponding to the format of the source document based on the translation corresponding to each sentence segment and the second format tag inserted in the translation. This disclosure facilitates the comparison and display of sentence segments and translations by dividing the source document into sentence segments; and by inserting format tags to mark the text format in the translation, making it the same as the format of the corresponding sentence segments in the source document. Therefore, when outputting the translation, the text format of the source document can be restored to the translation document based on the format tags, improving processing efficiency and accuracy, and reducing costs.

[0035] refer to Figure 1 , Figure 1 This diagram illustrates an application scenario of the document translation method provided in this embodiment. The application scenario includes a terminal device 101 and a server 102. The terminal device includes, but is not limited to, mobile phones, tablets, laptops, desktop computers, personal digital assistants, etc. The server includes, but is not limited to, a standalone physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, and big data and artificial intelligence platforms.

[0036] Terminal device 101 displays multiple sentence segments of the source document to be translated in a first area of ​​the terminal interface, and at least one of the multiple sentence segments includes a first format tag corresponding to the format type of the sentence segment; it obtains the translation corresponding to each of the multiple sentence segments and displays the translation corresponding to each sentence segment in a second area of ​​the terminal interface; it receives a format tag insertion instruction, wherein the format tag insertion instruction includes the target position of a second format tag in the translation corresponding to the at least one sentence segment, and the second format tag is of the same type as the first format tag included in the at least one sentence segment; it inserts and displays the second format tag in the translation corresponding to the at least one sentence segment according to the format tag insertion instruction; when it is necessary to output the translation, it generates a translation document corresponding to the format of the source document based on the translation corresponding to each sentence segment and the second format tag inserted in the translation. Optionally, terminal device 101 can upload the translation with inserted format tags to server 102, and server 102 can generate a translation document and send it to 101.

[0037] In addition, the terminal device 101 can also acquire any operation behavior of the user on the sentence segment and / or translation; the operation behavior includes at least one of the following: confirming the status of the sentence segment, inputting the translation, proofreading the translation, copying the original text to the translation, clearing the translation, inserting a tag, selecting text content, searching for text content; and send the operation behavior to the server 102 so that the server 102 can monitor the operation behavior and / or perform data analysis based on the operation behavior.

[0038] The document translation method provided in this disclosure will be described in detail below with reference to specific embodiments and accompanying drawings.

[0039] refer to Figure 2 , Figure 2 This is a schematic flowchart of a document translation method provided in an embodiment of this disclosure. The method of this embodiment can be applied to a terminal device, and the document translation method includes:

[0040] S201. Display multiple sentence segments of the source document to be translated in the first area of ​​the terminal interface, and at least one of the multiple sentence segments includes a first format tag corresponding to the format type of the sentence segment.

[0041] In this embodiment, the source document to be translated can be split into multiple sentence segments. This embodiment does not limit the splitting method; for example, it can be split according to punctuation marks, or according to delimiters such as spaces, line breaks, etc. Splitting can be automatic or manual. The split sentence segments can be displayed sequentially in the first area of ​​the terminal interface. Optionally, such as... Figure 3 As shown, in the first area 21, each sentence segment is displayed vertically in the order in which it appears in the source document, in the form of a list. That is, one sentence segment is displayed in each row. Of course, other display methods may also be used, but they are not shown here.

[0042] Furthermore, since some sentences in the source document may have different formatting, including but not limited to bold, italics, underline, strikethrough, background color, font color, etc., and the source document may also include images, audio, video, etc., which also have certain formatting. To facilitate users in quickly setting the translation format, this embodiment can first process the source document, such as... Figure 4 As shown, the details are as follows:

[0043] S2011. After splitting the original content of the source document into multiple segments, identify the format type included in any segment and insert the first format tag corresponding to the format type at the corresponding position of the segment.

[0044] S2012. The plurality of sentence segments are displayed in the first area of ​​the terminal interface, and the inserted first format tags are also displayed.

[0045] In this embodiment, it can be as follows Figure 3 The image shows the inserted first format labels 23 (where... Figure 3 Each sentence segment in the source document and other symbols in the corresponding translation are also format tags. To distinguish them, the corresponding format tags in the translation are denoted as second format tags (24). In this embodiment, the identification of format types can be done in any possible way, without limitation. Different format types correspond to different first format tags, and the corresponding first format tags can be inserted according to the relevant insertion rules of the format type. In this embodiment, by identifying the format type of the source document segments and inserting the first format tags, the user no longer needs to pay attention to what the format of the segments is, but only to the position and type of the first format tags. Subsequently, the second format tags of the same type can be inserted at the corresponding positions in the translation.

[0046] Optionally, formatting tags may include double tags or single tags. Double tags consist of two tags, one for identifying the start and one for identifying the end of the formatting. For example, for bold formatting, which typically involves one or more words in bold, a formatting tag can be inserted before and after the bold text to indicate that the text between the two tags is in bold format. Single tags are used to identify independently existing formatting elements, such as images, audio, and video. Furthermore, each tag is optionally unique within each sentence or paragraph and is primarily described by information such as number, type, opening, and position.

[0047] Optionally, when identifying the format type included in any sentence segment in S2021 and inserting the first format tag corresponding to the format type at the corresponding position of the sentence segment, specifically, the format type included in any sentence segment can be identified first. If the format type is the first format type to appear in the source document, the corresponding first format tag is generated and inserted into the corresponding position of the sentence segment; if the format type is not the first format type to appear in the source document, the first format tag corresponding to the format type is searched from the format tag set and the found first format tag is inserted into the corresponding position of the sentence segment.

[0048] In this embodiment, for each source document, the first format tag can be dynamically generated. When identifying format types from beginning to end, a corresponding first format tag is generated for the first occurrence of a format type and inserted into the sentence segment. Alternatively, it can be cached in the format tag set so that when other sentences containing the same format type are subsequently identified, the corresponding first format tag can be directly looked up without regenerating it. It should be noted that the dynamic generation process in this embodiment, where the correspondence between format types and format tags applies only to the current source document, may not be applicable to other source documents. Of course, a unified correspondence between format types and first format tags can also be used, applicable to different source documents.

[0049] In this embodiment, when generating the first format tag, optionally, HTML elements can be directly drawn as format tags. However, directly drawing HTML elements in a rich text box will have the following effects on the existing text: during the input process, the translation may be filled into the tag, causing the translation and tag to be disordered; the cursor position calculation is complex, and the addition or deletion of text in the HTML-depicted tag must be considered. To solve the above problems, in another optional method, the first format tag is in the form of an image, which avoids the increased computational complexity caused by tag nesting, and the single-element tag is not affected by the style during input.

[0050] Furthermore, when generating the first format tags, a canvas can be used for drawing. The specific steps include: building an off-screen canvas before entering the editor to improve the tag drawing speed; drawing the corresponding tags according to the design draft and converting them to base64; caching the generated tag URLs so that the same tags in the next segment will not be drawn again.

[0051] S202. Obtain the translations corresponding to the multiple sentence segments and display the translations corresponding to the multiple sentence segments in the second area of ​​the terminal interface.

[0052] In this embodiment, the translation corresponding to each sentence can be obtained by machine translation or by human translation. That is, the user inputs the translation corresponding to each sentence, or the translation corresponding to each sentence can be obtained through other means. There are no restrictions here.

[0053] After obtaining the translation for each sentence segment, the translation for each sentence segment is displayed in the second area of ​​the terminal interface. Alternatively, after obtaining the translation for each sentence segment, the translations corresponding to that sentence segment are displayed sequentially in the second area of ​​the terminal interface.

[0054] Optionally, the translation can be displayed in the same way as the sentence / segment, for example, as shown below. Figure 3 As shown, in the second area 22, the translations are displayed in a list format, arranged vertically in order, with each row showing the translation corresponding to one sentence segment. Optionally, the first and second areas can be aligned, and the sentences and their corresponding translations can also be aligned, for example... Figure 3 The first area 21 and the second area 22 are horizontally aligned. Of course, other alignment methods can also be used to display them, which makes it easier for users to quickly locate sentences and corresponding translations, and facilitates the subsequent insertion of format tags and other operations on the translation, such as review and proofreading.

[0055] S203. Receive a format tag insertion instruction, wherein the format tag insertion instruction includes the target position of a second format tag in the translation corresponding to the at least one sentence segment, and the second format tag is of the same type as the first format tag included in the at least one sentence segment;

[0056] S204. Insert and display the second format tag at the target position in the translation corresponding to the at least one sentence segment according to the format tag insertion instruction.

[0057] In this embodiment, the second format tag in the translation can be inserted by the user. For any sentence in the translation, the user can view the first format tag included in the sentence and its position in the first area, and then insert a second format tag of the same type as the first format tag at the same position in the translation (denoted as the target position), thereby displaying the second format tag inserted by the user in the translation.

[0058] S205. Generate a translation document corresponding to the source document format based on the translation of each sentence and the second format tag inserted in the translation.

[0059] In this embodiment, after inserting the second format tags into the translations of all or part of the sentence segments, when the translation needs to be output, the document format can be restored according to the required output translation and the inserted second format tags. For example, if a double tag indicates bold format, the text format between the double tags will be automatically adjusted to bold format; if a single tag indicates an image, the image format will be set. The format setting command corresponding to each format tag can be pre-configured, and then the corresponding format setting command can be called when outputting the translation to restore the document format.

[0060] Optionally, the terminal device can receive instructions from the user to select which sentence segments' translations to output, and then output only the translations corresponding to the selected sentence segments. Optionally, the process of generating the translation document can be executed by the server. That is, after executing S201-S203, the user can upload the translation to the server. When a translation document needs to be generated, the user sends an instruction to the server to generate the translation document, and the server generates the translation document and sends it to the terminal device. Furthermore, optionally, when multiple users' terminal devices can operate on the same source document, the server can also configure different permissions for different users. For example, which users can insert second format tags, which users can modify and proofread, which users can output the translation document, etc., thereby restricting the operation process of each user according to permissions.

[0061] The document translation method provided in this embodiment displays multiple sentence segments of the source document to be translated in a first area of ​​the terminal interface, and at least one of the multiple sentence segments includes a first format tag corresponding to the format type of the sentence segment; obtains the translations corresponding to the multiple sentence segments and displays the translations corresponding to the multiple sentence segments in a second area of ​​the terminal interface; receives a format tag insertion instruction, wherein the format tag insertion instruction includes the target position of a second format tag in the translation corresponding to at least one sentence segment, and the second format tag is of the same type as the first format tag included in at least one sentence segment; inserts and displays the second format tag in the target position of the translation corresponding to at least one sentence segment according to the format tag insertion instruction; and generates a translation document corresponding to the format of the source document based on the translation corresponding to each sentence segment and the second format tag inserted in the translation. In this embodiment, during the translation of the source document, the user does not need to pay attention to the exact text format of the source document. Instead, the user only needs to focus on the type and position of the first format tags included in each sentence and paragraph of the source document. The user can then insert the second format tags of the same type at the corresponding positions in the translation. When outputting the translation, the document format can be automatically restored based on the second format tags, ensuring that the translated document corresponds to the format of the source document, thereby improving processing efficiency and accuracy and reducing costs.

[0062] Based on the above embodiments, such as Figure 5 As shown, before receiving the format tag insertion instruction in S203, the procedure further includes:

[0063] S301. Receive an operation instruction to move the cursor in the corresponding translation of any sentence segment, identify the cursor position according to the operation instruction, and determine the cursor position as the target position;

[0064] S302. Receive a selection instruction for a second format tag, wherein the selection instruction includes a second format tag selected from a set of format tags that is of the same type as the first format tag included in the segment.

[0065] In this embodiment, when inserting a second format tag, the user first moves the cursor to the target position where the second format tag needs to be inserted. The terminal device recognizes the cursor position and determines it as the target position. The user then selects a second format tag from the format tag set that is the same type as the first format tag in the sentence segment as the format tag to be inserted. For example, the interface can provide format tags corresponding to different format types for the user to choose from. Further, a format tag insertion instruction is received, wherein the format tag insertion instruction includes the target position of the second format tag in the translation corresponding to the at least one sentence segment. The second format tag is inserted and displayed at the target position in the translation corresponding to the at least one sentence segment according to the format tag insertion instruction. That is, after the user selects the format tag, they can confirm the insertion of the format tag. After receiving the format tag insertion instruction, the terminal device inserts the second format tag at the target position in the translation. It should be noted that the execution order of S301 and S302 is not limited in this embodiment.

[0066] Based on the above embodiments, the translated text is located in a rich text input box. Rich Text Format (RTF) is a cross-platform document format developed by Microsoft. Its biggest feature is that it's WYSIWYG; whatever the formatting is adjusted to, the same effect will be displayed directly. Furthermore, as... Figure 6 The cursor position recognition described in the above embodiments may specifically include:

[0067] S401. Find the outermost parent node of the node where the cursor is located, where the outermost parent node is the outermost rich text input box node of the node where the cursor is located;

[0068] S402. Find the sibling node before the outermost parent node to determine the first sibling node;

[0069] S403. Determine the cursor position based on the search path of the first sibling node found.

[0070] In this embodiment, the accurate insertion of format tags relies on obtaining the precise cursor position and restoring it after insertion. While browsers provide corresponding cursor APIs to help developers calculate positions, cursor position calculation becomes extremely complex when various element tags and text are combined and nested within rich text input boxes.

[0071] The cursor management API, Selection, is obtained through window.getSelection, which corresponds to the Ranges selected by the user, commonly known as "drag selection." In most cases, it only applies to a single area, and can be obtained as follows:

[0072] const selection=window.getSelection();

[0073] const range=selection.getRangeAt(0);

[0074] / **

[0075] *Fields contained in a Range object

[0076] *collapsed: Returns a boolean value indicating whether the start and end positions of the Range are the same.

[0077] *endContainer: Returns the node containing the endpoint of the Range.

[0078] *endOffset: Returns a number representing the position of the Range's endpoint within the endContainer.

[0079] *startContainer: Returns the node containing the starting point of the Range.

[0080] *startOffset: Returns a number representing the position of the starting point of the Range within the startContainer.

[0081] /

[0082] In this embodiment, the node refers to the rich text input box node. The node where the cursor is located may be nested within another node. Therefore, we can perform a node-by-node query from the node where the cursor is located backward. First, we obtain the startContainer using getRangeAt to determine the node where the cursor is located. Then, we find the outermost parent node of the node where the cursor is located, and then we search backward for the sibling nodes before the outermost parent node to determine the first sibling node. During the search process, based on the text length traversed by the search path to the first sibling node, we can determine the text length from the node where the cursor is located to the starting point of the first sibling node, and thus determine the cursor position.

[0083] Specifically, when searching for the outermost parent node of the node where the cursor is located, it can be determined whether the parent node of the node where the cursor is located is the outermost rich text input box node. If the parent node of the node where the cursor is located is the outermost rich text input box node, it means that there are no other nested nodes outside the parent node of the node where the cursor is located, and the parent node of the node where the cursor is located is determined as the outermost parent node. If not, it continues to determine whether the parent node of the parent node is the outermost rich text input box node, and repeats the above determination process until the outermost rich text input box node is found and determined as the outermost parent node.

[0084] Similarly, when searching for the sibling nodes before the outermost parent node to determine the foremost sibling node, we can search forward to determine if there is a sibling node before the outermost parent node. If there is no sibling node before the outermost parent node, then the outermost parent node is determined to be the foremost sibling node. If there is a sibling node before the outermost parent node, we continue to determine if there is a sibling node before the sibling node before the outermost parent node, and repeat the above judgment process until the foremost sibling node is found.

[0085] In the above process, this embodiment first searches for the outermost parent node, then searches for the foremost sibling node before the outermost parent node, obtaining the search path for the foremost sibling node. Based on the search path, the first text length from the cursor to the starting point of the outermost parent node can be obtained. Specifically, the text length from the cursor node to the starting point of its parent node can be determined first, then the text length from the starting point of its parent node to the starting point of its parent's parent node can be obtained, and so on, until the text length from the cursor node to the starting point of the outermost parent node is determined. Simultaneously, the text length from the cursor to the starting point of the cursor node can also be obtained. These are then summarized to obtain the first text length from the cursor to the starting point of the outermost parent node. Meanwhile, by searching for the foremost sibling node before the outermost parent node, the second text length of each preceding sibling node can be obtained. Furthermore, based on the search path for the foremost sibling node, the first and second text lengths are summarized to determine the total text length from the cursor to the starting point of the foremost sibling node, which is the distance from the cursor to the starting point of the foremost sibling node. This total text length is then used as the cursor position. Through this embodiment, the cursor position can be accurately determined in a rich text input box.

[0086] Based on any of the above embodiments, the terminal interface can also provide functions such as confirming sentence / segment status, inputting translation, proofreading translation, copying original text to translation, clearing translation, inserting tags, selecting text content, and searching text content. Specifically, the terminal interface can be configured with a built-in menu bar, including but not limited to the functions listed above. The terminal interface can also be customized with a menu bar to extend the terminal interface functionality. Extended functions can be added by the user or obtained from the server. Some of the main functions of the built-in menu bar are described below:

[0087] Confirm Segment / Batch Confirm Segment Status: Each segment has multiple statuses. Confirming a segment helps determine its current status. For example, after proofreading, if the translated content and formatting tags corresponding to the segment are confirmed to be correct, a "confirmed" status tag can be displayed. If the translated content or formatting tags corresponding to the segment are confirmed to be incorrect, an "error" status tag can be displayed. This facilitates checking the accuracy of the translation and aids in the final document restoration. Optionally, if the type of formatting tags in the segment is identified to be different from the type of formatting tags in the corresponding translation, an "error" status tag can be displayed. Figure 3 As shown in the 6th sentence segment, if a formatting tag not present in the original sentence segment appears in the translation, an error status tag will be displayed. However, if the translation content and formatting of other sentence segments are correct, a confirmation status tag will be displayed.

[0088] Copy Original Text / Batch Copy Original Text to Translation: Copy the original text to the translation area for easier user operation;

[0089] Clear Translations / Batch Clear Translations: Clears the content of the translation area, improving user translation efficiency;

[0090] Insert tags: Insert tags into the translation to facilitate the final document formatting restoration;

[0091] The terminal interface also provides operation areas for information confirmation, information interaction and display; the terminal interface can also be configured with shortcut keys; the terminal interface can also communicate with external events, such as uploading translations to the server, monitoring user operation behavior, obtaining extended functions from the server, etc.

[0092] Among them, such as Figure 7 As shown, the specific user behavior monitored is as follows:

[0093] S501. Obtain any user operation on the sentence segment and / or translation; the operation includes at least one of the following: confirming the sentence segment status, inputting the translation, proofreading the translation, copying the original text to the translation, clearing the translation, inserting a tag, selecting text content, and searching for text content;

[0094] S502. The operation behavior is sent to the server so that the server can monitor the operation behavior and / or perform data analysis based on the operation behavior.

[0095] In this embodiment, the terminal can monitor the user's above-mentioned operation behavior and send the operation behavior to the server. The server can monitor whether the user has abnormal operation, prevent the user from leaking documents, and ensure data security through the operation behavior. The server can also perform data analysis on the user's operation behavior, such as analyzing which functions the user frequently uses, and which functions need to be optimized or expanded.

[0096] Corresponding to the document translation method in the above embodiments, Figure 8 This is a structural block diagram of a document translation device provided in an embodiment of this disclosure. For ease of explanation, only the parts relevant to the embodiments of this disclosure are shown. (Refer to...) Figure 8 The document translation device 600 includes: a source document processing unit 601, a translation processing unit 602, a tag setting unit 603, and a translation output unit 604.

[0097] The source document processing unit 601 is used to display multiple sentence segments of the source document to be translated in a first area of ​​the terminal interface, and at least one of the multiple sentence segments includes a first format tag corresponding to the format type of the sentence segment.

[0098] The translation processing unit 602 is used to obtain the translations corresponding to the plurality of sentence segments and display the translations corresponding to the plurality of sentence segments in the second area of ​​the terminal interface;

[0099] The tag setting unit 603 is configured to receive a format tag insertion instruction, wherein the format tag insertion instruction includes a target position of a second format tag in the translation corresponding to the at least one sentence segment, and the second format tag is of the same type as the first format tag included in the at least one sentence segment; and to insert and display the second format tag at the target position in the translation corresponding to the at least one sentence segment according to the format tag insertion instruction.

[0100] The translation output unit 604 is used to generate a translation document corresponding to the source document format based on the translation corresponding to each sentence and the second format tags inserted in the translation.

[0101] In one embodiment of this disclosure, when the source document processing unit 601 displays multiple segments of the source document to be translated in a first area of ​​the terminal interface, it is used to:

[0102] The original content of the source document is split into multiple sentence segments;

[0103] Identify the format type included in any sentence segment and insert the first format tag corresponding to the format type at the corresponding position in the sentence segment;

[0104] The multiple sentence segments are displayed in the first area of ​​the terminal interface, along with the inserted first format tags.

[0105] In one embodiment of this disclosure, when the source document processing unit 601 identifies the format type included in any sentence segment and inserts a first format tag corresponding to the format type at the corresponding position of the sentence segment, it is used to:

[0106] Identify the format types included in any sentence or paragraph;

[0107] If the format type is the first format type to appear in the source document, then a corresponding first format tag is generated and inserted into the corresponding position of the sentence segment; or

[0108] If the format type is not the first format type to appear in the source document, then the first format tag corresponding to the format type is searched from the format tag set, and the found first format tag is inserted into the corresponding position of the sentence segment.

[0109] In one embodiment of this disclosure, before receiving a format tag insertion instruction, the tag setting unit 603 is further configured to:

[0110] Receive an operation instruction to move the cursor in the corresponding translation of any sentence segment, identify the cursor position according to the operation instruction, and determine the cursor position as the target position;

[0111] A selection instruction for a second format tag is received, the selection instruction including a second format tag selected from a set of format tags that is of the same type as the first format tag included in the segment. In one embodiment of this disclosure, the first format tag and the second format tag include a dual tag or a single tag;

[0112] The dual label includes two labels, which are used to identify the start and end positions of the format, respectively;

[0113] The single label is used to identify a format that exists independently.

[0114] In one embodiment of this disclosure, the translation is located in a rich text input box; the label setting unit 603, when recognizing the cursor position, is used to:

[0115] Find the outermost parent node of the node where the cursor is located, where the outermost parent node is the outermost rich text input box node of the node where the cursor is located;

[0116] Find the sibling node preceding the outermost parent node to determine the foremost sibling node;

[0117] The cursor position is determined based on the search path of the first sibling node found.

[0118] In one embodiment of this disclosure, the label setting unit 603, when searching for the outermost parent node of the node where the cursor is located, is used to:

[0119] Determine if the parent node of the node where the cursor is located is the outermost rich text input box node;

[0120] If so, then the parent node of the node where the cursor is located is determined as the outermost parent node; or

[0121] If not, continue to determine whether the parent node of the parent node is the outermost rich text input box node, and repeat the above determination process until the outermost parent node is found; and / or

[0122] When the label setting unit 603 searches for sibling nodes before the outermost parent node and determines the foremost sibling node, it is used for:

[0123] Determine whether there are sibling nodes before the outermost parent node;

[0124] If not, then the outermost parent node is determined to be the foremost sibling node; or

[0125] If so, continue to determine whether there is a sibling node before the sibling node before the outermost parent node, and repeat the above determination process until the first sibling node is found.

[0126] In one embodiment of this disclosure, when the label setting unit 603 determines the cursor position based on the search path of the first sibling node found, it is used to:

[0127] Get the first text length from the cursor to the starting point of the outermost parent node;

[0128] Get the second text length of each sibling node preceding the outermost parent node;

[0129] Based on the search path of the first sibling node found, the lengths of the first and second texts are summed to determine the total text length from the cursor to the starting point of the first sibling node, and the total text length is determined as the cursor position.

[0130] In one embodiment of this disclosure, the document translation device further includes a monitoring unit for:

[0131] Acquire any user action on a sentence segment and / or translation; the action includes at least one of the following: confirming the sentence segment status, inputting the translation, proofreading the translation, copying the original text to the translation, clearing the translation, inserting a tag, selecting text content, and searching for text content;

[0132] The operation is sent to the server so that the server can monitor the operation and / or perform data analysis based on the operation.

[0133] The document translation device provided in this embodiment can be used to execute the technical solutions of the above method embodiments. Its implementation principle and technical effects are similar, and will not be described again here.

[0134] refer to Figure 9 The diagram illustrates a structural schematic of an electronic device 900 suitable for implementing embodiments of the present disclosure. The electronic device 900 can be a terminal device or a server. The terminal device can include, but is not limited to, mobile terminals such as mobile phones, laptops, digital radio receivers, personal digital assistants (PDAs), portable Android devices (PADs), portable media players (PMPs), and in-vehicle terminals (e.g., in-vehicle navigation terminals), as well as fixed terminals such as digital TVs and desktop computers. Figure 9 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.

[0135] like Figure 9As shown, the electronic device 900 may include a processing unit (e.g., a central processing unit, a graphics processing unit, etc.) 901, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 902 or a program loaded from a storage device 908 into a random access memory (RAM) 903. The RAM 903 also stores various programs and data required for the operation of the electronic device 900. The processing unit 901, ROM 902, and RAM 903 are interconnected via a bus 904. An input / output (I / O) interface 905 is also connected to the bus 904.

[0136] Typically, the following devices can be connected to I / O interface 905: input devices 906 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 907 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 908 including, for example, magnetic tapes, hard disks, etc.; and communication devices 909. Communication device 909 allows electronic device 900 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 9 An electronic device 900 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.

[0137] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 909, or installed from a storage device 908, or installed from a ROM 902. When the computer program is executed by a processing device 901, it performs the functions defined in the methods of embodiments of this disclosure.

[0138] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.

[0139] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.

[0140] The aforementioned computer-readable medium carries one or more programs, which, when executed by the electronic device, cause the electronic device to perform the methods shown in the above embodiments.

[0141] Computer program code for performing the operations of this disclosure can be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, and C++, and conventional procedural programming languages ​​such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a Local Area Network (LAN) or a Wide Area Network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0142] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0143] The units described in the embodiments of this disclosure can be implemented in software or in hardware. The name of a unit does not necessarily limit the unit itself; for example, the first acquisition unit can also be described as "a unit that acquires at least two Internet Protocol addresses".

[0144] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.

[0145] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0146] In a first aspect, according to one or more embodiments of this disclosure, a document translation method is provided, comprising:

[0147] The first area of ​​the terminal interface displays multiple sentence segments of the source document to be translated, and at least one of the multiple sentence segments includes a first format tag corresponding to the format type of the sentence segment;

[0148] Obtain the translations corresponding to the multiple sentence segments, and display the translations corresponding to the multiple sentence segments in the second area of ​​the terminal interface;

[0149] Receive a format tag insertion instruction, wherein the format tag insertion instruction includes a target position of a second format tag in the translation corresponding to the at least one sentence segment, and the second format tag is of the same type as the first format tag included in the at least one sentence segment;

[0150] The second format tag is inserted and displayed at the target position in the translation corresponding to the at least one sentence segment according to the format tag insertion instruction;

[0151] Based on the translation of each sentence and the second format tags inserted in the translation, a translation document corresponding to the format of the source document is generated.

[0152] According to one or more embodiments of this disclosure, displaying multiple segments of the source document to be translated in a first area of ​​the terminal interface includes:

[0153] The original content of the source document is split into multiple sentence segments;

[0154] Identify the format type included in any sentence segment and insert the first format tag corresponding to the format type at the corresponding position in the sentence segment;

[0155] The multiple sentence segments are displayed in the first area of ​​the terminal interface, along with the inserted first format tags.

[0156] According to one or more embodiments of this disclosure, the step of identifying the format type included in any sentence segment and inserting a first format tag corresponding to the format type at the corresponding position of the sentence segment includes:

[0157] Identify the format types included in any sentence or paragraph;

[0158] If the format type is the first format type to appear in the source document, then a corresponding first format tag is generated and inserted into the corresponding position of the sentence segment; or

[0159] If the format type is not the first format type to appear in the source document, then the first format tag corresponding to the format type is searched from the format tag set, and the found first format tag is inserted into the corresponding position of the sentence segment.

[0160] According to one or more embodiments of this disclosure, receiving the format tag insertion instruction includes:

[0161] Receive an operation instruction to move the cursor in the corresponding translation of any sentence segment, identify the cursor position according to the operation instruction, and determine the cursor position as the target position;

[0162] Receive a selection instruction for a second format tag, the selection instruction including a second format tag selected from a set of format tags that is of the same type as the first format tag included in the segment;

[0163] Receive a format tag insertion instruction, and insert the second format tag at the target position of the translation according to the format tag insertion instruction.

[0164] According to one or more embodiments of this disclosure, the first format label and the second format label include dual labels or single labels;

[0165] The dual label includes two labels, which are used to identify the start and end positions of the format, respectively;

[0166] The single label is used to identify a format that exists independently.

[0167] According to one or more embodiments of this disclosure, the translated text is located in a rich text input box; the identification of the cursor position includes:

[0168] Find the outermost parent node of the node where the cursor is located, where the outermost parent node is the outermost rich text input box node of the node where the cursor is located;

[0169] Find the sibling node preceding the outermost parent node to determine the foremost sibling node;

[0170] The cursor position is determined based on the search path of the first sibling node found.

[0171] According to one or more embodiments of this disclosure, finding the outermost parent node of the node where the cursor is located includes:

[0172] Determine if the parent node of the node where the cursor is located is the outermost rich text input box node;

[0173] If so, then the parent node of the node where the cursor is located is determined as the outermost parent node; or

[0174] If not, continue to determine whether the parent node of the parent node is the outermost rich text input box node, and repeat the above determination process until the outermost parent node is found; and / or

[0175] The process of finding the sibling node preceding the outermost parent node to determine the foremost sibling node includes:

[0176] Determine whether there are sibling nodes before the outermost parent node;

[0177] If not, then the outermost parent node is determined to be the foremost sibling node; or

[0178] If so, continue to determine whether there is a sibling node before the sibling node before the outermost parent node, and repeat the above determination process until the first sibling node is found.

[0179] According to one or more embodiments of this disclosure, determining the cursor position based on the search path of the first sibling node found includes:

[0180] Get the first text length from the cursor to the starting point of the outermost parent node;

[0181] Get the second text length of each sibling node preceding the outermost parent node;

[0182] Based on the search path of the first sibling node found, the lengths of the first and second texts are summed to determine the total text length from the cursor to the starting point of the first sibling node, and the total text length is determined as the cursor position.

[0183] According to one or more embodiments of this disclosure, the method further includes:

[0184] Acquire any user action on a sentence segment and / or translation; the action includes at least one of the following: confirming the sentence segment status, inputting the translation, proofreading the translation, copying the original text to the translation, clearing the translation, inserting a tag, selecting text content, and searching for text content;

[0185] The operation is sent to the server so that the server can monitor the operation and / or perform data analysis based on the operation.

[0186] Secondly, according to one or more embodiments of this disclosure, a document translation device is provided, comprising:

[0187] The source document processing unit is used to display multiple sentence segments of the source document to be translated in a first area of ​​the terminal interface, and at least one of the multiple sentence segments includes a first format tag corresponding to the format type of the sentence segment;

[0188] The translation processing unit is used to obtain the translations corresponding to the multiple sentence segments and display the translations corresponding to the multiple sentence segments in the second area of ​​the terminal interface;

[0189] A tag setting unit is configured to receive a format tag insertion instruction, wherein the format tag insertion instruction includes a target position of a second format tag in the translation corresponding to the at least one sentence segment, and the second format tag is of the same type as the first format tag included in the at least one sentence segment; and to insert and display the second format tag at the target position in the translation corresponding to the at least one sentence segment according to the format tag insertion instruction.

[0190] The translation output unit is used to generate a translation document corresponding to the source document format based on the translation corresponding to each sentence and the second format tags inserted in the translation.

[0191] According to one or more embodiments of this disclosure, when the source document processing unit displays multiple segments of the source document to be translated in a first area of ​​the terminal interface, it is used to:

[0192] The original content of the source document is split into multiple sentence segments;

[0193] Identify the format type included in any sentence segment and insert the first format tag corresponding to the format type at the corresponding position in the sentence segment;

[0194] The multiple sentence segments are displayed in the first area of ​​the terminal interface, along with the inserted first format tags.

[0195] According to one or more embodiments of this disclosure, when the source document processing unit identifies the format type included in any sentence segment and inserts a first format tag corresponding to the format type at the corresponding position of the sentence segment, it is configured to:

[0196] Identify the format types included in any sentence or paragraph;

[0197] If the format type is the first format type to appear in the source document, then a corresponding first format tag is generated and inserted into the corresponding position of the sentence segment; or

[0198] If the format type is not the first format type to appear in the source document, then the first format tag corresponding to the format type is searched from the format tag set, and the found first format tag is inserted into the corresponding position of the sentence segment.

[0199] According to one or more embodiments of this disclosure, the label setting unit is further configured to:

[0200] Receive an operation instruction to move the cursor in the corresponding translation of any sentence segment, identify the cursor position according to the operation instruction, and determine the cursor position as the target position;

[0201] Receive a selection instruction for a second format tag, the selection instruction including a second format tag selected from a set of format tags that is of the same type as the first format tag included in the segment.

[0202] According to one or more embodiments of this disclosure, the first format label and the second format label include dual labels or single labels;

[0203] The dual label includes two labels, which are used to identify the start and end positions of the format, respectively;

[0204] The single label is used to identify a format that exists independently.

[0205] According to one or more embodiments of this disclosure, the translated text is located in a rich text input box; the label setting unit, when recognizing the cursor position, is used to:

[0206] Find the outermost parent node of the node where the cursor is located, where the outermost parent node is the outermost rich text input box node of the node where the cursor is located;

[0207] Find the sibling node preceding the outermost parent node to determine the foremost sibling node;

[0208] The cursor position is determined based on the search path of the first sibling node found.

[0209] According to one or more embodiments of this disclosure, when searching for the outermost parent node of the node where the cursor is located, the label setting unit is used to:

[0210] Determine if the parent node of the node where the cursor is located is the outermost rich text input box node;

[0211] If so, then the parent node of the node where the cursor is located is determined as the outermost parent node; or

[0212] If not, continue to determine whether the parent node of the parent node is the outermost rich text input box node, and repeat the above determination process until the outermost parent node is found; and / or

[0213] When the label setting unit searches for sibling nodes preceding the outermost parent node and determines the foremost sibling node, it is used for:

[0214] Determine whether there are sibling nodes before the outermost parent node;

[0215] If not, then the outermost parent node is determined to be the foremost sibling node; or

[0216] If so, continue to determine whether there is a sibling node before the sibling node before the outermost parent node, and repeat the above determination process until the first sibling node is found.

[0217] According to one or more embodiments of this disclosure, when the label setting unit determines the cursor position based on the search path of the first sibling node found, it is used to:

[0218] Get the first text length from the cursor to the starting point of the outermost parent node;

[0219] Get the second text length of each sibling node preceding the outermost parent node;

[0220] Based on the search path of the first sibling node found, the lengths of the first and second texts are summed to determine the total text length from the cursor to the starting point of the first sibling node, and the total text length is determined as the cursor position.

[0221] According to one or more embodiments of this disclosure, the document translation device further includes a monitoring unit for:

[0222] Acquire any user action on a sentence segment and / or translation; the action includes at least one of the following: confirming the sentence segment status, inputting the translation, proofreading the translation, copying the original text to the translation, clearing the translation, inserting a tag, selecting text content, and searching for text content;

[0223] The operation is sent to the server so that the server can monitor the operation and / or perform data analysis based on the operation.

[0224] Thirdly, according to one or more embodiments of the present disclosure, an electronic device is provided, including: a display device, an input / output device, a memory, and at least one processor;

[0225] The memory stores computer-executed instructions; the input / output device is used for interacting with instructions and / or data; the display device is used for displaying the terminal interface;

[0226] The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the document translation method as described in the first aspect and various possible designs of the first aspect.

[0227] Fourthly, according to one or more embodiments of the present disclosure, a computer-readable storage medium is provided, wherein computer-executable instructions are stored therein, and when a processor executes the computer-executable instructions, the document translation method described in the first aspect and various possible designs of the first aspect is implemented.

[0228] Fifthly, according to one or more embodiments of this disclosure, a computer program product is provided, including computer execution instructions that, when executed by a processor, implement the document translation method as described in the first aspect and various possible designs of the first aspect.

[0229] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.

[0230] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.

[0231] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.

Claims

1. A document translation method, characterized in that, include: The first area of ​​the terminal interface displays multiple sentence segments of the source document to be translated, and at least one of the multiple sentence segments includes a first format tag corresponding to the format type of the sentence segment; Obtain the translations corresponding to the multiple sentence segments, and display the translations corresponding to the multiple sentence segments in the second area of ​​the terminal interface; Receive a format tag insertion instruction, wherein the format tag insertion instruction includes a target position of a second format tag in the translation corresponding to the at least one sentence segment, and the second format tag is of the same type as the first format tag included in the at least one sentence segment; The second format tag is inserted and displayed at the target position in the translation corresponding to the at least one sentence segment according to the format tag insertion instruction; Based on the translation of each sentence and the second format tags inserted in the translation, a translation document corresponding to the format of the source document is generated. Before receiving the format tag insertion instruction, the method further includes: Receive an operation instruction to move the cursor in the corresponding translation of at least one sentence segment, identify the cursor position according to the operation instruction, and determine the cursor position as the target position; Receive a selection instruction for a second format tag, the selection instruction including a second format tag selected from a set of format tags that is of the same type as the first format tag included in the segment.

2. The method according to claim 1, characterized in that, The first area of ​​the terminal interface displays multiple segments of the source document to be translated, including: The original content of the source document is split into multiple sentence segments; Identify at least one format type included in a sentence segment, and insert the first format tag corresponding to the format type at the corresponding position in the sentence segment; The multiple sentence segments are displayed in the first area of ​​the terminal interface, along with the inserted first format tags.

3. The method according to claim 2, characterized in that, The step of identifying at least one format type included in a sentence segment and inserting a first format tag corresponding to the format type at the corresponding position in the sentence segment includes: Identify the format type included in at least one sentence segment; If the format type is the first format type to appear in the source document, then a corresponding first format tag is generated and inserted into the corresponding position of the sentence segment; or If the format type is not the first format type to appear in the source document, then the first format tag corresponding to the format type is searched from the format tag set, and the found first format tag is inserted into the corresponding position of the sentence segment.

4. The method according to any one of claims 1-3, characterized in that, The first format label and the second format label can be either double labels or single labels; The dual label includes two labels, which are used to identify the start and end positions of the format, respectively; The single label is used to identify a format that exists independently.

5. The method according to claim 1, characterized in that, The translated text is located in the rich text input box; the cursor position recognition includes: Find the outermost parent node of the node where the cursor is located, where the outermost parent node is the outermost rich text input box node of the node where the cursor is located; Find the sibling node preceding the outermost parent node to determine the foremost sibling node; The cursor position is determined based on the search path of the first sibling node found.

6. The method according to claim 5, characterized in that, The process of finding the outermost parent node of the node where the cursor is located includes: Determine if the parent node of the node where the cursor is located is the outermost rich text input box node; If so, then the parent node of the node where the cursor is located is determined as the outermost parent node; or If not, continue to determine whether the parent node of the parent node is the outermost rich text input box node, and repeat the above determination process until the outermost parent node is found; and / or The process of finding the sibling node preceding the outermost parent node to determine the foremost sibling node includes: Determine whether there are sibling nodes before the outermost parent node; If not, then the outermost parent node is determined to be the foremost sibling node; or If so, continue to determine whether there is a sibling node before the sibling node before the outermost parent node, and repeat the above determination process until the first sibling node is found.

7. The method according to claim 5, characterized in that, Determining the cursor position based on the search path of the first sibling node found includes: Get the first text length from the cursor to the starting point of the outermost parent node; Get the second text length of each sibling node preceding the outermost parent node; Based on the search path of the first sibling node found, the lengths of the first and second texts are summed to determine the total text length from the cursor to the starting point of the first sibling node, and the total text length is determined as the cursor position.

8. The method according to any one of claims 1-3, characterized in that, The method further includes: Acquire at least one user action on a sentence segment and / or translation; the action includes at least one of the following: confirming the sentence segment status, inputting the translation, proofreading the translation, copying the original text to the translation, clearing the translation, inserting a tag, selecting text content, and searching for text content; The operation is sent to the server so that the server can monitor the operation and / or perform data analysis based on the operation.

9. A document translation device, characterized in that, include: The source document processing unit is used to display multiple sentence segments of the source document to be translated in a first area of ​​the terminal interface, and at least one of the multiple sentence segments includes a first format tag corresponding to the format type of the sentence segment; The translation processing unit is used to obtain the translations corresponding to the multiple sentence segments and display the translations corresponding to the multiple sentence segments in the second area of ​​the terminal interface; A tag setting unit is configured to receive a format tag insertion instruction, wherein the format tag insertion instruction includes a target position of a second format tag in the translation corresponding to the at least one sentence segment, and the second format tag is of the same type as the first format tag included in the at least one sentence segment; and to insert and display the second format tag at the target position in the translation corresponding to the at least one sentence segment according to the format tag insertion instruction. The translation output unit is used to generate a translation document corresponding to the source document format based on the translation corresponding to each sentence and the second format tags inserted in the translation; Before receiving the format tag insertion instruction, the tag setting unit is also used to: Receive an operation instruction to move the cursor in the corresponding translation of at least one sentence segment, identify the cursor position according to the operation instruction, and determine the cursor position as the target position; Receive a selection instruction for a second format tag, the selection instruction including a second format tag selected from a set of format tags that is of the same type as the first format tag included in the segment.

10. An electronic device, characterized in that, include: Display device, input / output device, memory, and at least one processor; The memory stores computer-executed instructions; the input / output device is used for interacting with instructions and / or data; the display device is used for displaying the terminal interface; The at least one processor executes computer execution instructions stored in the memory, causing the at least one processor to perform the document translation method as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, implement the document translation method as described in any one of claims 1-8.

12. A computer program product comprising computer-executable instructions, characterized in that, When the computer execution instructions are executed by the processor, the document translation method as described in any one of claims 1-8 is implemented.

Citation Information

Patent Citations

  • Text processing method and device, electronic equipment and storage medium

    CN111291575A