Translation method, electronic equipment and computer storage medium

By using word-level language detection technology and translation methods with different display methods in electronic devices, the problem of mistranslation and mistranslation in mixed language source text translation is solved, and rapid and accurate translation and improved user experience is achieved.

CN119918548APending Publication Date: 2025-05-02HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411803298.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-03-21
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

The existing translation functions are prone to mistranslation and mistranslation problems when dealing with source text in mixed languages, resulting in inaccurate translation results and poor user experience.

Method used

By implementing a translation method in an electronic device, word-level language detection technology is used to identify different languages ​​in the source text of mixed languages, and translate and display them separately, and highlight the content of different languages ​​in different display methods to realize the search-free function of "language dimension".

Benefits of technology

It realizes fast and accurate translation of mixed language source text, avoids mistranslation and mistranslation, and improves the user experience. Users can quickly locate the required content without comparing characters one by one.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119918548A_ABST
    Figure CN119918548A_ABST
Patent Text Reader

Abstract

The invention provides a translation method, electronic equipment and a computer storage medium. The method comprises the following steps: receiving a first input operation of a user; in response to the first input operation, a first text and a second text are displayed, the first text is a first language, the second text is a second language, and the first language is different from the second language; receiving a first translation request of a user; a first interface is displayed, the first interface comprises a third text and a fourth text, the third text and the fourth text are of a third language, the third language is different from the first language, the third text is obtained by translating the first text, the fourth text corresponds to the second text, and the display mode of the third text is different from the display mode of the fourth text. According to the method, the translation results of different language contents can be displayed in different display modes, a search-free function of language dimensions is realized, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

[0001] This application is a divisional application. The application number of the original application is 202310280352.6, and the original application date is March 21, 2023. The entire contents of the original application are incorporated into this application by reference. Technical Field

[0002] The present application relates to the field of computer technology, and in particular to a translation method, electronic equipment and computer storage medium. Background Art

[0003] Mobile phones, tablets and other terminals can provide a translation function, that is, translating the text entered or selected by the user (which can be called the source text) into a text in the target language and returning it to the user. However, this translation function is only applicable to the case where the source text is in a single language. When the source text is a mixed language, there will often be problems such as mistranslation and missing translation. For example, when the source text is a mixed language of English and German, the terminal may only translate the English content into Chinese content, but not the German content, that is, there is a problem of missing translation. Alternatively, the terminal will recognize the German content as English content and translate the German content in the same way as the English content, resulting in incorrect translation of the German content, that is, there is a problem of mistranslation. Therefore, the availability of the translation function is low and it is difficult to meet the needs of users. Summary of the invention

[0004] The present application discloses a translation method, an electronic device and a computer storage medium, which can quickly and accurately obtain the translation results corresponding to the source text of the mixed language, and display the translation results of the content in different languages ​​in different display modes, thereby realizing the search-free function of the "language dimension" and improving the user experience.

[0005] In a first aspect, the present application provides a translation method, applied to an electronic device, the method comprising: receiving a first input operation of a user; displaying a first text and a second text in response to the first input operation, wherein the first text is in a first language, the second text is in a second language, and the first language is different from the second language; receiving a first translation request of the user; displaying a first interface, the first interface comprising a third text and a fourth text, wherein the third text and the fourth text are in a third language, the third language is different from the first language, the third text is translated from the first text, the fourth text corresponds to the second text, and the display mode of the third text is different from the display mode of the fourth text.

[0006] In some examples, the display method includes at least one of the following: whether to highlight, font thickness, font size, font color, whether the font is italic, font type, whether it is underlined, whether the font has a background texture, the color of the font's background texture, the pattern of the font's background texture, whether there is a border around the font, the font's border shape, the font's border thickness, and the font's border color.

[0007] In the above method, for a mixed-language source text (including a first text and a second text in different languages), the electronic device can accurately obtain the translation results (including a third text and a fourth text) corresponding to the source text to avoid the problems of mistranslation and omission, and the electronic device will display the third text and the fourth text in the translation results in different display modes, so that the user does not need to compare the source text and the translation results character by character, and can quickly locate the third text corresponding to the first text, thereby realizing the "language dimension" free search function and effectively meeting the needs of users.

[0008] In a possible implementation, when the second language is the same as the third language, the fourth text is the same as the second text; when the second language is different from the third language, the fourth text is obtained by translating the second text.

[0009] In the above method, the source text includes a first text in a first language different from a third language, and a second text in a second language the same as the third language. The electronic device can automatically identify and translate the first text but not the second text, thereby avoiding missing the first text and wasting resources caused by translating the second text.

[0010] In a possible implementation, the first interface includes the first text and the second text, a display mode of the first text is the same as a display mode of the third text, and a display mode of the second text is the same as a display mode of the fourth text.

[0011] In the above method, when the electronic device displays the source text and the corresponding translation results, the display mode of the first text and the corresponding third text can be the same, and the display mode of the second text and the corresponding fourth text can be the same, which further improves the usability of the "language dimension" free search function, allowing users to quickly obtain the correspondence between the different language contents in the source text and the text in the translation results directly according to the display mode, further improving the efficiency of users in finding the required text.

[0012] In a possible implementation manner, the first interface includes information in the first language and the second language.

[0013] In the above method, the user can intuitively obtain the language information of the source text, avoiding the user from performing other operations to obtain the language information of the source text, reducing user operations and further improving the user experience.

[0014] In a possible implementation, the first interface includes information of the third language. In the above method, the user can intuitively obtain information of the target language (ie, the third language) to be translated, further improving the user experience.

[0015] In a possible implementation, the first interface includes a first control, and the first control is used to perform at least one of the following functions: copying the third text, saving the third text, and forwarding the third text.

[0016] In the above method, the electronic device can provide one-key copy, one-key save, one-key forwarding and other functions for the translation result (i.e., the third text) corresponding to the first text in the first language. The user does not need to manually select the third text and then perform other operations to implement functions such as copy / save / forward the third text, thereby reducing user operations and further improving the user experience.

[0017] In a possible implementation, receiving a first input operation from a user includes: receiving the first input operation from the user on a second interface, wherein the second interface includes a first instant messaging application interface, and the first input operation includes selecting text on the first instant messaging application interface.

[0018] In a possible implementation, receiving a first input operation from a user includes: receiving the first input operation from the user on a third interface, wherein the third interface includes a first translation application interface, and the first input operation includes inputting the first text and the second text in an input box of the first translation application interface.

[0019] In a possible implementation, receiving a first input operation from a user includes: receiving the first input operation from the user on a fourth interface, wherein the fourth interface includes a first browser application interface, the first browser application interface includes a fifth text, and the first input operation includes selecting the first text and the second text in the fifth text.

[0020] In the above method, mixed language translation and the "language dimension" search-free function can be implemented in different application interfaces and different application scenarios. It is not limited to a specific scenario, has universality, and has high functional availability.

[0021] In a possible implementation, the third text in the first interface is in a highlighted state, and the first text corresponding to the third text is determined from the first text in the first language and the second text in the second language according to a preset rule.

[0022] In a possible implementation manner, the first language is a minority language.

[0023] In the above method, the electronic device can automatically identify the content in the source text in the language that the user may be interested in, that is, the first text in the first language, and highlight the translation result corresponding to the first text (that is, the third text), so that the user can quickly obtain the third text, further improving the efficiency of the user in obtaining the required content and providing a better user experience.

[0024] In a possible implementation, after receiving the first translation request of the user, the method further includes: using a classifier to process the first text and the second text to obtain first information, wherein the first information indicates that the first text and the second text are in a mixed language; using a tagger to obtain the language of each symbol in the first text and the second text, and obtaining a word-level language detection result, wherein the word-level language detection result includes the first language and the second language, and the first interface is displayed according to the word-level language detection result.

[0025] In a possible implementation, the method further includes: receiving a second input operation of the user; displaying a sixth text in response to the second input operation; receiving a second translation request of the user; processing the sixth text using a classifier to obtain second information, wherein the second information indicates that the sixth text is in a fourth language, the second information is a sentence-level language detection result, and the tagger is not enabled when the information obtained by the classifier is a sentence-level language detection result; and displaying a seventh text, wherein the seventh text is obtained by translating the sixth text.

[0026] In the above method, the electronic device can first perform a fast sentence-level language detection through a classifier to determine whether the source text is a mixed language. Only when the judgment result is yes, accurate word-level language detection is performed, that is, a two-stage judgment is adopted. This can greatly improve the detection speed while ensuring the detection accuracy. Downstream translation based on such language detection results can effectively improve the downstream translation quality and translation speed.

