Text translation method and device based on translation strategy, equipment and storage medium

The method optimizes machine translation by selecting appropriate services based on language pairs and service instance conditions, enhancing translation efficiency and quality through strategic service selection.

CN119227697APending Publication Date: 2024-12-31GUANGZHOU SANQI DREAM NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411058311.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-02
Publication Date
2024-12-31

AI Technical Summary

Technical Problem

Existing machine translation methods, whether statistical or neural, face limitations in efficiency and quality, failing to meet user needs for stable and efficient translation due to issues in processing complex sentence structures and contextual understanding.

Method used

A text translation method that selects a suitable translation service based on language pairs, text content, and the request flow and response time of translation service instances, combining statistical and neural machine translation to optimize efficiency and quality.

Benefits of technology

Ensures efficient and stable translation by prioritizing translation services that balance quality and efficiency, addressing the limitations of single machine translation methods.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119227697A_ABST
    Figure CN119227697A_ABST
Patent Text Reader

Abstract

The invention discloses a text translation method and device based on a translation strategy, equipment and a storage medium, and relates to the technical field of machine translation. The method is applied to a translation server, and comprises the following steps: obtaining a to-be-translated source text and a target language type according to a received translation request, and identifying the source language type of the source text; determining a first translation strategy of the source text according to the source language type, the target language type and the text content of the source text; determining a second translation strategy of the source text according to the request traffic and the response time of each translation service instance of the translation server; each translation service instance comprises a statistical machine translation service instance and a neural machine translation service instance; determining a target translation service instance of the source text in each translation service instance according to the second translation strategy and the first translation strategy; and distributing the translation request to the target translation service instance, and translating a source text of the translation request through the target translation service instance to obtain a translated text.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of machine translation, and in particular to a text translation method, apparatus, device and storage medium based on a translation strategy. Background Art

[0002] Machine translation refers to the process of using a machine to translate a natural language in written or spoken form into another natural language in written or spoken form through a specific computer program. With the continuous advancement of technology and the increasing demand for translation, machine translation has a wide range of application scenarios in many fields.

[0003] In the prior art, machine translation mainly includes statistical machine translation and neural machine translation. Statistical machine translation relies on predefined rules and statistical models, and has high stability and response speed, but has limitations in processing complex sentence structures and contextual understanding. Neural machine translation relies on deep learning technology and can better handle contextual relationships and complex sentence structures, but has a slow response speed and a high response failure rate. Therefore, both statistical machine translation and neural machine translation have corresponding limitations in terms of efficiency and quality, and it is difficult to meet users' needs for efficient and stable translation. Summary of the invention

[0004] The present application provides a text translation method, apparatus, device and storage medium based on a translation strategy, so as to select a suitable translation service to translate the source text according to the language pair and text content of the source text and the request flow and response time of each translation service instance, thereby ensuring translation efficiency and translation quality, solving the problem that a single machine translation method in the prior art has corresponding limitations in terms of efficiency and quality, and meeting the user's needs for efficient and stable translation.

[0005] In a first aspect, the present application provides a text translation method based on a translation strategy, which is applied to a translation server, comprising:

[0006] Acquire a source text to be translated and a target language type according to the received translation request, and identify the source language type of the source text;

[0007] Determining a first translation strategy for the source text according to a source language type, a target language type, and text content of the source text;

[0008] Determining a second translation strategy for the source text according to request traffic and response time of each translation service instance of the translation server; each translation service instance includes a service instance of statistical machine translation and a service instance of neural machine translation;

[0009] Determining a target translation service instance of the source text in each of the translation service instances according to the second translation strategy and the first translation strategy;

[0010] The translation request is assigned to the target translation service instance, and the source text of the translation request is translated by the target translation service instance to obtain a translated text.

[0011] In a second aspect, the present application provides a text translation device based on a translation strategy, which is applied to a translation server, including:

[0012] A language type identification module is configured to obtain a source text to be translated and a target language type according to a received translation request, and identify a source language type of the source text;

[0013] A first strategy determination module is configured to determine a first translation strategy for the source text according to a source language type, a target language type and text content of the source text;

[0014] A second strategy determination module is configured to determine a second translation strategy for the source text according to request traffic and response time of each translation service instance of the translation server; the each translation service instance includes a service instance of statistical machine translation and a service instance of neural machine translation;

[0015] A translation service selection module, configured to determine a target translation service instance of the source text among the translation service instances according to the second translation strategy and the first translation strategy;

[0016] The text translation module is configured to assign the translation request to the target translation service instance, and translate the source text of the translation request through the target translation service instance to obtain a translated text.

[0017] In a third aspect, the present application provides a text translation device based on a translation strategy, comprising:

[0018] one or more processors;

[0019] The memory stores one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the text translation method based on the translation strategy as described in the first aspect.

[0020] In a fourth aspect, the present application provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, are used to perform the text translation method based on translation strategy as described in the first aspect.

[0021] In the present application, the source text and the target language type to be translated are obtained through the received translation request, and the source language type of the source text is identified; the first translation strategy of the source text is determined according to the source language type, the target language type and the text content of the source text; the second translation strategy of the source text is determined according to the request traffic and response time of each translation service instance of the translation server; each translation service instance includes a service instance of statistical machine translation and a service instance of neural machine translation; according to the second translation strategy and the first translation strategy, a target translation service instance of the source text is determined in each translation service instance; the translation request is assigned to the target translation service instance, and the source text of the translation request is translated by the target translation service instance to obtain a translated text. Through the above-mentioned technical means, the first translation strategy of the source text can be determined according to the language pair and text content of the source text, so as to characterize the translation quality of the translation service instance when translating the source text through the first translation strategy; the second translation strategy of the source text can be determined according to the request traffic and response time of each translation service instance, so as to characterize the translation efficiency of the translation service instance when translating the source text through the second translation strategy; and the appropriate translation service is selected to translate the source text in combination with the first translation strategy and the second translation strategy to ensure translation efficiency and translation quality, thereby solving the problem that the single machine translation method in the prior art has corresponding limitations in terms of efficiency and quality, and can meet the user's requirements for efficient and stable translation. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] Figure 1 is a flowchart of a text translation method based on a translation strategy provided in an embodiment of the present application;

