Text translation method, device, electronic device and storage medium

By replacing and marking phrases in the text in the translation model, translating them into the target person's name, and translating other texts into the target language, the problem of translation errors in the prior art is solved and the accuracy of translation is improved.

CN115062631BActive Publication Date: 2025-03-11BEIJING IQIYI TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210563887.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-23
Publication Date
2025-03-11
Estimated Expiration
2042-05-23

AI Technical Summary

Technical Problem

When translating human names in texts, the prior art cannot accurately process phrases corresponding to human names and non-human names semantics, resulting in translation errors.

Method used

By replacing the phrase in the text to be translated with the target person name and marking it, a new text is formed, and then inputting the text into the target translation model, identifying and outputting the marked person name, and translating other texts into the target language.

Benefits of technology

It effectively prevents phrases with human name semantics and non-human name semantics from being mistakenly translated into words with non-human name semantics during translation, improving the accuracy of text translation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115062631B_ABST
    Figure CN115062631B_ABST
Patent Text Reader

Abstract

The present application provides a text translation method, device, electronic device and storage medium, the method comprising: when a first text to be translated into a target language includes a first phrase, the first phrase is replaced with a first target name and marked to obtain a second text, the first target name corresponds to the target language, the first phrase corresponds to the source language, the first phrase corresponds to the name semantics and at least one non-name semantics, and the real semantics of the first phrase in the first text is the name; the second text is input into a target translation model to obtain the target text; the target translation model is used to identify the first target name in a marked state and output it, and translate the text in the second text that is different from the first target name into the target language and output it. The present application can prevent the first phrase from being translated into a word with non-name semantics when it needs to be translated into a word with name semantics, so that the first text can be accurately translated, improving the accuracy of text translation.
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, device, electronic device and storage medium. Background Art

[0002] In the field of machine translation, when translating names, data training is mainly used to allow the model to fit autonomously, recognize the name based on the model and translate it correctly. However, in the case of names corresponding to other meanings, if data fitting is performed directly through the model, the noun that should be a name may be translated into a noun with other meanings, which will cause errors in the translation of the name. Summary of the invention

[0003] The embodiments of the present application provide a text translation method, device, electronic device and storage medium to solve the problem in the prior art that a person's name corresponding to at least one non-person's name semantics cannot be accurately translated in a text.

[0004] In a first aspect of an embodiment of the present application, a text translation method is provided, comprising:

[0005] In a case where a first text to be translated into a target language includes a first phrase, the first phrase is replaced with a first target name and marked to obtain a second text, wherein the first target name corresponds to the target language, the first phrase corresponds to a source language, the first phrase corresponds to a person name semantics and at least one non-person name semantics, and the actual semantics of the first phrase in the first text is a person name;

[0006] Inputting the second text into a target translation model to obtain a target text corresponding to the first text;

[0007] The target translation model is used to identify and output the first target name in a marked state, translate the text in the second text that is different from the first target name into the target language and output it, and the target text corresponds to the target language.

[0008] In a second aspect of the embodiment of the present application, a text translation device is also provided, including:

[0009] a processing module, configured to, when a first text to be translated into a target language includes a first phrase, replace the first phrase with a first target name and mark the first phrase to obtain a second text, wherein the first target name corresponds to the target language, the first phrase corresponds to a source language, the first phrase corresponds to a person name semantics and at least one non-person name semantics, and the actual semantics of the first phrase in the first text is a person name;

[0010] A first acquisition module, used for inputting the second text into a target translation model to acquire a target text corresponding to the first text;

[0011] The target translation model is used to identify and output the first target name in a marked state, translate the text in the second text that is different from the first target name into the target language and output it, and the target text corresponds to the target language.

[0012] In a third aspect of the embodiments of the present application, an electronic device is further provided, including:

[0013] at least one processor; and a memory communicatively coupled to the at least one processor;

[0014] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned text translation method.

[0015] In a fourth aspect of the embodiments of the present application, a non-transitory computer-readable storage medium storing computer instructions is also provided, wherein the computer instructions are used to enable the computer to execute the above-mentioned text translation method.