[0027] In a second aspect, the present application provides an electronic device, including a transceiver, a processor and a memory; the memory is used to store a computer program, and the processor calls the computer program to execute the translation method provided in the first aspect of the present application and any one of the implementation methods of the first aspect.

[0028] In a third aspect, the present application provides a computer storage medium, which stores a computer program, and when executed by a processor, implements the translation method provided by the first aspect of the present application and any one of the implementation methods of the first aspect.

[0029] In a fourth aspect, the present application provides a computer program product. When the computer program product runs on an electronic device, the electronic device executes the translation method provided in the first aspect of the present application and any one of the implementations of the first aspect.

[0030] In a fifth aspect, the present application provides an electronic device, the electronic device comprising a method or device for executing any aspect or implementation of the present application. The above electronic device is, for example, a chip.

[0031] It should be understood that the description of technical features, technical solutions, beneficial effects or similar language in this application does not imply that all features and advantages can be realized in any single embodiment. On the contrary, it is understood that the description of features or beneficial effects means that specific technical features, technical solutions or beneficial effects are included in at least one embodiment. Therefore, the description of technical features, technical solutions or beneficial effects in this application does not necessarily refer to the same embodiment. Furthermore, the technical features, technical solutions and beneficial effects described in this application can also be combined in any appropriate manner. Those skilled in the art will understand that this application can be implemented without one or more specific technical features, technical solutions or beneficial effects of a specific embodiment. In other embodiments, additional technical features and beneficial effects can also be identified in specific embodiments that do not embody all embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0032] The following is an introduction to the drawings used in this application.

[0033] Figure 1 It is a hardware structure diagram of an electronic device provided by the present application;

[0034] Figure 2 It is a schematic diagram of the software architecture of an electronic device provided by the present application;

[0035] Figure 3 It is a schematic diagram of the software architecture of another electronic device provided by the present application;

[0036] Figure 4 It is a schematic diagram of the architecture of a multi-granularity language detection system provided by this application;

[0037] Figure 5 is a schematic diagram of a user interface provided by the present application;

[0038] Figure 6is a schematic diagram of another user interface provided by the present application;

[0039] Figure 7 is a schematic diagram of another user interface provided by the present application;

[0040] Figure 8 It is a flowchart of a translation method provided by this application;

[0041] Fig. 9 It is a flowchart of another translation method provided by this application. DETAILED DESCRIPTION

[0042] The technical solutions in the embodiments of the present application will be described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present application.

[0043] In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B. "And / or" in the text is only a description of the association relationship of associated objects, indicating that three relationships can exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.

[0044] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features.

[0045] In the embodiments of the present application, the words "exemplary" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs.

[0046] An electronic device may provide a function of translating a text input or selected by a user (i.e., the text to be translated, which may be referred to as the source text) into a text in a target language, which may be referred to as a translation function. In this application, a language may also be referred to as a language, a language type, a language type, etc. The current translation function may be implemented in the following two ways.

[0047] Method 1: First, sentence-level language detection technology is used to identify the source text. The language detection result obtained is the predicted language of the source text (only one). Then, the corresponding machine translation model is determined based on the language detection result, and the source text is used as the input of the machine translation model to obtain the output translation result. It should be noted that a machine model is used to translate text in one language, and different machine translation models are required to translate text in different languages.

[0048] Method 1 only considers the case where the source text is in a single language. When the source text is in mixed languages ​​(mixed languages, i.e. multiple languages), there will often be problems such as mistranslation and missing translation. For example, suppose the source text is a mixed language of Chinese and Korean: "User aaa Account: aaa123 Region: Hubei Wuhan Set notes and tags Friends permissions Moments 20 Video Number More information", Method 1 may not translate the Korean content (for example, when the target language is Chinese), and the translation result is consistent with the source text, that is, there is a problem of missing translation. For another example, assuming that the source text is a mixture of English and German (He turned around and asked: "Entschuldigen Sie, sprechen Sie Deutsch?" but passersby ignored him and walked straight ahead), Method 1 may recognize the German content in the source text as English content, and translate the German content in the same way as the English content, resulting in incorrect translation of the German content (for example, "Entschuldigen Sie, sprechen Sie Deutsch?" is translated as "Entschuldigen Sie, sprechen Sie Deutsch"), that is, there is a problem of mistranslation. Therefore, the translation quality is poor and it is difficult to meet the needs of users.

[0049] Method 2: First, the source text is recognized using word-level language detection technology. The language detection result obtained is the predicted language (one or more) of each character (i.e., word, phrase or punctuation mark) in the source text. Then, the source text is split according to the language, and the text belonging to the same language is used as the input of the machine translation model corresponding to the language to obtain the output. Finally, the output of at least one machine translation model is combined to obtain the translation result. For example, assuming that the source text is a mixture of English and German (He turned around and asked:"Entschuldigen Sie,sprechen Sie Deutsch?"but passersby ignored him and walked straight ahead.), the language detection result is: the language of characters 0-5 (i.e., He turned around and asked:) and characters 15-23 (i.e., but passersbyignored him and walked straight ahead.) is English, and the language of characters 6-14 (i.e., "Entschuldigen Sie,sprechen Sie Deutsch?") is German. Therefore, characters 0-5 and characters 15-23 will be sent to the corresponding machine translation model for English for translation, and characters 6-14 will be sent to the corresponding machine translation model for German for translation.

[0050] Method 2 only considers the case where the source text is in mixed languages. When the source text is in a single language, Method 2 still needs to perform language detection on each character in the source text. This not only fails to improve the translation quality, but also greatly increases the computing cost, resulting in a significant reduction in the translation speed. In actual translation scenarios, the case where the source text is in a single language is more common than the case where the source text is in mixed languages. Therefore, the cost of using Method 2 is far greater than the benefit, and the usability of the translation function is poor.

[0051] In method one and method two, when the source text is in mixed languages, when the electronic device displays the translation results, the texts in different languages ​​are displayed in the same way, but the user may only want to obtain the content in one of the languages. The user often needs to compare the source text and the translation results character by character, which can easily make the user dizzy and unable to find the required translation content, seriously affecting the user experience.

[0052] The present application provides a translation method, which is applied to an electronic device. The electronic device can first determine whether a source text is a single language or a mixed language. When the source text is a single language, the language detection result of the source text can be directly obtained based on the determination result. When the source text is a mixed language, the language detection result is obtained using word-level language detection technology, and then translation is performed based on the obtained language detection result. It can be understood that when the source text is a single language, the sentence-level language detection technology is used, and when the source text is a mixed language, the word-level language detection technology is used. This can greatly improve the translation speed while ensuring the translation quality.

[0053] Furthermore, for mixed-language source texts, the electronic device can use different display methods to display content in different languages ​​when displaying the translation results. For example, for source texts including content in two languages, the electronic device can highlight (e.g., highlight) the translation result of the content in one of the languages ​​when displaying the translation results. The content in this language can be understood as the content in the language that the user may be interested in / required by the electronic device (which may be called the language of interest content) that is automatically recognized by the electronic device. In other words, the electronic device provides a "language dimension" free search function, allowing users to quickly obtain the content they need.

[0054] Therefore, the present application can solve the technical problems existing in the above-mentioned methods 1 and 2, meet the needs of users in translation scenarios, and improve the usability of the translation function.

[0055] "Highlighting" in this application may be, but is not limited to, highlighting, bold font display, italic font display, underlining, background texture, borders such as circles or rectangles around characters, font color different from the font color of other texts, font type different from the font type of other texts (for example, Kaiti and Songti belong to different font types), font size different from the font size of other texts, etc.

[0056] In the present application, the electronic device may be a mobile phone, a tablet computer, a handheld computer, a desktop computer, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a cellular phone, a personal digital assistant (PDA), as well as smart home devices such as smart TVs and smart cameras, wearable devices such as smart bracelets, smart watches, and smart glasses, extended reality (XR) devices such as augmented reality (AR), virtual reality (VR), and mixed reality (MR), in-vehicle devices or smart city devices. The embodiments of the present application do not impose any special restrictions on the specific types of electronic devices.

[0057] Figure 1 A schematic diagram of the hardware structure of an electronic device 100 is exemplarily shown.

[0058] It should be understood that Figure 1 The electronic device 100 shown is only one example of an electronic device, and the electronic device 100 may have more or fewer components than shown in the figure, may combine two or more components, or may have a different configuration of components. Figure 1 The various components shown in the EMBODIMENTS 2000 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.

[0059] like Figure 1As shown, the electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0060] The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Among them, different processing units may be independent devices or integrated into one or more processors. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.

