A method, apparatus, electronic device, and storage medium for detecting syntax errors.

The text of the back-translated statement is generated through translation and word alignment operations, and the text is used to train the grammar error detection model, which solves the problem of grammar error detection between different languages ​​and improves the detection accuracy.

CN113822053BActive Publication Date: 2025-04-18SHANGHAI LIULISHUO INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010559496.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-06-18
Publication Date
2025-04-18
Estimated Expiration
2040-06-18

AI Technical Summary

Technical Problem

The prior art is difficult to effectively detect grammatical errors, especially in expressions between different languages.

Method used

By taking the primitive statement text of the first language and translating it into the translated statement text of the second language, the word alignment operation is performed to determine whether the word order is the same. If different, perform word-by-word translation to get the back-translated statement text, and add it with the primitive statement text to the training set, and train the syntax error detection model to detect syntax errors.

Benefits of technology

It improves the accuracy of grammatical error detection and can effectively detect grammatical errors that express first language text according to the second language grammatical rules.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113822053B_ABST
    Figure CN113822053B_ABST
Patent Text Reader

Abstract

The present application discloses a grammatical error detection method, which includes obtaining an original sentence text in a first language, and translating the original sentence text into a translated sentence text in a second language; performing a word alignment operation on the original sentence text and the translated sentence text, and judging whether the word order of the original sentence text and the translated sentence text is the same according to the alignment result; if not, performing a word-by-word translation operation on the translated sentence text to obtain a back-translated sentence text in the first language; adding the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text to a training set, and using the samples in the training set to train the initial model to obtain a grammatical error detection model; performing a grammatical error detection operation on the sentence text to be detected by the grammatical error detection model. The present application can improve the accuracy of grammatical error detection. The present application also discloses a grammatical error detection device, an electronic device and a storage medium, which have the above beneficial effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of text detection, and in particular to a grammatical error detection method, device, electronic device and storage medium. Background Art

[0002] Since the grammars of different languages ​​are not exactly the same, when users learn other languages, they often express sentences in other languages ​​according to the grammatical habits of their native language, which will lead to grammatical errors. For example, Chinese people often use Chinglish when learning English. Currently, there is no technical solution that can detect the above grammatical errors.

[0003] Therefore, how to improve the accuracy of grammatical error detection is a technical problem that those skilled in the art currently need to solve. Summary of the invention

[0004] The purpose of the present application is to provide a grammatical error detection method, device, electronic device and storage medium, which can improve the accuracy of grammatical error detection.

[0005] In order to solve the above technical problems, the present application provides a grammatical error detection method, which comprises:

[0006] Acquire an original sentence text in a first language, and translate the original sentence text into a translated sentence text in a second language;

[0007] Performing a word alignment operation on the original sentence text and the translated sentence text, and judging whether the word order of the original sentence text and the translated sentence text is the same according to the alignment result;

[0008] If not, performing a word-by-word translation operation on the target sentence text to obtain a back-translated sentence text in the first language;

[0009] Adding the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text to a training set, and using the samples in the training set to train the initial model to obtain a grammatical error detection model;

[0010] The grammatical error detection model is used to perform a grammatical error detection operation on the sentence text to be detected.

[0011] Optionally, performing a word-by-word translation operation on the target sentence text to obtain a back-translated sentence text in the first language includes:

[0012] Determine a back-translated word corresponding to each word in the target sentence text, and generate an intermediate back-translated sentence text having the same word order as the target sentence text using the back-translated word;

[0013] According to the alignment result, randomly adding the target word to the intermediate back-translation sentence text according to a preset probability to obtain the back-translation sentence text;

[0014] The target word is a word that does not exist in the original sentence text and is translated into the second language.

[0015] Optionally, performing a word-by-word translation operation on the target sentence text to obtain a back-translated sentence text in the first language includes:

[0016] Translate each word in the translation sentence text into the first language to obtain a first candidate back-translation word;

[0017] According to the alignment result, the word corresponding to each word in the translation sentence text in the original sentence text is set as a second candidate back-translation word;

[0018] Performing a word-by-word translation operation on the target sentence text based on the first candidate back-translation word and the second candidate back-translation word to obtain the back-translation sentence text having the same word order as the target sentence text;

[0019] Wherein, the ratio of the first candidate back-translated word to the second candidate back-translated word in the back-translated sentence text is within a preset range.