[0023] Figure 2 is a schematic diagram of a front-end web page of a translation server provided in an embodiment of the present application;

[0024] Figure 3 is a flowchart of determining a first translation strategy provided by an embodiment of the present application;

[0025] Figure 4 is a flowchart of determining a second translation strategy provided by an embodiment of the present application;

[0026] Figure 5 It is a schematic diagram of the communication process between the translation server and the translation client provided in the embodiment of the present application;

[0027] Figure 6 It is a structural schematic diagram of a text translation device based on a translation strategy provided in an embodiment of the present application;

[0028] Figure 7 It is a structural diagram of a text translation device based on a translation strategy provided in an embodiment of the present application. DETAILED DESCRIPTION

[0029] In order to make the purpose, technical scheme and advantages of the present application clearer, the specific embodiments of the present application are further described in detail below in conjunction with the accompanying drawings. It is understood that the specific embodiments described herein are only used to explain the present application, rather than to limit the present application. It should also be noted that, for the convenience of description, only the part related to the present application but not all the contents are shown in the accompanying drawings. Before discussing the exemplary embodiments in more detail, it should be mentioned that some exemplary embodiments are described as processes or methods depicted as flow charts. Although the flow chart describes each operation (or step) as a sequential process, many of the operations therein can be implemented in parallel, concurrently or simultaneously. In addition, the order of each operation can be rearranged. The process can be terminated when its operation is completed, but it can also have additional steps not included in the accompanying drawings. The process can correspond to a method, a function, a procedure, a subroutine, a subprogram, etc.

[0030] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.

[0031] In the more common existing implementation methods, machine translation translates texts through separate statistical machine translation or neural machine translation. Statistical machine translation relies on pre-defined rules and statistical models, and has high stability and response speed, but has limitations in processing complex sentence structures and contextual understanding. Neural machine translation relies on deep learning technology and can better handle contextual relationships and complex sentence structures, but has a slow response speed and a high response failure rate. Therefore, whether it is a single statistical machine translation or a single neural machine translation, there are corresponding limitations in terms of efficiency and quality, and it is difficult to meet users' needs for efficient and stable translation.

[0032] To solve the above problems, this embodiment provides a text translation method based on a translation strategy, which selects a suitable translation service to translate the source text according to the language pair and text content of the source text and the request traffic and response time of each translation service instance, so as to ensure translation efficiency and translation quality.

[0033] The text translation method based on the translation strategy provided in this embodiment can be executed by a text translation device based on the translation strategy, and the text translation device based on the translation strategy can be implemented by software and / or hardware, and the text translation device based on the translation strategy can be composed of two or more physical entities, or can be composed of one physical entity. For example, the text translation device based on the translation strategy can be a translation server, which is a server that provides translation services to users.

[0034] The text translation device based on the translation strategy is installed with at least one type of operating system, wherein the operating system includes but is not limited to Android system, Linux system and Windows system. The text translation device based on the translation strategy can install at least one application based on the operating system, and the application can be an application that comes with the operating system, or an application that is downloaded from a third-party device or server. In this embodiment, the text translation device based on the translation strategy has at least an application that can execute the text translation method based on the translation strategy.

[0035] For ease of understanding, this embodiment is described by taking the translation server as an example of the main body that executes the text translation method based on the translation strategy.

[0036] Figure 1 A flowchart of a text translation method based on a translation strategy provided in an embodiment of the present application is given. Figure 1 , the text translation method based on translation strategy specifically includes:

[0037] S110: Acquire a source text to be translated and a target language type according to the received translation request, and identify the source language type of the source text.

[0038] The translation request is an instruction to request the translation server to translate the corresponding source text. For example, the translation server provides a front-end webpage, where the user can input the source text to be translated and select the target language type into which the source text is translated. The front-end webpage generates a translation request based on the input source text and target language type, and calls the API interface to transmit the translation request to the backend of the translation server. For example, Figure 2 Schematic diagram of the front-end web page of the translation server provided in the embodiment of the present application. Figure 2As shown, the user can open the front-end webpage 10 of the translation server through a terminal device such as a computer or a mobile phone, fill in the source text to be translated in the source text input box 11 of the front-end webpage 10, select the target language type in the first selection box 14 of the target language type, click the translation control 15, and the front-end webpage generates a translation request according to the source text in the source text input box 11 and the target language type in the first selection box, and transmits the translation request to the background of the translation server. The background of the translation server parses the translation request to obtain the source text to be translated and the target language type.

[0039] refer to Figure 2 The front-end webpage is provided with a second selection box 12 of the source language type. The user can select the source language type in the second selection box 12. The front-end webpage generates a translation request according to the source text, the source language type and the target language type, and transmits the translation request to the background. The background parses the translation request to obtain the source text, the source language type and the target language type. Among them, the source language type is the language type of the source text.