[0061] The processor 110 may also be provided with a memory for storing instructions and data. In one embodiment, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0062] In one embodiment, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0063] The charging management module 140 is used to receive charging input from the charger. While the charging management module 140 is charging the battery 142, it can also power the electronic device 100 through the power management module 141. The power management module 141 is used to connect the battery 142, the charging management module 140 and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140, and powers the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160.

[0064] The wireless communication function of the electronic device 100 can be implemented by antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modulation and demodulation processor and baseband processor. Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in the electronic device 100 can be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antenna. For example, antenna 1 can be reused as a diversity antenna of a wireless local area network. In another embodiment, the antenna can be used in combination with a tuning switch.

[0065] The mobile communication module 150 can provide wireless communication solutions including second generation (2G) / third generation (3G) / fourth generation (4G) / fifth generation (5G) / sixth generation (6G) applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, and filter, amplify and process the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and convert it into electromagnetic waves for radiation through the antenna 1. In one embodiment, at least some of the functional modules of the mobile communication module 150 can be set in the processor 110. In one embodiment, at least some of the functional modules of the mobile communication module 150 can be set in the same device as at least some of the modules of the processor 110.

[0066] The modem processor may include a modulator and a demodulator. Among them, the modulator is used to modulate the low-frequency baseband signal to be sent into a medium-high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After the low-frequency baseband signal is processed by the baseband processor, it is passed to the application processor. The application processor outputs a sound signal through an audio device (not limited to a speaker 170A, a receiver 170B, etc.), or displays an image or video through a display screen 194. In one embodiment, the modem processor may be an independent device. In another embodiment, the modem processor may be independent of the processor 110 and be set in the same device as the mobile communication module 150 or other functional modules.

[0067] The wireless communication module 160 can provide wireless communication solutions including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), infrared (IR), etc., which are applied to the electronic device 100. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2, modulates the frequency of the electromagnetic wave signal and performs filtering, and sends the processed signal to the processor 110. The wireless communication module 160 can also receive the signal to be sent from the processor 110, modulate the frequency of it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2.

[0068] In one embodiment, the antenna 1 of the electronic device 100 is coupled to the mobile communication module 150, and the antenna 2 is coupled to the wireless communication module 160, so that the electronic device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technology may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technology. The GNSS may include a global positioning system (GPS), a global navigation satellite system (GLONASS), a Beidou navigation satellite system (BDS), a quasi-zenith satellite system (QZSS) and / or a satellite based augmentation system (SBAS).

[0069] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0070] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In one embodiment, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0071] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0072] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, etc. of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In one embodiment, the ISP can be set in the camera 193.

[0073] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. The photosensitive element can be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the optical signal into an electrical signal, and then passes the electrical signal to the ISP to be converted into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In one embodiment, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.

[0074] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0075] The internal memory 121 can be used to store computer executable program codes, which include instructions. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data created during the use of the electronic device 100 (such as audio data, a phone book, etc.), etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc. The processor 110 executes various functional applications and data processing of the electronic device 100 by running instructions stored in the internal memory 121, and / or instructions stored in a memory provided in the processor.

[0076] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0077] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In one embodiment, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.

[0078] The speaker 170A, also called a "speaker", is used to convert an audio electrical signal into a sound signal. The electronic device 100 can listen to music or listen to a hands-free call through the speaker 170A.

[0079] The receiver 170B, also called a "earpiece", is used to convert audio electrical signals into sound signals. When the electronic device 100 receives a call or voice message, the voice can be received by placing the receiver 170B close to the human ear.

[0080] Microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can speak by approaching the microphone 170C with his mouth to input the sound signal into the microphone 170C. The electronic device 100 can be provided with at least one microphone 170C.

[0081] The earphone jack 170D is used to connect a wired earphone.

[0082] The pressure sensor 180A is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In one embodiment, the pressure sensor 180A can be set on the display screen 194. There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, etc. A capacitive pressure sensor can be a parallel plate including at least two conductive materials. When a force acts on the pressure sensor 180A, the capacitance between the electrodes changes. The electronic device 100 determines the intensity of the pressure based on the change in capacitance. When a touch operation acts on the display screen 194, the electronic device 100 detects the intensity of the touch operation based on the pressure sensor 180A. The electronic device 100 can also calculate the touch position based on the detection signal of the pressure sensor 180A. In one embodiment, touch operations acting on the same touch position but with different touch operation intensities can correspond to different operation instructions.

[0083] The gyro sensor 180B may be used to determine the motion posture of the electronic device 100 .

[0084] The air pressure sensor 180C is used to measure air pressure.

[0085] The magnetic sensor 180D includes a Hall sensor, and the electronic device 100 can detect the opening and closing of the flip leather case by using the magnetic sensor 180D.

[0086] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes).

[0087] The distance sensor 180F is used to measure the distance.

[0088] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector such as a photodiode.

[0089] The ambient light sensor 180L is used to sense the brightness of ambient light.

[0090] The fingerprint sensor 180H is used to collect fingerprints.

[0091] The temperature sensor 180J is used to detect the temperature.

[0092] The touch sensor 180K is also called a "touch control device". The touch sensor 180K can be set on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also called a "touch control screen". The touch sensor 180K is used to detect touch operations acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194. In another embodiment, the touch sensor 180K can also be set on the surface of the electronic device 100, which is different from the position of the display screen 194.

[0093] Bone conduction sensor 180M can obtain vibration signals.

[0094] The key 190 includes a power key, a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.

[0095] Motor 191 can generate vibration prompts.

[0096] Indicator 192 may be an indicator light, which may be used to indicate charging status, power changes, messages, missed calls, notifications, etc.

[0097] The SIM card interface 195 is used to connect a SIM card.

[0098] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture, or a cloud architecture. For example, the software system of the layered architecture may be an Android system, or a Harmony operating system (OS), or other software systems. The embodiment of the present application takes the Android system of the layered architecture as an example to illustrate the software structure of the electronic device 100.

[0099] Figure 2 A schematic diagram of a software architecture of an electronic device 100 is exemplarily shown.

[0100] The layered architecture divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In one embodiment, the Android system is divided into four layers, from top to bottom: the application layer, the application framework layer, the Android runtime and system library, and the kernel layer.

[0101] The application layer can include a series of application packages.

[0102] like Figure 2As shown, the application package may include applications such as camera, calendar, music, gallery, short message, call, navigation, translation, browser, etc. The translation in this application can be an independent application or a functional module integrated in other applications, which is not limited in this application. The application in this application can also be replaced by other forms of software such as mini-programs and atomic services.

[0103] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.

[0104] like Figure 2 As shown, the application framework layer may include a window manager, a content provider, a view system, a phone manager, a resource manager, a notification manager, and the like.

[0105] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.

[0106] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.

[0107] The view system includes visual controls, such as controls for displaying text, controls for displaying images, etc. The view system can be used to build applications. A display interface can be composed of one or more views. For example, a display interface including a text notification icon can include a view for displaying text and a view for displaying images.

[0108] The phone manager is used to provide communication functions of the electronic device 100, such as management of call status (including connecting, hanging up, etc.).

[0109] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.

[0110] The notification manager enables applications to display notification information in the status bar, which can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, the notification manager is used to notify download completion, message reminders, etc. The notification manager can also be a notification that appears in the top status bar of the system in the form of a chart or scroll bar text, such as a notification of an application running in the background, or a notification that appears on the screen in the form of a dialog window. For example, a text message is prompted in the status bar, a prompt sound is emitted, the electronic device 100 vibrates, an indicator light flashes, etc.

[0111] Android Runtime includes core libraries and virtual machines. Android runtime is responsible for scheduling and management of the Android system.

[0112] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.

[0113] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.

[0114] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.

[0115] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.

[0116] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.

[0117] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0118] A 2D graphics engine is a drawing engine for 2D drawings.

[0119] The kernel layer is the layer between hardware and software. The kernel layer contains at least display driver, camera driver, audio driver, and sensor driver.

[0120] The following is an illustrative description of the workflow of the software and hardware of the electronic device 100 in conjunction with a translation scenario.

[0121] When the touch sensor 180K receives a touch operation, the corresponding hardware interrupt is sent to the kernel layer. The kernel layer processes the touch operation into an original input event (including touch coordinates, timestamp of the touch operation and other information). The original input event is stored in the kernel layer. The application framework layer obtains the original input event from the kernel layer and identifies the control corresponding to the input event. For example, if the touch operation is a touch single-click operation and the control corresponding to the single-click operation is a translation control of the translation application, the translation application calls the interface of the application framework layer, translates the source text entered by the user in the input box of the translation application and obtains the text in the target language (i.e., the translation result), and then controls the display driver by calling the kernel layer to display the text in the target language through the display screen 194.

