Translation method and device of electronic mail and computer equipment

文档序号:342910 发布日期:2021-12-03 浏览:24次 中文

阅读说明:本技术 电子邮件的翻译方法、装置和计算机设备 (Translation method and device of electronic mail and computer equipment ) 是由 刘让琼 孟麟 周国强 谭悦伟 于 2020-05-28 设计创作,主要内容包括:本申请涉及一种电子邮件的翻译方法、装置和计算机设备。该方法包括:响应于在电子邮件的邮件界面所触发的邮件文本翻译操作,获取电子邮件的标记语言数据,标记语言数据包括通过分区标签标记的邮件文本;通过分区标签从标记语言数据提取邮件文本,翻译邮件文本获得翻译内容,将标记语言数据中的邮件文本替换为翻译内容,得到重组标记语言数据;解析重组标记语言数据,并将解析获得的邮件内容在邮件界面上显示,邮件内容包括翻译内容。采用本方法能够简化用户的操作步骤。(The application relates to a translation method and device of an email and computer equipment. The method comprises the following steps: responding to a mail text translation operation triggered on a mail interface of the electronic mail, and acquiring markup language data of the electronic mail, wherein the markup language data comprises a mail text marked by a partition label; extracting a mail text from the markup language data through the partition tag, translating the mail text to obtain translation contents, and replacing the mail text in the markup language data with the translation contents to obtain recombinant markup language data; and analyzing the recombined markup language data, and displaying the mail content obtained by analysis on a mail interface, wherein the mail content comprises translation content. The method can simplify the operation steps of the user.)

1. A method for translating an email, the method comprising:

responding to a mail text translation operation triggered on a mail interface of an electronic mail, and acquiring markup language data of the electronic mail, wherein the markup language data comprises a mail text marked by a partition label;

extracting the mail text from the markup language data through the partition tag, translating the mail text to obtain translation content, and replacing the mail text in the markup language data with the translation content to obtain recombinant markup language data;

and analyzing the recombined markup language data, and displaying the mail content obtained by analysis on a mail interface, wherein the mail content comprises the translation content.

2. The method of claim 1, wherein prior to the mail text translation operation triggered in response to the mail interface of the electronic mail, the method further comprises:

displaying the mail content of the electronic mail in an original text display area in the mail interface;

the analyzing the recombined markup language data and displaying the mail content obtained by analyzing on a mail interface comprises:

and analyzing the recombined markup language data, and displaying the mail content obtained by analysis in a translation display area in a mail interface.

3. The method of claim 2, further comprising:

setting the translation display area to be in an editing state in response to a translation modification operation triggered on a mail interface;

and modifying the translation content according to the editing operation on the translation display area.

4. The method of claim 3, wherein the translation of the mail text is performed by a translation model on a server; the method further comprises the following steps:

and reporting the modified translation content to the server, so that the server updates the translation model based on the mail content before translation and the modified translation content.

5. The method of claim 2, wherein the retrieving markup language data of the email in response to the email text translation operation triggered at the email interface of the email comprises:

responding to a mail text real-time translation operation triggered on a mail interface of an electronic mail, and acquiring markup language data of the electronic mail corresponding to a text display area in the mail interface when the mail content of the text display area changes;

the analyzing the restructured markup language data and displaying the email content of the email obtained by analyzing on the email interface includes:

and analyzing the received recombined markup language data each time, and updating and displaying the mail content of the electronic mail obtained by analyzing each time in a translation display area of the mail interface.

6. The method of claim 5, wherein the obtaining markup language data of the email corresponding to the text display area when the email content of the text display area in the email interface changes in response to the email text real-time translation operation triggered by the email interface of the email comprises:

triggering a cycle timer in response to a mail text real-time translation operation triggered on a mail interface of an electronic mail;

detecting the mail content in the original text display area every time when the cycle timer counts a preset time;

and when the change of the mail content in the original text display area is detected, acquiring the markup language data of the electronic mail corresponding to the original text display area.

7. The method according to any one of claims 2 to 6, further comprising:

in response to the mail content replacement operation triggered on the mail interface, replacing the mail content in the original text display area with the mail content in the translated text display area;

and closing the translation display area.

8. The method of claim 1, further comprising:

responding to a text selection operation triggered in the mail interface to acquire a target text; the target text is a portion of the mail text;

responding to a local text translation operation triggered on the mail interface, and sending the target text to a server;

receiving a translation text for the target text sent by the server;

and displaying the translation text.

9. The method of claim 8, wherein the displaying the translated text comprises:

acquiring coordinates of the target text equivalent to the mail interface;

determining a text size of the translated text;

when the text size is in the size range supported by the floating window, displaying the floating window on the mail interface according to the coordinate and the text size, and displaying the translation text on the floating window;

when the text size is larger than the maximum size of the size range, displaying a floating window on the mail interface according to the coordinates and the maximum size, adjusting the arrangement mode of the translated text, and displaying the adjusted translated text on the floating window;

and when the text size is smaller than the minimum size of the size range, displaying a floating window on the mail interface according to the coordinates and the minimum size, and displaying the translation text on the floating window.

10. The method of claim 1, wherein the retrieving markup language data for the email in response to the email text translation operation triggered at the email interface of the email comprises:

acquiring a default language;

detecting the original language of a mail text of the electronic mail;

when the original language is not matched with the default language, displaying a translation prompt toolbar;

and responding to the mail text translation operation triggered by the translation prompt toolbar to acquire the markup language data of the electronic mail.

11. The method of claim 10, wherein said detecting an original language of a mail text of said e-mail comprises:

acquiring character codes corresponding to characters in the mail text;

in the character coding, determining the proportion of the character coding in a character coding interval of a preset language;

and when the proportion is larger than a preset proportion, determining the original language of the mail text of the electronic mail as the preset language.

12. The method according to claim 1, wherein replacing the mail text in the markup language data with the translated content to obtain the restructured markup language data comprises:

acquiring a mail picture based on a picture tag in the markup language data;

identifying an identification text and a corresponding text format from the mail picture;

translating the recognition text to obtain a recognition text translation;

and replacing the mail text in the markup language data with the translation content, and replacing the markup language corresponding to the picture label with the markup language corresponding to the recognized text translation and the text format to generate recombined markup language data.

13. A method for translating an email, the method comprising:

receiving markup language data of an electronic mail sent by a terminal, wherein the markup language data comprises a mail text marked by a partition label;

extracting the mail text from the markup language data through the partition tag, and translating the mail text to obtain translation contents;

replacing the mail text in the markup language data with the translation content to obtain recombined markup language data;

sending the recombined markup language data to the terminal, so that the terminal analyzes the recombined markup language data and displays the analyzed mail content; the mail content includes the translated content.

14. An apparatus for translating an e-mail, the apparatus comprising:

the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for responding to mail text translation operation triggered on a mail interface of an electronic mail and acquiring markup language data of the electronic mail, and the markup language data comprises mail text marked by a partition label;

the mail text translation module is used for extracting the mail text from the markup language data through the partition tag, translating the mail text to obtain translation contents, and replacing the mail text in the markup language data with the translation contents to obtain recombined markup language data;

and the display module is used for analyzing the recombined markup language data and displaying the mail content obtained by analysis on a mail interface, wherein the mail content comprises the translation content.

15. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor realizes the steps of the method of any one of claims 1 to 13 when executing the computer program.

Technical Field

The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for translating an email, and a computer device.

Background

When receiving or writing a foreign language mail, a user usually needs to copy the mail, paste the mail into translation software for translation to obtain a translation result, and paste the translation result on the mail software. However, the format of the pasted translation result is usually changed, and the user needs to readjust the format, which results in a cumbersome operation.

Disclosure of Invention

In view of the above, it is necessary to provide a method, an apparatus, a computer device and a storage medium for translating an email, which can simplify the user operation steps.

A method of translating an email, the method comprising:

responding to a mail text translation operation triggered on a mail interface of an electronic mail, and acquiring markup language data of the electronic mail, wherein the markup language data comprises a mail text marked by a partition label;

extracting the mail text from the markup language data through the partition tag, translating the mail text to obtain translation content, and replacing the mail text in the markup language data with the translation content to obtain recombinant markup language data;

and analyzing the recombined markup language data, and displaying the mail content obtained by analysis on a mail interface, wherein the mail content comprises the translation content.

A method of translating an email, the method comprising:

receiving markup language data of an electronic mail sent by a terminal, wherein the markup language data comprises a mail text marked by a partition label;

extracting the mail text from the markup language data through the partition tag, and translating the mail text to obtain translation contents;

replacing the mail text in the markup language data with the translation content to obtain recombined markup language data;

sending the recombined markup language data to the terminal, so that the terminal analyzes the recombined markup language data and displays the analyzed mail content; the mail content includes the translated content.

An apparatus for translating an email, the apparatus comprising:

the system comprises an acquisition module, a processing module and a display module, wherein the acquisition module is used for responding to mail text translation operation triggered on a mail interface of an electronic mail and acquiring markup language data of the electronic mail, and the markup language data comprises mail text marked by a partition label;