[0016] In a fifth aspect of the embodiments of the present application, a computer program product is also provided, including a computer program, and the computer program implements the above-mentioned text translation method when executed by a processor.

[0017] The embodiments of the present application include at least the following technical effects:

[0018] The technical solution of the present application obtains a second text by replacing a first phrase in a first text with a first target name and marking it, and then inputs the second text into a target translation model, wherein the target translation model recognizes and outputs the first target name in a marked state, and translates the text in the second text that is different from the first target name into a target language and outputs it, thereby obtaining a target text. This can prevent the first phrase corresponding to the semantics of a person's name and the semantics of a non-person's name from being translated into a word with the semantics of a non-person's name when it needs to be translated into a word with the semantics of a person's name, thereby accurately translating the first text including the first phrase, thereby improving the accuracy of text translation. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art are briefly introduced below.

[0020] Figure 1 A flowchart of a text translation method provided in an embodiment of the present application;

[0021] Figure 2 A schematic diagram of the structure of a text translation device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0022] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. 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 this application.

[0023] It should be understood that the references to "one embodiment" or "an embodiment" throughout the specification mean that the specific features, structures, or characteristics associated with the embodiment are included in at least one embodiment of the present application. Therefore, the references to "in one embodiment" or "in an embodiment" appearing throughout the specification do not necessarily refer to the same embodiment. In addition, these specific features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0024] In the various embodiments of the present application, it should be understood that the size of the serial numbers of the following processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0025] The text translation method provided in the embodiment of the present application is described in detail below.

[0026] The text translation method provided in the embodiment of the present application is applied to an electronic device, which may be a server or a terminal device. The electronic device is provided with a target translation model, and the electronic device is used to translate a first text from a source language into a target language, such as Figure 1 As shown, the method may include:

[0027] Step 101: When a first text to be translated into a target language includes a first phrase, the first phrase is replaced with a first target name and marked to obtain a second text, wherein the first target name corresponds to the target language, the first phrase corresponds to the source language, the first phrase corresponds to a name semantics and at least one non-name semantics, and the actual semantics of the first phrase in the first text is a name.

[0028] For a first text to be translated into a target language, the electronic device first needs to determine whether the first text includes a first phrase before translating the first text into the target language. The first phrase refers to a word corresponding to the semantics of a person's name and at least one non-person's name, and its real semantics in the first text is the semantics of a person's name. In the case where the first text includes the first phrase, the electronic device replaces the first phrase with the first target person's name and marks it to obtain a second text. The first target person's name is the corresponding translation word in the target language when the first phrase is the semantics of a person's name. The second text obtained by the electronic device includes the first target person's name corresponding to the first phrase and the text in the first text that is different from the first phrase, wherein the first target person's name corresponds to the target language, and the text in the first text that is different from the first phrase corresponds to the source language.

[0029] Through step 101, the electronic device replaces the first phrase with the first target name, thereby preventing the electronic device from directly translating the first phrase into words corresponding to the non-name semantics of the first phrase when the true semantics of the first phrase are uncertain, thereby preventing the first text translation error from occurring.

[0030] Specifically, the first text may be part or the whole of a text file, for example, the first text may be at least one line in a film or TV series or at least one sentence or paragraph in a literary work. The source language corresponding to the first text may be Chinese, the target language may be English, or both may be other languages, which are not specifically limited in this application.

[0031] Step 102, input the second text into a target translation model to obtain a target text corresponding to the first text; wherein the target translation model is used to identify and output the first target name in a marked state, translate the text in the second text that is different from the first target name into the target language and output it, and the target text corresponds to the target language.

[0032] After obtaining the second text, the electronic device inputs it into the target translation model to obtain the target text. Specifically, the target translation model can identify and output the first target name in the marked state in the second text, and can translate the text in the second text that is different from the first target name into the target language and output it, that is, the target translation model can translate the unmarked text in the second text into the target language, without processing the first target name, and splice the translated text corresponding to the first target name and the part of the first text that is different from the first target file to obtain the target text.