[0020] Optionally, translating each word in the target sentence text into the first language to obtain a first candidate back-translated word includes:

[0021] A translator is used to translate each word in the translation sentence text, and N words in the translation results whose semantic similarity is greater than a preset value are used as the first candidate back-translation words.

[0022] Optionally, adding the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text to a training set includes:

[0023] Adding the back-translated sentence text as a negative example to the training set;

[0024] The original sentence text corresponding to the back-translated sentence text is added to the training set as a positive example.

[0025] Optionally, performing a grammatical error detection operation on the sentence text to be detected by using the grammatical error detection model includes:

[0026] Inputting the sentence text to be detected into the grammatical error detection model to obtain a detection result;

[0027] The text with grammatical errors in the sentence text to be detected is marked according to the detection result.

[0028] Optionally, after marking the text with grammatical errors in the sentence text to be detected according to the detection result, the method further includes:

[0029] A corrected text in the first language is generated based on the text with grammatical errors.

[0030] The present application also provides a grammatical error detection device, which comprises:

[0031] A translation module, used for acquiring an original sentence text in a first language and translating the original sentence text into a target sentence text in a second language;

[0032] A word alignment module, used to perform a word alignment operation on the original sentence text and the translated sentence text, and determine whether the word order of the original sentence text and the translated sentence text is the same according to the alignment result;

[0033] A back-translation module, used for performing a word-by-word translation operation on the target sentence text to obtain a back-translated sentence text in the first language if the word order of the original sentence text and the target sentence text is different;

[0034] A model training module, used for adding the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text to a training set, and using the samples in the training set to train the initial model to obtain a grammatical error detection model;

[0035] The error detection module is used to perform a grammatical error detection operation on the sentence text to be detected through the grammatical error detection model.

[0036] The present application also provides a storage medium on which a computer program is stored. When the computer program is executed, the steps of the above-mentioned syntax error detection method are implemented.

[0037] The present application also provides an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the above-mentioned syntax error detection method when calling the computer program in the memory.

[0038] The present application provides a grammatical error detection method, comprising obtaining an original sentence text in a first language, and translating the original sentence text into a translated sentence text in a second language; performing a word alignment operation on the original sentence text and the translated sentence text, and judging whether the word order of the original sentence text and the translated sentence text is the same according to the alignment result; if not, performing a word-by-word translation operation on the translated sentence text to obtain a back-translated sentence text in the first language; adding the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text to a training set, and training an initial model using samples in the training set to obtain a grammatical error detection model; and performing a grammatical error detection operation on the sentence text to be detected by using the grammatical error detection model.

[0039] The present application translates the original sentence text of the first language into the translated sentence text of the second language, and performs a word alignment operation on the original sentence text and the translated sentence text. If the word order of the original sentence text is the same as that of the translated sentence text, the vocabulary expression order of the first language and the second language is consistent when expressing the meaning of the translated sentence text; if the word order of the original sentence text is different from that of the translated sentence text, the vocabulary expression order of the first language and the second language is inconsistent when expressing the meaning of the translated sentence text. Therefore, if the word order of the original sentence text and the translated sentence text is different, the present application performs a word-by-word translation operation on the translated sentence text to obtain a back-translated sentence text in the first language, and uses the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text to train the original model to obtain a grammatical error detection model. The grammatical error detection model can detect grammatical errors in expressing the first language text according to the grammatical rules of the second language, and it can be seen that the present application can improve the accuracy of grammatical error detection. The present application also provides a grammatical error detection device, a storage medium and an electronic device, which have the above-mentioned beneficial effects and are not repeated here. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0041] Figure 1 A flowchart of a grammatical error detection method provided in an embodiment of the present application;

[0042] Figure 2 A schematic diagram of a method for constructing a back-translated sentence text provided in an embodiment of the present application;

[0043] Figure 3 A flow chart of a method for detecting grammatical errors in Chinese English expressions provided in an embodiment of the present application;

[0044] Figure 4 A schematic diagram of constructing a training sample provided in an embodiment of the present application;

[0045] Figure 5 A schematic diagram of the structure of a grammatical error detection device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0046] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings 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.

[0047] See below Figure 1 , Figure 1 A flowchart of a grammatical error detection method provided in an embodiment of the present application.

[0048] Specific steps may include:

[0049] S101: Acquire an original sentence text in a first language, and translate the original sentence text into a translated sentence text in a second language;