the mail text translation module is used for extracting the mail text from the markup language data through the partition tag, translating the mail text to obtain translation contents, and replacing the mail text in the markup language data with the translation contents to obtain recombined markup language data;

and the display module is used for analyzing the recombined markup language data and displaying the mail content obtained by analysis on a mail interface, wherein the mail content comprises the translation content.

In one embodiment, the display module is further configured to display the email content of the email in an original text display area in the email interface; and analyzing the recombined markup language data, and displaying the mail content obtained by analysis in a translation display area in a mail interface.

In one embodiment, the translation device of the e-mail further comprises a translation modification module, wherein the translation modification module is used for setting the translation display area to be in an editing state in response to a translation modification operation triggered on the mail interface; and modifying the translation content according to the editing operation on the translation display area.

In one embodiment, the translation of the mail text is performed by a translation model on the server. The translation device of the e-mail also comprises a reporting module, wherein the reporting module is used for reporting the modified translation content to a server, so that the server updates the translation model based on the mail content before translation and the modified translation content.

In one embodiment, the obtaining module is configured to, in response to a real-time email text translation operation triggered on an email interface of an email, obtain, when email content in an email display area in the email interface changes, markup language data of the email corresponding to the original display area; the display module is used for analyzing the received recombined markup language data each time and updating and displaying the mail content of the electronic mail obtained by analysis each time in a translation display area of the mail interface.

In one embodiment, the acquiring module is configured to trigger a cycle timer in response to a real-time email text translation operation triggered on an email interface of an email; detecting the mail content in the original text display area every time when the cycle timer counts a preset time; and when the change of the mail content in the original text display area is detected, acquiring the markup language data of the electronic mail corresponding to the original text display area.

In one embodiment, the translation device for the e-mail further comprises a translation replacing module, wherein the translation replacing module is used for replacing the mail content in the original text display area with the mail content in the translation display area in response to the mail content replacing operation triggered on the mail interface; and closing the translation display area.

In one embodiment, the translation device of the e-mail further comprises a target text sending module and a translation text receiving module; the acquisition module is used for responding to a text selection operation triggered in the mail interface and acquiring a target text; the target text is a portion of the mail text; the target text sending module is used for responding to local text translation operation triggered on the mail interface and sending the target text to a server; the translation text receiving module is used for receiving translation texts for the target texts sent by the server; the display module is used for displaying the translation text.

In one embodiment, the display module is used for acquiring coordinates of the target text, which are equivalent to the mail interface; determining a text size of the translated text; when the text size is in the size range supported by the floating window, displaying the floating window on the mail interface according to the coordinate and the text size, and displaying the translation text on the floating window; when the text size is larger than the maximum size of the size range, displaying a floating window on the mail interface according to the coordinates and the maximum size, adjusting the arrangement mode of the translated text, and displaying the adjusted translated text on the floating window; and when the text size is smaller than the minimum size of the size range, displaying a floating window on the mail interface according to the coordinates and the minimum size, and displaying the translation text on the floating window.

In one embodiment, the obtaining module is used for obtaining a default language; detecting the original language of a mail text of the electronic mail; when the original language is not matched with the default language, displaying a translation prompt toolbar; and responding to the mail text translation operation triggered by the translation prompt toolbar to acquire the markup language data of the electronic mail.

In one embodiment, the obtaining module is used for obtaining character codes corresponding to characters in the mail text; in the character coding, determining the proportion of the character coding in a character coding interval of a preset language; and when the proportion is larger than a preset proportion, determining the original language of the mail text of the electronic mail as the preset language.

In one embodiment, the mail text translation module is used for acquiring a mail picture based on a picture tag in the markup language data; identifying an identification text and a corresponding text format from the mail picture; translating the recognition text to obtain a recognition text translation; and replacing the mail text in the markup language data with the translation content, and replacing the markup language corresponding to the picture label with the markup language corresponding to the recognized text translation and the text format to generate recombined markup language data.

An apparatus for translating an email, the apparatus comprising:

the system comprises a markup language data receiving module, a data processing module and a data processing module, wherein the markup language data receiving module is used for receiving markup language data of an electronic mail sent by a terminal, and the markup language data comprises a mail text marked by a partition label;

the extraction module is used for extracting the mail text from the markup language data through the partition tag and translating the mail text to obtain translation contents;

the replacing module is used for replacing the mail text in the markup language data with the translation content to obtain recombined markup language data;

the system comprises a recombination markup language data sending module, a mail content analyzing module and a mail content analyzing module, wherein the recombination markup language data sending module is used for sending the recombination markup language data to the terminal so that the terminal analyzes the recombination markup language data and displays the analyzed mail content; the mail content includes the translated content.

A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:

responding to a mail text translation operation triggered on a mail interface of an electronic mail, and acquiring markup language data of the electronic mail, wherein the markup language data comprises a mail text marked by a partition label;

extracting the mail text from the markup language data through the partition tag, translating the mail text to obtain translation content, and replacing the mail text in the markup language data with the translation content to obtain recombinant markup language data;

and analyzing the recombined markup language data, and displaying the mail content obtained by analysis on a mail interface, wherein the mail content comprises the translation content.

A computer device comprising a memory and a processor, the memory storing a computer program, the processor implementing the following steps when executing the computer program:

receiving markup language data of an electronic mail sent by a terminal, wherein the markup language data comprises a mail text marked by a partition label;

extracting the mail text from the markup language data through the partition tag, and translating the mail text to obtain translation contents;

replacing the mail text in the markup language data with the translation content to obtain recombined markup language data;

sending the recombined markup language data to the terminal, so that the terminal analyzes the recombined markup language data and displays the analyzed mail content; the mail content includes the translated content.

A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:

responding to a mail text translation operation triggered on a mail interface of an electronic mail, and acquiring markup language data of the electronic mail, wherein the markup language data comprises a mail text marked by a partition label;

extracting the mail text from the markup language data through the partition tag, translating the mail text to obtain translation content, and replacing the mail text in the markup language data with the translation content to obtain recombinant markup language data;

and analyzing the recombined markup language data, and displaying the mail content obtained by analysis on a mail interface, wherein the mail content comprises the translation content.

A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:

receiving markup language data of an electronic mail sent by a terminal, wherein the markup language data comprises a mail text marked by a partition label;

extracting the mail text from the markup language data through the partition tag, and translating the mail text to obtain translation contents;

replacing the mail text in the markup language data with the translation content to obtain recombined markup language data;

sending the recombined markup language data to the terminal, so that the terminal analyzes the recombined markup language data and displays the analyzed mail content; the mail content includes the translated content.

The translation method, the translation device, the computer equipment and the storage medium of the electronic mail respond to the translation operation of the mail text, utilize the characteristic of the mark language data, extract the mail text from the mark language data through the partition label, and translate to obtain the translated content, replace the mail text in the mark language data with the translated content, namely translate the mail text only, and other contents in the mark language data do not change, namely the mail content analyzed from the recombined mark language data is compared with the mail content of the original text, only the text part changes, therefore, the translated mail content does not lose the original text pattern, the operation steps of the user can be simplified, the translation can be realized in the electronic mail program, and the efficiency of writing or previewing foreign language mails by the user can be improved.

Drawings

FIG. 1 is a diagram of an application environment of a method for translating an email in one embodiment;

FIG. 2 is a flowchart illustrating a method for translating an email in one embodiment;

FIG. 3 is a diagram illustrating the content of an email in one embodiment;

FIG. 4(a) is a schematic interface diagram of a mail interface in one embodiment;

FIG. 4(b) is a schematic interface diagram of a translation control in one embodiment;

FIG. 5(a) is a schematic diagram of an interface for triggering real-time translation, according to an embodiment;

FIG. 5(b) is a schematic diagram of an interface for real-time translation in one embodiment;

FIG. 6 is a diagram of an email interface including a translation modification control, in one embodiment;

FIG. 7 is a diagram illustrating an example email interface after replacement of a translation;

FIG. 8(a) is a diagram illustrating an interface for word fetching translation, according to an embodiment;

FIG. 8(b) is a diagram illustrating an interface including a word fetch translation text, according to an embodiment;

FIG. 9 is a flow diagram that illustrates the display of translated text, in one embodiment;

FIG. 10 is a schematic diagram of an interface including a translation prompt toolbar according to one embodiment;

FIG. 11 is a schematic diagram of an interface including a translation prompt toolbar according to another embodiment;

FIG. 12(a) is a diagram illustrating a mail interface at a handset side before translation in accordance with an embodiment;

fig. 12(b) is a schematic diagram of a mail interface of the translated mobile phone end in an embodiment;

FIG. 13 is a system architecture diagram of a method of translating mail in one embodiment;

FIG. 14 is a flowchart showing a method of translating an electronic mail in another embodiment;

FIG. 15 is a block diagram showing the construction of an electronic mail translation apparatus according to an embodiment;