[0033] In an embodiment of the present application, a second text is obtained by replacing a first phrase in a first text with a first target name and marking it, and then the second text is input into a target translation model, the target translation model identifies the first target name in a marked state and outputs it, and the text in the second text that is different from the first target name is translated into the target language and outputs it, thereby obtaining the target text. In the case where the first text to be translated into the target language includes a first phrase corresponding to the semantics of a name and at least one non-name semantics, the present application first replaces the first phrase with the corresponding word in the target language when it is used as the semantics of a name, i.e., the first target name, before translating the first text through the target translation model, thereby preventing the first phrase from being translated incorrectly due to the direct translation of the first text through the target translation model. Therefore, the present application can prevent the first phrase corresponding to the semantics of a name and non-name semantics from being translated into a word with non-name semantics when it needs to be translated into a word with the semantics of a name, and thus can accurately translate the first text including the first phrase, thereby improving the accuracy of text translation.

[0034] In an optional embodiment of the present application, before replacing the first phrase with the first target name and marking it in step 101, the method further includes:

[0035] Acquire a name library corresponding to the text set including the first text, wherein the name library stores at least one first name corresponding to the text set, and the first name corresponds to at least one non-name semantics;

[0036] In a case where it is detected that the first text includes the first person's name, the first person's name in the first text is determined as the first phrase.

[0037] After the electronic device obtains the first text to be translated into the target language, in order to improve the accuracy of text translation and avoid translating the name with non-name semantics incorrectly, it is necessary to detect whether the first text includes a first phrase, where the first phrase corresponds to the semantics of the name and at least one non-name semantics, and the actual semantics in the first text is a name.

[0038] For the first text, the electronic device can obtain a name library corresponding to the text set to which the first text belongs, and the name library stores at least one first name in the text set, and each first name corresponds to at least one non-name semantics, that is, all names with non-name semantics in the text set are stored in the name library. For example, when the first text is a line, the text set can be a line set of a film or TV series to which the lines belong, and the name library corresponding to the line set can be a character name with non-name semantics in the film or TV series. For example, the character name can be "Bai Xue", and "Bai Xue" can correspond to non-name semantics in addition to the name semantics, such as white snow.

[0039] The electronic device can determine whether the first text includes the first phrase by detecting whether the first text includes the first person's name. If it is detected that the first text includes the first person's name, the first person's name in the detected first text can be determined as the first phrase.

[0040] The above-mentioned implementation scheme of the present application determines whether the first text includes the first phrase by obtaining a name library corresponding to a text set including the first text, and detecting whether the first text includes the first name in the name library. Thus, it is possible to quickly determine whether the first text includes the first phrase based on the name library.

[0041] In an optional embodiment of the present application, the name library includes a target name corresponding to each first name.

[0042] The method further comprises:

[0043] Retrieving the target name corresponding to the first phrase in the name database;

[0044] The retrieved target name is determined as the first target name.

[0045] When the electronic device determines that the first text includes the first phrase, the first phrase needs to be replaced with the first target name and marked, and the first target name is the translation word of the first phrase as a name semantics in the target language. In the name library, each first name corresponds to a target name, and the target name is the translation word corresponding to the first name in the target language. Therefore, the electronic device can retrieve the target name corresponding to the first phrase in the name library, and determine the retrieved target name as the first target name, so that the translation word in the target language when the first phrase is used as a name can be directly obtained without translation through the translation model.

[0046] The above implementation scheme of the present application can quickly obtain the correct translation result of the first phrase in the first text, that is, the first target name, by searching the first target name corresponding to the first phrase in the name library, thereby improving the translation efficiency of text translation.

[0047] In an optional embodiment of the present application, replacing the first phrase with the first target person's name and marking it in step 101 includes:

[0048] inserting a first symbol before the first target person's name and inserting a second symbol after the first target person's name;