[0050] Wherein, this step can select original sentence text from a large amount of first language corpora, and translate the original sentence text into the target sentence text of the second language, and this specific step can utilize translator to realize the translation of the first language to the second language. The above-mentioned original sentence text can include a plurality of sentences, and can translate the multiple original sentence texts into the target sentence texts of the multiple second languages ​​according to the sentence as a unit. After executing the translation operation of this step, the present embodiment can also record the corresponding relationship between the original sentence text and the target sentence text.

[0051] S102: performing a word alignment operation on the original sentence text and the translated sentence text;

[0052] S103: judging whether the word order of the original sentence text and the translation sentence text is the same according to the alignment result; if so, the process ends; if not, proceeding to S104;

[0053] Among them, S102 and S103 are based on the original sentence text and the translated sentence text, and the word alignment operation can be performed on the original sentence text and the translated sentence text according to the corresponding relationship between the original sentence text and the translated sentence text. In this embodiment, the word alignment operation can be implemented using the fast-align toolkit, and the process of the word alignment operation is illustrated by an example:

[0054] Use fast-align to align the original sentence text and the translated sentence text. An example of the alignment result is as follows:

[0055] Original sentence text: mr.smith was too eager to join the game.

[0056] Translated sentence text: Mr. Smith was extremely eager to join the game.

[0057] Alignment result: 1-0 0-1 4-2 6-3 9-4.

[0058] It can be seen from the alignment result that'smith' (1) corresponds to Smith, and the rest of the words follow the same pattern. The order of numbering the Chinese words is monotonically increasing, and the numbers after the dash are also monotonically increasing, but the numbers corresponding to the English words are not aligned. At this time, it can be determined that the word orders of the original sentence text and the translated sentence text are different.

[0059] In this embodiment, a word alignment operation can be performed on each pair of the original sentence text and the translated sentence text. If the word orders of a pair of the original sentence text and the translated sentence text are different, the relevant operations in S104 are entered; if the word orders of a pair of the original sentence text and the translated sentence text are the same, it is determined whether the word orders of the next pair of the original sentence text and the translated sentence text are the same. If the word orders of all the original sentence texts and the translated sentence texts are the same, the process ends.

[0060] S104: Perform a word-by-word translation operation on the translated sentence text to obtain the back-translated sentence text in the first language;

[0061] Among them, on the basis of determining that the word orders of the original sentence text and the translated sentence text are different, in this embodiment, the translated sentence text with different word orders in the first language and the second language can be subjected to a word-by-word translation operation. The word-by-word translation operation means: translating the text in the first language in the order of the words in the translated sentence text in units of words, that is, obtaining the back-translated sentence text in the first language. Continuing with the example of "Mr. Smith was extremely eager to join the game" above to illustrate the process of word-for-word translation:

[0062] Original sentence text: mr.smith was too eager to join the game.

[0063] Translated sentence text: Mr. Smith was extremely eager to join the game.

[0064] Back-translated sentence text: smith mr.eager join game.

[0065] S105: adding the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text to a training set, and using the samples in the training set to train the initial model to obtain a grammatical error detection model;

[0066] Among them, on the basis of obtaining the back-translated sentence text, the original sentence text corresponding to the back-translated sentence text can be determined, and the original sentence text in this embodiment can be a first language text without grammatical errors. In this embodiment, the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text are added to the training set, and the back-translated sentence text and the original sentence text in the training set can also be respectively added with corresponding sentence type labels. Specifically, in this embodiment, the back-translated sentence text can be added to the training set as a negative sample, and the original sentence text corresponding to the back-translated sentence text can also be added to the training set as a positive sample, and then the samples in the training set are used to train the initial model to obtain a grammatical error detection model.

[0067] S106: Performing a grammatical error detection operation on the sentence text to be detected by using a grammatical error detection model.

[0068] Among them, the grammatical error detection model trained in this embodiment has the ability to detect grammatical errors in the first language text expressed according to the grammatical rules of the second language. Therefore, the sentence text to be detected can be input into the grammatical error detection model, and whether there is a grammatical error can be determined based on the result output by the model.