FIG. 16 is a block diagram showing the construction of an electronic mail translation apparatus according to an embodiment;

FIG. 17 is a diagram illustrating an internal structure of a computer device according to an embodiment.

Detailed Description

In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.

The translation method of the e-mail can be applied to the application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented by an independent server or a server cluster formed by a plurality of servers. The terminal 102 may be used to obtain and display various e-mail data, etc., while the server 104 is used to translate the mail text. The translation method of the e-mail can be applied to an e-mail program, and the e-mail program can be applied to the terminal 102.

In one embodiment, as shown in fig. 2, a method for translating an email is provided, which is described by taking the method as an example applied to the terminal 102 in fig. 1, and includes the following steps:

step 202, in response to a mail text translation operation triggered on a mail interface of an electronic mail, acquiring markup language data of the electronic mail, wherein the markup language data comprises a mail text marked by a partition label.

Among these, email is a communication means that electronically provides information exchange. The mail interface of the e-mail can be used for displaying the mail content of the e-mail. The function bar, the mail list, the menu bar, etc. may be displayed on the mail interface of the e-mail, but are not limited thereto. The mail text translation operation is for translating mail text of an electronic mail. The mail text translation operation may include, but is not limited to, a mail full-text translation operation, a mail text real-time translation operation, and the like. The full-text mail translation operation is used for translating the whole mail text on the premise of not changing the mail format. The real-time translation operation of the mail text is used for carrying out real-time dynamic translation according to the content input by the user when the mail is written. The Markup Language data of the e-mail may specifically be HTML (hypertext Markup Language) data of the e-mail, XML (Extensible Markup Language) data of the e-mail, XHTML (Extensible hypertext Markup Language) of the e-mail, or the like, but is not limited thereto. The partition label is used for marking the mail text and distinguishing the mail text from other contents of the e-mail. In the HTML data, the partition tag may specifically be a < div > tag. Mail text refers to text that does not carry a format, i.e., plain text.

In particular, a mail text translation control may be displayed in a ribbon of a mail interface of an email. Such as full-text translation controls, real-time translation controls, and the like, are not so limited. The terminal responds to the full-text translation operation of the email triggered on the email interface of the email to acquire the markup language data of the email. Or the terminal responds to the real-time translation operation of the email triggered on the email interface of the email to acquire the markup language data of the email.

And step 204, extracting the mail text from the markup language data through the partition label, translating the mail text to obtain translation contents, and replacing the mail text in the markup language data with the translation contents to obtain the recombinant markup language data.

The translation content refers to translation content obtained by translating the mail text. For example, the mail text is in english, and the translated content is in chinese. The markup language data of the e-mail includes data such as mail text, partition tags, and text format. The restructuring markup language data includes translation content, the partition label, the text format, and other data.

In particular, the terminal may implement the translation of the mail text locally. The terminal extracts the mail text from the markup language data through the partition tag, translates the mail text to obtain translation content, and replaces the mail text in the markup language data with the translation content to obtain the recombinant markup language data.

In this embodiment, since the terminal has limited computing resources, the translation work is performed by a server with high computing power. The terminal sends the markup language data to the server so that the server extracts the mail text from the markup language data through the partition tag, the server translates the mail text to obtain translation content, and the mail text in the markup language data is replaced by the translation content to form the recombined markup language data. The server sends the recombined markup language data to the terminal. And the terminal receives the recombined markup language data returned by the server.

For example, as shown in FIG. 3, a diagram of the content of a mail piece in one embodiment is shown. The following is the markup language data for an email:

< div > < br > < div > < niuh id ═ FMSigSeperator "style ═" WIDTH:210 px; HEIGHT, 1px, "color ═ b5c4df," size ═ 1, "align ═ left" > < div > < span id ═ FoxFrOMNAME "> < div style ═ MARGIN, 10 px; FONT-FAMILY verdana; FONT-SIZE 10pt "> < div > curraineliu (Liu Dongqiong) </div > </div > </span > </div >)

Wherein, WIDTH is 210 px; the HEIGHT of 1px means 210 pixels, the HEIGHT of 1 pixel, color means color, size means size, align means arrangement, and align means left arrangement. MARGIN refers to a blank, where there are 10 pixel points. FONT-FAMILY refers to the FONT style and verdana is the FONT style name. FONT-SIZE refers to FONT SIZE.

In this embodiment, the email text would be placed in the < div > </div > tag pair, with < style > indicating the format of the current tag. During translation, only the data in the < div > </div > tag is extracted for translation, and the content in the < style > tag is not extracted for translation. Therefore, the method can only translate the mail text without losing the style of the original text. "the above translation results are from WeChat" as presented in the screenshot; the mail translation of Foxmail is completed by joint debugging of a plurality of departments.

And step 206, analyzing the recombined markup language data, and displaying the mail content obtained by analysis on a mail interface, wherein the mail content comprises translation content.

The mail content comprises translation content and a format corresponding to the translation content. And the format corresponding to the translation content is the format corresponding to the mail text. The text format corresponding to the mail text and the format of the translated content may be, but not limited to, font size, whether underlining is added, whether bold is added, whether italic is added, whether expression is added, and the like.

Specifically, the terminal analyzes the restructured markup language data and displays the mail content obtained by analysis on a mail interface, wherein the mail content comprises translation content. For example, the terminal may display the mail content obtained by parsing on the original text display area. Or the terminal can create a translation display area and display the mail content obtained by analysis in the translation display area. Or, the terminal can create a mail interface again, display the content of the original e-mail in the original text display area of the created mail interface, and display the content of the e-mail obtained by analysis in the translation display area.

The translation method of the electronic mail extracts the mail text from the mark language data by using the characteristic of the mark language data in response to the mail text translation operation and translates the mail text to obtain the translation content, replaces the mail text in the mark language data with the translation content, namely only the mail text is translated, and other contents in the mark language data are not changed, namely only a text part is changed compared with the mail content of the original text in the mail content analyzed from the recombined mark language data, so that the translated mail content does not lose the original text style, the operation steps of a user are simplified, the translation can be realized in an electronic mail program, and the efficiency of writing or previewing foreign language mails by the user is improved.

In one embodiment, before responding to a mail text translation operation triggered at a mail interface of an electronic mail, the method further comprises: and displaying the mail content of the electronic mail in an original text display area in the mail interface. Analyzing the recombined markup language data, and displaying the mail content obtained by analysis on a mail interface, wherein the method comprises the following steps: and analyzing the recombined markup language data, and displaying the mail content obtained by analysis in a translation display area in the mail interface.

The original text display area is used for displaying original mail content of the electronic mail.

Specifically, in an original text display area in the mail interface, the terminal displays the original mail content of the electronic mail. And the terminal analyzes and recombines the markup language data and displays the analyzed and obtained mail content in a translation display area in the mail interface.

Fig. 4(a) is a schematic interface diagram of a mail interface in one embodiment. FIG. 4(b) is a schematic interface diagram of a translation control in one embodiment. Fig. 4(a) and 4(b) are schematic interfaces on a PC (Personal Computer) side. Fig. 4(a) is a mail interface 400, which includes a textual display area 402. Specifically, FIG. 4(a) may be a mail preview interface. Mail content of the electronic mail is displayed in the original text display area 402. And acquiring a full-text translation operation triggered by a right mouse button on the mail interface, and creating the mail interface 410 in the figure 4 (b). Here, 412 is a text display area, and 414 is a translation display area. The mail content in the original text display area 412 in fig. 4(b) is the same as that in the original text display area 402 in fig. 4 (a). The terminal parses the restructured markup language data and displays the mail contents obtained by the parsing in a translation display area 414 of the mail interface 410. Specifically, the font size, the field format such as the bolding, and the arrangement of the pictures of the original text display area 412 and the translated text display area 414 are not changed. And, the title of the e-mail and the body part of the e-mail are translated by the server. The "Introduction" is translated into "Introduction" as in the figure. Also, the picture position in fig. 4(b) does not change. In the text display area, the picture is after "bbbbbbbb Public Interest Foundation"; in the translation display area, the picture is shown after "bbbbbbbb public welfare fund donates to a part of african medical supplies".

Fig. 5(a) is a schematic interface diagram for triggering real-time translation in one embodiment. FIG. 5(b) is a diagram illustrating an interface for real-time translation, according to an embodiment. Fig. 5(a) and 5(b) are schematic interfaces on a PC (Personal Computer) side. Fig. 5(b) includes a mail interface 500, including a textual display area 502. Specifically, fig. 5(a) may be a mail editing interface. Mail content of the electronic mail is displayed in the original text display area 502. Acquiring real-time translation operation triggered by a left mouse button on a toolbar on the mail interface, and as shown in fig. 5(b), newly building a translation display area 504 in the mail interface 500 by the terminal. The mail content in the original text display area 502 in fig. 5(b) is the same as that in the original text display area 502 in fig. 5 (a). The terminal parses the restructured markup language data and displays the mail contents obtained by the parsing in a translation display area 504 of the mail interface 500. Specifically, the font size, the field format such as the bolding, and the arrangement of the pictures of the original text display area 502 and the translated text display area 504 are not changed.