[0040] In the case where the user has not selected the source language type in the second selection box, the corresponding source language type can be identified based on the source text. Exemplarily, the source text is input into a pre-trained language type recognition model, the text features of the source text are extracted through the language type recognition model, and the source language type of the source text is identified based on the text features. Among them, the language type recognition model is trained by multiple sample texts and corresponding annotated language types. Further, in order to improve the recognition accuracy of the language type, the source language type of the source text can be identified through a multimodal recognition model. The specific implementation process is: according to the translation request, the voice data corresponding to the source text is obtained; the source text and the voice data are input into the pre-trained multimodal recognition model, and the source language type of the source text output by the multimodal recognition model is obtained. Exemplarily, when the user inputs the source text on the front-end web page, he can also input the voice data of reading the source text aloud. The front-end web page generates a translation request based on the source text and the voice data, and transmits the translation request to the background. The background parses the translation request to obtain the source text and voice data, and inputs the source text and voice data into a pre-trained multimodal recognition model. The multimodal recognition model extracts the text features and voice features of the source text and voice data respectively, fuses the text features and voice features, and identifies the source language type of the source text based on the fused features. Among them, the multimodal recognition model is trained with sample text and corresponding voice data as well as annotated language types. This embodiment extracts and fuses the features of the source text and the corresponding voice data through a multimodal recognition model, accurately identifies the source language type of the source text based on the fused features, and improves the recognition accuracy of the source language type.

[0041] Need explanation, reference Figure 2After the backend identifies the source text and determines the source language type, the source language type can be returned to the front-end webpage 10 to display the source language type in the second selection box 12 of the front-end webpage 10. If the user finds that the source identification type identified by the backend is incorrect, the source language type in the second selection box 12 can be manually modified, and the front-end webpage 10 transmits the modified source language type to the backend, which translates the source text based on the modified source language type to ensure the accuracy of subsequent translation and improve the reliability of the translation service.

[0042] S120: Determine a first translation strategy for the source text according to the source language type, the target language type, and the text content of the source text.

[0043] Exemplarily, the translation quality of the source text translated by each translation service instance of the translation server can be determined according to the source language type, target language type and text content of the source text, and the first translation strategy of the source text is generated according to the translation quality of each translation service instance, so as to indicate the translation quality of each translation service instance when used to translate the source text through the first translation strategy. In this embodiment, each translation service instance of the translation server includes at least one service instance of statistical machine translation and at least one service instance of neural machine translation. In the case where the translation server includes multiple service instances of neural machine translation, the service instances of multiple neural machine translations may be the same or different. In the case where the translation server includes multiple service instances of statistical machine translation, the service instances of multiple statistical machine translations may be the same or different.

[0044] In this embodiment, Figure 3 It is a flowchart for determining the first translation strategy provided in an embodiment of the present application.

[0045] like Figure 3 As shown, the step of determining the first translation strategy specifically includes S1201-S1203:

[0046] S1201. Evaluate first translation accuracy of each translation service instance of the translation service end according to a source language type and a target language type of a source text.

[0047] Exemplarily, the service instance of neural machine translation translates the source text through a pre-trained neural network model, and the service instance of statistical machine translation translates the source text through a pre-trained statistical model. The translation accuracy of the neural network model and the statistical model for translating various language pairs can be evaluated in advance according to the number of various bilingual training samples used when training the neural network model and the statistical model. Among them, the more the number of bilingual training samples, the higher the translation accuracy. In addition, the neural network model and the statistical model can be tested through a test sample set, and the translation accuracy of the neural network model and the statistical model for translating various language pairs can be evaluated according to the test results. The translation accuracy of each neural network model and each statistical model for translating each language pair is generated into an accuracy mapping table. Afterwards, the translation accuracy of each neural network model and each statistical model is obtained according to the source language type and the target language type. The translation accuracy of each neural network model is used as the first translation accuracy of the service instance corresponding to the neural machine translation, and the translation accuracy of each statistical model is used as the first translation accuracy of the service instance corresponding to the statistical machine translation.

[0048] S1202: Determine the text length and text domain of the source text according to the text content, and evaluate the second translation accuracy of each translation service instance according to the text length and text domain.

[0049] Exemplarily, the text length of the source text is counted according to the number of words in the text content of the source text. The keywords in the text content of the source text are detected, and the text field of the source text is analyzed according to the keywords. For example, when the keyword is a medical name, the text field of the source text is determined to be the medical field, and when the keyword is a sports name, the text field of the source text is determined to be the sports field. Compared with the statistical model, the neural network model is more accurate in translating long sentences or complex texts. Therefore, when the text length is long and the text field is more complex, it can be determined that the translation accuracy of the neural network model is higher than the translation accuracy of the statistical model. In this regard, the present embodiment proposes that when the text length of the source text is less than or equal to the preset length threshold, and when the text field of the source text belongs to a preset simple field, the first preset accuracy is used as the translation accuracy of the neural network model and the statistical model. In the case where the text length of the source text is less than or equal to the preset length threshold but the text domain of the source text does not belong to the preset simple domain, or in the case where the text length of the source text is greater than the preset length threshold but the text domain of the source text belongs to the preset simple domain, the first preset accuracy is used as the translation accuracy of the neural network model, and the second preset accuracy is used as the translation accuracy of the statistical model, and the second preset accuracy is less than the first preset accuracy. In the case where the text length of the source text is greater than the preset length threshold and the text domain of the source text does not belong to the preset simple domain, the first preset accuracy is used as the translation accuracy of the neural network model, and the third preset accuracy is used as the translation accuracy of the statistical model, and the third preset accuracy is less than the second preset accuracy. Afterwards, the translation accuracy corresponding to each neural network model is used as the second translation accuracy of the corresponding neural machine translation service instance, and the translation accuracy of each statistical model is used as the second translation accuracy of the corresponding statistical machine translation service instance.

[0050] S1203: Determine a first translation priority for each translation service instance according to the first translation accuracy and the second translation accuracy of each translation service instance, and generate a first translation strategy for the source text according to the first translation priority for each translation service instance.

[0051] Exemplarily, the first translation accuracy and the second translation accuracy of the translation service instance are added together, and the accumulated value is used as the first translation priority corresponding to the translation service instance. The first translation priority can be understood as the priority of the corresponding translation service instance selected for translating the source text based on the translation quality. Therefore, the higher the translation accuracy of the translation service instance, the higher the priority selected for translating the source text.