[0049] The first symbol is an initial symbol indicating the start of recognition, and the second symbol is a termination symbol indicating the stop of recognition.

[0050] After the electronic device replaces the first phrase with the first target name, in order to enable the target translation model to recognize the first target name, the first symbol and the second symbol may be used to mark the first target name. Specifically, the first symbol may be inserted before the first target name as an initial symbol, and the second symbol may be inserted before the first target name as a termination symbol. For example, the first symbol may be “<”, and the second symbol may be ">”.

[0051] Specifically, when the first text includes multiple first phrases, the first target person name corresponding to each first phrase is marked by the first symbol and the second symbol, and the target translation model can determine each first target person name by identifying the first symbol and the second symbol. Specifically, multiple groups of different first symbols and second symbols can be set, so that different first phrases can correspond to different first symbols and second symbols.

[0052] The above implementation scheme of the present application, by adding an initial symbol and an end symbol before and after the first target name respectively, enables the target translation model to quickly identify the first target name based on the positions of the initial symbol and the end symbol, thereby improving the efficiency of the target translation model in identifying the first target name.

[0053] In an optional embodiment of the present application, step 102 inputs the second text into a target translation model to obtain a target text corresponding to the first text, including:

[0054] Recognize the first symbol and the second symbol based on the target translation model to determine the first target name in a marked state;

[0055] Translating the text in the second text that is different from the first target name based on the target translation model to obtain a third text corresponding to the target language;

[0056] Copying the target name to a target position in the third text based on the target translation model to obtain the target text;

[0057] The target position is determined based on the position of the first target name in the second text.

[0058] After acquiring the second text, the electronic device inputs the second text into the target translation model. The target translation model first identifies the first target name in the second text, then translates the text in the second text that is different from the first target name to obtain a third text corresponding to the target language, and finally adds the identified first target name to the target position in the third text to obtain the target text, which is the translation text corresponding to the first text in the target language. The target position can be determined based on the position of the first target name in the second text.

[0059] Specifically, the target translation model may be a pre-trained translation model that can identify the marked words in the text to be translated, translate the unmarked text, and add the marked words to the translated text.

[0060] Specifically, when training the target translation model, a name dictionary and a training text set may be pre-set, wherein the training text set includes a plurality of training texts and a standard translation text in the target language corresponding to each training text. The names in the training text are replaced and marked by the name dictionary, and then input into the target translation model to obtain the translation text in the target language, and then the optimization parameters are determined by comparing the difference between the translation text and the standard translation text, and the target translation model is optimized, so that the target translation text can finally recognize the names in the training text that belong to the name dictionary, translate the parts of the training text other than the names, and accurately copy the target names in the target language corresponding to the names into the translated text.

[0061] In the above implementation scheme of the present application, the remaining text in the second text except the first target text can be translated into the target language to obtain a third text through the target translation model, and the first target name can be copied into the third text to obtain the target text. The target translation model can directly copy the first target name that has been translated into the target language, thereby preventing the target translation model from translating the first phrase into a word with non-name semantics when the true semantics of the first phrase is uncertain, thereby improving the accuracy of text translation.

[0062] In an optional embodiment of the present application, the method further includes:

[0063] Acquire a plurality of training texts, wherein the training texts correspond to the source language, and the training texts include marked second phrases, and the second phrases correspond to the target language;

[0064] For each of the training texts, obtaining a first translation text corresponding to the training text, where the first translation text corresponds to the target language;

[0065] Performing model training according to the plurality of training texts and the first translation text corresponding to each of the training texts, and obtaining a matching degree between the first translation text and a second translation text after completing one model training, wherein the second translation text is an output result of the translation model obtained through training;

[0066] When the matching degree is less than a preset ratio, the model training process is repeated until the matching degree between the first translation text and the second translation text is greater than the preset ratio, then the model training is stopped to obtain the target translation model.

[0067] It should be noted that when performing model training based on multiple training texts and the first translation text corresponding to each training text, the electronic device can input the training text and the first translation text into a pre-built model architecture. Perform at least one training with the training text and the first translation text to obtain a target translation model. Among them, the process of model training can be understood as the process of adjusting model parameters. For each model training except the first model training, the model parameters need to be adjusted before training, so the model parameters corresponding to each model training are different.