According to the translation method of the electronic mail, the mail content of the electronic mail is displayed in the original text display area in the mail interface, the markup language data are analyzed and recombined, the mail content obtained through analysis is displayed in the translation display area in the mail interface, and the original text and the translation can be displayed on the interface more intuitively and simultaneously.

In one embodiment, the method for translating the email further comprises: setting a translation display area to be in an editing state in response to a translation modification operation triggered on the mail interface; and modifying the translation content according to the editing operation of the translation display area.

And the translation modification operation is used for modifying the mail content obtained by analysis in the translation display area. The edit status is a modifiable status. The editing operation on the translation display area, that is, the editing operation occurring in the translation display area, may be, but is not limited to, replacing a certain character, adding a character, deleting a character, and the like.

Specifically, the terminal responds to the translation modification operation triggered on the mail interface and sets the translation display area to be in an editing state. And the terminal sets the original text display area to be in a non-editable state. That is, the original text display area cannot be edited after the translation modification operation is triggered. The terminal may also display a word "currently in a translation modification state" in the first toolbar and close the "translation modification" control. And modifying the translation content by the terminal according to the editing operation of the translation display area.

FIG. 6 is a diagram illustrating an example email interface including a translation modification control. The terminal may set the translation display area to the edit state in response to the triggering operation of the modified translation control in fig. 5 (b). And modifying the translation content according to the editing operation of the translation display area. The first toolbar in FIG. 6 displays the word "currently in the modified translation state" and closes the "translation modification" control, leaving the "alternate text" control and the "return" control.

Alternatively, the terminal may create a translation modification interface in response to the "corrected translation" in fig. 4(b), and modify the translation contents according to an editing operation on the translation modification interface.

The translation method of the electronic mail responds to the translation modification operation triggered on the mail interface, sets the translation display area to be in an editing state, modifies the translation content according to the editing operation on the translation display area, provides a translation modification function, can modify the translation when the translation does not meet the expected requirement, and improves the correctness of the replaced translation.

In one embodiment, the translation of the mail text is performed by a translation model on the server. The translation method of the e-mail further comprises the following steps: and reporting the modified translation content to a server, so that the server updates a translation model based on the mail content before translation and the modified translation content.

The translation model is obtained by training according to the text sample and the translation sample. The translation model may be, but not limited to, a CNN (Convolutional Neural Networks) model, a BERT (Bidirectional Encoder Representations) model, an LSTM (Long Short-Term Memory) model, or the like.

Specifically, the terminal reports the modified translation content to the server, so that the server retrains the original translation model based on the mail content before translation and the modified translation content, thereby updating the translation model.

According to the translation method of the electronic mail, the modified translation content is reported to the server, so that the server updates the translation model based on the mail content before translation and the modified translation content, more sample data can be obtained to train the translation model, and the translation accuracy of the translation model is improved.

In one embodiment, in response to a mail text translation operation triggered on a mail interface of an electronic mail, acquiring markup language data of the electronic mail, including: and responding to the real-time translation operation of the mail text triggered on the mail interface of the electronic mail, and acquiring the markup language data of the electronic mail corresponding to the original text display area when the mail content of the original text display area in the mail interface is changed.

Analyzing the reorganized markup language data, and displaying the mail content of the electronic mail obtained by analyzing on a mail interface, wherein the analyzing comprises the following steps: and analyzing the restructured markup language data received each time, and updating and displaying the mail content of the electronic mail obtained by analyzing each time in a translation display area of a mail interface.

In particular, the real-time translation operation of the mail text is used for enabling the mail to generate a translation effect of changing the mail. And responding to the real-time translation operation of the mail text triggered by the mail editing interface of the electronic mail, and detecting whether the mail content of the text display area in the mail interface is changed or not by the terminal. And when the terminal detects that the mail content of the original text display area in the mail interface changes, acquiring the markup language data of the electronic mail corresponding to the original text display area. That is, as long as the mail content in the text display area in the mail interface changes, the terminal needs to acquire the markup language data of the electronic mail corresponding to the text display area, where the markup language data includes the mail text of the electronic mail corresponding to the text display area. And the terminal sends the markup language data to the server once every time the terminal acquires the markup language data of the electronic mail corresponding to the original text display area, so that the server extracts the mail text from the markup language data through the partition label, translates the mail text to obtain translation content, and replaces the mail text in the markup language data with the translation content to obtain the recombined markup language data. The server sends the recombined markup language data to the terminal.

And the terminal analyzes the received recombined markup language data each time, and updates and displays the mail content of the electronic mail obtained by analysis each time in a translation display area of a mail interface. For example, when the mail content in the original text display area is "hello", the terminal transmits markup language data including "hello" to the server, and the mail content in the translated text display area is "hello". When the mail content in the original text display area is 'hello, nice to see you', the terminal sends markup language data containing 'hello, nice to see you' to the server, and the mail content in the translated text display area is 'hello, nice to see you'.

The translation method of the electronic mail responds to the real-time translation operation of the mail text triggered on the mail interface of the electronic mail, when the mail content of the original text display area in the mail interface changes, the markup language data of the electronic mail corresponding to the original text display area is obtained, the received recombined markup language data is analyzed each time, the mail content of the electronic mail obtained by analysis each time is updated and displayed in the translation display area of the mail interface, the real-time translation effect can be achieved, the user experience is improved, and when the mail of the original text display area in the mail interface changes, the markup language data of the electronic mail corresponding to the original text display area is obtained, so that the network burden and the client computing burden can be reduced.

In one embodiment, in response to a real-time email text translation operation triggered on an email interface of an email, when email content in an email display area in the email interface changes, acquiring markup language data of the email corresponding to the original display area, including: triggering a cycle timer in response to a mail text real-time translation operation triggered on a mail interface of an electronic mail; detecting the mail content in the original text display area every time when the cycle timer counts a preset time; and when the mail content change in the original text display area is detected, acquiring the markup language data of the electronic mail corresponding to the original text display area.

Wherein the cycle timer is used to repeatedly perform a timing operation. The preset time length is the time length of the cycle timer at each time. For example, the loop timer may count 10 milliseconds, 50 milliseconds, 2 seconds, etc. at a time, but is not limited thereto.

Specifically, the terminal triggers a cycle timer in response to a real-time translation operation of a mail text triggered on a mail interface of an electronic mail. And the circulation timer starts to time, and the terminal detects the mail content in the original text display area when the circulation timer times to reach a preset time. And when the terminal detects that the mail content in the original text display area changes, acquiring the markup language data of the electronic mail corresponding to the original text display area. For example, when a user opens a mail editing interface, and a mail text real-time translation operation is triggered. The terminal triggers a cycle timer in response to a real-time translation operation of the mail text triggered at the mail interface of the electronic mail. Whether the mail content in the original text display area changes or not is detected every 1 second. For example, the change may be, but is not limited to, a change in font format, a change in font color, a change in mail text, and the like. Specifically, when detecting that the mail text in the original text display area changes, the markup language data of the electronic mail corresponding to the original text display area is acquired.

The email translation method triggers the cycle timer in response to the email text real-time translation operation triggered on the email interface of the email, detects the email content in the original text display area whenever the cycle timer counts the preset time length, acquires the markup language data of the email corresponding to the original text display area when detecting the change of the email content in the original text display area, can achieve the real-time translation effect through the detection of the cycle timer and the email content, and acquires the markup language data of the email corresponding to the original text display area only when the cycle timer is triggered and the email in the original text display area changes in the email interface, and can reduce the network burden and the client calculation burden.

In one embodiment, the method for translating the email further comprises: in response to the mail content replacement operation triggered on the mail interface, replacing the mail content in the original text display area with the mail content in the translated text display area; and closing the translation display area.

Specifically, a mail content replacement operation is triggered on the mail interface, the mail content in the original text display area is replaced with the mail content in the translated text display area in response to the mail content replacement operation triggered on the mail interface, and the translated text display area is closed. That is, the markup language data corresponding to the original text display area is replaced with the markup language data of the translation display area, and the translation display area is closed. Therefore, only one original text display area remains.

As shown in fig. 5(b), the left side of the mail interface is an original text display area, and the right side is a translated text display area. The two areas are independent browsing windows, and are similar to the way that two browsers are opened and tiled on a desktop when a user browses a webpage at ordinary times. Therefore, after the original text is translated, the restructured markup language data returned by the server is rendered and displayed in the window of the translation display area. After responding to the mail content replacement operation triggered on the mail interface, as shown in fig. 7, the mail interface diagram after the translation replacement in one embodiment is shown. As can be seen from fig. 7, the original translation display area is closed after the replacement, which only includes the mail content in the translation display area 702.