[0122] Figure 3 A schematic diagram of the software architecture of another electronic device 100 is shown as an example.

[0123] like Figure 3 As shown, the electronic device 100 may include a multi-granularity language detection system 210, a point-to-point recommendation system 220, a translation system 230, and a display system 240. The translation system 230 may include N translation systems, any one of which may be represented as a translation system i, and the translation system i is used to translate text in the corresponding language i, i is a positive integer less than or equal to N, and N is a positive integer greater than 1.

[0124] The multi-granular language detection system 210 can be used to identify the language of the source text input or selected by the user. The multi-granular language detection system 210 can first determine whether the source text is a single language or a mixed language, and then select whether to perform word-level language detection on the source text based on the determination result to obtain the language of the source text, and finally select the next level system to receive the source text based on the language of the acquired source text. Figure 3 In the case 1 shown, when the multi-granularity language detection system 210 recognizes that the source text is a single language, the language of the entire source text can be directly identified. There is at most one language identified, and the recognition result can be called a sentence-level language detection result. After the multi-granularity language detection system 210 obtains the sentence-level language detection result, the source text can be sent to the translation system in the translation system 230 corresponding to the sentence-level language detection result. Figure 3 Taking the sentence-level language detection result as language N as an example, the multi-granularity language detection system 210 will send the source text to the translation system N for translating language N. Figure 3In the case 2 shown, when the multi-granularity language detection system 210 recognizes that the source text is a mixed language, it can perform word-level language detection on the source text, that is, identify the language of each character (that is, word, phrase or punctuation mark) in the source text. There is at least one language identified, and the recognition result can be called the word-level language detection result. After the multi-granularity language detection system 210 obtains the word-level language detection result, it can send the source text and the word-level language detection result together to the point-to-point recommendation system 220 for processing.

[0125] The click recommendation system 220 can be used to identify the content in the source text in the language that the user may be interested in (which may be referred to as the language of interest content). The click recommendation system 220 can identify the content in at least one language that the user may be interested in (i.e., the language of interest content) from the content in multiple languages ​​included in the source text according to preset rules, based on the word-level language detection results sent by the multi-granularity language detection system 210, the target language, and the pre-stored language category information. The content in the source text other than the language of interest content can be referred to as non-language content. For specific examples, see the following Figure 8 S104-S109 in. Among them, the translation function of the electronic device 100 is to translate the source text into a text in a target language, and the target language can be preset by the electronic device 100 or set by the user. The language category information can include, but is not limited to, the classification of languages ​​on the Internet, such as whether it is classified as a small language. After the recommendation system 220 recognizes the content of the language of interest, the content of the language of interest can be sent to the corresponding translation system in the translation system 230 according to the language of the content of the language of interest. When the content of the language of interest includes content in multiple languages, the content of different languages ​​in the content of the language of interest will be sent to different translation systems in the translation system 230 for processing. In one embodiment, the recommendation system 220 can also send the content of the language of non-interest to the corresponding translation system in the translation system 230 according to the language of the content of the language of non-interest. When the content of the language of non-interest includes content in multiple languages, the content of different languages ​​in the content of the language of non-interest will be sent to different translation systems in the translation system 230 for processing.

[0126] The translation system 230 can be used to receive a source text and output a translation result of the source text to the display system 240. Any one of the translation systems 230 (translation system i) can be used to receive and translate a text in language i. Figure 3 In the case 2 shown (i.e. the source text is a mixed language), the translation system 230 can also be used to recombine the translation results output by multiple translation systems, i.e. arrange and combine them according to the arrangement of characters in the source text, and obtain a translation result consistent with the format of the source text.

[0127] The display system 240 can be used to display the translation results of the source text. Figure 3 In the case 2 shown (i.e. the source text is in mixed languages), the display system 240 can display the translation results of the content in the language of interest and the translation results / content in the language of non-interest in different display modes, for example, highlighting the translation results of the content in the language of interest. In the case where the recommendation system 220 sends the content in the language of non-interest to the translation system 230 for translation, the display system 240 displays the translation results of the content in the language of non-interest, and in the case where the content in the language of non-interest is not translated, the display system 240 displays the content in the language of non-interest.

[0128] In one embodiment, the electronic device 100 may further include an interaction module, which may be used to receive user operations on translation results of content in a language of interest displayed by the display system 240, and trigger copying, forwarding, and saving functions, etc. for the translation results based on the user operations.

[0129] Next, we will introduce Figure 3 The architecture and processing of the multi-granularity language detection system 210 are shown.

[0130] Figure 4 The schematic diagram of the architecture of a multi-granularity language detection system 210 in an electronic device 100 is exemplarily shown.

[0131] Figure 4 The multi-granularity language detection system 210 shown may be constructed based on a deep learning model and trained using a stochastic gradient descent method through multi-task self-supervised learning.

[0132] like Figure 4 As shown in (A) and (B), the multi-granularity language detection system 210 may include a language model 211, a classifier 212, and a tagger 213. The language model 211 may be a BERT model, which may be used to obtain a high-dimensional representation of the input content. The classifier 212 may be used to determine whether the source text is a single language or a mixed language. The tagger 213 may be used to identify the language of each character (i.e., word, phrase, or punctuation mark) in the source text.

[0133] Next, the processing of the multi-granularity language detection system 210 is described by assuming that the source text is a text of length T (including T characters). The source text can be represented as W = {w t |t=1,…,T},w t The tth character in the source text from the front to the back.

[0134] First, if Figure 4As shown in (A) and (B), the language model 211 can receive the source text W and the preset detection characters [CLS] as input, and for each character w in the source text t And the detected characters [CLS] are represented in high dimensions, and the corresponding latent vector is output: the latent vector H corresponding to the source text = {h t |t=1,…,T} and the latent vector h corresponding to the detected character [CLS] , where h t Yes t The corresponding latent vector. The detection character [CLS] can be a character added before the source text W to determine whether the source text is a single language or a mixed language.

[0135] Then, if Figure 4 As shown in (A) and (B), the latent vector h corresponding to the detected character [CLS] output by the language model 211 [CLS] can be input to the classifier 212, which can classify the [CLs] Determine whether the source text W is a single language or a mixed language, and output a corresponding determination result. The determination result output by the classifier 212 can be used to determine whether to enable the tagger 213.

[0136] like Figure 4 In case 1 shown in (A), when the classifier 212 determines that the source text W is a single language, the identifier of the language of the entire source text (i.e., the sentence-level language detection result) can be directly output. For example, the identifier of English is [EN], the identifier of German is [DE], and the identifier of Chinese is [ZH]. The identifiers of other languages ​​are similar and are not listed one by one. Figure 4 (A) is illustrated by taking the sentence-level language detection result of English as an example. In case 1, the tagger 213 is not enabled. Therefore, even if the tagger 213 receives the latent vector H corresponding to the source text output by the language model 211, it will not process it. Figure 4 The tagger 213 shown in (A) is gray, indicating that it is not enabled. Therefore, in case 1, the output of the multi-granularity language detection system 210 is the output of the classifier 212, that is, the sentence-level language detection result.

[0137] like Figure 4 In case 2 shown in (B), when the classifier 212 determines that the source text W is a mixed language, it can output a preset mixed symbol [MIX], which indicates that the source text is a mixed language. In this case, the tagger 213 will be enabled. After the classifier 202 outputs the mixed symbol [MIX], the tagger 213 can identify the language of each character in the source text according to the input content (i.e., the latent vector H corresponding to the source text output by the language model 211) and output the language of each character in the source text (i.e., the word-level language detection result), which can be represented as U = {u t|t=1,…,T}, where u t Yes t The description of the language identifier is similar to the description of the language identifier output by the above classifier 212, and will not be repeated. Therefore, in case 2, the output of the multi-granularity language detection system 210 is the output U of the tagger 213, that is, the word-level language detection result.

[0138] In case 1, the multi-granularity language detection system 210 performs a fast sentence-level language detection process (implemented by the classifier 212) but does not perform a word-level language detection process (the tagger 213 is not enabled). In case 2, the multi-granularity language detection system 210 first performs a fast sentence-level language detection process (implemented by the classifier 212) and then performs an accurate word-level language detection process (implemented by the tagger 213). Figure 4 The multi-granularity language detection system 210 shown utilizes a deep learning model to simultaneously implement sentence-level language detection and word-level language detection, and can output sentence-level language detection results or multi-granularity language detection results as appropriate.