[0069] As a feasible implementation, the process of performing a grammatical error detection operation through a grammatical error detection model may include: inputting the sentence text to be detected into the grammatical error detection model to obtain a detection result; and marking the text with grammatical errors in the sentence text to be detected according to the detection result. After marking the text with grammatical errors in the sentence text to be detected according to the detection result, it also includes: generating a corrected text in the first language based on the text with grammatical errors. The process of generating the corrected text may include: determining the sentence text to be detected with grammatical errors, generating a second language translation text of the sentence text to be detected, and back-translating the second language translation text to obtain a corrected text in the first language.

[0070] In this embodiment, the original sentence text in the first language is translated into the translated sentence text in the second language, and a word alignment operation is performed on the original sentence text and the translated sentence text. If the word order of the original sentence text is the same as that of the translated sentence text, then when expressing the meaning of the translated sentence text, the lexical expression order of the first language and the second language is the same; if the word order of the original sentence text is different from that of the translated sentence text, then when expressing the meaning of the translated sentence text, the lexical expression order of the first language and the second language is different. Therefore, if the word order of the original sentence text is different from that of the translated sentence text, this embodiment performs a word-by-word translation operation on the translated sentence text to obtain the back-translated sentence text in the first language, and uses the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text to train the original model to obtain a grammar error detection model. The grammar error detection model can detect the grammar errors of expressing the first language text according to the grammar rules of the second language. It can be seen that this embodiment can improve the accuracy of grammar error detection.

[0071] As a feasible implementation manner, the process of obtaining the back-translated sentence text in the first language in S104 may include: determining the back-translated word corresponding to each word in the translated sentence text, and using the back-translated words to generate an intermediate back-translated sentence text with the same word order as the translated sentence text; randomly adding target words to the intermediate back-translated sentence text according to the alignment result with a preset probability to obtain the back-translated sentence text; where the target words are the words in the original sentence text that do not have a translation in the second language.

[0072] Since in the process of translation between the first language and the second language, there may be a situation where there is no translation text for a certain word in the first language in the second language. For example, there is no accurate translation for "to" and "the" in Chinese. Therefore, this embodiment first determines the back-translated word corresponding to each word in the translated sentence text, uses the back-translated words to generate an intermediate back-translated sentence text with the same word order as the translated sentence text, and then randomly adds the words in the original sentence text that do not have a translation in the second language to the intermediate back-translated sentence text. The above process is illustrated by an example:

[0073] Original sentence text: mr.smith was too eager to join the game.

[0074] Translated sentence text: Mr. Smith was extremely eager to join the game.

[0075] Intermediate back-translated sentence text: smith mr.eager join game.

[0076] Back-translated sentence text: smith mr.was too the eager join to game.

[0077] By using the target word to fill in the intermediate back-translated sentence text, the back-translated sentence text can be made closer to the actual scenario when the user makes grammatical errors, thereby improving the accuracy of grammatical error detection.

[0078] See also Figure 2 , Figure 2 A schematic diagram of a method for constructing a back-translated sentence text provided in an embodiment of the present application. Figure 1 For further description of the corresponding embodiment S104, this embodiment can be compared with Figure 1 The corresponding embodiments are combined to obtain a further implementation method. This embodiment may include the following steps:

[0079] S201: translating each word in the translation sentence text into the first language to obtain a first candidate back-translation word;

[0080] In this step, a translator may be used to translate each word in the translation sentence text, and N words in the translation results whose semantic similarity is greater than a preset value are used as the first candidate back-translation words.

[0081] S202: according to the alignment result, the word corresponding to each word in the translation sentence text in the original sentence text is set as a second candidate back-translation word;

[0082] S203: performing a word-by-word translation operation on the target sentence text based on the first candidate back-translation word and the second candidate back-translation word to obtain the back-translation sentence text having the same word order as the target sentence text;

[0083] Among them, in the above embodiment, a translator can be used to translate each word in the translation sentence text into the first language, and the top 5 translation results are extracted as the first candidate back-translated words. This embodiment also sets the corresponding word of each word in the translation sentence text in the original sentence text as the second candidate back-translated word, and then selects from the first candidate back-translated word and the second candidate back-translated word to construct the back-translated sentence text. Specifically, the ratio of the first candidate back-translated word to the second candidate back-translated word in the back-translated sentence text is within a preset range. As a feasible implementation method, this embodiment can set the source of the words in the back-translated sentence text to the first candidate back-translated word and the second candidate back-translated word, and the ratio of the two sources can be set to 3:7, 2:8 or 8:2.