According to the translation method of the electronic mail, in response to the mail content replacement operation triggered on the mail interface, the mail content in the original text display area is replaced by the mail content in the translated text display area, and the translated text display area is closed, so that the mail content in the translated text display area can be automatically displayed in the original text display area, the translated text display area is closed, and the operation is simpler and more convenient.

In one embodiment, the method for translating the email further comprises: responding to a text selection operation triggered in the mail interface, and acquiring a target text; the target text is a portion of the mail text; responding to local text translation operation triggered on a mail interface, and sending a target text to a server; receiving a translation text for the target text sent by the server; the translated text is displayed.

The text selection operation refers to an operation of selecting a part of mail text from the mail text. The target text is at least a portion of the mail text. The target text may also be the entirety of the mail text. For example, the target text may be only one word, one sentence, etc., but is not limited thereto. The local text translation operation refers to a translation operation only performed on the selected target text.

Specifically, a target text is selected through a left mouse button in the mail interface, and the target text is obtained. And triggering a menu bar corresponding to the target text through a right mouse button, triggering a local text translation operation by the menu bar on the mail interface, and sending the target text to the server. The terminal receives the translation text for the target text sent by the server and displays the translation text. The terminal can display the translation text in a floating window mode, and can also display the translation text in a newly-built translation display area.

FIG. 8(a) is a diagram illustrating an interface for word fetching translation, according to an embodiment. FIG. 8(b) is a diagram illustrating an interface including a translated text for word fetching in one embodiment. As shown in fig. 8(a), in response to a text selection operation triggered by a left mouse button in the email interface, a target text, which is a part of the email text, is obtained. And triggering a menu bar through a right mouse button. The menu bar can comprise copy operation, full selection operation, adding to event recording operation, translation operation and full translation operation. The translation operation in the figure is a local text translation operation. And the terminal responds to the local text translation operation triggered on the mail interface and sends the target text to the server. As shown in fig. 8(b), the terminal receives the translation text "chinese supported african epidemic situation" for the target text sent by the server, and displays the translation text in the floating window.

The translation method of the electronic mail obtains the target text in response to the text selection operation triggered in the mail interface, the target text is a part of the mail text, the target text is sent to the server in response to the local text translation operation triggered in the mail interface, the translated text for the target text sent by the server is received, the translated text is displayed, generally in a word selection translation scene, the original text format, such as bolding, font color and the like, does not need to be displayed, and then the target text is sent, so that the efficiency of obtaining the translated text can be improved.

In one embodiment, as shown in fig. 9, a flowchart for displaying the translated text in one embodiment includes:

and step 902, obtaining coordinates of the target text equivalent to the mail interface.

Specifically, since the target text is in the mail interface, the coordinate system related to the mail interface can be constructed by using one corner of the mail interface as an origin and the borders of the mail interface as the x-axis and the y-axis, respectively. The target text corresponds to the mail interface i.e. the presence coordinates. The coordinates may be the coordinates of the upper left corner of the target text being rendered, may be the coordinates of the middle of the target text, may be the coordinates of the lower left corner of the target text, may be the coordinates of the lower right corner of the target text, and so on, without being limited thereto.

Step 904 determines the text size of the translated text.

Wherein the text size includes a text width and a text height. The text width and the text height can both be represented by the number of Pixel points (PX, Pixel). The text size includes the spacing between each character. The character size of each character can be configured as desired.

Specifically, the server translates the target text to obtain a translated text. The character size, character format, and the like of the translation text may be preset at the terminal, but are not limited thereto. The terminal determines the text size of the translated text. For example, if the text is translated as "chinese supports african resistance, then the text size of" chinese supports african resistance "is determined.

And step 906, when the text size is in the size range supported by the floating window, displaying the floating window on the mail interface according to the coordinates and the text size, and displaying the translation text on the floating window.

Wherein the size range includes at least one of a width range, a height range, and an area range calculated from the height and the width. Taking the size range as the width range as an example, when the text width in the text size is greater than the minimum width supported by the floating window and less than the maximum width supported by the floating window, the terminal takes the coordinate as a positioning point, displays the floating window with the size corresponding to the text size on the mail interface, and displays the translated text in the floating window. That is, when the text size is within the size range supported by the floating window, the size of the floating window varies with the text size of the translated text.

In this embodiment, the coordinates of the upper left corner of the floating window may be the same as the coordinates of the lower left corner of the target text, or a number of pixel points may be added to the y value of the coordinates of the target text on the basis of the coordinates of the lower left corner of the target text, so that the interface is more attractive. The text size can be increased based on the original text size. For example, 10 pixels more may be added to the text size. The size of the floating window may include a margin. For example, the left and right margins are M pixels, and the top and bottom margins are N pixels. The terminal can also add controls under the translated text of the floating window. For example, an error correction control, a label control such as "translation result from WeChat" is displayed.

And 908, when the text size is larger than the maximum size of the size range, displaying a floating window on the mail interface according to the coordinates and the maximum size, adjusting the arrangement mode of the translated text, and displaying the adjusted translated text on the floating window.

Wherein the maximum dimension includes at least one of a maximum width, a maximum height, and an area resulting from the minimum width and the minimum height.

Specifically, taking the maximum size of the size range as the maximum width as an example, when the text size is larger than the maximum width, the terminal displays a floating window on the mail interface according to the coordinates and the maximum width, adjusts the arrangement mode of the translated text according to the size range, and displays the adjusted translated text in the floating window.

For example, when the text width is greater than the maximum width supported by the floating window, the number of split lines of the translated text is obtained according to the ratio of the text width to the maximum width, the target height of the floating window is obtained according to the product of the number of split lines and the character height of the translated text, and the display position of the floating window is determined according to the coordinate, the maximum width and the target height. And the terminal adjusts the arrangement mode of the translation text and displays the adjusted translation text on the suspension window.

And step 910, when the text size is smaller than the minimum size of the size range, displaying a floating window on the mail interface according to the coordinates and the minimum size, and displaying the translation text on the floating window.

The minimum dimension includes a minimum width and a minimum height, and the minimum dimension may be an area obtained by the minimum width and the minimum height. The minimum width may be determined according to the setting of the terminal. The minimum height dimension is highly correlated to the characters of the translated text.

Specifically, when the text size is smaller than the minimum size of the size range, the terminal displays a floating window with the coordinate as a positioning point, the minimum width and the minimum height on the mail interface according to the coordinate and the minimum size, and displays the translation text on the floating window.

The translation method of the electronic mail obtains the coordinates of the target text which is equivalent to the mail interface, determines the text size of the translated text, and when the text size is in the size range supported by the floating window, displaying a floating window on the mail interface according to the coordinates and the text size, displaying the translated text on the floating window, and when the text size is larger than the maximum size of the size range, displaying a floating window on the mail interface according to the coordinates and the maximum size, adjusting the arrangement mode of the translation text, and displaying the adjusted translated text in the floating window, wherein when the text size is smaller than the minimum size of the size range, and displaying a floating window on the mail interface according to the coordinates and the minimum size, displaying the translated text on the floating window, adjusting the size of the floating window, the arrangement mode of the translated text and the like according to the text size of the translated text, and displaying the comparison result of the original translated text more intuitively in a floating window mode.

In one embodiment, in response to a mail text translation operation triggered on a mail interface of an electronic mail, acquiring markup language data of the electronic mail comprises: acquiring a default language; detecting the original language of a mail text of an electronic mail; when the original language is not matched with the default language, displaying a translation prompt toolbar; and responding to the mail text translation operation triggered in the translation prompt toolbar to acquire the mark-up language data of the electronic mail.

The default language is a language default set in the e-mail software. For example, the default language may be Chinese, English, etc., but is not limited thereto. The original language of the mail text can refer to the original language of the browsed mail text and can also be the original language of the written mail text. The translation prompt toolbar is used for inquiring whether a user needs to trigger a mail text translation operation. The translation prompt toolbar may include a full-text translation toolbar and a real-time translation toolbar. The translation prompt toolbar includes a mail text translation control. The unmatched original language and default language means that the language with the highest proportion in the mail text is unmatched with the default language. For example, the language with the highest percentage in the mail text is english, and the default language is chinese, i.e., the original language does not match the default language.

Specifically, the terminal acquires a default language and detects an original language of a mail text of the e-mail. And when the original language is not matched with the default language, displaying a translation prompt toolbar on the mail interface, wherein the translation prompt toolbar comprises a mail text translation control. In response to a mail text translation operation triggered in a translation prompt toolbar, a terminal acquires markup language data of an electronic mail. For example, when a mail is previewed and the original language does not match with the default language, a full-text translation toolbar is displayed, and the markup language data of the e-mail is acquired in response to a mail text full-text translation operation triggered in the translation prompt toolbar. Or when the mail is written, and the original language is not matched with the default language, displaying a real-time translation toolbar; and responding to the real-time translation operation of the mail text triggered in the real-time translation toolbar to acquire the markup language data of the electronic mail.