[0139] Figure 4 The multi-granularity language detection system 210 shown can first perform a fast sentence-level language detection to determine whether the source text is a mixed language, and only when the judgment result is yes, perform accurate word-level language detection, that is, a two-stage judgment is adopted. This can greatly improve the detection speed while ensuring the detection accuracy. Downstream translation based on such language detection results can effectively improve the downstream translation quality and translation speed.

[0140] Understandably, Figure 4 The described architecture and processing process do not constitute a specific limitation on the multi-granularity language detection system 210. The multi-granularity language detection system 210 in the embodiments of the present application may include but is not limited to any system, module, deep learning model and / or statistical model that can implement functions similar to those implemented by the above-mentioned multi-granularity language detection system 210.

[0141] The following describes an application scenario and a user interface example for the scenario.

[0142] Figure 5 A schematic diagram exemplarily shows a user interface of a translation scenario.

[0143] like Figure 5As shown in (A), the electronic device 100 can display a user interface 510 of a translation application, and the user interface 510 can include language information 511, an input box 512, a translation control 513, and a display box 514. The language information 511 can include source language information 511A and target language information 511B, wherein the source language information 511A can display "automatic detection", indicating that the electronic device 100 will automatically detect the language of the source text when translating, and the source language information 511A can also be used by the user to select the language of the source text, for example, options such as "English", "German", "Chinese", etc. can be selected, and the target language information 511B can be used to display the default or user-selected target language, and the specific option examples are similar to the example of the source language information 511A, and the user interface 510 is illustrated by taking the target language information 511B displaying "Chinese" as an example. The input box 512 can be used to input the source text to be translated. The input box 512 in the user interface 510 displays the input source text (He turned around and asked: "Entschuldigen Sie, sprechen Sie Deutsch?" but passersby ignored him and walked straight ahead.). The translation control 513 can be used to trigger the translation of the text in the input box 512. The display box 514 can be used to display the translation result of the text in the input box 512. The electronic device 100 can receive a user operation on the translation control 513 (the user operation is, for example, a touch operation, and the touch operation is, for example, a click operation), and in response to the user operation, translate the source text displayed in the input box 512 into a text in the target language (i.e., Chinese), and display the text in the target language in the display box 514. For specific examples, see Figure 5 User interface 520 shown in (B).

[0144] like Figure 5As shown in (B), the user interface 520 is similar to the user interface 510, except that the electronic device 100 displays the source text in the input box 512 in a different manner. In the user interface 520, the German text 512A ("Entschuldigen Sie, sprechen Sie Deutsch?") included in the input box 512 is displayed differently from the English text, and the German text can be in a highlighted (e.g., highlighted) state. In addition, the display box 514 in the user interface 520 displays the translation result of the source text (he turned around and asked, "Excuse me, do you speak German?" But the passerby ignored him and walked straight ahead), wherein the translation result 514A ("Excuse me, do you speak German?") of the German text in the source text is displayed differently from the translation result of the English text, and the translation result of the German text is in a highlighted (e.g., highlighted) state. In this way, the user can quickly obtain the content of the same language in the source text and the translation result through the input box 512 and the display box 514 in the user interface 520. The user no longer needs to compare the source text and the translation result character by character, thereby realizing the "language dimension" free search function and improving the user experience.

[0145] like Figure 5 As shown in (B), the user interface 520 also includes a copy control 521, a save control 522, and a forward control 523, wherein the copy control 521 can be used to trigger the translation result of the German text highlighted in the copy display box 514, the save control 522 can be used to trigger the translation result of the German text highlighted in the save display box 514, and the forward control 523 can be used to trigger the translation result of the German text highlighted in the forward display box 514, such as forwarding to a contact via a short message, forwarding to a social friend via a social application, etc. In other words, the electronic device 100 can provide auxiliary interactive functions such as one-click copying, saving, and forwarding of the translation results of the language content of interest, further improving the user experience.

[0146] Figure 6 A schematic diagram illustrating a user interface of yet another translation scenario.

[0147] like Figure 6 As shown in (A), the electronic device 100 can display a user interface 610. In one embodiment, the user interface 610 is an interface for displaying the personal information of user 1 in an instant messaging application. The user interface 610 may include a user nickname 611, an account name 612, a location 613, a note control 614, a permission control 615, a control 616, a control 617, a message control 618, and a call control 619. Among them, the user nickname 611 is used to display the nickname of user 1. The account name 612 may include the characters "Account: ", the region 613 may include the characters "Region: Hubei Wuhan". The note control 614 may include the characters "Set notes and tags", which are used for the current user to set notes and / or tags for user 1. The permission control 615 may include the characters "Friends permissions", which are used for the current user to set permissions for user 1. Control 616 may include the characters "Circle" and pictures, which are used to trigger the display of pictures, texts and other content posted by user 1. Control 617 may include the characters "More information", which are used to trigger the display of other information about user 1. The message control 618 may include the characters "Send message", which are used to trigger the display of a chat interface with user 1. The call control 619 may include the characters "Audio and video call", which are used to trigger an audio call / video call with user 1. The electronic device 100 can receive a user operation on the user interface 610, which is, for example, a touch operation, such as but not limited to a two-finger press, a three-finger press or a sliding operation, etc., Figure 6 (A) is exemplified by taking the user operation as a two-finger pressing operation. The electronic device 100 can extract part or all of the text in the user interface 610 in response to the user operation, and can display Figure 6 The user interface 620 shown in (B).

[0148] like Figure 6 As shown in (B), the user interface 620 is similar to the user interface 610, except that a portion of the text 621 in the user interface 620 is selected, and the text 621 includes characters in the user nickname 611, characters in the account name 612, characters in the region 613, and a portion of the characters in the note control 614, namely, “ account: Region: Hubei Wuhan Settings", in some examples, the electronic device 100 can respond to a user operation on the text in the user interface 620, such as a touch operation, such as a sliding operation, to modify the selected text, such as including more characters or fewer characters. The user interface 620 also includes a control bar 622 and a display box 623. The control bar 622 may include multiple controls, such as a scan control, a translation control, a control for folding the control bar 622, a shopping control, and a collection control, etc. The display box 623 may include a title 623A (including the characters "Extract text"), a close control 623B, Text 623C, and multiple functional controls for text 623C. The text 623C has the same content as the text 621 in the selected state, and can also be understood as text extracted from the user interface 610. The multiple functional controls include, for example, a select all control 623D, a search control 623E, a copy control 623F, a translation control 623G, and a share control 623H. The electronic device 100 can receive a user operation on part or all of the text in the text 623C, such as a touch operation, such as a sliding operation, and in response to the user operation, select part or all of the text in the text 623C. Figure 6 Take the example of selecting all the text in text 623C. Figure 6 The user interface 630 shown in (C).

[0149] like Figure 6 As shown in (C), the user interface 630 is similar to the user interface 620, except that all characters of the text 623C in the user interface 630 are selected. The electronic device 100 can receive a user operation on the translation control 623G in the user interface 630, such as a touch operation, such as a single-click operation. In response to the user operation, the electronic device 100 can translate the selected text (i.e., the text 623C) into the target language ( Figure 6 Take the default Chinese as an example) for text, then you can display Figure 6 The user interface 640 is shown in (D).