[0052] In this embodiment, since the translation accuracy of the neural network model is higher than that of the statistical model, after adding the first translation accuracy and the second translation accuracy of the translation service instance to obtain the cumulative value, the cumulative value of the translation accuracy corresponding to the service instance of the neural machine translation can be multiplied by the first preset weight to obtain the first translation priority of the service instance of the neural machine translation, and the first preset weight is greater than one. The cumulative value of the translation accuracy corresponding to the service instance of the statistical machine translation is used as the first translation priority of the service instance of the statistical machine translation. It can be understood that this embodiment increases the priority gap between the service instance of the neural machine translation and the service instance of the statistical machine translation by multiplying the cumulative value of the translation accuracy corresponding to the service instance of the neural machine translation by a first preset weight greater than one, so as to give priority to translating the source text of the service instance of the neural machine translation with a higher translation accuracy.

[0053] After determining the first translation priority of each translation service instance, the first translation priority of each translation service instance can be used to generate a first translation strategy, so as to indicate the priority of each translation service instance selected for translating the source text based on the translation quality through the first translation strategy. In addition, the first translation priority of each translation service instance can be sorted down, and a preset number of translation service instances with a high ranking and the corresponding first translation priority can be used to generate a first translation strategy, so as to screen out a batch of translation service instances with low translation accuracy and ensure the translation accuracy of the source text.

[0054] S130. Determine a second translation strategy for the source text according to the request traffic and response time of each translation service instance of the translation server; each translation service instance includes a service instance of statistical machine translation and a service instance of neural machine translation.

[0055] Exemplarily, the translation efficiency of each translation service instance in translating the source text can be determined based on the request traffic and response time of each translation service instance, and a second translation strategy for the source text can be generated based on the translation efficiency of each translation service instance to indicate the translation efficiency of each translation service instance when translating the source text through the second translation strategy.

[0056] In this embodiment, Figure 4 It is a flowchart for determining the second translation strategy provided in an embodiment of the present application.

[0057] like Figure 4 As shown, the step of determining the second translation strategy specifically includes S1301-S1303:

[0058] S1301: Determine the second translation priority of each translation service instance according to a preset load balancing algorithm and the request flow of each translation service instance.

[0059] Wherein, the request flow is the total number of translation requests processed by the current translation service instance. The larger the request flow, the larger the load of the translation service instance, and the lower the translation efficiency of the translation service instance to the source text. The smaller the request flow, the smaller the load of the translation service instance, and the higher the translation efficiency of the translation service instance to the source text. In this regard, the present embodiment adopts the least connection algorithm in the load balancing algorithm, and according to the least connection algorithm and the request flow of each translation service instance, it is determined that the second translation priority of the translation service instance with a larger number of requests is smaller, and the second translation priority of the translation service instance with a smaller number of requests is larger.

[0060] S1302: Determine the priority weight of each translation service instance according to the response time of each translation service instance of the translation server.

[0061] Wherein, response time is the time for translation service instance to process translation request, and the response time of current translation service instance can be determined according to the time of each translation request pre-processed by translation service instance. The larger the response time, the lower the translation efficiency of translation service instance is, and the smaller the response time, the higher the translation efficiency of translation service instance is. To this end, the present embodiment pre-sets the negative correlation mapping relationship satisfied between response time and the weight of translation priority, and determines the priority weight of each translation service instance by the negative correlation mapping relationship and the response time of each translation service instance, so that the priority weight of the translation service instance with the larger response time is lower.

[0062] S1303: Multiply the priority weight of each translation service instance by the corresponding second translation priority to obtain a third translation priority of each translation service instance, and generate a second translation strategy for the source text according to the third translation priority of each translation service instance.

[0063] Exemplary, the priority weight of the translation service instance is multiplied by the corresponding second translation priority, and the product can characterize the translation efficiency of the corresponding translation service instance when translating the source text, and the product can be used as the third translation priority of the translation service instance, and the third translation priority can be understood as the priority of the corresponding translation service instance selected for translating the source text based on the translation efficiency. Therefore, the shorter the response time and the smaller the number of requests, the higher the translation efficiency of the translation service instance, and the higher its third translation priority. In this embodiment, since the translation efficiency of the statistical model is higher than that of the neural network model, after the priority weight of the service instance of the statistical machine translation is multiplied by the second translation priority to obtain the product, the product can be multiplied by the second preset weight to obtain the third translation priority of the service instance of the statistical machine translation, and the second preset weight is greater than one. The priority and weight product corresponding to the service instance of the neural machine translation are used as the third translation priority of the service instance of the neural machine translation. It can be understood that in this embodiment, the translation efficiency corresponding to the service instance of the statistical machine translation is multiplied by the second preset weight greater than one to increase the priority gap between the service instance of the statistical machine translation and the service instance of the neural machine translation, so as to give priority to the translation efficiency of the service instance of the statistical machine translation with higher translation efficiency.

[0064] After determining the third translation priority of each translation service instance, the third translation priority of each translation service instance can be used to generate a second translation strategy, so as to indicate the priority of each translation service instance selected for translating the source text based on translation efficiency through the second translation strategy. In addition, the third translation priority of each translation service instance can be sorted down, and a preset number of translation service instances with a high ranking and the corresponding third translation priority can be used to generate a second translation strategy, so as to screen out a batch of translation service instances with low translation efficiency and ensure the translation efficiency of the source text.

[0065] This embodiment determines the second translation priority of each translation service instance through a load balancing algorithm and the request traffic of each translation service instance, determines the priority weight through the response time of each translation service instance, and determines the priority of each translation service instance selected for translating the source text according to the product of the second translation priority and the priority weight, and generates a second translation strategy according to the priority, so as to instruct the selection of a translation service instance with higher translation efficiency to translate the source text through the second translation strategy, thereby ensuring the translation efficiency of the source text.

[0066] S140: Determine a target translation service instance of the source text in each translation service instance according to the second translation strategy and the first translation strategy.