FIG. 10 is a diagram illustrating an interface including a translation prompt toolbar according to an embodiment. Take the default language as Chinese for example, and the original language in the figure is English. Then, when the original language "english" does not match the default language "chinese" while the mail preview is being performed, a translation prompting toolbar 1002 is displayed. The translation prompt toolbar comprises an 'immediate translation' control which can be used for triggering the full-text translation operation of the mail. The translation prompt toolbar is also used for displaying a query sentence of 'translating the mail'. In response to a full-text translation operation of the mail triggered in the translation prompt toolbar 1002, the terminal acquires markup language data of the electronic mail.

FIG. 11 is a schematic diagram of an interface including a translation prompt toolbar according to another embodiment. Take the default language as Chinese for example, and the original language in the figure is English. "Nice to meet you". When the original language "English" does not match the default language "Chinese", a translation prompt toolbar 1102 is displayed. And the real-time translation is opened and displayed on the translation prompt toolbar, the target language can be translated in real time only by inputting Chinese, and the writing of overseas mails is more convenient. The translation prompt toolbar 1102 includes an "open immediately" control. An "open immediately" control may be used to trigger a mail text real-time translation operation. In response to a real-time translation operation of a mail text triggered in the translation prompt toolbar 1102, the terminal acquires markup language data of an electronic mail. Since the original language of the text of the mail entered by the user is not the same as the default language, it is stated that the user may need to compose a foreign language mail, which may be slower than the Chinese mail. Then, in response to the real-time translation operation of the mail text, the user does not need to directly write the foreign language mail, only needs to input the text of the Chinese mail, and can display the translation text in the translation display area, so that the writing efficiency of the foreign language mail is improved.

The translation method of the electronic mail obtains the default language, detects the original language of the mail text of the electronic mail, displays the translation prompting toolbar when the original language is not matched with the default language, responds to the mail text translation operation triggered on the translation prompting toolbar, obtains the markup language data of the electronic mail, and can prompt a user to trigger the translation operation, so that the user can trigger the translation operation quickly, and the mail preview or mail writing efficiency is improved.

In one embodiment, detecting an original language of a mail text of an email includes: acquiring character codes corresponding to characters in a mail text; in the character coding, determining the proportion of the character coding in a character coding interval of a preset language; and when the proportion is larger than the preset proportion, determining the original language of the mail text of the electronic mail as the preset language.

Here, the character code may be GB2312, Unicode (Unicode), or the like, but is not limited thereto. Different character encoding sections represent different symbols or languages, and the like. For example, the language corresponding to the Unicode code in the [4E00,9FA5] interval is chinese. The predetermined language may be, but is not limited to, chinese, english, german, or french. Each word of the chinese text has a corresponding character encoding. English, German and French are based on word-defined character codes. The preset proportion is preset on the terminal. For example, the preset ratio may be 60%, 70%. the like is not limited thereto. The terminal may not encode the numbers or count into the scale.

Specifically, the terminal obtains a character code corresponding to each character in the mail text. In the character coding, the terminal determines the proportion of the character coding in the character coding interval of the preset language. When the ratio is larger than the preset ratio, for example, the terminal determines the ratio of the character code located in the Chinese character interval to the character code of the mail text. The numbers may or may not be encoded in the denominator. And when the proportion is larger than the preset proportion, the terminal determines the original language of the mail text as the preset language. Taking the preset language as Chinese as an example, in character encoding, the terminal determines the ratio of character encoding in the character encoding interval [4E00,9FA5] of Chinese. And when the proportion is more than 60% of the preset proportion, the terminal determines that the original language is the preset language.

In this embodiment, when the ratio is smaller than or equal to the preset ratio, the terminal determines that the original language of the email text of the email is not the preset language. For example, the original language may be English.

The translation method of the electronic mail obtains the character code corresponding to the character in the mail text; in the character coding, the proportion of the character coding in the character coding interval of the preset language is determined, and when the proportion is larger than the preset proportion, the original language of the mail text of the electronic mail is determined to be the preset language, so that the language of the mail text can be automatically detected, the language does not need to be input, and the mail processing efficiency is improved.

In one embodiment, replacing the mail text in the markup language data with the translated content to obtain the restructured markup language data includes: acquiring a mail picture based on a picture tag in markup language data; identifying an identification text and a corresponding text format from the mail picture; translating the recognition text to obtain a recognition text translation; and replacing the mail text in the markup language data with the translation content, and replacing the markup language corresponding to the picture tag with the markup language corresponding to the recognized text translation and the text format to generate the recombined markup language data.

Wherein the picture tag in the markup language data is used for marking the mail picture. For example, the picture tag may be < img >. The representation of the mail picture may be a mail picture path, such as a URL (Uniform Resource Locator), but is not limited thereto. The format of the mail picture is not limited, and for example, JPEG format (Joint Photographic Experts Group), png (Portable Network Graphics), bmp (Bitmap), and the like can be used without limitation. The text format may be, for example, a space between characters, a font size, a font style, a font color, and the like, but is not limited thereto. The markup language corresponding to the picture tag is the markup language including the picture tag and the mail picture path. The markup language corresponding to the recognized text translation and text format is the markup language that includes information for the recognized text translation and text format.

Specifically, the terminal obtains a mail picture path based on the picture tag in the markup language data, and obtains a mail picture according to the mail picture path. The terminal recognizes the Recognition text and the corresponding text format from the mail picture by means of OCR (Optical Character Recognition). And the terminal translates the recognition text to obtain a translation of the recognition text. And generating corresponding markup language data according to the recognized text translation and the corresponding text format. And the terminal replaces the mail text in the markup language data with the translation content, replaces the markup language corresponding to the picture label with the markup language corresponding to the recognized text translation and the text format, and generates the recombined markup language data.

In this embodiment, the server may obtain the email image based on the image tag in the markup language data, identify the identification text and the corresponding text format from the email image, translate the identification text to obtain an identification text translation, replace the email text in the markup language data with translation content, replace the markup language corresponding to the image tag with the markup language corresponding to the identification text translation and the text format, and generate the recombinant markup language.

In this embodiment, since the size of the picture may not match the default size of the translation display area of the email software, the terminal may adjust the arrangement of the recognized text translations according to the size of the translation display area to adapt to the size of the translation display area. As shown in fig. 4(b), The mail content in The original text display area 412 may be a picture, and since The english text is generally longer than The translated chinese text, The recognized english text and The arrangement manner are "The plane wave filed with Supplies managed by China-5.4mil lion masks", and "The plane is filled with chinese donations-540 wan muzzles" displayed in The translation display area may be displayed in one row.

In this embodiment, when it is recognized that the email picture further includes a picture Z, the terminal records a display position of the picture Z in the email picture, generates markup language data corresponding to the picture Z, and replaces a markup language corresponding to a picture tag with markup language data corresponding to the recognized text translation, the recognized text format, and the picture Z. For example, the picture in fig. 4(b) is after "bbbbbbbb Public Interest Foundation", then the picture is shown after "bbbbbbbb Public Interest fund donation to a portion of african medical supplies". Alternatively, the terminal may also recognize a paragraph mark, which may be, for example, a line feed mark, a space before a paragraph, and the like, and record which paragraph mark the picture is under to record the display position.

According to the translation method of the electronic mail, the mail picture is obtained based on the picture tag, the identification text and the corresponding text format in the mail picture are identified, the identification text translation is obtained through translation, the markup language corresponding to the original picture tag is replaced by the markup language corresponding to the identification text translation and the text format, namely when the electronic mail is displayed, the mail picture is replaced by the identification text translation carrying the text format, the format of the identification text translation corresponding to the mail picture can be guaranteed not to be changed, and user operation is simplified.

In one embodiment, as shown in fig. 12(a), a schematic diagram of a mail interface at a mobile phone end before translation in one embodiment is shown. Triggering mail text translation operation, namely 'translating mail' operation in a figure, on a mail interface of a mobile phone end, obtaining mark language data of an electronic mail by a terminal, wherein the mark language data comprises mail text marked by a partition label, sending the mark language data to a server so that the server extracts the mail text from the mark language data through the partition label, translating the mail text to obtain translation content, and replacing the mail text in the mark language data with the translation content to obtain recombined mark language data. And the terminal receives the recombined markup language data returned by the server, analyzes the recombined markup language data, and displays the mail content obtained by analysis on a mail interface, wherein the mail content comprises translation content. Fig. 12(b) is a schematic diagram of a mail interface of the translated mobile phone end in an embodiment. Fig. 12(b) includes the mail content obtained by parsing, and the mail content obtained by parsing includes the translated content and the corresponding font style. By clicking on the "original text" control in fig. 12(b), the original text can be viewed.