[0150] like Figure 6 As shown in (D), the user interface 640 is similar to the user interface 610, except that the part of the text 621 (" account: Region: Hubei Wuhan Settings”) is selected, the user interface 640 also includes a translation box 641, and the translation box 641 may include a title 641A (including the character “Translation”), a close control 641B, source language information 641C, target language information 641D, source text 641E, translated text 641F and multiple functional controls. Among them, the source language information 641C may display “Automatic Detection”, indicating that the electronic device 100 will automatically detect the language of the source text when translating, and the target language information 641D may be used to display the default or user-selected target language (“Chinese”). The source text 641E has the same content as the selected text 621, including Chinese text and Korean text, wherein the display methods of the Chinese text and the Korean text are different, and the Korean text and The translation text 641F is the target language (i.e., Chinese) text "Little Sister Account: Lucky Arrival Region: Hubei Wuhan Settings" obtained by translating the source text 641E, where "Little Sister" and "Lucky Arrival" are the Korean texts in the source text 641E. The translation results of the two Korean texts are highlighted (e.g., highlighted). The multiple functional controls include, for example, control 641G, control 641H, control 641I, and control 641J. Control 641G is used to copy the translation text 641F, control 641H is used to copy the translation result of the Korean text in the translation text 641F (i.e., "highlighted translation"), control 641I is used to share the translation text 641F, and control 641J is used to share the translation result of the Korean text in the translation text 641F (i.e., "highlighted translation").

[0151] Figure 7 A schematic diagram illustrating a user interface of yet another translation scenario.

[0152] like Figure 7As shown in (A), the electronic device 100 can display the user interface 710 of the browser, and the user interface 710 may include a URL bar 711, website information 712, text 713 and a control bar 714. Among them, the URL bar 711 can be used to display the current URL / website name, for example, including the characters "How to Learn-Article Website 1", indicating that the current web page is the "How to Learn" web page in Article Website 1. Website information 712 may include information such as the website name "Article Website 1", website introduction, search box, etc. Text 713 may be the text content in the current web page, and may include the characters "First, it is very important to understand yourself, especially your strengths and weaknesses, so that you can find the right learning strategy according to your own situation. Second, manage your time and life.lt is so common for students to deal with many things in the same time, then priority should be given to the things that related to your goal.". The control bar 714 may include multiple functional controls, such as a control for returning to the previous web page, a control for jumping to the next web page, a control for jumping to the home page of the browser application, a control for viewing the window of the browser application, a control for viewing more information, etc. The electronic device 100 may receive a user operation on part or all of the text in the text 713, such as a touch operation, such as a long press operation and a slide operation, and in response to the user operation, select part or all of the text in the text 713. Figure 7 Take the selection of part of the text in the text 713 as an example for explanation, then it can be displayed Figure 7 The user interface 720 shown in (B) .

[0153] like Figure 7As shown in (B), user interface 720 is similar to user interface 710, except that text 721 ("You can find the correct learning strategy based on your own situation. Second, manage your time and life.") in text 713 displayed on user interface 720 is in a selected state, and user interface 720 also includes a function bar 722. Function bar 722 may include multiple function controls, such as a copy control (for copying text 721), a select all control (for selecting all texts of the current web page, such as setting text 713 to a selected state), a search control (for searching text 721 on other websites), a translation control 722A, and a sharing control (for sharing text 721). Electronic device 100 may receive a user operation on translation control 722A, such as a touch operation, such as a single-click operation. In response to the user operation, electronic device 100 may translate the above-mentioned selected text (i.e., text 721) into a target language ( Figure 7 Take the default Chinese as an example) for text, then you can display Figure 7 The user interface 730 shown in (C).

[0154] like Figure 7As shown in (C), the user interface 730 is similar to the user interface 710, except that the user interface 730 also includes a translation box 731, which may include a title 731A (including the character "translation"), a close control 731B, source language information 731C, target language information 731D, source text 731E, translation text 731F and multiple functional controls. Among them, the source language information 731C can display "automatic detection", indicating that the electronic device 100 will automatically detect the language of the source text when translating, and the target language information 731D can be used to display the default or user-selected target language ("Chinese"). The source text 731E has the same content as the text 721 in the selected state in the user interface 720, including Chinese text and English text, wherein the display methods of the Chinese text and the English text are different, and the English text "Second, manage your time and life." is in a highlighted (e.g., highlighted) state. The translated text 731F is a text in the target language (i.e., Chinese) obtained by translating the source text 731E, "You can find the correct learning strategy according to your own situation. Second, manage your time and life.", where "Second, manage your time and life." is the translation result of the English text in the source text 731E, and the translation result is in a highlighted (e.g., highlighted) state. Multiple functional controls include, for example, control 731G, control 731H, control 731I, and control 731J, control 731G is used to copy the translated text 731F, control 731H is used to copy the translation result of the English text in the translated text 731F (i.e., "highlighted translation"), control 731I is used to share the translated text 731F, and control 731J is used to share the translation result of the English text in the translated text 731F (i.e., "highlighted translation").

[0155] Not limited to the above example, in other examples, the electronic device 100 may also display the language included in the detected source text, for example, Figure 5 The source language information 511A in the user interface 520 shown in (B) shows "English+German", indicating that the electronic device 100 detects that the source text displayed in the input box 512 includes contents in both English and German.

[0156] Not limited to the above examples, in other examples, the electronic device 100 may also provide auxiliary interactive functions such as one-key copy, save, and forward for the translation results, and controls and Figure 5 The copy control 521, save control 522 and forward control 523 in the user interface 520 shown in (B) are similar and will not be described in detail.

[0157] Not limited to the above example, in other examples, the electronic device 100 may not display the control for copying / saving / forwarding the content in the language of interest, for example Figure 5 The copy control 521, the save control 522, and the forward control 523 shown in (B) are Figure 6 The control 641H and the control 641J shown in (D) are Figure 7 Instead of the controls 731H and 731J shown in (C), the copying / saving / forwarding of the language of interest content is triggered by other means. For example, when the electronic device 100 detects that the cursor is located at the location of the highlighted translation result (hereinafter referred to as highlighted text) (for example, it is detected that the touch position of the user's finger is located at the location of the highlighted text, or it is detected that the cursor corresponding to a device such as a mouse or stylus connected to the electronic device 100 is located at the location of the highlighted text), the electronic device 100 can display a prompt message, which is used to prompt the user to copy, save and / or forward by selecting / selecting the highlighted text. The user can select the highlighted text based on the prompt message. When the electronic device 100 subsequently detects a user operation for selecting the highlighted text, a copy control, a save control and / or a forwarding control can be displayed. The specific instructions and Figure 7 The description of displaying the function bar 722 when the text 721 is selected is similar.

[0158] Based on the above embodiments, the translation method involved in this application is introduced. This method can be applied to Figure 1 The electronic device 100 shown. The method can be applied to Figure 2 The electronic device 100 shown. The method can be applied to Figure 3 An electronic device 100 is shown.

[0159] See also Figure 8 , Figure 8 : is a flowchart of a translation method provided in an embodiment of the present application. The method may include but is not limited to the following steps:

[0160] S101: The electronic device obtains a source text input by a user.

[0161] In one implementation, the electronic device may obtain the source text input by the user, or the source text selected by the user from the text displayed by the electronic device. For specific examples, see the following Fig. 9 Description of S201.

[0162] S102: The electronic device determines whether the source text includes content in multiple languages.

[0163] In one embodiment, the electronic device can identify the language of the source text and obtain a language detection result. For the specific identification process, see Figure 3 and Figure 4The electronic device can determine whether the source text includes content in multiple languages ​​according to the language detection result, that is, determine whether the source text is a mixed language. When the determination result is no, that is, the source text only includes content in one language (also referred to as the source text is a single language), the electronic device can execute S103. When the determination result is yes, the electronic device can intelligently identify the content in the source text that the user may be interested in / needed by the language (also referred to as the content in the language of interest) according to the language detection result, for example, executing S104 and S107.

[0164] S103: The electronic device translates the source text and displays the translation result.

[0165] In one embodiment, when the source text includes content in only one language, the electronic device can use the translation model corresponding to the language to translate the source text and obtain the output of the translation model, that is, the translation result in the target language. The target language can be preset by the electronic device or determined in response to a user operation, such as in response to a request for Figure 5 The target language information 511B in the user interface 510 shown in (A) is determined by a user operation.

[0166] S104: The electronic device determines whether the source text includes content in the target language.

[0167] In one embodiment, the electronic device can determine whether the source text includes content in the target language based on the acquired language detection result. When the judgment result is yes, the electronic device can determine that the content in at least one language other than the target language in the source text is the content in the language that the user may be interested in / required (i.e., the language of interest content), and translate the language of interest content, for example, executing S105-S106. When the judgment result is no, the electronic device can execute other steps to identify the language of interest content, for example, executing S107.

[0168] S105: The electronic device translates the non-target language content in the source text and obtains text 1.

[0169] In one embodiment, the source text may include content in the target language and content in at least one other language (which may be referred to as a non-target language) other than the target language, and text 1 may include the translation result of the content in the at least one other language, that is, the translation result of the content in the language of interest. In some examples, the content in the non-target language may include content in multiple languages, and for any one of the multiple languages, the electronic device may use the translation model corresponding to the language to translate the content in the language and obtain the output translation result, and text 1 includes the translation results of the content in the multiple languages.

[0170] S106: The electronic device displays the text 1 using the first display mode, and displays the target language content in the source text using the second display mode.

[0171] In one embodiment, the electronic device displays text 1 and the target language content in the source text according to the arrangement of characters in the source text, wherein text 1 and the target language content in the source text are displayed differently, for example, text 1 (i.e., the translation result of the language of interest) is highlighted.

[0172] In one embodiment, the electronic device can display the source text and the translation result of the source text (including text 1 and the target language content in the source text), wherein the non-target language content in the source text is displayed in the same manner as text 1, for example, the non-target language content is highlighted in the source text, and text 1 is highlighted in the translation result of the source text.

[0173] S107: The electronic device determines whether the source text includes content in a preset language.

[0174] In one embodiment, the preset language is a minority language classified on the Internet, such as languages ​​other than Chinese, English, French, Spanish, Russian, and Arabic. However, the preset language may also be a minority language determined by other classification methods on the Internet. For example, languages ​​other than English are classified as minority languages, and this application does not limit this.

[0175] In another embodiment, the preset language is selected by the electronic device from the acquired language detection results (including multiple languages) according to preset rules. In some examples, based on the country where the electronic device is located, a language other than the common language of the country (for example, the common language in China is Chinese) can be selected from the acquired language detection results as the preset language. Not limited to this, in other examples, based on the versatility of the language, the least versatile language can be selected from the acquired language detection results as the preset language. This application does not limit this.

[0176] In one embodiment, the electronic device can determine whether the source text includes content in a preset language based on the acquired language detection result. When the judgment result is yes, the electronic device can determine that the content in the preset language in the source text is content in a language that the user may be interested in / required (i.e., content in the language of interest), and translate the content in the language of interest, for example, executing S108-S109. When the judgment result is no, the electronic device can execute S110.

[0177] S108: The electronic device translates the content of the preset language in the source text to obtain text 2, and translates the content of the language other than the preset language in the source text to obtain text 3.

[0178] In one embodiment, for the content of any language in the source text, the electronic device can use the translation model corresponding to the language to translate the content of the language, and obtain the output translation result, and then recombines the translation results of the contents in multiple languages, that is, arranges and combines them according to the arrangement of characters in the source text to obtain a translation result (which can be called the target text) that is consistent with the format of the source text. The target text includes the translation result of the content in the preset language (i.e., text 2) and the translation result of the content in at least one language other than the preset language (collectively referred to as text 3).

[0179] S109: The electronic device displays text 2 using the third display mode, and displays text 3 using the fourth display mode.

[0180] In one implementation, the electronic device may display the target text (ie, the translation result of the source text), wherein text 2 and text 3 are displayed in different ways, for example, text 2 is highlighted.

[0181] In one embodiment, the electronic device can display the source text and the translation result of the source text (including text 2 and text 3), wherein the content of the preset language in the source text and text 2 are displayed in the same manner, for example, the content of the preset language is highlighted in the source text, and text 2 is highlighted in the translation result of the source text.

[0182] S110: The electronic device translates the source text and displays the translation result.

[0183] In one implementation, for content in any language of the source text, the electronic device can use the translation model corresponding to the language to translate the content in the language, obtain the output translation result, and then recombine the translation results of the obtained content in multiple languages, that is, arrange and combine them according to the arrangement of characters in the source text to obtain a translation result consistent with the format of the source text. When the electronic device displays the translation result, the translation results of content in different languages ​​will be displayed in the same way.

[0184] In some examples, Figure 8 The application scenario of the method shown is Figure 5 In the scenario shown in FIG. 5 , the source text is the text displayed in the input box 512 shown in the user interface 520 (He turned around and asked: "EntschuldigenSie, sprechen Sie Deutsch?" but passersby ignored him and walked straight ahead.), the language detection results of the source text are English and German, and the target language of the translation is Chinese. Therefore, when executing Figure 8 In the process shown, the judgment result of S102 is yes, and the judgment result of S104 is no. At this time, the electronic device will execute S107. Assuming that the preset language is German, a minority language, the judgment result of S107 is yes, and the electronic device can identify the German text in the source text ("Entschuldigen Sie, sprechen Sie Deutsch?") as the language of interest. An example of the electronic device displaying the translation result of the source text (i.e., the target text) can be seen in the display box 514 shown in the user interface 520, wherein the translation result of the German text ("Excuse me, can you speak German?") (i.e., text 2) is highlighted, and the translation result of the English text (i.e., text 3) is not highlighted.

[0185] In some examples, Figure 8 The application scenario of the method shown is Figure 6 The scene shown, where the source text is the text 623C ( account: Region: Hubei Wuhan), the language detection results of the source text are Chinese and Korean, and the target language of the translation is Chinese. Therefore, when executing Figure 8 In the process shown in FIG. 1 , if the judgment result of S102 is yes and the judgment result of S104 is yes, the electronic device will execute S105, and the electronic device will convert the Korean text ( and ) is identified as the content in the language of interest and translated, and the Chinese text in the source text is not translated. An example of an electronic device displaying the translation result of the source text (i.e., the target text) can be seen in the translation text 641F shown in the user interface 640, wherein the translation result of the Korean text ("Little Sister" and "Lucky Comes") (i.e., text 1) is highlighted, and the Chinese text (i.e., the content in the target language in the source text) is not highlighted.

[0186] In some examples, Figure 8 The application scenario of the method shown is Figure 7 The scenario shown, the specific description and the above application scenario are Figure 6 The description of the scenario shown is similar, see the above description and Figure 7 Description.

[0187] exist Figure 8In the method shown, when the source text is in a mixed language, the electronic device can intelligently identify the language of interest content that the user may be interested in / need, such as content in a non-target language, or content in a minority language, from the source text based on the language detection result, and highlight the language of interest content when displaying the translation result of the source text, thereby further mining and utilizing the language detection results, allowing the user to quickly obtain the translation results of the required language content, realizing the "language dimension" translation search-free function, and greatly facilitating user use.

[0188] See also Fig. 9 , Fig. 9 This is a flowchart of another translation method provided in an embodiment of the present application. The method may include but is not limited to the following steps:

[0189] S201: The electronic device receives a first input operation from a user.

[0190] S202: The electronic device displays the first text and the second text in response to the first input operation.

[0191] In one implementation, the electronic device may obtain a source text to be translated according to a first input operation, where the source text includes a first text and a second text.

[0192] In some examples, the first input operation includes the user inputting a source text in an input box of the translation application interface, and the electronic device may display the source text in the input box of the translation application interface, for example Figure 5 In the scenario shown, the electronic device may first receive text input into an input box 512 in the user interface 510 and display the user interface 510 , wherein the text displayed in the input box 512 in the user interface 510 is the first text and the second text.

[0193] In other examples, the first input operation includes a user selecting text on an instant messaging application interface, such as Figure 6 In the scenario shown, the electronic device can first receive a user operation on the user interface 610 (such as a two-finger press operation), and in response to the user operation, extract part of the text in the user interface 610, and display a pop-up box: display box 623, in which the above-mentioned extracted text 623C is displayed, and the text 623C is the first text and the second text.

[0194] In other examples, the first input operation includes the user selecting specific text (ie, source text) in the text on the browser application interface, for example Figure 7In the scenario shown, the electronic device can receive a user operation (such as a long press operation) on a portion of the text 713 shown in the user interface 710, and in response to the user operation, display the user interface 720, in which the text 721 in the text 713 shown in the user interface 720 (i.e., the portion of the text selected by the user above) is in a selected state, and the text 721 is the first text and the second text.

[0195] S203: The electronic device receives a first translation request from a user.

[0196] In one implementation, the first translation request may be used to trigger the translation of the source text.

[0197] In some examples, the first input operation includes a user inputting text in an input box of a translation application interface, and the electronic device receiving a first translation request includes: the electronic device receiving a user operation on a translation control in the translation application interface, such as Figure 5 In the scenario shown, the electronic device receives a user operation on a translation control 513 in the user interface 510 .

[0198] In some other examples, the first input operation includes a user selecting text on an instant messaging application interface, and the electronic device may display a pop-up box in response to the first input operation, where the pop-up box includes the first text, the second text, and a translation control, and the electronic device receives a first translation request, including: the electronic device receives a user operation on the translation control in the pop-up box, such as Figure 6 In the scenario shown, the electronic device can first receive a user operation on the text 623C in the display box 623 (i.e., the pop-up box) shown in the user interface 620, and in response to the user operation, select the text 623C (i.e., the first text and the second text). At this time, the user interface 630 can be displayed, and then the user operation on the translation control 623G in the display box 623 shown in the user interface 630 can be received.

[0199] In some other examples, the first input operation includes a user selecting specific text in the text on the browser application interface, and the electronic device can display multiple functional controls in response to the first input operation, and the electronic device receives a first translation request, including: the electronic device receives a user operation on a translation control in the multiple functional controls, such as Figure 7 In the scenario shown, the electronic device receives a user operation on a translation control 722A in a function bar 722 (including multiple function controls) shown in a user interface 720 .

[0200] In one implementation, the electronic device may first determine whether the source text includes texts in multiple languages ​​based on the received first translation request. For a specific process example, see Figure 8 Description of S102, Fig. 9For example, the source text includes a first text in a first language and a second text in a second language (the first language and the second language are different). In a specific implementation, the source text may include texts in more languages ​​or texts in fewer languages.

[0201] In one embodiment, when the electronic device determines that the source text includes texts in multiple languages, the electronic device can obtain word-level language detection results. For the specific acquisition process, see Figure 3 and Figure 4 The word-level language detection result may include the above-mentioned multiple languages, and the above-mentioned multiple languages ​​include the first language and the second language. The word-level language detection result can be used by the electronic device to determine the display mode of the translation result of the source text, that is, the first interface shown in S204 below is determined according to the word-level language detection result. In some examples, the electronic device can determine the first text in the first language from the texts in the multiple languages ​​according to the preset rules, which can be understood as identifying the language of interest that the user may be interested in / needed. For specific implementation examples, see Figure 8 As described in S104 and S107, the display modes of the translation results of the language of interest and the translation results of other source texts may be different. Optionally, the display modes of the language of interest and other source texts may also be different.

[0202] In one embodiment, after the electronic device determines that the source text includes texts in multiple languages, it can use the corresponding translation models to translate the texts in multiple languages ​​in the source text, and obtain a target text in a third language (i.e., the target language). The target text includes a third text and a fourth text, the third text corresponds to the first text, the third text is obtained by translating the first text, and the fourth text corresponds to the second text.

[0203] In some examples, when the second language is the same as the third language, the fourth text is the same as the second text, that is, the electronic device does not translate the second text in the third language in the source text. The first language is different from the third language. For details, see Figure 8 Description of S104-S106.

[0204] In other examples, when the second language is different from the third language, the fourth text is obtained by translating the second text, and the first language is the preset language. For details, see Figure 8 Description of S107-S109.

[0205] S204: The electronic device displays a first interface (the first interface includes a third text corresponding to the first text and a fourth text corresponding to the second text).

[0206] In one implementation, after the electronic device obtains the translation result of the source text (i.e., the target text), it can display a first interface, the first interface includes a third text and a fourth text, and the display mode of the third text is different from the display mode of the fourth text. For specific examples, see Figure 8 Optionally, the first interface further includes a first text and a second text, the display mode of the first text is the same as the display mode of the third text, and the display mode of the second text is the same as the display mode of the fourth text.

[0207] In some examples, Figure 5 In the scenario shown, the text displayed in the input box 512 shown in the user interface 510 is the source text, the third language is Chinese, the source text includes a German text (i.e., a first text in the first language) and an English text (i.e., a second text in the second language). At this time, the second language and the third language are different, so the fourth text is obtained by translating the second text. The first interface can be referred to as Figure 5 The user interface 520 shown in (B) is characterized in that the input box 512 in the user interface 520 displays the source text, and the German text 512A (i.e., the first text) therein is highlighted, and the other texts therein (i.e., the English text, i.e., the second text) therein are not highlighted, and the display box 514 in the user interface 520 displays the target text, and the translation result 514A (i.e., the translation result of the first text, i.e., the third text) therein is highlighted, and the other texts therein (i.e., the translation result of the second text, i.e., the fourth text) therein are not highlighted.

[0208] In some examples, Figure 6 In the scenario shown, the text 623C shown in the user interface 630 is the source text, the third language is Chinese, and the source text includes a Korean text (i.e., a first text in the first language) and a Chinese text (i.e., a second text in the second language). At this time, the second language and the third language are the same, so the fourth text is the same as the second text. The first interface can be referred to as Figure 6 The user interface 640 shown in (D) of FIG. 1 shows a source text 641E and a translation text 641F (ie, a target text), and the Korean text ( and ) (i.e., the first text) is highlighted, the Chinese text in the source text 641E ("Account: " and "Region: Hubei Wuhan Settings") (i.e., the second text) is not highlighted, "Little Sister" and "Lucky Comes" in the translated text 641F (i.e., the translation result of the first text, i.e., the third text) are highlighted, and the other texts in the translated text 641F (i.e., the fourth text corresponding to the second text, i.e., the second text) are not highlighted. Figure 7 Description of the scenario shown and Figure 6The description of the scenario shown is similar and will not be repeated here.

[0209] In one embodiment, the first interface also includes information of the first language and the second language, and optionally the third language, so that the user can intuitively obtain the language detection result of the source text and the target language.

[0210] In one embodiment, the first interface further includes a first control, and the first control is used to perform at least one of the following functions: copying the third text, saving the third text, and forwarding the third text. For specific examples, see Figure 5 The copy control 521, the save control 522 and the forward control 523 in the user interface 520 shown in (B) of FIG. Figure 6 The control 641H and the control 641J shown in (D) are Figure 7 Control 731H and control 731J shown in (C).

[0211] exist Fig. 9 In the method shown, for a source text including content in multiple languages, the electronic device translates the texts in the multiple languages ​​separately to obtain a target text, that is, the translation result corresponding to the source text in the mixed language can be obtained quickly and accurately. In addition, when the electronic device displays the target text, different display methods can be used for the translation results of source texts in different languages, such as highlighting the translation result (i.e., the third text) of the recognized content in the language of interest (i.e., the first text). The user no longer needs to compare the source text and the target text character by character, thus realizing the "language dimension" free search function and improving the user experience.

[0212] The above embodiments are described using the translation scenario as an example. In other embodiments, they can also be applied to the voice broadcast scenario. The difference is that the "translation model" needs to be replaced by the "voice broadcast model". Any voice broadcast model is used to obtain the pronunciation of the content in a corresponding language, and "display" needs to be replaced by "play". The specific instructions are similar and will not be repeated here.

[0213] The methods provided in the embodiments of the present application may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiments of the present application is generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, a network device, a user device or other programmable device. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from one website, computer, server or data center to another website, computer, server or data center via wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media integrated therein. The available medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a digital video disc (DWD), or a semiconductor medium (e.g., a solid state drive (SSD)). As mentioned above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them; although the present application is described in detail with reference to the above embodiments, a person skilled in the art should understand that the technical solutions described in the above embodiments can still be modified, or some of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A translation method, characterized in that: Applied to electronic equipment, the method comprises: receiving a first input operation from a user; In response to the first input operation, display a first text and a second text, wherein the first text is in a first language, the second text is in a second language, and the first language is different from the second language; receiving a first translation request from the user; Displaying a first interface, the first interface including a third text and a fourth text, wherein the third text and the fourth text are in a third language, the third language is different from the first language, the third text is translated from the first text, the fourth text corresponds to the second text, and the display mode of the third text is different from the display mode of the fourth text When the second language is the same as the third language, the fourth text is the same as the second text; When the second language is different from the third language, the fourth text is obtained by translating the second text.

2. The method according to claim 1, characterized in that The first interface includes the first text and the second text. The display mode of the first text is the same as the display mode of the third text. The display mode of the second text is the same as the display mode of the fourth text.

3. The method according to claim 1, characterized in that The first interface includes information in the first language and the second language.

4. The method according to claim 1, characterized in that The first interface includes a first control, and the first control is used to perform at least one of the following functions: copying the third text, saving the third text, and forwarding the third text.

5. The method according to claim 1, characterized in that The receiving a first input operation of the user includes: The first input operation of the user is received on a second interface, wherein the second interface includes a first instant messaging application interface, and the first input operation includes selecting text on the first instant messaging application interface.

6. The method according to any one of claims 1 to 5, characterized in that: The receiving a first input operation of the user includes: The first input operation of the user is received on a third interface, wherein the third interface includes a first translation application interface, and the first input operation includes inputting the first text and the second text in an input box of the first translation application interface.

7. The method according to any one of claims 1 to 5, characterized in that: The receiving a first input operation of the user includes: The first input operation of the user is received on a fourth interface, wherein the fourth interface includes a first browser application interface, the first browser application interface includes a fifth text, and the first input operation includes selecting the first text and the second text in the fifth text.

8. The method according to claim 1, characterized in that The third text in the first interface is in a highlighted state, and the first text corresponding to the third text is determined from the first text in the first language and the second text in the second language according to a preset rule.

9. The method according to claim 1, characterized in that The first language is a minority language.

10. The method according to claim 1, characterized in that After receiving the first translation request from the user, the method further includes: Processing the first text and the second text using a classifier to obtain first information, wherein the first information indicates that the first text and the second text are in mixed languages; A tagger is used to obtain the language of each symbol in the first text and the second text, and a word-level language detection result is obtained, wherein the word-level language detection result includes the first language and the second language, and the first interface is displayed according to the word-level language detection result.

11. An electronic device, characterized in that: The method comprises a transceiver, a processor and a memory, wherein the memory is used to store a computer program, and the processor calls the computer program to execute the method according to any one of claims 1 to 10.

12. A computer storage medium, characterized in that: The computer storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 10 is implemented.