[0067] Exemplarily, when the first translation strategy includes the first translation priority of each translation service instance, and the second translation strategy includes the third translation priority of each translation service instance, the first translation priority of the translation service instance can be added to the third translation priority to obtain the fourth translation priority of the translation service instance; the translation service instance with the largest corresponding fourth translation priority in each translation service instance is determined as the target translation service instance. For example, the translation service end includes translation service instance A, translation service instance B, translation service instance C, and translation service instance D. The first translation strategy and the second translation strategy respectively indicate the first translation priority and the third translation priority of the four translation service instances. The first translation priority and the third translation priority of the translation service instance A are added to obtain the fourth translation priority of the translation service instance A. The fourth translation priority of the translation service instance A can represent the priority of selecting the translation service instance A to translate the source text based on the translation quality and translation efficiency of the translation service instance A. The calculation process of the fourth translation priority of the translation service instance B, the translation service instance C, and the translation service instance D is similar. The fourth translation priorities of the four translation service instances are compared, and the translation service instance with the largest fourth translation priority is used as the target translation service instance for translating the source text. For example, if the fourth translation priority of translation service instance A is the largest, translation service instance A is used as the target translation service instance for translating the source text. It can be understood that the fourth translation priority combines the first translation priority determined based on translation quality and the third translation priority determined based on translation efficiency. The translation service instance with the largest fourth translation priority takes both translation efficiency and translation quality into consideration and can be used as the target translation service instance for translating the source text to ensure the translation quality and translation efficiency of the source text.

[0068] Further, if a batch of translation service instances with lower first translation priorities are screened out in advance and a first translation strategy is generated based on the first translation priorities of the remaining translation service instances, and a batch of translation service instances with lower third translation priorities are screened out in advance and a second translation strategy is generated based on the third translation priorities of the remaining translation service instances, then a co-existing translation service instance can be determined in the first translation strategy and the second translation strategy, and the first translation priority and the third translation priority of the co-existing translation service instance are added to obtain the fifth translation priority of the translation service instance, and the translation service instance with the largest fifth translation priority is used as the target translation service instance. It can be understood that when the translation service instance exists in both the first translation strategy and the second translation strategy, it indicates that the translation service instance takes into account both translation efficiency and translation quality, so the target translation service instance is determined in the translation service instance where the first translation strategy and the second translation strategy co-exist. The fifth translation priority combines the first translation priority determined based on translation quality and the third translation priority determined based on translation efficiency. The translation service instance with the largest fifth translation priority has good performance in terms of translation quality and translation efficiency, and can be used as the target translation service instance for translating the source text to ensure the translation quality and translation efficiency of the source text.

[0069] S150: Allocate the translation request to a target translation service instance, and use the target translation service instance to translate the source text of the translation request to obtain a translated text.

[0070] For example, Figure 5 Schematic diagram of the communication process between the translation server and the translation client provided in the embodiment of the present application. Figure 5 As described, the translation client sends a translation request to the translation server. After the translation server parses the source text according to the translation request, it determines the target translation service instance for translating the source text from translation service instance A, translation service instance B, translation service instance C, and translation service instance D. If the translation server determines that translation service instance A is the target translation service instance, the translation request is assigned to translation service instance A. Translation service instance A calls the corresponding neural network model or statistical model to translate the source text in the translation request from the source language type to the target language type to obtain the translated text. Afterwards, translation service instance A returns the translated text to the translation server. The translation server generates a translation response based on the translated text and sends the translation response to the translation client. Reference Figure 2 If the translation client is a web client, after receiving the translation response, the translation text is obtained in the translation response and displayed in the translation text display box 13 of the front-end web page 10, so that the user can read and copy the translation text corresponding to the source text in the source text input box 11 through the translation text display box 13.

[0071] It should be noted that in the process of processing translation requests, the translation service instance may encounter abnormal problems, resulting in the inability to process the translation request in time, affecting the user's experience. In this regard, the present embodiment proposes to detect the processing status of the target translation service instance for the translation request; when the processing status is a response failure or a response timeout, the retry mechanism is triggered by the exponential backoff algorithm to enable the target translation service instance to reprocess the translation request; when the number of retries of the translation request reaches the preset number threshold, the fuse mechanism is triggered to reallocate the translation request to other translation service instances for processing. Among them, when the target translation service instance fails to translate the source text, the target translation service instance converts the processing status to a response failure; when the time for the target translation service instance to translate the source text exceeds the preset time threshold, the target translation service instance converts the processing status to a response timeout; the preset time threshold is the maximum time required for the target translation service instance to translate the text. When the translation service detects that the target translation service instance is in a state of response failure or response timeout, it can be determined that the target translation service instance is abnormal in the process of translating the source text, and then the retry mechanism of the target translation service instance is triggered through the exponential backoff algorithm. After the retry mechanism is triggered, the target translation service instance reprocesses the translation request to translate the source text. The exponential backoff algorithm limits the time interval between each retry of the target translation service instance, that is, as the number of retries of the target translation service instance increases, the time interval between retries becomes longer. The exponential backoff algorithm can reduce the pressure on the translation service, avoid initiating a large number of retry requests in a short period of time, and ensure the operation stability of the translation service. When the number of retries reaches the preset number threshold, it indicates that the target translation service instance is currently unable to translate the source text into the corresponding translation text, and the translation service allocates the translation request to other translation service instances, so that the translation request can be processed in time through other translation service instances, so as to avoid the processing of the translation request from being stagnant at the target translation service instance, and ensure the processing efficiency of the translation request. This embodiment detects the processing status of the translation request by the target translation service instance in real time, and triggers a retry mechanism when an abnormal state is detected to enable the target translation service instance to reprocess the translation request. When the number of retries reaches an upper limit, the translation request is allocated to other translation service instances to avoid the processing of the translation request being stagnant at the target translation service instance, thereby ensuring the processing efficiency of the translation request.