[0084] The following is an example of an actual application to illustrate the process described in the above embodiment. Figure 3 and Figure 4 , Figure 3 A flow chart of a method for detecting grammatical errors in Chinese English expressions provided in an embodiment of the present application is provided. Figure 4A schematic diagram of constructing a training sample provided in an embodiment of the present application.

[0085] Chinese English learners usually express themselves in English using a Chinese way of thinking. This embodiment provides a method for identifying such Chinese expressions, which may specifically include the following steps:

[0086] Step 1: Generate training samples;

[0087] In this embodiment, English sentences are extracted from a large amount of English corpus as positive examples of training samples. Figure 4 As shown, bilingual machine translation corpus can be used to generate English with Chinese expressions. Alignment tools can be used to align Chinese and English. If the alignment order of Chinese and English is inconsistent, it means that the order of Chinese and English vocabulary expressions is inconsistent for the meaning expressed by the sentence. If the order of Chinese and English vocabulary expressions is inconsistent, English learners are likely to use Chinese expressions when expressing the meaning. Therefore, this Chinese sentence is selected, and each word in it is translated or replaced word by word. The generated English is considered to have the problem of Chinese expressions.

[0088] The steps for corpus generation are as follows:

[0089] (a) Align Chinese and English sentences using fast-align.

[0090] The alignment results are as follows:

[0091] English sentence: Mr. Smith was too eager to join the game.

[0092] Chinese sentence: Mr. Smith was very eager to join in the game.

[0093] Alignment results: 1-0 0-1 4-2 6-3 9-4;

[0094] According to the alignment results, 'smith'(1) corresponds to Smith, and the same goes for the other words.

[0095] (b) Find English-Chinese translation pairs that meet certain conditions.

[0096] (c) Translate all Chinese words in the Chinese-English translation pair into Chinese and extract the top 5 translation results. Replace the Chinese sentences with English one word at a time. The sources of the replacement English are the Chinese-English correspondence table generated in (c) and the original English expression in (a). The ratio of the two sources can be set to 3:7, 2:8 or 8:2.

[0097] (d) Since some English words in (a) have no corresponding Chinese words, they are randomly added to the result in (d), and the random probability here is set to 0.5. The sentences finally generated in Chinese expressions may include:

[0098] smith mr.eager admission to game.

[0099] smith.mr.very thoughtful game membership.

[0100] smith mr.too was eager to join.

[0101] (e) The Chinese expressions generated in (d) can be used as negative examples for the classifier, and the positive examples can be normal English text.

[0102] Step 2: Use the training samples to train the neural network model to obtain a Chinese English discriminator (i.e., a grammatical error detection model).

[0103] Among them, this embodiment can adopt a neural network model (Transformer) based on the attention mechanism. For the input sentence, each word in it is first converted into a word vector, and then the vector representation of the sentence is generated through the attention mechanism (self-attention), the forward neural network (Feed Forward) and other networks, and the multi-layer perceptron is used according to the vector.

[0104] The grammatical error detection model can digitize and vectorize English text, convert English text into matrix X, and represent the extracted sentences through vectors. Matrix X passes through a multi-head attention mechanism, so that the vector representation of each word contains information about related words. After the forward neural network, nonlinear transformation is performed, so that the neural network can better express and fit the Chinese expression information. The above sentence vector is sent to a multi-layer perceptron for training to obtain a Chinese English discriminator. The training loss is a cross entropy loss function.

[0105] Step 3: Use the trained Chinese English discriminator to predict students’ English expressions.

[0106] The above embodiment proposes a detection technology for English sentences containing Chinese expressions, which utilizes large-scale text data and can solve the problem of detecting Chinese expressions without manual annotation.

[0107] See also Figure 5 , Figure 5 A schematic diagram of the structure of a grammatical error detection device provided in an embodiment of the present application;

[0108] The device may include:

[0109] The translation module 100 is used to obtain an original sentence text in a first language and translate the original sentence text into a target sentence text in a second language;

[0110] A word alignment module 200 is used to perform a word alignment operation on the original sentence text and the translated sentence text, and determine whether the word order of the original sentence text and the translated sentence text is the same according to the alignment result;

[0111] A back-translation module 300 is used to perform a word-by-word translation operation on the target sentence text to obtain a back-translation sentence text in the first language if the word order of the original sentence text and the target sentence text is different;

[0112] A model training module 400 is used to add the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text to a training set, and train an initial model using samples in the training set to obtain a grammatical error detection model;