[0068] Specifically, in the process of obtaining the target translation model, after a model training is performed on the training text and the first translation text, the matching degree between the first translation text and the second translation text output by the trained translation model is obtained, and then the matching degree is compared with a preset ratio (for example, the preset ratio is 95%) to determine whether the model training process is completed.

[0069] Specifically, when the matching degree is less than a preset ratio, the model training process is repeated until the matching degree between the first translation text and the second translation text is greater than a preset ratio. At this time, when the model obtained by the model training is used for translation, the matching degree between the output second translation text and the first translation text reaches a preset ratio, indicating that the difference between the output second translation text and the expected translation text meets the condition, so the model training can be stopped to obtain the target translation model.

[0070] The above-mentioned implementation scheme of the present application, in the process of obtaining the target translation model by performing at least one model training according to the training text and the first translation text, obtains the matching degree of the first translation text and the second translation text after each model training, and determines the number of training times corresponding to the stop of the model training based on the relationship between the matching degree and the preset ratio, so that the target translation model obtained when the model training is stopped can reduce the difference between the output translation text and the expected text when translating the text.

[0071] In order to further illustrate the technical solution of the present application, the above technical solution is applied to a specific scenario. For example, in the character list of a TV series, there is a person named "Bai Xue". In the process of translating the Chinese subtitles of the TV series into English subtitles, a common translation model may translate "Bai Xue" as "snow white" instead of the translation "Bai Xue" as a person's name. The technical solution of the present application is introduced below through the sentence "Excuse me, is Bai Xue here?" as an example.

[0072] "Excuse me, is Bai Xue here?" is determined as the first text. The source language corresponding to the first text is Chinese, and the target language corresponding to the target text to be obtained is English. The first phrase corresponds to the semantics of a person's name and at least one non-person's name, and the real semantics of the first phrase in the first text is a person's name. Then "Bai Xue" meets the conditions of the first phrase, and "Bai Xue" is determined as the first phrase. By replacing the first phrase (Bai Xue) with the first target person's name (Bai Xue) and marking it, the second text, namely "Excuse me, is Bai Xue here?", is obtained.<Bai Xue> Are you there? ", where the first phrase is marked by the symbols "<" and ">". The second text (Excuse me<Bai Xue> Are you there? ) is input into the target translation model, and the target translation model can recognize the symbols "<" (the initial symbol indicating the start of recognition) and ">" (the terminal symbol indicating the end of recognition), output the first target name (Bai Xue) and output the second text (Excuse me<Bai Xue> In the text translation method provided by the present application, the first text can be accurately translated, the accuracy of the text translation is improved, and the text translation into "Is snow white there?" is avoided.

[0073] The above describes the text translation method provided in the embodiment of the present application. The following will describe the text translation device provided in the embodiment of the present application in conjunction with the accompanying drawings.

[0074] like Figure 2 As shown, the embodiment of the present application also provides a text translation device, the device comprising:

[0075] The processing module 201 is used to replace the first phrase with a first target name and mark it to obtain a second text when a first text to be translated into a target language includes a first phrase, wherein the first target name corresponds to the target language, the first phrase corresponds to the source language, the first phrase corresponds to a name semantics and at least one non-name semantics, and the actual semantics of the first phrase in the first text is a name.

[0076] The first acquisition module 202 is used to input the second text into a target translation model to acquire a target text corresponding to the first text.

[0077] The target translation model is used to identify and output the first target name in a marked state, translate the text in the second text that is different from the first target name into the target language and output it, and the target text corresponds to the target language.

[0078] Optionally, the device further comprises:

[0079] A second acquisition module is used to acquire a name library corresponding to the text set including the first text, wherein the name library stores at least one first name corresponding to the text set, and the first name corresponds to at least one non-name semantics;