[0072] In this embodiment, when assigning translation requests to other translation service instances, a candidate translation service instance for translating the source text can be determined based on the first translation strategy and the second translation strategy, and the translation request can be assigned to the candidate translation service instance for processing. Among them, the candidate translation service instance is a translation service instance for translating the source text that is reselected after the target translation service instance fails to translate the source text. The specific implementation process is: add the first translation priority of the translation service instance to the third translation priority to obtain the fourth translation priority of the translation service instance; determine the candidate translation service instance according to the fourth translation priority of each translation service instance, and the fourth translation priority of the candidate translation service instance is only less than the fourth translation priority of the target translation service instance; and reallocate the translation request to the candidate translation service instance for processing. Exemplarily, when determining the target translation service instance, the first translation priority and the third translation priority of the translation service instance are added to obtain the fourth translation priority of the translation service instance, and the various translation service instances are sorted in descending order according to the fourth translation priority, and the first translation service instance is used as the target translation service instance, and the second translation service instance is used as the candidate translation service instance. After determining that the target translation service instance cannot translate the source text, the translation request is reconfigured to the candidate translation service instance so that the source text is translated through the candidate translation service instance. Figure 5 After determining that translation service instance A as the target translation service instance cannot translate the source text, the translation service end determines that translation service instance C is a candidate translation service instance and assigns the translation request to translation service instance C. Translation service instance C translates the source text in the translation request to obtain a translated text, and returns the translated text to the translation service end. The translation service end generates a translation response based on the translated text, and sends the translation response to the translation client, so that the translation client obtains the translated text from the translation response. In this embodiment, the translation request is reprocessed by the candidate translation service instance whose fourth translation priority is second only to the target translation service instance to ensure the translation quality and translation efficiency of the source text.

[0073] In summary, the text translation method based on translation strategy provided by the embodiment of the present application obtains the source text and the target language type to be translated through the received translation request, and identifies the source language type of the source text; determines the first translation strategy of the source text according to the source language type, the target language type and the text content of the source text; determines the second translation strategy of the source text according to the request traffic and response time of each translation service instance of the translation server; each translation service instance includes a service instance of statistical machine translation and a service instance of neural machine translation; according to the second translation strategy and the first translation strategy, determines the target translation service instance of the source text in each translation service instance; assigns the translation request to the target translation service instance, and translates the source text of the translation request through the target translation service instance to obtain a translated text. Through the above-mentioned technical means, the first translation strategy of the source text can be determined according to the language pair and text content of the source text, so as to characterize the translation quality of the translation service instance when translating the source text through the first translation strategy; the second translation strategy of the source text can be determined according to the request traffic and response time of each translation service instance, so as to characterize the translation efficiency of the translation service instance when translating the source text through the second translation strategy; and the appropriate translation service is selected to translate the source text in combination with the first translation strategy and the second translation strategy to ensure translation efficiency and translation quality, thereby solving the problem that the single machine translation method in the prior art has corresponding limitations in terms of efficiency and quality, and can meet the user's requirements for efficient and stable translation.

[0074] Based on the above embodiments, Figure 6 A schematic diagram of the structure of a text translation device based on a translation strategy provided in an embodiment of the present application. Figure 6 The text translation device based on translation strategy provided in this embodiment specifically includes: a language type identification module 21, a first strategy determination module 22, a second strategy determination module 23, a translation service selection module 24 and a text translation module 25.

[0075] The language type identification module 21 is configured to obtain the source text to be translated and the target language type according to the received translation request, and identify the source language type of the source text;

[0076] A first strategy determination module 22, configured to determine a first translation strategy for a source text according to a source language type, a target language type and text content of the source text;

[0077] A second strategy determination module 23 is configured to determine a second translation strategy for the source text according to request traffic and response time of each translation service instance of the translation server; each translation service instance includes a service instance of statistical machine translation and a service instance of neural machine translation;

[0078] A translation service selection module 24, configured to determine a target translation service instance of the source text in each translation service instance according to the second translation strategy and the first translation strategy;

[0079] The text translation module 25 is configured to assign the translation request to a target translation service instance, and translate the source text of the translation request through the target translation service instance to obtain a translated text.

[0080] On the basis of the above embodiment, the first strategy determination module 22 includes: a first accuracy determination unit, configured to evaluate the first translation accuracy of each translation service instance of the translation service end according to the source language type and the target language type of the source text; a second accuracy determination unit, configured to determine the text length and text domain of the source text according to the text content, and evaluate the second translation accuracy of each translation service instance according to the text length and the text domain; the first strategy determination unit is configured to determine the first translation priority of each translation service instance according to the first translation accuracy and the second translation accuracy of each translation service instance, and generate a first translation strategy for the source text according to the first translation priority of each translation service instance.

[0081] On the basis of the above embodiment, the second strategy determination module 23 includes: a first priority determination unit, configured to determine the second translation priority of each translation service instance according to a preset load balancing algorithm and the request traffic of each translation service instance; a weight determination unit, configured to determine the priority weight of each translation service instance according to the response time of each translation service instance of the translation server; a second strategy determination unit, configured to multiply the priority weight of each translation service instance by the corresponding second translation priority to obtain a third translation priority of each translation service instance, and generate a second translation strategy for the source text according to the third translation priority of each translation service instance.

[0082] On the basis of the above-mentioned embodiment, the first translation strategy is used to indicate the first translation priority of each translation service instance, and the second translation strategy is used to indicate the third translation priority of each translation service instance; accordingly, the translation service selection module 24 includes: a second priority determination unit, configured to add the first translation priority and the third translation priority of the translation service instance to obtain the fourth translation priority of the translation service instance; a translation service selection unit, configured to determine the translation service instance with the largest corresponding fourth translation priority among each translation service instance as the target translation service instance.