[0113] The error detection module 500 is used to perform a grammatical error detection operation on the sentence text to be detected by using the grammatical error detection model.

[0114] This embodiment translates the original sentence text of the first language into the translated sentence text of the second language, and performs a word alignment operation on the original sentence text and the translated sentence text. If the word order of the original sentence text is the same as that of the translated sentence text, then the vocabulary expression order of the first language and the second language is consistent when expressing the meaning of the translated sentence text; if the word order of the original sentence text is different from that of the translated sentence text, then the vocabulary expression order of the first language and the second language is inconsistent when expressing the meaning of the translated sentence text. Therefore, if the word order of the original sentence text and the translated sentence text is different, this embodiment performs a word-by-word translation operation on the translated sentence text to obtain a back-translated sentence text in the first language, and uses the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text to train the original model to obtain a grammatical error detection model. The grammatical error detection model can detect grammatical errors in the first language text expressed according to the grammatical rules of the second language, and it can be seen that this embodiment can improve the accuracy of grammatical error detection.

[0115] Furthermore, the back-translation module 300 is used to determine the back-translated word corresponding to each word in the target sentence text, and use the back-translated word to generate an intermediate back-translated sentence text with the same word order as the target sentence text; and is also used to randomly add a target word to the intermediate back-translated sentence text according to a preset probability based on the alignment result to obtain the back-translated sentence text; wherein the target word is a word that does not exist in the original sentence text but is translated into the second language.

[0116] Furthermore, the back-translation module 300 includes:

[0117] A first candidate back-translation word determination unit, configured to translate each word in the target sentence text into the first language to obtain a first candidate back-translation word;

[0118] A second candidate back-translation word determination unit, configured to set the word corresponding to each word in the translation sentence text in the original sentence text as a second candidate back-translation word according to the alignment result;

[0119] a back-translation sentence text generating unit, configured to perform a word-by-word translation operation on the target sentence text based on the first candidate back-translation word and the second candidate back-translation word to obtain the back-translation sentence text having the same word order as the target sentence text;

[0120] Wherein, the ratio of the first candidate back-translated word to the second candidate back-translated word in the back-translated sentence text is within a preset range.

[0121] Furthermore, the first candidate back-translation word determination unit is used to use a translator to translate each word in the translation sentence text, and use N words in the translation results whose semantic similarity is greater than a preset value as the first candidate back-translation words.

[0122] Furthermore, the model training module 400 is used to add the back-translated sentence text as a negative sample to the training set; and is also used to add the original sentence text corresponding to the back-translated sentence text as a positive sample to the training set.

[0123] Furthermore, the error detection module 500 is used to input the sentence text to be detected into the grammatical error detection model to obtain a detection result; and is also used to mark the text with grammatical errors in the sentence text to be detected according to the detection result.

[0124] Furthermore, it also includes:

[0125] The error correction module is used to generate a corrected text in the first language based on the text with grammatical errors after marking the text with grammatical errors in the sentence text to be detected according to the detection result.

[0126] Since the embodiments of the apparatus part correspond to the embodiments of the method part, please refer to the description of the embodiments of the method part for the embodiments of the apparatus part, which will not be repeated here.

[0127] The present application also provides a storage medium on which a computer program is stored, and when the computer program is executed, the steps provided in the above embodiment can be implemented. The storage medium may include: a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and other media that can store program codes.

[0128] The present application also provides an electronic device, which may include a memory and a processor, wherein a computer program is stored in the memory, and when the processor calls the computer program in the memory, the steps provided in the above embodiment may be implemented. Of course, the electronic device may also include various network interfaces, power supplies and other components.

[0129] The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same and similar parts between the various embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of this application.

[0130] It should also be noted that, in this specification, 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 "comprises", "comprising" 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, an element defined by the statement "comprising a ..." does not exclude the presence of other identical elements in the process, method, article or device including the element.

Claims

