Translation method and training method, device and equipment of classification model, and storage medium
By using a word segmentation-based method to identify translatable units in a simultaneous interpretation system and performing real-time translation, the problem of balancing translation quality and latency is solved, achieving high-quality, low-latency translation results.
Patent Information
- Application Number
- CN202110739519.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-30
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2041-06-30
AI Technical Summary
In simultaneous interpretation systems, how to balance the contradiction between translation quality and translation time delay, especially when real-time translation is required.
The method determines whether the current processing unit can be translated independently based on word segmentation, and translates it immediately when it is determined to be translatable. A classification model is used to judge the translatability of unit samples, and training data is constructed to train the classification model.
It achieves reduced translation latency while ensuring translation quality by identifying and translating smaller, independent units, thereby reducing the waiting time for entire sentences.
Smart Images

Figure CN113408306B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of computers, in particular to the field of artificial intelligence such as natural language processing and deep learning, and more particularly to a translation method and a training method of a classification model, a device, an apparatus and a storage medium. BACKGROUND
[0002] A simultaneous interpretation system usually includes an Auto Speech Recognition (ASR) system and a Machine Translation (MT) system, the ASR system is used to perform speech recognition on source language speech to obtain source language text corresponding to the source language speech, and the MT system is used to translate the source language text to obtain target language text corresponding to the source language text.
[0003] In a simultaneous interpretation or other similar scenario, it is necessary to balance the quality of translation and the delay of translation. SUMMARY
[0004] The present disclosure provides a translation method and a training method of a classification model, a device, an apparatus and a storage medium.
[0005] According to an aspect of the present disclosure, a translation method is provided, including: obtaining a current processing unit of a source language text based on word segmentation in the source language text; determining a classification result of the current processing unit by using a classification model; and if the classification result is that the current processing unit can be individually translated, translating the current processing unit to obtain a translation result of the current processing unit in a target language.
[0006] According to another aspect of the present disclosure, a training method of a classification model is provided, including: processing word segmentation in an original sample to obtain at least one unit sample corresponding to the original sample; obtaining label information corresponding to each unit sample in the at least one unit sample, the label information being used to identify whether the unit sample can be individually translated; constructing training data by using the each unit sample and the label information corresponding to the each unit sample; and training a classification model by using the training data.
[0007] According to another aspect of the present disclosure, a translation device is provided, including: an obtaining module configured to obtain a current processing unit of a source language text based on word segmentation in the source language text; a classification module configured to determine a classification result of the current processing unit by using a classification model; and a translation module configured to, if the classification result is that the current processing unit can be individually translated, translate the current processing unit to obtain a translation result of the current processing unit in a target language.
[0008] According to another aspect of the present disclosure, a training device of a classification model is provided, comprising: a processing module configured to process word segmentation in an original sample to obtain at least one unit sample corresponding to the original sample; an obtaining module configured to obtain label information corresponding to each unit sample in the at least one unit sample, the label information being used to identify whether the unit sample can be translated individually; a constructing module configured to construct training data by using the each unit sample and the label information corresponding to the each unit sample; and a training module configured to train a classification model by using the training data.
[0009] According to another aspect of the present disclosure, an electronic device is provided, comprising: at least one processor; and 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 to enable the at least one processor to perform the method according to any one of the above aspects.
[0010] According to another aspect of the present disclosure, a non-transitory computer readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to perform the method according to any one of the above aspects.
[0011] According to another aspect of the present disclosure, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the method according to any one of the above aspects.
[0012] According to the technical solution of the present disclosure, the translation quality and the translation time delay can be effectively balanced.
[0013] It should be understood that the content described in this part is not intended to identify key or important features of the embodiments of the present disclosure, nor to limit the scope of the present disclosure. Other features of the present disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0014] The accompanying drawings are used to better understand the present solution and do not limit the present disclosure. Among them:
[0015] Figure 1 is a schematic diagram according to a first embodiment of the present disclosure;
[0016] Figure 2 is a schematic diagram according to a second embodiment of the present disclosure;
[0017] Figure 3 is a schematic diagram according to a third embodiment of the present disclosure;
[0018] Figure 4 is a schematic diagram according to a fourth embodiment of the present disclosure;
[0019] Figure 5 is a schematic diagram according to a fifth embodiment of the disclosure;
[0020] Figure 6 is a schematic diagram according to a sixth embodiment of the disclosure;
[0021] Figure 7 is a schematic diagram according to a seventh embodiment of the disclosure;
[0022] Figure 8 is a schematic diagram according to an eighth embodiment of the disclosure;
[0023] Figure 9 is a schematic diagram according to a ninth embodiment of the disclosure;
[0024] Figure 10 is a schematic diagram of an electronic device for implementing any of the translation method or the training method of the classification model according to the embodiments of the disclosure. DETAILED DESCRIPTION
[0025] Exemplary embodiments of the disclosure are described herein with reference to the accompanying drawings, which are included to provide a thorough understanding of embodiments of the disclosure and are not intended to be exhaustive or to limit the scope of the disclosure to the exact details shown. Accordingly, persons of ordinary skill in the art will recognize that many variations and modifications can be made to the embodiments described herein without departing from the scope and spirit of the disclosure. Also, for the purpose of clarity and the brevity, the description below omits the description of well-known functions and structures.
[0026] For simultaneous interpretation, high translation quality and low translation delay are important requirements. Generally, the more input information of the translation model, the higher the translation quality, but the higher the translation delay, so the balance between translation quality and translation delay needs to be considered.
[0027] Figure 1 is a schematic diagram according to a first embodiment of the disclosure, and the embodiment provides a translation method, comprising:
[0028] 101. Obtain a current processing unit of a source language based on word segmentation in a source language text.
[0029] 102. Determine a classification result of the current processing unit by using a classification model.
[0030] 103. If the classification result is that the current processing unit is a translatable unit, translate the current processing unit to obtain a translation result of the current processing unit in a target language.
[0031] For example, for simultaneous interpretation, the translation method provided by the embodiment can be used to determine whether the current processing unit is a translatable unit, and if the current processing unit is a translatable unit, the current processing unit is translated to obtain a translation result of the current processing unit in a target language. Figure 2As shown, the simultaneous interpretation system may include an ASR system and an MT system. The ASR system can perform speech recognition on the source language speech to obtain the source language text corresponding to the source language speech. The MT system is used to translate the source language text to obtain the target language text corresponding to the source language text. In the embodiments of the present disclosure, the source language is Chinese and the target language is English as an example.
[0032] The source language text may include at least one word segment. For example, it can be expressed as: X={x1, x2,..., xT}, where X represents the source language text, xi (i = 1, 2,... T) represents the i-th word segment in the source language text, and T is the total number of word segments in the source language text.
[0033] The source language text can obtain the above at least one word segment by using the word segmentation methods of various related technologies. For example, if the source language text is "I went to the park at 10 a.m.", after word segmentation, the corresponding word segments include "morning, 10, o'clock, I, went, to, the, park", where different word segments are separated by commas.
[0034] To ensure the translation quality, generally, translation is performed sentence by sentence. For example, assuming that "I went to the park at 10 a.m." in the above example is a sentence, the translation model needs to wait until the whole sentence "I went to the park at 10 a.m." is received to obtain the corresponding translation result, such as "At 10a.m I went to the park". This way of translating sentence by sentence has a relatively high latency.
[0035] To reduce the latency, translation can be performed word segment by word segment. For example, a fixed number of word segments can be delayed before starting translation. Based on the above example, for example, it can wait until the word segment "10" is received and then translate "morning, 10". However, this way of division only considering the number information may result in low translation quality.
[0036] To balance the translation quality and translation latency, after obtaining the current processing unit, it can be judged whether it can be translated alone. When it can be translated alone, the current processing unit is translated.
[0037] That a certain unit "can be translated alone" can also be referred to as that this unit is a "translatable unit (Meaningful Unit, MU)", which refers to the smallest unit whose translation result will not be affected by subsequent inputs.
[0038] For example, in the above example, the initial translation result of "morning" is "morning", and with the continuous input of the subsequent input, such as the input is updated to "morning, 10, point", the corresponding translation result is updated to "At 10a.m", since the translation result of "morning" will be affected by the subsequent input, "morning" cannot be used as a translatable unit. For another example, the initial translation result of "morning, 10, point" is "At 10a.m", and with the continuous input of the subsequent input, such as the input is updated to "morning, 10, point, I", the corresponding translation result is "At 10a.m, me", and for the unit "morning, 10, point", even if "I" is inputted subsequently, the translation result is not affected, therefore, "morning, 10, point" can be used as a translatable unit.
[0039] Since the current processing unit is a translatable unit, or can be translated individually, the translation result will not be affected by the subsequent input, therefore, the translation quality can be guaranteed.
[0040] In this embodiment, by translating the current processing unit, the current processing unit is obtained based on the segmentation, and the translation can be performed in units of the current processing unit instead of in units of a sentence, and the translation delay can be reduced; by determining the classification result of the current processing unit, the current processing unit is translated when the current processing unit can be translated individually, and the translation quality can be guaranteed, so that the balance between translation quality and translation delay can be achieved.
[0041] In some embodiments, the segmentation is at least one, and the current processing unit of the source language is obtained based on the segmentation in the source language text, including: selecting one segmentation as a current segmentation in sequence among the at least one segmentation; grouping all segmentations before the current segmentation as a segmentation sequence; and taking a part in the segmentation sequence that cannot be translated individually as the current processing unit of the source language.
[0042] In sequence refers to the order of time, for example, based on the above example, "morning" is selected as the current segmentation at the first time, and "10" is selected as the current segmentation at the second time.
[0043] The "before" before the current segmentation includes the current segmentation, for example, at the second time, the first segmentation sequence corresponding to the second time is "morning, 10".
[0044] The initial state of the segmentation in the segmentation sequence is a part that cannot be translated individually, and with the classification of the current processing unit, there can be a part that can be translated individually in the segmentation sequence, and then the part can be removed as the current processing unit.
[0045] For example, at the first time, the segmented sequence is "morning", which is a part that cannot be translated independently. Therefore, "morning" is the current processing unit at the first time. Assuming that the classification model determines that "morning" cannot be translated independently, i.e., "morning" is a part that cannot be translated independently. At the second time, the segmented sequence is "morning, 10". Since "morning" is a part that cannot be translated independently, and the initial state of "10" is also a part that cannot be translated independently, "morning, 10" is the current processing unit at the second time. Assuming that the classification model determines that "morning, 10" is a part that cannot be translated independently. Similarly, at the third time, the segmented sequence is "morning, 10, point". Since "morning, 10" is a part that cannot be translated independently, and the initial state of "point" is also a part that cannot be translated independently, "morning, 10, point" is the current processing unit at the third time. Assuming that the classification model determines that "morning, 10, point" can be translated independently, then at the next time, i.e., at the fourth time, the segmented sequence is "morning, 10, point, I". Since "morning, 10, point" is a part that can be translated independently, it needs to be removed. Therefore, the current processing unit at the fourth time is "I".
[0046] By sequentially selecting the current segmented word and obtaining the current processing unit based on the current segmented word, the current processing unit can be classified and translated in sequence, which conforms to the scenario of performing in sequence in actual translation.
[0047] As shown in Figure 2 After obtaining the current processing unit, a classification model can be used to classify the current processing unit to obtain a classification result corresponding to the current processing unit.
[0048] The classification model is a binary classification model. Specifically, the classification result includes: the current processing unit can be translated independently, or the current processing unit cannot be translated independently.
[0049] In some embodiments, the classification model is used to determine the classification result of the current processing unit, including: based on a preset number of segmented words after the current segmented word, a reference sequence is formed; the segmented sequence and the reference sequence are used as the input of the classification model, and the classification model is used to process the input to determine the classification result of the current processing unit.
[0050] Wherein, "after" in the current segmented word does not include the current segmented word, and the preset number can be represented by m, m is the number of reference words. For example, when m=2, the reference sequence can be represented as: reference sequence={x(t+1),...,x(t+m)} for xt, and for t+m greater than T, it is selected as null.
[0051] AsFigure 3 As shown, for the source language text, the segmented sequence and the reference sequence can be obtained based on the current segmentation, the input of the classification model includes the segmented sequence and the reference sequence, and the output of the classification model is the classification result of the current processing unit. Since the input of the classification model includes the segmented sequence, the output can also be considered as the classification result of the segmented sequence.
[0052] By taking the segmented sequence and the reference sequence as the input of the classification model, the accuracy of the classification result can be improved.
[0053] If the current processing unit is a translatable unit, the current processing unit can be translated and the translation result can be output simultaneously without waiting for subsequent input. The output form can be in the form of text or speech, etc. For example, the translated text in the target language corresponding to the current processing unit can be output to the display screen, or the translated text can be synthesized into speech, and then the corresponding speech in the target language can be played through a loudspeaker or other output device.
[0054] Based on the above example, it is assumed that three units that can be individually translated are obtained, i.e., three translatable units, which are “morning, 10, o'clock”, “I, went, a trip”, and “park”. As shown, Figure 4 Based on the translatable units, the translation results (indicated by “simultaneous interpretation translation results”) of the translatable units can be obtained immediately, without waiting for the entire sentence to be input to obtain the translation results (indicated by “normal text translation results”).
[0055] The above embodiment takes the application process as an example, in which the classification model is involved, i.e., the classification model needs to be used to determine whether a processing unit is a translatable unit, or in other words, whether it can be individually translated. The classification model can be obtained after being trained before the application process. The training process of the classification model is described below.
[0056] Figure 5 is a schematic diagram according to the fourth embodiment of the present disclosure, and the embodiment provides a training method of a classification model, which comprises:
[0057] 501, processing the original sample to obtain at least one unit sample corresponding to the original sample.
[0058] 502, obtaining label information corresponding to each unit sample in the at least one unit sample, the label information being used to identify whether the unit sample can be individually translated.
[0059] 503, constructing training data by using the each unit sample and the label information corresponding to the each unit sample.
[0060] 504. training a classification model using the training data.
[0061] Still taking the sentence "I went to the park at 10 am" as an example, the sentence can be used as an original sample during training.
[0062] In some embodiments, the original sample includes at least one token, and the processing of the original sample to obtain at least one unit sample corresponding to the original sample includes: selecting a token as a current token in sequence among the at least one token; and grouping all tokens before the current token into a unit sample.
[0063] Wherein, assuming that the original sample includes T tokens, T unit samples can be obtained. Based on the above example, the unit sample ct corresponding to different time t can be shown in Table 1:
[0064] Table 1
[0065]
[0066]
[0067] Further, after processing the original sample, a reference sample can also be obtained. The reference sample ft refers to a sequence of a preset number (such as m = 2) of tokens after the current token.
[0068] Then, the training data can be constructed based on the triple <unit sample, reference sample, label information>.
[0069] Assuming that the label information is represented by lt, lt = 1 indicates that the unit sample can be translated alone, and lt = 0 indicates that the unit sample cannot be translated alone, the training data can be shown in Table 2:
[0070] Table 2
[0071] t ct ft lt 1 morning 10, point 0 2 morning, 10 point, I 0 3 morning, 10, point I, went 1 4 morning, 10, point, I went, a 0 5 morning, 10, point, I, went a, park 0 6 morning, 10, point, I, went a, park 1 7 morning, 10, point, I, went a, park 1
[0072] By forming a unit sample based on a current token, multiple unit samples can be generated based on one original sample, expanding the number of unit samples.
[0073] In some embodiments, the original sample is a source language text, and the obtaining of the label information corresponding to each unit sample in the at least one unit sample includes: obtaining a complete sentence translation result of a target language corresponding to the source language text; translating the each unit sample to obtain a unit translation result of the target language corresponding to the each unit sample; and if the unit translation result is the same as at least part of the content in the complete sentence translation result and the positions correspond, determining the label information as information identifying the unit sample as a translatable unit.
[0074] wherein the unit translation result is identical to at least part of the content of the whole sentence translation result and the positions are consistent, the unit translation result can be referred to as a prefix of the whole sentence translation result.
[0075] Suppose that the unit translation result corresponding to the unit sample at time t is denoted by yt, and the source language text, the whole sentence translation result, and the unit translation result are as shown in NULL Figure 6 Since the unit translation result of “morning, 10, point” is “At 10 a.m”, the unit translation result is a prefix of the whole sentence translation result, and therefore the label information lt corresponding to “morning, 10, point” is 1; similarly, since the unit translation result of “morning, 10, point, I, went, to” is “At 10 a.m I went to”, the unit translation result is a prefix of the whole sentence translation result, and therefore the label information lt corresponding to “morning, 10, point, I, went, to” is 1.
[0076] By determining whether the corresponding unit sample can be individually translated based on whether the unit translation result is a prefix of the whole sentence translation result, the semantic integrity of the unit that can be individually translated can be ensured, and the translation quality can be improved.
[0077] When obtaining the unit translation result of each unit sample, if a general translation method is used, that is, each unit sample is taken as the input of the translation model, and the translation model is used for translation, there can be a case that each unit sample cannot be individually translated, and only the whole sentence of the original sample can be individually translated. In this case, the classification model trained using the training data described above can only identify a relatively long translatable unit, resulting in a long translation delay.
[0078] For example, the original sample is “A, in, Beijing, met, B”, and the general translation method is generally used. The label information corresponding to the whole sentence “A, in, Beijing, met, B” is set to 1, and the label information of the remaining unit samples is 0.
[0079] The length of the unit sample with the label information of 1 is too long, resulting in a long translation delay of the classification model trained using the unit sample when the classification model is applied.
[0080] In order to reduce the translation delay, the length of the unit sample as a translatable unit can be reduced as much as possible.
[0081] In some embodiments, the original sample includes word segmentation, and the translating of the individual unit samples to obtain the unit translation results of the individual unit samples in the target language includes: taking the individual unit sample and a preset number of word segmentations after the individual unit sample as input of a translation model, and using the translation model to translate the input to obtain the unit translation result of the individual unit sample in the target language.
[0082] wherein the preset number corresponding to the translation is irrelevant to the preset number in the reference sample or the reference sequence, that is, the preset number corresponding to the translation can be represented by k, which is different from m in the reference sample or the reference sequence, k represents a delay of k word segmentations before translation, and the translation manner can be referred to as wait-k translation.
[0083] The wait-k translation manner has a prediction capability, and a correct translation result can be generated without waiting for the complete input of a sentence. For example, taking "A, in, Beijing, and, B, meet" as an example, when k = 2, the corresponding translation result is as shown in Table 1, that is, after receiving the word segmentation "Beijing", it can be predicted that the translation result is "met", without waiting for the word segmentation "meet" to be received to translate "met". Figure 6
[0084] Based on the wait-k translation manner, in simultaneous interpretation, it can be known that "A", "in", "Beijing", "and", "B", and "meet" are individually translatable, rather than "A, in, Beijing, and, B, meet" being individually translatable, and then each individually translatable unit can be translated in real time, to reduce the translation delay.
[0085] By using the wait-k manner to translate when obtaining the unit translation result of the unit sample, a unit sample that is individually translatable and has a smaller length can be obtained, and a classification model trained based on training data constructed based on the unit sample can identify a unit that is individually translatable and has a shorter length during translation, to reduce the translation delay.
[0086] In this embodiment, the training data of the classification model is constructed based on the original sample, the number of the training data can be expanded, the label information is used to identify whether the unit sample is individually translatable, the classification model capable of identifying whether the unit sample is individually translatable can be trained, and then the individually translatable unit can be translated, to balance the translation quality and the translation delay.
[0087] Figure 7 is a schematic diagram according to the eighth embodiment of the present disclosure, and the present embodiment provides a translation device. As shown in Figure 8 As shown, the translation apparatus 800 comprises an obtaining module 801, a classification module 802, and a translation module 803.
[0088] The obtaining module 801 is configured to obtain a current processing unit of the source language text based on the word segmentation in the source language text.
[0089] In some embodiments, the word segmentation is at least one, and the obtaining module 801 is specifically configured to: select one word segmentation as a current word segmentation in sequence among the at least one word segmentation; group all word segmentations before the current word segmentation into a word segmentation sequence; and take a part in the word segmentation sequence that cannot be individually translated as the current processing unit of the source language.
[0090] In some embodiments, the classification module 802 is specifically configured to: group a preset number of word segmentations after the current word segmentation into a reference sequence; take the word segmentation sequence and the reference sequence as inputs of the classification model; and process the inputs by using the classification model to determine the classification result of the current processing unit.
[0091] In this embodiment, by translating the current processing unit, the current processing unit is obtained based on word segmentation, which can realize translation in units of current processing units instead of in units of sentences, and can reduce translation delay; by determining the classification result of the current processing unit, the current processing unit is translated when the current processing unit can be individually translated, which can ensure translation quality, thereby achieving a balance between translation quality and translation delay.
[0092] Figure 8 According to the ninth embodiment of the present disclosure, a schematic diagram of a training apparatus of a classification model is provided. As shown in the figure, Figure 9 The training apparatus 900 of the classification model comprises a processing module 901, an obtaining module 902, a construction module 903, and a training module 904.
[0093] The processing module 901 is configured to process word segmentations in an original sample to obtain at least one unit sample corresponding to the original sample. The obtaining module 902 is configured to obtain label information corresponding to each unit sample in the at least one unit sample, the label information being used to identify whether the unit sample can be individually translated. The construction module 903 is configured to construct training data by using the each unit sample and the label information corresponding to the each unit sample. The training module 904 is configured to train a classification model by using the training data.
[0094] In some embodiments, the original sample includes at least one token, and the processing module 901 is specifically configured to: select one token in the at least one token as a current token in sequence; and group all tokens before the current token as a unit sample.
[0095] In some embodiments, the original sample is a source language text, and the obtaining module 902 is specifically configured to: obtain a complete sentence translation result of a target language corresponding to the source language text; translate each unit sample to obtain a unit translation result of the target language corresponding to each unit sample; and determine that the label information is information identifying the unit sample as a translatable unit, if the unit translation result is the same as at least part of the content in the complete sentence translation result and the positions are consistent.
[0096] In some embodiments, the obtaining module 902 is specifically configured to: take each unit sample and a preset number of tokens after the unit sample as input of a translation model; and translate the input by using the translation model to obtain a unit translation result of the target language corresponding to each unit sample.
[0097] In this embodiment, the training data of the classification model is constructed by using the original sample, so that the number of training data can be expanded; the label information is used to identify whether the unit sample can be individually translated, so that the classification model capable of identifying whether the unit can be individually translated can be trained, and then the unit that can be individually translated can be translated, so that the translation quality and the translation delay can be balanced.
[0098] It can be understood that the same or similar contents in different embodiments in the embodiments of the present disclosure can be mutually referred to.
[0099] It can be understood that "first", "second", and the like in the embodiments of the present disclosure are only used for distinction, and do not represent importance, time sequence, and the like.
[0100] According to the embodiments of the present disclosure, the present disclosure further provides an electronic device, a readable storage medium, and a computer program product.
[0101] Figure 9A schematic block diagram of an example electronic device 1000 that can be used to implement embodiments of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the present disclosure described and / or claimed herein.
[0102] like Figure 10 Figure 10 As shown, the electronic device 1000 includes a computing unit 1001, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 1002 or a computer program loaded from a storage unit 10010 into a random access memory (RAM) 1003. The RAM 1003 may also store various programs and data required for the operation of the electronic device 1000. The computing unit 1001, ROM 1002, and RAM 1003 are interconnected via a bus 1004. An input / output (I / O) interface 1005 is also connected to the bus 1004.
[0103] Multiple components in electronic device 1000 are connected to I / O interface 1005, including: input unit 1006, such as keyboard, mouse, etc.; output unit 1007, such as various types of displays, speakers, etc.; storage unit 1008, such as disk, optical disk, etc.; and communication unit 1009, such as network card, modem, wireless transceiver, etc. Communication unit 1009 allows electronic device 1000 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0104] The computing unit 1001 can be various general purpose and / or special purpose processing components having processing and computing capabilities. Some examples of the computing unit 1001 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 1001 performs various methods and processes described above, such as a translation method or a training method of a classification model. For example, in some embodiments, the translation method or the training method of a classification model can be implemented as a computer software program tangibly embodied in a machine-readable medium, such as the storage unit 1008. In some embodiments, part or all of the computer program can be loaded and / or installed onto the electronic device 1000 via the ROM 1002 and / or the communication unit 1009. When the computer program is loaded onto the RAM 1003 and executed by the computing unit 1001, one or more steps of the translation method or the training method of a classification model described above can be performed. Alternatively, in other embodiments, the computing unit 1001 can be configured to perform the translation method or the training method of a classification model by any other suitable means, such as by means of firmware.
[0105] Various implementations of the systems and techniques described above can be realized in digital electronic circuitry, integrated circuitry, a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on a chip (SOC), a programmable logic device (PLD), a computer hardware, firmware, software, and / or combinations thereof. These various implementations can include implementation in one or more computer programs that are executable and / or interpretable on a programmable system including at least one programmable processor, which can be special or general purpose, coupled to receive data and instructions from, and to transmit data and instructions to, a storage system, at least one input device, and at least one output device.
[0106] Program code for carrying out methods of the present disclosure can be written in any combination of one or more programming languages. The program code can be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the program code, when executed by the processor or controller, produces the functions / operations specified in the flowcharts and / or the block diagrams. The program code can be executed entirely on a machine, partially on a machine, partially on a machine and partially on a remote machine or entirely on a remote machine or server.
[0107] In the context of the present disclosure, a machine-readable medium can be a tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can include but is not limited to an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of the machine-readable storage medium will include one or more lines of electrical connections, portable computer disks, hard disk drives, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or Flash memory), optical fibers, portable compact disc read-only memories (CD-ROMs), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0108] To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the computer. Other kinds of devices can be used to provide for interaction with a user as well; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
[0109] The systems and techniques described here can be implemented in a computing system that includes a back end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front end component (e.g., a user computer having a graphical user interface or a Web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back end, middleware, or front end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network (LAN), a wide area network (WAN), and the Internet.
[0110] The computer system can include clients and servers. This relationship can be. The servers are generally remote from the users and can be accessed via the Internet using a communication network. The relationship can be a client-server relationship over a communications network, and as such, the servers can be accessed by the clients using computer programs. The servers can be cloud servers, also known as cloud computing servers or cloud hosts, which are mainframe products in the cloud computing service system, and solve the defects of large management difficulty and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or simply "VPS").
[0111] It should be understood that the various forms of flow shown above can be reordered, added to, or have steps deleted. For example, the steps described in the present disclosure can be performed in parallel, in series, or in a different order, as long as the desired results of the technical solutions of the present disclosure can be achieved, and the present disclosure is not limited herein.
[0112] The above detailed description does not constitute a limitation on the protection scope of the present disclosure. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A translation method, comprising: Based on word segmentation in the source language text, the current processing unit of the source language text is obtained; A classification model is used to determine the classification result of the current processing unit; The label information of unit samples in the training data of the classification model is determined based on the unit translation result and the whole sentence translation result of the unit sample. The unit translation result is obtained in the following way: using the wait-k translation model, the unit sample and a preset number of word segments following the unit sample are used as the input of the wait-k translation model, and the wait-k translation model is used to translate the input to obtain the unit translation result of the target language corresponding to the unit sample. The wait-k translation method has predictive ability and can generate the correct translation result without waiting for the whole sentence input to be complete. The preset number is k, where k is the number of word segments delayed by the wait-k translation model. If the classification result indicates that the current processing unit can be translated independently, the current processing unit is translated to obtain the translation result of the target language corresponding to the current processing unit; Wherein, the word segmentation is at least one, and the step of obtaining the current processing unit of the source language based on word segmentation in the source language text includes: In the at least one word segmentation, one word segmentation is selected sequentially as the current word segmentation; Combine all the segments preceding the current segment into a segmentation sequence; The parts of the word segmentation sequence that cannot be translated individually are used as the current processing unit of the source language.
2. The method according to claim 1, wherein, The step of using a classification model to determine the classification result of the current processing unit includes: A reference sequence is formed based on a preset number of segments following the current segmentation; The word segmentation sequence and the reference sequence are used as input to the classification model, and the classification model is used to process the input to determine the classification result of the current processing unit.
3. A method for training a classification model, comprising: The word segmentation in the original sample is processed to obtain at least one unit sample corresponding to the original sample; The tag information corresponding to each unit sample in the at least one unit sample is obtained. The tag information is used to identify whether the unit sample can be translated individually. The tag information is determined based on the unit translation result and the whole sentence translation result of the unit sample. The unit translation result is obtained in the following way: using the wait-k translation model, the unit sample and a preset number of word segments after the unit sample are used as the input of the wait-k translation model. The wait-k translation model is used to translate the input to obtain the unit translation result of the target language corresponding to the unit sample. The wait-k translation method has predictive ability and can generate the correct translation result without waiting for the whole sentence input to be complete. The preset number is k, where k is the number of word segments delayed by the wait-k translation model. Training data is constructed using the unit samples and the corresponding label information of each unit sample; The classification model is trained using the training data. The original sample includes at least one word segmentation, and the processing of the original sample to obtain at least one unit sample corresponding to the original sample includes: Among the at least one word segmentation, one word segmentation is selected sequentially as the current word segmentation; All the words preceding the current word segment are combined into a single unit sample.
4. The method according to claim 3, wherein, The original sample is source language text, and obtaining the label information corresponding to each unit sample in the at least one unit sample includes: Obtain the complete sentence translation result of the target language corresponding to the source language text; Each unit sample is translated to obtain the unit translation result of the target language corresponding to each unit sample; If the unit translation result is the same as at least part of the whole sentence translation result, and the positions correspond, the tag information is determined to be information that identifies the unit sample as a translatable unit.
5. A translation device, comprising: The acquisition module is used to obtain the current processing unit of the source language text based on word segmentation in the source language text; A classification module is used to determine the classification result of the current processing unit using a classification model. The label information of the unit samples in the training data of the classification model is determined based on the unit translation result and the whole sentence translation result of the unit sample. The unit translation result is obtained in the following way: using a wait-k translation model, the unit sample and a preset number of word segments following the unit sample are used as input to the wait-k translation model. The wait-k translation model is used to translate the input to obtain the unit translation result of the target language corresponding to the unit sample. The wait-k translation method has predictive ability and can generate the correct translation result without waiting for the whole sentence input to be complete. The preset number is k, where k is the number of word segments delayed by the wait-k translation model. The translation module is used to translate the current processing unit if the classification result indicates that the current processing unit can be translated independently, so as to obtain the translation result of the target language corresponding to the current processing unit; Wherein, the word segmentation is at least one, and the acquisition module is specifically used for: In the at least one word segmentation, one word segmentation is selected sequentially as the current word segmentation; Combine all the segments preceding the current segment into a segmentation sequence; The parts of the word segmentation sequence that cannot be translated individually are used as the current processing unit of the source language.
6. The apparatus according to claim 5, wherein, The classification module is specifically used for: A reference sequence is formed based on a preset number of segments following the current segmentation; The word segmentation sequence and the reference sequence are used as input to the classification model, and the classification model is used to process the input to determine the classification result of the current processing unit.
7. A training device for a classification model, comprising: The processing module is used to process the word segmentation in the original sample to obtain at least one unit sample corresponding to the original sample. The acquisition module is used to acquire label information corresponding to each unit sample in the at least one unit sample. The label information is used to identify whether the unit sample can be translated individually. The label information is determined based on the unit translation result and the whole sentence translation result of the unit sample. The unit translation result is obtained in the following way: using the wait-k translation model, the unit sample and a preset number of word segments following the unit sample are used as input to the wait-k translation model. The wait-k translation model is used to translate the input to obtain the unit translation result of the target language corresponding to the unit sample. The wait-k translation method has predictive ability and can generate the correct translation result without waiting for the whole sentence input to be complete. The preset number is k, where k is the number of word segments delayed by the wait-k translation model. A construction module is used to construct training data using the unit samples and the label information corresponding to each unit sample; The training module is used to train the classification model using the training data; The original sample includes at least one word segmentation, and the processing module is specifically used for: Among the at least one word segmentation, one word segmentation is selected sequentially as the current word segmentation; All the words preceding the current word segment are combined into a single unit sample.
8. The apparatus according to claim 7, wherein, The original sample is source language text, and the acquisition module is specifically used for: Obtain the complete sentence translation result of the target language corresponding to the source language text; Each unit sample is translated to obtain the unit translation result of the target language corresponding to each unit sample; If the unit translation result is the same as at least part of the whole sentence translation result, and the positions correspond, the tag information is determined to be information that identifies the unit sample as a translatable unit.
9. An electronic device, comprising: At least one processor; as well as A memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-4.
10. A non-transitory computer-readable storage medium storing computer instructions, wherein, The computer instructions are used to cause the computer to perform the method according to any one of claims 1-4.
11. A computer program product comprising a computer program that, when executed by a processor, implements the method according to any one of claims 1-4.
Citation Information
Patent Citations
A method and device for translating voice
CN109582982A