[0083] On the basis of the above embodiments, the text translation device based on the translation strategy also includes an exception handling module, which includes: a processing status detection unit, configured to detect the processing status of the translation request by the target translation service instance after the translation request is assigned to the target translation service instance; a request reprocessing unit, configured to trigger a retry mechanism through an exponential backoff algorithm to enable the target translation service instance to reprocess the translation request when the processing status is a response failure or a response timeout; a request reallocation unit, configured to trigger a fuse mechanism to reallocate the translation request to other translation service instances for processing when the number of retries of the translation request reaches a preset number threshold.

[0084] On the basis of the above embodiments, the first translation strategy is used to indicate the first translation priority of each translation service instance, and the second translation strategy is used to indicate the third translation priority of each translation service instance; accordingly, the request reallocation unit includes: a priority determination subunit, configured to add the first translation priority and the third translation priority of the translation service instance to obtain the fourth translation priority of the translation service instance; a candidate instance determination subunit, configured to determine the candidate translation service instance according to the fourth translation priority of each translation service instance, the fourth translation priority of the candidate translation service instance is only less than the fourth translation priority of the target translation service instance; a request reallocation subunit, configured to reallocate the translation request to the candidate translation service instance for processing.

[0085] Based on the above embodiment, the language type recognition module includes: a voice data acquisition unit, configured to acquire voice data corresponding to the source text according to a translation request; a voice type acquisition unit, configured to input the source text and voice data into a pre-trained multimodal recognition model to obtain the source language type of the source text output by the multimodal recognition model.

[0086] As described above, the text translation device based on translation strategy provided by the embodiment of the present application obtains the source text and the target language type to be translated through the received translation request, and identifies the source language type of the source text; determines the first translation strategy of the source text according to the source language type, the target language type and the text content of the source text; determines the second translation strategy of the source text according to the request traffic and response time of each translation service instance of the translation service end; each translation service instance includes a service instance of statistical machine translation and a service instance of neural machine translation; according to the second translation strategy and the first translation strategy, determines the target translation service instance of the source text in each translation service instance; assigns the translation request to the target translation service instance, and translates the source text of the translation request through the target translation service instance to obtain a translated text. Through the above-mentioned technical means, the first translation strategy of the source text can be determined according to the language pair and text content of the source text, so as to characterize the translation quality of the translation service instance when translating the source text through the first translation strategy; the second translation strategy of the source text can be determined according to the request traffic and response time of each translation service instance, so as to characterize the translation efficiency of the translation service instance when translating the source text through the second translation strategy; and the appropriate translation service is selected to translate the source text in combination with the first translation strategy and the second translation strategy to ensure translation efficiency and translation quality, thereby solving the problem that the single machine translation method in the prior art has corresponding limitations in terms of efficiency and quality, and can meet the user's requirements for efficient and stable translation.

[0087] The text translation device based on translation strategy provided in the embodiment of the present application can be used to execute the text translation method based on translation strategy provided in the above embodiment, and has corresponding functions and beneficial effects.

[0088] Figure 7 is a structural diagram of a text translation device based on a translation strategy provided in an embodiment of the present application, with reference to Figure 7 The text translation device based on the translation strategy includes: a processor 31, a memory 32, a communication device 33, an input device 34 and an output device 35. The number of the processor 31 in the text translation device based on the translation strategy can be one or more, and the number of the memory 32 in the text translation device based on the translation strategy can be one or more. The processor 31, the memory 32, the communication device 33, the input device 34 and the output device 35 of the text translation device based on the translation strategy can be connected through a bus or other methods.

[0089] The memory 32, as a computer-readable storage medium, can be used to store software programs, computer executable programs and modules, such as program instructions / modules corresponding to the text translation method based on the translation strategy of any embodiment of the present application (for example, the language type identification module 21, the first strategy determination module 22, the second strategy determination module 23, the translation service selection module 24 and the text translation module 25 in the text translation device based on the translation strategy). The memory 32 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function; the data storage area may store data created according to the use of the device, etc. In addition, the memory 32 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, or other non-volatile solid-state storage devices. In some instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network and a combination thereof.

[0090] The communication device 33 is used for data transmission.

[0091] The processor 31 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 32, that is, implements the above-mentioned text translation method based on the translation strategy.

[0092] The input device 34 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 35 may include a display device such as a display screen.

[0093] The text translation device based on the translation strategy provided above can be used to execute the text translation method based on the translation strategy provided in the above embodiment, and has corresponding functions and beneficial effects.

[0094] An embodiment of the present application also provides a storage medium containing computer executable instructions, which are used to execute a text translation method based on a translation strategy when executed by a computer processor. The text translation method based on the translation strategy includes: obtaining a source text and a target language type to be translated according to a received translation request, and identifying the source language type of the source text; determining a first translation strategy for the source text according to the source language type, the target language type and the text content of the source text; determining a second translation strategy for the source text according to the request traffic and response time of each translation service instance of the translation service end; each translation service instance includes a service instance for statistical machine translation and a service instance for neural machine translation; determining a target translation service instance for the source text in each translation service instance according to the second translation strategy and the first translation strategy; allocating the translation request to the target translation service instance, and translating the source text of the translation request through the target translation service instance to obtain a translated text.

[0095] Storage medium - any of various types of memory devices or storage devices. The term "storage medium" is intended to include: installation media, such as CD-ROM, floppy disk or tape device; computer system memory or random access memory, such as DRAM, DDR RAM, SRAM, EDO RAM, Rambus RAM, etc.; non-volatile memory, such as flash memory, magnetic media (such as hard disk or optical storage); registers or other similar types of memory elements, etc. Storage media may also include other types of memory or combinations thereof. In addition, the storage medium may be located in the first computer system in which the program is executed, or may be located in a different second computer system, which is connected to the first computer system via a network (such as the Internet). The second computer system can provide program instructions to the first computer for execution. The term "storage medium" may include two or more storage media residing in different locations (for example, in different computer systems connected by a network). The storage medium may store program instructions (for example, embodied as a computer program) that can be executed by one or more processors.