1. A grammatical error detection method, characterized in that: include: Acquire an original sentence text in a first language, and translate the original sentence text into a translated sentence text in a second language; Performing a word alignment operation on the original sentence text and the translated sentence text, and judging whether the word order of the original sentence text and the translated sentence text is the same according to the alignment result; If not, performing a word-by-word translation operation on the target sentence text to obtain a back-translated sentence text in the first language; Adding the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text to a training set, and using the samples in the training set to train the initial model to obtain a grammatical error detection model; Performing a grammatical error detection operation on the sentence text to be detected by using the grammatical error detection model; The method of performing a word-by-word translation operation on the target sentence text to obtain a back-translated sentence text in the first language includes: determining a back-translated word corresponding to each word in the target sentence text, and using the back-translated word to generate an intermediate back-translated sentence text having the same word order as the target sentence text; randomly adding a target word to the intermediate back-translated sentence text according to a preset probability according to the alignment result to obtain the back-translated sentence text; wherein the target word is a word that does not exist in the original sentence text but is translated into the second language; Or, performing a word-by-word translation operation on the target sentence text to obtain a back-translation sentence text in the first language, including: translating each word in the target sentence text into the first language to obtain a first candidate back-translation word; setting the word corresponding to each word in the target sentence text in the original sentence text as a second candidate back-translation word according to the alignment result; performing a word-by-word translation operation on the target sentence text based on the first candidate back-translation word and the second candidate back-translation word to obtain the back-translation sentence text with the same word order as the target sentence text; wherein the ratio of the first candidate back-translation word to the second candidate back-translation word in the back-translation sentence text is within a preset range.

2. The grammatical error detection method according to claim 1, characterized in that: Translating each word in the target sentence text into the first language to obtain a first candidate back-translated word includes: A translator is used to translate each word in the translation sentence text, and N words in the translation results whose semantic similarity is greater than a preset value are used as the first candidate back-translation words.

3. The grammatical error detection method according to claim 1, characterized in that: Adding the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text to a training set includes: Adding the back-translated sentence text as a negative example to the training set; The original sentence text corresponding to the back-translated sentence text is added to the training set as a positive example.

4. The grammatical error detection method according to claim 1, characterized in that: Performing a grammatical error detection operation on the sentence text to be detected by using the grammatical error detection model includes: Inputting the sentence text to be detected into the grammatical error detection model to obtain a detection result; The text with grammatical errors in the sentence text to be detected is marked according to the detection result.

5. The grammatical error detection method according to claim 4, characterized in that: After marking the text with grammatical errors in the sentence text to be detected according to the detection result, the method further includes: A corrected text in the first language is generated based on the text with grammatical errors.

6. A grammatical error detection device, characterized in that: include: A translation module, used for acquiring an original sentence text in a first language and translating the original sentence text into a target sentence text in a second language; A word alignment module, used to perform a word alignment operation on the original sentence text and the translated sentence text, and determine whether the word order of the original sentence text and the translated sentence text is the same according to the alignment result; A back-translation module, used for performing a word-by-word translation operation on the target sentence text to obtain a back-translated sentence text in the first language if the word order of the original sentence text and the target sentence text is different; A model training module, used for adding the back-translated sentence text and the original sentence text corresponding to the back-translated sentence text to a training set, and using the samples in the training set to train the initial model to obtain a grammatical error detection model; An error detection module, used for performing a grammatical error detection operation on the sentence text to be detected by using the grammatical error detection model; The back-translation module is specifically used to determine the back-translation word corresponding to each word in the target sentence text, and use the back-translation word to generate an intermediate back-translation sentence text with the same word order as the target sentence text; randomly add the target word to the intermediate back-translation sentence text according to the alignment result according to a preset probability to obtain the back-translation sentence text; wherein the target word is a word that does not exist in the original sentence text and is translated into the second language; or, specifically used to translate each word in the target sentence text into the first language to obtain a first candidate back-translation word; according to the alignment result, set the word corresponding to each word in the target sentence text in the original sentence text as a second candidate back-translation word; perform a word-by-word translation operation on the target sentence text based on the first candidate back-translation word and the second candidate back-translation word to obtain the back-translation sentence text with the same word order as the target sentence text; wherein the ratio of the first candidate back-translation word to the second candidate back-translation word in the back-translation sentence text is within a preset range.

7. An electronic device, characterized in that: The method comprises a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the grammatical error detection method according to any one of claims 1 to 5 when calling the computer program in the memory.

8. A storage medium, characterized in that: The storage medium stores computer executable instructions, and when the computer executable instructions are loaded and executed by the processor, the steps of the grammatical error detection method as described in any one of claims 1 to 5 are implemented.

Citation Information

Patent Citations

  • Method and system for correcting term mistranslation in translation and related device

    CN108804428A