[0080] A determination module is used to determine the first name in the first text as the first phrase when it is detected that the first text includes the first name.

[0081] Optionally, the name library includes target names corresponding to each first name, and the device further includes:

[0082] A search module, used for searching the name database for a target name corresponding to the first phrase;

[0083] The second determining module is used to determine the retrieved target name as the first target name.

[0084] Optionally, the processing module 201 includes:

[0085] An inserting submodule, used for inserting a first symbol before the first target name and inserting a second symbol after the first target name;

[0086] The first symbol is an initial symbol indicating the start of recognition, and the second symbol is a termination symbol indicating the stop of recognition.

[0087] Optionally, the first acquisition module 202 includes:

[0088] a recognition submodule, configured to recognize the first symbol and the second symbol based on the target translation model, and determine the first target name in a marked state;

[0089] a translation submodule, configured to translate the text in the second text that is different from the first target name based on the target translation model to obtain a third text corresponding to the target language;

[0090] A copy submodule, used for copying the target name to a target position in the third text based on the target translation model to obtain the target text;

[0091] The target position is determined based on the position of the first target name in the second text.

[0092] Optionally, the device further comprises:

[0093] A third acquisition module is used to acquire a plurality of training texts, wherein the training texts correspond to the source language, and the training texts include marked second phrases, and the second phrases correspond to the target language;

[0094] A fourth acquisition module, configured to acquire, for each of the training texts, a first translation text corresponding to the training text, wherein the first translation text corresponds to the target language;

[0095] a fifth acquisition module, configured to perform model training according to the plurality of training texts and the first translation text corresponding to each of the training texts, and obtain a matching degree between the first translation text and a second translation text after completing one model training, wherein the second translation text is an output result of the translation model obtained through training;

[0096] The sixth acquisition module is used to repeat the model training process when the matching degree is less than a preset ratio, until the matching degree between the first translation text and the second translation text is greater than the preset ratio, stop the model training, and acquire the target translation model.

[0097] The text translation device provided by the present application obtains a second text by replacing a first phrase in a first text with a first target name and marking it, and then inputs the second text into a target translation model, wherein the target translation model recognizes and outputs the first target name in a marked state, and translates the text in the second text that is different from the first target name into a target language and outputs it, thereby obtaining a target text. This device can prevent the first phrase corresponding to the semantics of a person's name and the semantics of a non-personal name from being translated into a word with the semantics of a non-personal name when it needs to be translated into a word with the semantics of a person's name, thereby accurately translating the first text including the first phrase, thereby improving the accuracy of text translation.

[0098] The present application also provides an electronic device, including:

[0099] at least one processor; and a memory communicatively coupled to the at least one processor;

[0100] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the above-mentioned text translation method.

[0101] The memory mentioned in the above electronic device may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the above processor.

[0102] The processor mentioned in the above electronic device can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0103] The embodiment of the present application also provides a non-transitory computer-readable storage medium storing computer instructions, wherein the computer instructions are used to enable the computer to execute the above-mentioned text translation method.

[0104] An embodiment of the present application also provides a computer program product, including a computer program, which implements the above-mentioned text translation method when executed by a processor.

[0105] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can 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 embodiment 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, 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 a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium may be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrated. The available medium may be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive Solid State Disk (SSD)), etc.

[0106] It should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0107] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0108] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application are included in the protection scope of the present application.

Claims

1. A text translation method, characterized in that: The method comprises: In a case where a first text to be translated into a target language includes a first phrase, the first phrase is replaced with a first target name and marked to obtain a second text, wherein the first target name corresponds to the target language, the first phrase corresponds to a source language, the first phrase corresponds to a name semantics and at least one non-name semantics, and the real semantics of the first phrase in the first text is a name, and the second text is obtained by marking the first target name with an initial symbol and an end symbol respectively; Inputting the second text into a target translation model to obtain a target text corresponding to the first text; Among them, the first text belongs to a text collection, the text collection corresponds to a name library, the first names with non-name semantics in the text collection are all stored in the name library, the first phrase is determined based on the first name in the first text when it is detected that the first text includes the first name, the target translation model identifies the first target name based on the positions of the initial symbol and the terminal symbol, the target translation model is used to identify the first target name in a marked state and output it, translate the text in the second text that is different from the first target name into the target language and output it, and the target text corresponds to the target language.