In one embodiment, as shown in FIG. 13, a system architecture diagram of a method for translating mail in one embodiment is shown. The terminal starts the Foxmail program. The Foxmail provides three functions of mail word-taking translation, mail full-text translation and mail real-time translation. In order to realize the full-text translation function of the email, the terminal responds to email text translation operation triggered by an email interface of the email, and both the terminal and the server acquire markup language data of the email, namely, HTML data of the email, wherein the markup language data comprises email text marked by a partition tag. And sending the markup language data to a server so that the server analyzes the HTML data of the mail, extracting a mail text from the markup language data through the partition tag, translating the mail text to obtain translation content, and replacing the mail text in the markup language data with the translation content to obtain recombined markup language data, namely assembling the HTML. And the terminal receives the restructuring markup language data returned by the server, analyzes the restructuring markup language, and displays the mail content obtained by analysis on a mail interface, wherein the mail content comprises translation content. In order to realize the function of mail word-taking translation, a target text is obtained in response to a text selection operation triggered in an interface, wherein the target text is a part of a mail text; and in response to a local text translation operation triggered on the mail interface, sending a target text to the server, receiving a translation text for the target text sent by the server, and displaying the translation text. In order to realize the real-time translation function of the email, the terminal responds to the real-time translation operation of the email text triggered on the email interface of the email and triggers a cycle timer; detecting the mail content in the original text display area every time when the cycle timer counts a preset time; and when the change of the mail content of the original text display area in the mail interface is detected, acquiring the markup language data of the electronic mail corresponding to the original text display area. When the Foxmail software previews the foreign language mails or writes the foreign language mails, the user can respectively finish the targeted translation of the mail sentences, the full mails and the key-in contents during the writing of the mails through the functions of word-taking translation, full-text translation and real-time translation. The essence of the mails in Foxmail is HTML data, and in order to ensure the original format of the mails, four steps of HTML analysis, text extraction, text translation and HTML assembly are required. Because the computing resources of the client are limited, the four steps are handed to a server with strong computing power to complete; the client sends the HTML data of the mail to be translated to the server, the server extracts the text to be translated through HTML analysis and translates the text, and then replaces the original HTML label content with the translated text to form new HTML data and returns the new HTML data to the client; and under the condition of keeping the original format, the client displays the mail translation to the user.

In an embodiment, as shown in fig. 14, a schematic flowchart of a method for translating an email in another embodiment, taking an example that the method is applied to a server, includes:

and 1402, receiving markup language data of the e-mail sent by the terminal, wherein the markup language data comprises mail texts marked by the partition tags.

The Markup Language data of the e-mail may specifically be HTML (Hyper Text Markup Language) data of the e-mail, XML (Extensible Markup Language) data of the e-mail, XHTML (Extensible Hyper Text Markup Language) of the e-mail, or the like, but is not limited thereto. The partition label is used for marking the mail text and distinguishing the mail text from other contents of the e-mail. In the HTML data, the partition tag may specifically be a < div > tag. Mail text refers to text that does not carry a format, i.e., contains only text.

Specifically, the server receives markup language data of an electronic mail transmitted by the terminal, the markup language data including a mail text tagged by a zone tag.

In step 1404, mail text is extracted from the markup language data by the partition tag, and the mail text is translated to obtain translated contents.

Specifically, because the HTML data includes a large number of tags, and there are recursions within the tags that include other tags. Therefore, when extracting the mail text, the HTML data needs to be parsed into a DOM (Document Object Model) tree. Wherein the DOM tree is a data structure. And traversing the tags one by one in the DOM tree, ignoring the tags and the content in the tags, and leaving the mail text. Such as:

< div > < br > < div > < niuh id ═ FMSigSeperator "style ═" WIDTH:210 px; HEIGHT, 1px, "color ═ b5c4df," size ═ 1, "align ═ left" > < div > < span id ═ FoxFrOMNAME "> < div style ═ MARGIN, 10 px; FONT-FAMILY verdana; FONT-SIZE 10pt "> < div > curraineliu (Liu Dongqiong) </div > </div > </span > </div >)

Wherein:

< div > < br > < div > hello </div >: all tags will be ignored and the remaining "hello" is the mail text.

< hr id ═ FMSigSeperator "style ═ WIDTH:210 px; the hr label is ignored, and the content in the content data label in the tip bracket is ignored.

< div > currtaineliu (Liu Dong Qiong) </div >: the < div > tag will be ignored and the remaining "currainliu liu yield" is the text.

The translation function relates to a deep learning technology, and the complex translation function is difficult to complete by a client. The Foxmail will send the markup language data of the e-mail to the server. The server calls the trained translation model to perform translation.

And step 1406, replacing the mail text in the markup language data with the translation content to obtain the recombined markup language data.

Specifically, the server replaces the mail text in the markup language data with the translation content, and the other data in the markup language data are not changed, so that the recombined markup language data is obtained.

The mail content comprises translation content and a format corresponding to the translation content. And the format corresponding to the translation content is the format corresponding to the mail text. The format of the translated content may specifically be, but not limited to, font size, whether to add underlining, whether to add bold, whether to italics, whether to add emoticons, and the like.

Step 1408, sending the restructured markup language data to the terminal, so that the terminal parses the restructured markup language data and displays the parsed mail content, wherein the mail content includes the translated content.

Specifically, the server sends the restructuring markup language data to the terminal, so that the terminal parses the restructuring markup language data and displays the parsed mail content, wherein the mail content comprises the translation content.

The translation method of the E-mail has limited terminal computing resources, so that the translation work is finished by a server with stronger computing power, the markup language data of the E-mail sent by the terminal is received, the markup language data comprises the mail text marked by the partition label, the mail text is extracted from the markup language data by the partition label, the mail text is translated to obtain the translation content, the mail text in the markup language data is replaced by the translation content to obtain the recombined markup language data, the translation function is finished by the server, the computing resource consumption of the terminal can be reduced, the server only translates the mail text in the markup language data, but not translates other contents, so that the server only translates the mail text, does not do any modification on other data in the markup language data of the E-mail, and the displayed translated mail content can not lose the original text, the operation steps of the user are simplified, translation can be carried out in an e-mail program, and the efficiency of writing or previewing foreign language mails by the user is improved.

It should be understood that although the various steps in the flowcharts of fig. 2, 9 and 14 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2, 9 and 14 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps or stages.

In one embodiment, as shown in fig. 15, there is provided an apparatus for translating an email, which may be a part of a computer device using a software module or a hardware module, or a combination of the two, the apparatus specifically includes: an acquisition module 1502, a mail text translation module 1504, and a display module 1506, wherein:

an obtaining module 1502, configured to obtain markup language data of an email in response to a mail text translation operation triggered on a mail interface of the email, where the markup language data includes a mail text marked by a partition tag;

the mail text translation module 1504 is used for sending the markup language data to the server so that the server extracts the mail text from the markup language data through the partition label, translates the mail text to obtain translation content, and replaces the mail text in the markup language data with the translation content to obtain recombined markup language data;

a restructuring markup language data receiving module 1506, configured to receive restructuring markup language data returned by the server;

and the display module 1506 is configured to parse the reassembly markup language data and display the email content obtained through parsing on the email interface, where the email content includes the translation content.

The translation device of the electronic mail extracts the mail text from the mark language data by using the characteristic of the mark language data in response to the mail text translation operation and translates the mail text to obtain the translation content, replaces the mail text in the mark language data with the translation content, namely only the mail text is translated, and other contents in the mark language data are not changed, namely only a text part is changed compared with the mail content of the original text in the mail content analyzed from the recombined mark language data, so that the translated mail content does not lose the original text style, the operation steps of a user are simplified, the translation can be realized in an electronic mail program, and the efficiency of writing or previewing foreign language mails by the user is improved.

In one embodiment, the display module 1506 is further configured to display the email content of the email in an original text display area in the email interface; and analyzing the recombined markup language data, and displaying the mail content obtained by analysis in a translation display area in the mail interface.

According to the translation device of the electronic mail, the mail content of the electronic mail is displayed in the original text display area in the mail interface, the markup language data are analyzed and recombined, the mail content obtained through analysis is displayed in the translation display area in the mail interface, and the original text and the translation can be displayed on the interface more intuitively and simultaneously.

In one embodiment, the translation device of the e-mail further comprises a translation modification module, wherein the translation modification module is used for setting a translation display area to be in an editing state in response to a translation modification operation triggered on the mail interface; and modifying the translation content according to the editing operation of the translation display area.

The translation device of the electronic mail responds to the translation modification operation triggered on the mail interface, sets the translation display area to be in an editing state, modifies the translation content according to the editing operation on the translation display area, provides a translation modification function, can modify the translation when the translation does not meet the expected requirement, and improves the correctness of the replaced translation.

In one embodiment, the translation of the mail text is performed by a translation model on the server. The translation device of the e-mail also comprises a reporting module which is used for reporting the modified translation content to the server so that the server updates the translation model based on the mail content before translation and the modified translation content.

The translation device of the electronic mail reports the modified translation content to the server, so that the server updates the translation model based on the mail content before translation and the modified translation content, more sample data can be acquired to train the translation model, and the translation accuracy of the translation model is improved.

In an embodiment, the obtaining module 1502 is configured to, in response to a real-time email text translation operation triggered on an email interface of an email, obtain markup language data of the email corresponding to an original text display area when email content in the original text display area in the email interface changes; the display module 1506 is configured to parse the received reassembly markup language data each time, and update and display the email content of the email obtained through parsing each time in a translation display area of the email interface.