[0096] Of course, the storage medium containing computer executable instructions provided in the embodiments of the present application is not limited to the above-mentioned text translation method based on translation strategy, and the computer executable instructions can also execute the relevant operations in the text translation method based on translation strategy provided in any embodiment of the present application.

[0097] The translation strategy-based text translation apparatus, storage medium, and translation strategy-based text translation device provided in the above embodiments can execute the translation strategy-based text translation method provided in any embodiment of the present application. For technical details not described in detail in the above embodiments, please refer to the translation strategy-based text translation method provided in any embodiment of the present application.

[0098] The above are only preferred embodiments of the present application and the technical principles used. The present application is not limited to the specific embodiments herein, and various obvious changes, readjustments and substitutions that can be made by those skilled in the art will not deviate from the protection scope of the present application. Therefore, although the present application is described in more detail through the above embodiments, the present application is not limited to the above embodiments, and may also include more other equivalent embodiments without departing from the concept of the present application, and the scope of the present application is determined by the scope of the claims.

Claims

1. A text translation method based on translation strategy, characterized in that: Applied to the translation server, including: Acquire a source text to be translated and a target language type according to the received translation request, and identify the source language type of the source text; Determining a first translation strategy for the source text according to a source language type, a target language type, and text content of the source text; Determining a second translation strategy for the source text according to request traffic and response time of each translation service instance of the translation server; each translation service instance includes a service instance of statistical machine translation and a service instance of neural machine translation; Determining a target translation service instance of the source text in each of the translation service instances according to the second translation strategy and the first translation strategy; The translation request is assigned to the target translation service instance, and the source text of the translation request is translated by the target translation service instance to obtain a translated text.

2. The text translation method based on translation strategy according to claim 1, characterized in that: Determining the first translation strategy of the source text according to the source language type, the target language type and the text content of the source text includes: According to the source language type and the target language type of the source text, evaluating the first translation accuracy of each translation service instance of the translation server; Determine the text length and text domain of the source text according to the text content, and evaluate the second translation accuracy of each translation service instance according to the text length and the text domain; A first translation priority of each translation service instance is determined according to the first translation accuracy and the second translation accuracy of each translation service instance, and a first translation strategy of the source text is generated according to the first translation priority of each translation service instance.

3. The text translation method based on translation strategy according to claim 1, characterized in that: Determining the second translation strategy of the source text according to the request flow and response time of each translation service instance of the translation server includes: Determining the second translation priority of each translation service instance according to a preset load balancing algorithm and the request flow of each translation service instance; Determining the priority weight of each translation service instance according to the response time of each translation service instance of the translation server; The priority weight of each translation service instance is multiplied by the corresponding second translation priority to obtain a third translation priority of each translation service instance, and the second translation strategy of the source text is generated according to the third translation priority of each translation service instance.

4. The text translation method based on translation strategy according to claim 1, characterized in that: The first translation strategy is used to indicate a first translation priority of each translation service instance, and the second translation strategy is used to indicate a third translation priority of each translation service instance; Correspondingly, determining the target translation service instance of the source text in each translation service instance according to the second translation strategy and the first translation strategy includes: Adding the first translation priority and the third translation priority of the translation service instance to obtain a fourth translation priority of the translation service instance; A translation service instance having the highest fourth translation priority among the translation service instances is determined as the target translation service instance.

5. The text translation method based on translation strategy according to claim 1, characterized in that: After allocating the translation request to the target translation service instance, the method further includes: Detecting a processing status of the translation request by the target translation service instance; When the processing status is response failure or response timeout, triggering a retry mechanism through an exponential backoff algorithm to enable the target translation service instance to reprocess the translation request; When the number of retries of the translation request reaches a preset number threshold, a fuse mechanism is triggered to reallocate the translation request to other translation service instances for processing.

6. The text translation method based on translation strategy according to claim 5, characterized in that: The first translation strategy is used to indicate a first translation priority of each translation service instance, and the second translation strategy is used to indicate a third translation priority of each translation service instance; Accordingly, the step of allocating the translation request to other translation service instances for processing includes: Adding the first translation priority and the third translation priority of the translation service instance to obtain a fourth translation priority of the translation service instance; Determine a candidate translation service instance according to the fourth translation priority of each translation service instance, wherein the fourth translation priority of the candidate translation service instance is only less than the fourth translation priority of the target translation service instance; The translation request is reallocated to the candidate translation service instance for processing.

7. The text translation method based on translation strategy according to claim 1, characterized in that: The step of identifying the source language type of the source text comprises: Acquire voice data corresponding to the source text according to the translation request; The source text and the speech data are input into a pre-trained multimodal recognition model to obtain a source language type of the source text output by the multimodal recognition model.

8. A text translation device based on translation strategy, characterized in that: Applied to the translation server, including: A language type identification module is configured to obtain a source text to be translated and a target language type according to a received translation request, and identify a source language type of the source text; A first strategy determination module is configured to determine a first translation strategy for the source text according to a source language type, a target language type and text content of the source text; A second strategy determination module is configured to determine a second translation strategy for the source text according to request traffic and response time of each translation service instance of the translation server; the each translation service instance includes a service instance of statistical machine translation and a service instance of neural machine translation; a translation service selection module, configured to determine a target translation service instance of the source text among the translation service instances according to the second translation strategy and the first translation strategy; The text translation module is configured to assign the translation request to the target translation service instance, and translate the source text of the translation request through the target translation service instance to obtain a translated text.

9. A text translation device based on a translation strategy, characterized in that: include: one or more processors; A memory stores one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors implement the text translation method based on the translation strategy as described in any one of claims 1-7.

10. A storage medium containing computer executable instructions, characterized in that: When the computer executable instructions are executed by a computer processor, they are used to execute the text translation method based on translation strategy according to any one of claims 1 to 7.