2. The text translation method according to claim 1, characterized in that: Before replacing the first phrase with the first target person's name and marking it, the method further includes: Acquire a name library corresponding to the text set including the first text, wherein the name library stores at least one first name corresponding to the text set, and the first name corresponds to at least one non-name semantics; In a case where it is detected that the first text includes the first person's name, the first person's name in the first text is determined as the first phrase.

3. The text translation method according to claim 2, characterized in that: The name library includes target names corresponding to each first name; The method further comprises: Retrieving the target name corresponding to the first phrase in the name database; The retrieved target name is determined as the first target name.

4. The text translation method according to claim 1, characterized in that: The step of replacing the first phrase with the first target person's name and marking the first phrase includes: inserting a first symbol before the first target person's name and inserting a second symbol after the first target person's name; The first symbol is an initial symbol indicating the start of recognition, and the second symbol is a termination symbol indicating the stop of recognition.

5. The text translation method according to claim 4, characterized in that: The step of inputting the second text into a target translation model to obtain a target text corresponding to the first text includes: Recognize the first symbol and the second symbol based on the target translation model to determine the first target name in a marked state; Translating the text in the second text that is different from the first target name based on the target translation model to obtain a third text corresponding to the target language; Copying the target name to a target position in the third text based on the target translation model to obtain the target text; The target position is determined based on the position of the first target name in the second text.

6. The text translation method according to claim 1, characterized in that: The method further comprises: Acquire a plurality of training texts, wherein the training texts correspond to the source language, and the training texts include marked second phrases, and the second phrases correspond to the target language; For each of the training texts, obtaining a first translation text corresponding to the training text, where the first translation text corresponds to the target language; Performing model training according to the plurality of training texts and the first translation text corresponding to each of the training texts, and obtaining a matching degree between the first translation text and a second translation text after completing one model training, wherein the second translation text is an output result of the translation model obtained through training; When the matching degree is less than a preset ratio, the model training process is repeated until the matching degree between the first translation text and the second translation text is greater than the preset ratio, then the model training is stopped to obtain the target translation model.

7. A text translation device, characterized in that: The device comprises: a processing module, configured to replace the first phrase with a first target name and mark it to obtain a second text when a first text to be translated into a target language includes a first phrase, wherein the first target name corresponds to the target language, the first phrase corresponds to a source language, the first phrase corresponds to a name semantics and at least one non-name semantics, and the real semantics of the first phrase in the first text is a name, and the second text is obtained by marking the first target name with an initial symbol and an end symbol respectively; A first acquisition module, used for inputting the second text into a target translation model to acquire a target text corresponding to the first text; Among them, the first text belongs to a text collection, the text collection corresponds to a name library, the first names with non-name semantics in the text collection are all stored in the name library, the first phrase is determined based on the first name in the first text when it is detected that the first text includes the first name, the target translation model identifies the first target name based on the positions of the initial symbol and the terminal symbol, the target translation model is used to identify the first target name in a marked state and output it, translate the text in the second text that is different from the first target name into the target language and output it, and the target text corresponds to the target language.

8. An electronic device, characterized in that: include: at least one processor; as well as A memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the text translation method according to any one of claims 1 to 6.

9. A non-transitory computer-readable storage medium storing computer instructions, characterized in that: The computer instructions are used to enable the computer to execute the text translation method according to any one of claims 1 to 6.

10. A computer program product, characterized in that The invention comprises a computer program, which implements the text translation method according to any one of claims 1 to 6 when being executed by a processor.

Citation Information

Patent Citations

  • Machine translation method and apparatus, and machine translation system training method and apparatus

    CN108073573A

  • Intelligent translation method and device, computer equipment and storage medium

    CN112380879A