The translation device of the electronic mail responds to the real-time translation operation of the mail text triggered on the mail interface of the electronic mail, when the mail content of the original text display area in the mail interface changes, the markup language data of the electronic mail corresponding to the original text display area is obtained, the received recombined markup language data is analyzed each time, the mail content of the electronic mail obtained by analysis each time is updated and displayed in the translation display area of the mail interface, the real-time translation effect can be achieved, the user experience is improved, when the mail of the original text display area in the mail interface changes, the markup language data of the electronic mail corresponding to the original text display area is obtained, and the network burden and the client computing burden can be reduced.

In one embodiment, the obtaining module 1502 is configured to trigger a cycle timer in response to a real-time email text translation operation triggered on an email interface of an email; detecting the mail content in the original text display area every time when the cycle timer counts a preset time; and when the mail content change in the original text display area is detected, acquiring the markup language data of the electronic mail corresponding to the original text display area.

The translation device of the electronic mail triggers the cycle timer in response to the real-time translation operation of the mail text triggered on the mail interface of the electronic mail, detects the mail content in the original text display area whenever the cycle timer counts the preset time length, acquires the markup language data of the electronic mail corresponding to the original text display area when detecting the change of the mail content in the original text display area, can achieve the real-time translation effect through the detection of the cycle timer and the mail content, and acquires the markup language data of the electronic mail corresponding to the original text display area only when the cycle timer is triggered and the mail in the original text display area changes in the mail interface, and can reduce the network burden and the calculation burden of a client.

In one embodiment, the translation device of the e-mail further comprises a translation replacing module, wherein the translation replacing module is used for replacing the mail content in the original text display area with the mail content in the translation display area in response to the mail content replacing operation triggered on the mail interface; and closing the translation display area.

The translation device of the electronic mail responds to the mail content replacement operation triggered on the mail interface, replaces the mail content in the original text display area with the mail content in the translation display area, and closes the translation display area, so that the mail content in the translation display area can be automatically displayed in the original text display area, and the translation display area is closed, and the operation is simpler and more convenient.

In one embodiment, the translation device of the e-mail further comprises a target text sending module and a translation text receiving module; the obtaining module 1502 is configured to obtain a target text in response to a text selection operation triggered in the email interface; the target text is a portion of the mail text; the target text sending module is used for responding to local text translation operation triggered on the mail interface and sending a target text to the server; the translation text receiving module is used for receiving translation texts for the target texts sent by the server; the display module 1506 is used to display the translated text.

The translation device of the electronic mail obtains the target text in response to the text selection operation triggered in the mail interface, the target text is a part of the mail text, the target text is sent to the server in response to the local text translation operation triggered in the mail interface, the translated text for the target text sent by the server is received, the translated text is displayed, generally in a word selection translation scene, the original text format, such as bolding, font color and the like, does not need to be displayed, and then the target text is sent, so that the efficiency of obtaining the translated text can be improved.

In one embodiment, the display module 1506 is configured to obtain coordinates of the target text corresponding to the email interface; determining a text size of the translated text; when the text size is in the size range supported by the floating window, displaying the floating window on the mail interface according to the coordinate and the text size, and displaying the translation text on the floating window; when the text size is larger than the maximum size of the size range, displaying a floating window on the mail interface according to the coordinates and the maximum size, adjusting the arrangement mode of the translated text, and displaying the adjusted translated text on the floating window; and when the text size is smaller than the minimum size of the size range, displaying a floating window on the mail interface according to the coordinates and the minimum size, and displaying the translation text on the floating window.

The translation device of the electronic mail acquires the coordinates of the target text which is equivalent to the mail interface, determines the text size of the translated text, and when the text size is in the size range supported by the floating window, displaying a floating window on the mail interface according to the coordinates and the text size, displaying the translated text on the floating window, and when the text size is larger than the maximum size of the size range, displaying a floating window on the mail interface according to the coordinates and the maximum size, adjusting the arrangement mode of the translation text, and displaying the adjusted translated text in the floating window, wherein when the text size is smaller than the minimum size of the size range, and displaying a floating window on the mail interface according to the coordinates and the minimum size, displaying the translated text on the floating window, adjusting the size of the floating window, the arrangement mode of the translated text and the like according to the text size of the translated text, and displaying the comparison result of the original translated text more intuitively in a floating window mode.

In one embodiment, the obtaining module 1502 is configured to obtain a default language; detecting the original language of a mail text of an electronic mail; when the original language is not matched with the default language, displaying a translation prompt toolbar; and responding to the mail text translation operation triggered in the translation prompt toolbar to acquire the mark-up language data of the electronic mail.

The translation device of the electronic mail obtains the default language, detects the original language of the mail text of the electronic mail, displays the translation prompting toolbar when the original language is not matched with the default language, responds to the mail text translation operation triggered on the translation prompting toolbar, obtains the markup language data of the electronic mail, and can prompt a user to trigger the translation operation, so that the user can trigger the translation operation quickly, and the mail preview or mail writing efficiency is improved.

In one embodiment, the obtaining module 1502 is configured to obtain a character code corresponding to a character in a text of a mail; in the character coding, determining the proportion of the character coding in a character coding interval of a preset language; and when the proportion is larger than the preset proportion, determining the original language of the mail text of the electronic mail as the preset language.

The translation device of the electronic mail acquires character codes corresponding to characters in a mail text; in the character coding, the proportion of the character coding in the character coding interval of the preset language is determined, and when the proportion is larger than the preset proportion, the original language of the mail text of the electronic mail is determined to be the preset language, so that the language of the mail text can be automatically detected, the language does not need to be input, and the mail processing efficiency is improved.

In one embodiment, the mail text translation module 1504 is used to obtain a mail picture based on a picture tag in markup language data; identifying an identification text and a corresponding text format from the mail picture; translating the recognition text to obtain a recognition text translation; and replacing the mail text in the markup language data with the translation content, and replacing the markup language corresponding to the picture tag with the markup language corresponding to the recognized text translation and the text format to generate the recombined markup language data.

According to the translation device of the electronic mail, the mail picture is obtained based on the picture tag, the identification text and the corresponding text format in the mail picture are identified, the identification text translation is obtained through translation, the markup language corresponding to the original picture tag is replaced by the markup language corresponding to the identification text translation and the text format, namely when the electronic mail is displayed, the mail picture is replaced by the identification text translation carrying the text format, the format of the identification text translation corresponding to the mail picture can be guaranteed not to be changed, and user operation is simplified.

In one embodiment, as shown in fig. 16, a block diagram of a translation apparatus for an email in another embodiment is shown. The apparatus may adopt a software module or a hardware module, or a combination of the two, as a part of the computer device, and specifically includes: a markup language data receiving module 1602, an extracting module 1604, a replacing module 1606, and a restructuring markup language data transmitting module 1608, wherein:

a markup language data receiving module 1602, configured to receive markup language data of an email sent by a terminal, where the markup language data includes email text marked by a partition tag;

an extracting module 1604, configured to extract the mail text from the markup language data through the partition label, and translate the mail text to obtain a translation content;

a replacing module 1606, configured to replace the email text in the markup language data with the translation content, so as to obtain recombinant markup language data;

a reassembly markup language data sending module 1608, configured to send the reassembly markup language data to the terminal, so that the terminal parses the reassembly markup language data and displays a mail content obtained through parsing; the mail content includes the translated content.

The translation device of the email has limited terminal computing resources, so that the translation work is finished by a server with stronger computing power, the markup language data of the email sent by the terminal is received, the markup language data comprises email texts marked by partition labels, the email texts are extracted from the markup language data by the partition labels, the email texts are translated to obtain translation contents, the email texts in the markup language data are replaced by the translation contents to obtain recombined markup language data, the translation function is finished by the server, the consumption of the computing resources of the terminal can be reduced, the server only translates the email texts in the markup language data, but not translates other contents, so that the server only translates the email texts, does not change other data in the markup language data of the email, and the translated email contents can not lose original text styles, the operation steps of the user are simplified, translation can be carried out in an e-mail program, and the efficiency of writing or previewing foreign language mails by the user is improved.

For the specific definition of the translation apparatus of the e-mail, reference may be made to the above definition of the translation method of the e-mail, which is not described herein again. The modules in the email translation apparatus may be implemented in whole or in part by software, hardware, and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.

In one embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 17. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a method of translating an email. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.

Those skilled in the art will appreciate that the architecture shown in fig. 17 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.

In one embodiment, a computer device is further provided, which includes a memory and a processor, the memory stores a computer program, and the processor implements the steps of the above method embodiments when executing the computer program.

In an embodiment, a computer-readable storage medium is provided, in which a computer program is stored which, when being executed by a processor, carries out the steps of the above-mentioned method embodiments.

It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.

The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.

The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

38页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:智能终端及其翻译方法、存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!