CN111914540A - Statement identification method and device, storage medium and processor - Google Patents
Statement identification method and device, storage medium and processor Download PDFInfo
- Publication number
- CN111914540A CN111914540A CN201910390785.0A CN201910390785A CN111914540A CN 111914540 A CN111914540 A CN 111914540A CN 201910390785 A CN201910390785 A CN 201910390785A CN 111914540 A CN111914540 A CN 111914540A
- Authority
- CN
- China
- Prior art keywords
- sentence
- statement
- grammatical error
- grammatical
- result
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 82
- 238000001514 detection method Methods 0.000 claims abstract description 111
- 238000012545 processing Methods 0.000 claims abstract description 111
- 238000012937 correction Methods 0.000 claims abstract description 80
- 230000008569 process Effects 0.000 claims description 16
- 238000004364 calculation method Methods 0.000 claims description 6
- 238000002372 labelling Methods 0.000 abstract description 6
- 230000015654 memory Effects 0.000 description 25
- 230000006870 function Effects 0.000 description 17
- 235000013399 edible fruits Nutrition 0.000 description 11
- 238000010586 diagram Methods 0.000 description 8
- 230000005540 biological transmission Effects 0.000 description 5
- 239000011159 matrix material Substances 0.000 description 5
- 238000004891 communication Methods 0.000 description 4
- 230000000694 effects Effects 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000008878 coupling Effects 0.000 description 3
- 238000010168 coupling process Methods 0.000 description 3
- 238000005859 coupling reaction Methods 0.000 description 3
- 238000012549 training Methods 0.000 description 3
- 241000220225 Malus Species 0.000 description 2
- 235000021016 apples Nutrition 0.000 description 2
- 239000000284 extract Substances 0.000 description 2
- 238000010295 mobile communication Methods 0.000 description 2
- 230000003287 optical effect Effects 0.000 description 2
- 238000009825 accumulation Methods 0.000 description 1
- 238000013500 data storage Methods 0.000 description 1
- 230000010365 information processing Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 239000000203 mixture Substances 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Machine Translation (AREA)
- Document Processing Apparatus (AREA)
Abstract
本发明公开了一种语句鉴定方法及装置、存储介质和处理器。其中,该方法包括:获取待处理语句;将待处理语句输入至目标编码器,处理得到待处理语句的语义表示,其中,目标编码器为语法错误检测任务和语法错误纠错任务共享的编码器;将待处理语句的语义表示输入至处理模型,得到处理结果,其中,处理结果包括以下之一:语法错误检测结果、语法错误纠错结果。本发明解决了由于不同任务的标注数据不同难以直接混合使用导致系统处理任务的性能不佳的技术问题。
The invention discloses a sentence identification method and device, a storage medium and a processor. Wherein, the method includes: obtaining a statement to be processed; inputting the statement to be processed into a target encoder, and processing to obtain a semantic representation of the statement to be processed, wherein the target encoder is an encoder shared by a grammatical error detection task and a grammatical error correction task ; Input the semantic representation of the statement to be processed into the processing model to obtain a processing result, wherein the processing result includes one of the following: a grammatical error detection result and a grammatical error error correction result. The invention solves the technical problem of poor performance of the system processing tasks due to the difficulty of directly mixing and using the labeling data of different tasks.
Description
技术领域technical field
本发明涉及信息处理技术领域,具体而言,涉及一种语句鉴定方法及装置、存储介质和处理器。The present invention relates to the technical field of information processing, and in particular, to a sentence identification method and device, a storage medium and a processor.
背景技术Background technique
在语法错误检测与纠错任务上,过去因为任务划分和具体需求的不同,标注的数据存在一定的差异。在语法错误检测场景下,类似于Word里的拼写检查,仅需要对用户的输入中存在的错误进行发现和识别,并给出提示。以此为需求,标注了一些数据中存在的错误位置和类型,例如句子“我喜欢吃平果”,标注为第4个词“平果”错误。而在另一个语法错误纠错场景下,需要对用户的输入进行纠错,以此为需求,标注了另一批数据的语法正确形式,例如句子“我喜欢吃平果”及其正确形式“我喜欢吃苹果”。这两种标注数据本身并不相同,没法直接混合使用,所以称为异质标注数据。但是这两份数据针对的语法错误的检测和纠错是相互关联的,由于不同任务的标注数据不同难以直接混合使用导致系统处理任务的性能不佳。In the task of grammatical error detection and error correction, in the past, there were certain differences in the labeled data due to different task divisions and specific requirements. In the grammatical error detection scenario, similar to the spelling check in Word, it only needs to find and identify errors in the user's input, and give prompts. Taking this as a requirement, some error locations and types in the data are marked, for example, the sentence "I like to eat flat fruit" is marked as the fourth word "flat fruit" error. In another grammatical error correction scenario, the user's input needs to be corrected for errors, and based on this, the grammatically correct form of another batch of data is marked, such as the sentence "I like to eat flat fruit" and its correct form" I like to eat apples". These two kinds of labeling data are not the same in themselves and cannot be directly mixed, so they are called heterogeneous labeling data. However, the detection and correction of grammatical errors for these two data are related to each other, and it is difficult to directly mix and use the labeled data of different tasks, resulting in poor performance of the system processing tasks.
针对上述的问题,目前尚未提出有效的解决方案。For the above problems, no effective solution has been proposed yet.
发明内容SUMMARY OF THE INVENTION
本发明实施例提供了一种语句鉴定方法及装置、存储介质和处理器,以至少解决由于不同任务的标注数据不同难以直接混合使用导致系统处理任务的性能不佳的技术问题。Embodiments of the present invention provide a sentence identification method and device, a storage medium, and a processor to at least solve the technical problem of poor performance of system processing tasks due to difficulty in directly mixing and using different annotation data for different tasks.
根据本发明实施例的一个方面,提供了一种语句鉴定方法,包括:获取待处理语句;将所述待处理语句输入至目标编码器,处理得到所述待处理语句的语义表示,其中,所述目标编码器为语法错误检测任务和语法错误纠错任务共享的编码器;将所述待处理语句的语义表示输入至处理模型,得到处理结果,其中,所述处理结果包括以下之一:语法错误检测结果、语法错误纠错结果。According to an aspect of the embodiments of the present invention, there is provided a statement identification method, comprising: acquiring a statement to be processed; inputting the statement to be processed into a target encoder, and processing to obtain a semantic representation of the statement to be processed, wherein the The target encoder is an encoder shared by the grammatical error detection task and the grammatical error correction task; the semantic representation of the statement to be processed is input into the processing model to obtain a processing result, wherein the processing result includes one of the following: Error detection results, grammatical error correction results.
进一步地,所述方法还包括:在将所述待处理语句输入至目标编码器,处理得到所述待处理语句的语义表示之前,获取多个已被标注的语句,其中,所述多个已被标注的语句包括:已被标注语法错误的第一类语句和已被纠错语法错误的第二类语句;将所述第一类语句输入至所述目标编码器,处理得到所述第一类语句的语义表示,将所述第二类语句输入至所述目标编码器,处理得到所述第二类语句的语义表示,将所述第一类语句的语义表示输入至语法错误检测子模型,得到所述第一类语句的语法错误检测结果,将所述第二类语句的语义表示输入至目标解码器,得到所述第二类语句的语法错误纠错结果;将所述第一类语句的语法错误检测结果与已被标注语法错误进行比对,得到第一比对结果,将所述第二类语句的语法错误纠错结果与已被纠错语法错误进行比对,得到第二比对结果;根据所述第一比对结果和所述第二比对结果,调整所述目标编码器的参数。Further, the method further includes: before inputting the to-be-processed sentence into a target encoder and processing to obtain a semantic representation of the to-be-processed sentence, acquiring a plurality of marked sentences, wherein the plurality of The annotated sentences include: first-type sentences that have been marked with grammatical errors and second-type sentences that have been corrected for grammatical errors; inputting the first-type sentences to the target encoder, and processing to obtain the first type of sentences The semantic representation of the class sentence, the second class sentence is input into the target encoder, the semantic representation of the second class sentence is obtained by processing, and the semantic representation of the first class sentence is input to the syntax error detection sub-model , obtain the grammatical error detection result of the sentence of the first type, input the semantic representation of the sentence of the second type to the target decoder, and obtain the grammatical error correction result of the sentence of the second type; The grammatical error detection result of the sentence is compared with the marked grammatical error to obtain a first comparison result, and the grammatical error correction result of the second type of sentence is compared with the grammatical error that has been corrected to obtain a second comparison result. Comparison result; according to the first comparison result and the second comparison result, adjust the parameters of the target encoder.
进一步地,所述方法还包括:根据所述第一比对结果调整所述语法错误检测子模型的参数;根据所述第二比对结果调整所述目标解码器的参数。Further, the method further includes: adjusting parameters of the syntax error detection sub-model according to the first comparison result; adjusting parameters of the target decoder according to the second comparison result.
进一步地,根据所述第一比对结果和所述第二比对结果,调整所述目标编码器的参数包括:根据所述第一比对结果和交叉熵损失函数计算第一损失值;根据所述第二比对结果和所述交叉熵损失函数计算第二损失值;将所述第一损失值通过反向传播算法计算待调整的第一参数,将所述第二损失值通过所述反向传播算法计算待调整的第二参数;根据所述第一参数和所述第二参数,调整所述目标编码器的参数。Further, according to the first comparison result and the second comparison result, adjusting the parameters of the target encoder includes: calculating a first loss value according to the first comparison result and the cross entropy loss function; The second comparison result and the cross-entropy loss function are used to calculate a second loss value; the first loss value is calculated by a back-propagation algorithm to calculate the first parameter to be adjusted, and the second loss value is passed through the The back-propagation algorithm calculates the second parameter to be adjusted; according to the first parameter and the second parameter, the parameter of the target encoder is adjusted.
进一步地,根据所述第一参数和所述第二参数,调整所述目标编码器的参数包括:确定所述语法错误检测任务的第一权重值和所述语法错误纠错任务的第二权重值;根据所述第一参数、所述第一权重值、所述第二参数和所述第二权重值,调整所述目标编码器的参数。Further, according to the first parameter and the second parameter, adjusting the parameters of the target encoder includes: determining a first weight value of the syntax error detection task and a second weight of the syntax error correction task value; adjust the parameters of the target encoder according to the first parameter, the first weight value, the second parameter and the second weight value.
进一步地,所述目标编码器为多层Bi-LSTM编码器,所述目标解码器为多层Bi-LSTM解码器。Further, the target encoder is a multi-layer Bi-LSTM encoder, and the target decoder is a multi-layer Bi-LSTM decoder.
进一步地,若所述待处理语句为待进行语法错误检测的语句,则所述处理模型为语法错误检测子模型,若所述待处理语句为待进行语法错误纠错的语句,则所述处理模型为多层Bi-LSTM解码器。Further, if the statement to be processed is a statement to be subjected to grammatical error detection, the processing model is a grammatical error detection sub-model, and if the statement to be processed is a statement to be subjected to grammatical error correction, the processing The model is a multi-layer Bi-LSTM decoder.
根据本发明实施例的另一方面,还提供了一种语句鉴定装置,包括:第一获取单元,用于获取待处理语句;第一处理单元,用于将所述待处理语句输入至目标编码器,处理得到所述待处理语句的语义表示,其中,所述目标编码器为语法错误检测任务和语法错误纠错任务共享的编码器;第二处理单元,用于将所述待处理语句的语义表示输入至处理模型,得到处理结果,其中,所述处理结果包括以下之一:语法错误检测结果、语法错误纠错结果。According to another aspect of the embodiments of the present invention, a sentence identification device is further provided, including: a first acquiring unit, configured to acquire a to-be-processed sentence; and a first processing unit, configured to input the to-be-processed sentence into a target code is processed to obtain the semantic representation of the statement to be processed, wherein, the target encoder is an encoder shared by a syntax error detection task and a syntax error error correction task; a second processing unit is used to convert the syntax of the statement to be processed The semantic representation is input to the processing model to obtain a processing result, wherein the processing result includes one of the following: a grammatical error detection result and a grammatical error correction result.
进一步地,所述装置还包括:第二获取单元,用于在将所述待处理语句输入至目标编码器,处理得到所述待处理语句的语义表示之前,获取多个已被标注的语句,其中,所述多个已被标注的语句包括:已被标注语法错误的第一类语句和已被纠错语法错误的第二类语句;第三处理单元,用于将所述第一类语句输入至所述目标编码器,处理得到所述第一类语句的语义表示,将所述第二类语句输入至所述目标编码器,处理得到所述第二类语句的语义表示,第三获取单元,用于将所述第一类语句的语义表示输入至语法错误检测子模型,得到所述第一类语句的语法错误检测结果,将所述第二类语句的语义表示输入至目标解码器,得到所述第二类语句的语法错误纠错结果;对比单元,用于将所述第一类语句的语法错误检测结果与已被标注语法错误进行比对,得到第一比对结果,将所述第二类语句的语法错误纠错结果与已被纠错语法错误进行比对,得到第二比对结果;第一调整单元,用于根据所述第一比对结果和所述第二比对结果,调整所述目标编码器的参数。Further, the device further comprises: a second obtaining unit, configured to obtain a plurality of marked sentences before inputting the to-be-processed sentence into the target encoder and processing to obtain the semantic representation of the to-be-processed sentence, Wherein, the multiple marked sentences include: a first type of sentences marked with grammatical errors and a second type of sentences that have been corrected for grammatical errors; a third processing unit, configured to convert the first type of sentences Input to the target encoder, process to obtain the semantic representation of the first type of sentence, input the second type of sentence into the target encoder, process to obtain the semantic representation of the second type of sentence, and thirdly obtain a unit, configured to input the semantic representation of the first type of sentence into the grammatical error detection sub-model, obtain the grammatical error detection result of the first type of sentence, and input the semantic representation of the second type of sentence to the target decoder to obtain the grammatical error correction result of the second type of statement; the comparison unit is used to compare the grammatical error detection result of the first type of statement with the marked grammatical error, obtain the first comparison result, and set the The grammatical error correction result of the second type of sentence is compared with the grammatical error that has been corrected to obtain a second comparison result; a first adjustment unit is used for comparing the first comparison result and the second comparison result Compare the results and adjust the parameters of the target encoder.
进一步地,所述装置还包括:第二调整单元,用于根据所述第一比对结果调整所述语法错误检测子模型的参数;第三调整单元,用于根据所述第二比对结果调整所述目标解码器的参数。Further, the apparatus further includes: a second adjustment unit, configured to adjust the parameters of the syntax error detection sub-model according to the first comparison result; and a third adjustment unit, configured to adjust the parameters of the syntax error detection sub-model according to the second comparison result Adjust the parameters of the target decoder.
进一步地,所述第一调整单元包括:第一计算模块,用于根据所述第一比对结果和交叉熵损失函数计算第一损失值,根据所述第二比对结果和所述交叉熵损失函数计算第二损失值;第二计算模块,用于将所述第一损失值通过反向传播算法计算待调整的第一参数,将所述第二损失值通过所述反向传播算法计算待调整的第二参数;调整模块,用于根据所述第一参数和所述第二参数,调整所述目标编码器的参数。Further, the first adjustment unit includes: a first calculation module, configured to calculate a first loss value according to the first comparison result and the cross entropy loss function, and according to the second comparison result and the cross entropy The loss function calculates the second loss value; the second calculation module is used to calculate the first parameter to be adjusted by the back propagation algorithm, and the second loss value is calculated by the back propagation algorithm a second parameter to be adjusted; an adjustment module configured to adjust the parameter of the target encoder according to the first parameter and the second parameter.
进一步地,所述调整模块包括:确定子模块,用于确定所述语法错误检测任务的第一权重值和所述语法错误纠错任务的第二权重值;调整子模块,用于根据所述第一参数、所述第一权重值、所述第二参数和所述第二权重值,调整所述目标编码器的参数。Further, the adjustment module includes: a determination sub-module for determining a first weight value of the grammatical error detection task and a second weight value of the grammatical error correction task; The first parameter, the first weight value, the second parameter, and the second weight value adjust the parameters of the target encoder.
根据本发明实施例的另一方面,还提供了一种存储介质,其特征在于,所述存储介质包括存储的程序,其中,在所述程序运行时控制所述存储介质所在设备执行上述任意一项所述的语句鉴定方法。According to another aspect of the embodiments of the present invention, a storage medium is further provided, wherein the storage medium includes a stored program, wherein when the program is run, the device where the storage medium is located is controlled to execute any one of the above The sentence identification method described in item.
根据本发明实施例的另一方面,还提供了一种处理器,其特征在于,所述处理器用于运行程序,其中,所述程序运行时执行上述任意一项所述的语句鉴定方法。According to another aspect of the embodiments of the present invention, a processor is further provided, wherein the processor is configured to run a program, wherein, when the program runs, any one of the statement identification methods described above is executed.
在本发明实施例中,通过获取待处理语句;将待处理语句输入至目标编码器,处理得到待处理语句的语义表示,其中,目标编码器为语法错误检测任务和语法错误纠错任务共享的编码器;将待处理语句的语义表示输入至处理模型,得到处理结果,其中,处理结果包括以下之一:语法错误检测结果、语法错误纠错结果,达到了通过语法错误检测任务和语法错误纠错任务共享的编码器,使得异质的数据能够相互得到另一方的信息,从而实现了提升系统性能的技术效果,进而解决了由于不同任务的标注数据不同难以直接混合使用导致系统处理任务的性能不佳的技术问题。In the embodiment of the present invention, the to-be-processed sentence is acquired; the to-be-processed sentence is input into a target encoder, and the semantic representation of the to-be-processed sentence is obtained by processing, wherein the target encoder is shared by the grammatical error detection task and the grammatical error error correction task. The encoder; inputs the semantic representation of the sentence to be processed into the processing model, and obtains a processing result, wherein the processing result includes one of the following: a grammatical error detection result and a grammatical error correction result, which achieves the goal of passing the grammatical error detection task and grammatical error correction. The encoder shared by wrong tasks enables heterogeneous data to obtain information from the other party, thereby achieving the technical effect of improving system performance, and solving the problem of the performance of system processing tasks caused by the difficulty of directly mixing different labeled data for different tasks. Bad technical issues.
附图说明Description of drawings
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:The accompanying drawings described herein are used to provide a further understanding of the present invention and constitute a part of the present application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the attached image:
图1是根据本发明实施例提供的计算机终端的硬件结构框图;1 is a block diagram of a hardware structure of a computer terminal provided according to an embodiment of the present invention;
图2是根据本发明实施例提供的语句鉴定方法的流程图;2 is a flowchart of a statement identification method provided according to an embodiment of the present invention;
图3是根据本发明实施例提供的语句鉴定方法的示意图;3 is a schematic diagram of a sentence identification method provided according to an embodiment of the present invention;
图4是根据本发明实施例提供的语句鉴定装置的示意图;以及4 is a schematic diagram of a sentence identification device provided according to an embodiment of the present invention; and
图5是根据本发明实施例的可选的计算机终端的结构框图。FIG. 5 is a structural block diagram of an optional computer terminal according to an embodiment of the present invention.
具体实施方式Detailed ways
为了使本技术领域的人员更好地理解本发明方案,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分的实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都应当属于本发明保护的范围。In order to make those skilled in the art better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only Embodiments are part of the present invention, but not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by persons of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
需要说明的是,本发明的说明书和权利要求书及上述附图中的术语“第一”、“第二”等是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的本发明的实施例能够以除了在这里图示或描述的那些以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法、系统、产品或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法、产品或设备固有的其它步骤或单元。It should be noted that the terms "first", "second" and the like in the description and claims of the present invention and the above drawings are used to distinguish similar objects, and are not necessarily used to describe a specific sequence or sequence. It is to be understood that the data so used may be interchanged under appropriate circumstances such that the embodiments of the invention described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having" and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those expressly listed Rather, those steps or units may include other steps or units not expressly listed or inherent to these processes, methods, products or devices.
首先,在对本申请实施例进行描述的过程中出现的部分名词或术语适用于如下解释:First of all, some nouns or terms that appear in the process of describing the embodiments of the present application are suitable for the following explanations:
异质标注数据:是指对一相同或相关任务标注的有一定相关的数据,但是数据本身标注的内容不同。以语法纠错为例,一份数据标注了一些句子和它对应的语法正确形式,一份数据标注了句子及其存在的语法错误位置,这两份数据即是语法纠错的异质标注数据。Heterogeneous labeled data: refers to the data that is labeled for the same or related tasks to a certain extent, but the content of the data itself is different. Taking grammatical error correction as an example, a piece of data annotates some sentences and their corresponding grammatically correct forms, and a piece of data annotates sentences and their grammatical error locations. These two pieces of data are heterogeneous labeling data for grammatical error correction. .
语法错误检测:是指对句子中存在的语法错误进行检测。Grammatical error detection: refers to the detection of grammatical errors in sentences.
语法错误纠错:是指对句子中存在的语法错误进行改正。Grammatical error correction: refers to the correction of grammatical errors in sentences.
实施例1Example 1
根据本发明实施例,提供了一种语句鉴定的方法实施例,需要说明的是,在附图的流程图示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。According to an embodiment of the present invention, an embodiment of a method for identifying a sentence is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although A logical order is shown in the flowcharts, but in some cases steps shown or described may be performed in an order different from that herein.
本申请实施例一所提供的方法实施例可以在移动终端、计算机终端或者类似的运算装置中执行。图1示出了一种用于实现语句鉴定方法的计算机终端(或移动设备)的硬件结构框图。如图1所示,计算机终端10(或移动设备10)可以包括一个或多个(图中采用102a、102b,……,102n来示出)处理器102(处理器102可以包括但不限于微处理器MCU或可编程逻辑器件FPGA等的处理装置)、用于存储数据的存储器104、以及用于通信功能的传输装置。除此以外,还可以包括:显示器、输入/输出接口(I/O接口)、通用串行总线(USB)端口(可以作为I/O接口的端口中的一个端口被包括)、网络接口、电源和/或相机。本领域普通技术人员可以理解,图1所示的结构仅为示意,其并不对上述电子装置的结构造成限定。例如,计算机终端10还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。The method embodiment provided in
应当注意到的是上述一个或多个处理器102和/或其他数据处理电路在本文中通常可以被称为“数据处理电路”。该数据处理电路可以全部或部分的体现为软件、硬件、固件或其他任意组合。此外,数据处理电路可为单个独立的处理模块,或全部或部分的结合到计算机终端10(或移动设备)中的其他元件中的任意一个内。如本申请实施例中所涉及到的,该数据处理电路作为一种处理器控制(例如与接口连接的可变电阻终端路径的选择)。It should be noted that the one or more processors 102 and/or other data processing circuits described above may generally be referred to herein as "data processing circuits." The data processing circuit may be embodied in whole or in part as software, hardware, firmware or any other combination. Furthermore, the data processing circuitry may be a single stand-alone processing module, or incorporated in whole or in part into any of the other elements in the computer terminal 10 (or mobile device). As referred to in the embodiments of the present application, the data processing circuit acts as a kind of processor control (eg, selection of a variable resistance termination path connected to an interface).
存储器104可用于存储应用软件的软件程序以及模块,如本发明实施例中的语句鉴定方法对应的程序指令/数据存储装置,处理器102通过运行存储在存储器104内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的应用程序的语句鉴定方法。存储器104可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器104可进一步包括相对于处理器102远程设置的存储器,这些远程存储器可以通过网络连接至计算机终端10。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The
传输装置106用于经由一个网络接收或者发送数据。上述的网络具体实例可包括计算机终端10的通信供应商提供的无线网络。在一个实例中,传输装置106包括一个网络适配器(Network Interface Controller,NIC),其可通过基站与其他网络设备相连从而可与互联网进行通讯。在一个实例中,传输装置106可以为射频(Radio Frequency,RF)模块,其用于通过无线方式与互联网进行通讯。Transmission means 106 are used to receive or transmit data via a network. A specific example of the above-mentioned network may include a wireless network provided by a communication provider of the computer terminal 10 . In one example, the transmission device 106 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (Radio Frequency, RF) module, which is used for wirelessly communicating with the Internet.
显示器可以例如触摸屏式的液晶显示器(LCD),该液晶显示器可使得用户能够与计算机终端10(或移动设备)的用户界面进行交互。The display may be, for example, a touch screen type liquid crystal display (LCD) that enables a user to interact with the user interface of the computer terminal 10 (or mobile device).
在上述运行环境下,本申请提供了如图2所示的语句鉴定方法。图2是根据本发明实施例一的语句鉴定方法的流程图。Under the above operating environment, the present application provides a sentence identification method as shown in FIG. 2 . FIG. 2 is a flowchart of a sentence identification method according to
步骤S201,获取待处理语句。Step S201, acquiring the to-be-processed statement.
例如,待处理语句为:我喜欢吃平果。For example, the pending statement is: I like to eat flat fruit.
步骤S202,将待处理语句输入至目标编码器,处理得到待处理语句的语义表示,其中,目标编码器为语法错误检测任务和语法错误纠错任务共享的编码器。Step S202, inputting the sentence to be processed into the target encoder, and processing to obtain a semantic representation of the sentence to be processed, wherein the target encoder is an encoder shared by the task of grammatical error detection and the task of grammatical error correction.
上述的待处理语句可以为语法错误检测或纠错数据的句子,经过一个共享的目标解码器(例如,多层Bi-LSTM编码器),得到句子里各词的语义表示。多层Bi-LSTM编码器内部包含:1)句子的词经过词向量矩阵,映射为向量表示,得到句子的词向量序列;2)词向量序列经过多层Bi-LSTM网络得到各词的语义表示。The above-mentioned sentences to be processed may be sentences of grammatical error detection or error correction data. After a shared target decoder (eg, a multi-layer Bi-LSTM encoder), the semantic representation of each word in the sentence is obtained. The multi-layer Bi-LSTM encoder contains: 1) The words of the sentence are mapped to vector representation through the word vector matrix, and the word vector sequence of the sentence is obtained; 2) The word vector sequence is passed through the multi-layer Bi-LSTM network to obtain the semantic representation of each word .
也即,将待处理语句输入至目标编码器,得到语义表示为N*D维的矩阵,其中,N,D为自然数。例如,待处理语句为“我喜欢吃平果”包括四个词:我,喜欢,吃,平果,对其语义表示后为4*100维的矩阵。That is, input the sentence to be processed into the target encoder, and obtain a matrix whose semantic representation is N*D dimension, where N and D are natural numbers. For example, the to-be-processed sentence "I like to eat flat fruit" includes four words: I, like, eat, flat fruit, which is a 4*100-dimensional matrix after its semantic representation.
可选地,在本发明实施例提供的语句鉴定方法中,该方法还包括:在将待处理语句输入至目标编码器,处理得到待处理语句的语义表示之前,获取多个已被标注的语句,其中,多个已被标注的语句包括:已被标注语法错误的第一类语句和已被纠错语法错误的第二类语句;将第一类语句输入至目标编码器,处理得到第一类语句的语义表示,将第二类语句输入至目标编码器,处理得到第二类语句的语义表示,将第一类语句的语义表示输入至语法错误检测子模型,得到第一类语句的语法错误检测结果,将第二类语句的语义表示输入至目标解码器,得到第二类语句的语法错误纠错结果;将第一类语句的语法错误检测结果与已被标注语法错误进行比对,得到第一比对结果,将第二类语句的语法错误纠错结果与已被纠错语法错误进行比对,得到第二比对结果;根据第一比对结果和第二比对结果,调整目标编码器的参数。Optionally, in the sentence identification method provided by the embodiment of the present invention, the method further includes: before inputting the to-be-processed sentence into the target encoder and processing to obtain a semantic representation of the to-be-processed sentence, acquiring a plurality of marked sentences , wherein the multiple marked sentences include: the first type of sentences that have been marked with grammatical errors and the second type of sentences that have been corrected for grammatical errors; the first type of sentences are input into the target encoder, and the first Semantic representation of class sentences, input the second class of sentences to the target encoder, process to obtain the semantic representation of the second class of sentences, input the semantic representation of the first class of sentences to the syntax error detection sub-model, and obtain the grammar of the first class of sentences Error detection results, input the semantic representation of the second type of sentences to the target decoder, and obtain the grammatical error correction results of the second type of sentences; compare the grammatical error detection results of the first type of sentences with the marked grammatical errors, Obtain the first comparison result, compare the grammatical error correction result of the second type of sentence with the grammatical error that has been corrected, and obtain the second comparison result; according to the first comparison result and the second comparison result, adjust Parameters for the target encoder.
上述的多个已被标注的语句中即包括已被标注语法错误的第一类语句和已被纠错语法错误的第二类语句,例如,多个已被标注的语句中包括:语句一“今天天气真秦朗”,语法错误标注为第4个词“秦朗”错误,语法错误纠错为“今天天气真晴朗”;语句二“信号不好导致通话中短”,语法错误标注为第5个词“中短”错误,语法错误纠错为“信号不好导致通话中断”。将已被语法错误标注为第4个词“秦朗”错误的语句一“今天天气真秦朗”输入至目标编码器,处理得到语句一的语义表示一,将已被语法错误纠错为“今天天气真晴朗”的语句一“今天天气真秦朗”输入至目标编码器,处理得到语句一的语义表示二,将语句一的语义表示一输入至语法错误检测子模型,得到语句一的语法错误检测结果,将语句一的语义表示二输入至目标解码器,得到语句一的语法错误纠错结果;将语句一的语法错误检测结果与已被标注语法错误进行比对,得到第一比对结果,将语句一的语法错误纠错结果与已被纠错语法错误进行比对,得到第二比对结果;根据第一比对结果和第二比对结果,调整目标编码器的参数。The above-mentioned multiple marked sentences include the first type of sentences marked with grammatical errors and the second type of sentences that have been corrected for grammatical errors. For example, the multiple marked sentences include: Sentence one" Today's weather is really Qin Lang", the grammatical error is marked as the fourth word "Qin Lang", and the grammatical error correction is "Today's weather is really sunny"; the second sentence "The call is short due to poor signal", the grammatical error is marked as the fifth The word "medium and short" is wrong, and the grammatical error is corrected as "the call is interrupted due to poor signal". Input the
通过上述方案根据语句一的第一比对结果和语句一的第二比对结果,调整目标编码器的参数,根据语句二的第一比对结果和语句二的第二比对结果,调整目标编码器的参数,……根据语句N的第一比对结果和语句一的第二比对结果,调整目标编码器的参数。根据第一比对结果和第二对比结果计算交叉熵损失函数,反向梯度传播更新目标编码器的参数。According to the above scheme, the parameters of the target encoder are adjusted according to the first comparison result of
如图3所示,本方法通过在语法错误检测和语法错误纠错的数据上,使用共享的多层Bi-LSTM编码器提取到句子的语义表示,用异质的数据共同训练这个编码器,使得编码器得到充分的学习,能够同时提取到错误检测和纠错信息。不同数据独立的语法错误检测子模型和多层Bi-LSTM解码器又保证了不同数据输出的差异性。同时本方案的两个语法错误检测任务和语法错误纠错任务没有级联关系,不会产生错误累积,且不同数据能够联合训练,使得异质的数据能够相互得到另一方的信息,最终提升系统性能。As shown in Figure 3, this method extracts the semantic representation of sentences by using a shared multi-layer Bi-LSTM encoder on the data of grammatical error detection and grammatical error error correction, and jointly trains the encoder with heterogeneous data. The encoder is fully learned and can extract error detection and error correction information at the same time. Different data independent syntax error detection sub-models and multi-layer Bi-LSTM decoders ensure the difference of different data outputs. At the same time, the two grammatical error detection tasks and grammatical error correction tasks of this scheme have no cascading relationship, no error accumulation will occur, and different data can be jointly trained, so that heterogeneous data can obtain information from each other, and ultimately improve the system performance.
步骤S203,将待处理语句的语义表示输入至处理模型,得到处理结果,其中,处理结果包括以下之一:语法错误检测结果、语法错误纠错结果。Step S203: Input the semantic representation of the statement to be processed into the processing model, and obtain a processing result, wherein the processing result includes one of the following: a grammatical error detection result and a grammatical error error correction result.
在本发明实施例提供的语句鉴定方法中,若待处理语句为待进行语法错误检测的语句,则处理模型为语法错误检测子模型,若待处理语句为待进行语法错误纠错的语句,则处理模型为多层Bi-LSTM解码器。In the statement identification method provided by the embodiment of the present invention, if the statement to be processed is a statement to be subjected to grammatical error detection, the processing model is a grammatical error detection sub-model; The processing model is a multi-layer Bi-LSTM decoder.
若将待处理语句“我喜欢吃平果”语义表示后为4*100维的矩阵输入至语法错误检测子模型,得到待处理语句“我喜欢吃平果”的语法错误检测结果为标注为第4个词“平果”错误。若将待处理语句“我喜欢吃平果”语义表示后为4*100维的矩阵输入至多层Bi-LSTM解码器,得到待处理语句“我喜欢吃平果”的语法错误纠错结果为“我喜欢吃苹果”。If a 4*100-dimensional matrix after the semantic representation of the to-be-processed sentence "I like to eat flat fruit" is input into the grammatical error detection sub-model, the grammatical error detection result of the to-be-processed sentence "I like to eat flat fruit" is marked as No. 4 words "flat fruit" wrong. If the semantic representation of the to-be-processed sentence "I like to eat flat fruit" is a 4*100-dimensional matrix input to the multi-layer Bi-LSTM decoder, the grammatical error correction result of the to-be-processed sentence "I like to eat flat fruit" is " I like to eat apples".
综上所述,本发明实施例提供的语句鉴定方法,通过获取待处理语句;将待处理语句输入至目标编码器,处理得到待处理语句的语义表示,其中,目标编码器为语法错误检测任务和语法错误纠错任务共享的编码器;将待处理语句的语义表示输入至处理模型,得到处理结果,其中,处理结果包括以下之一:语法错误检测结果、语法错误纠错结果,达到了通过语法错误检测任务和语法错误纠错任务共享的编码器,使得异质的数据能够相互得到另一方的信息,从而实现了提升系统性能的技术效果,进而解决了由于不同任务的标注数据不同难以直接混合使用导致系统处理任务的性能不佳的技术问题。To sum up, the sentence identification method provided by the embodiment of the present invention obtains the to-be-processed sentence; inputs the to-be-processed sentence into the target encoder, and processes to obtain the semantic representation of the to-be-processed sentence, wherein the target encoder is the task of grammatical error detection The encoder shared with the grammatical error correction task; the semantic representation of the sentence to be processed is input into the processing model, and the processing result is obtained, wherein the processing result includes one of the following: the grammatical error detection result, the grammatical error error correction result, and the achievement of passing The shared encoder between the grammatical error detection task and the grammatical error error correction task enables heterogeneous data to obtain information from the other party, thereby achieving the technical effect of improving system performance, and solving the problem of difficulty in directing direct data due to different labeling data for different tasks. Mixed use of technical issues that lead to poor performance of the system processing tasks.
可选地,在本发明实施例提供的语句鉴定方法中,该方法还包括:根据第一比对结果调整语法错误检测子模型的参数;根据第二比对结果调整目标解码器的参数。Optionally, in the sentence identification method provided by the embodiment of the present invention, the method further includes: adjusting the parameters of the syntax error detection sub-model according to the first comparison result; and adjusting the parameters of the target decoder according to the second comparison result.
在上述方案中,通过根据第一比对结果调整语法错误检测子模型的参数;根据第二比对结果调整目标解码器的参数,不断更新了语法错误检测子模型和目标解码器的参数,保证了语法错误检测子模型和目标解码器输出结果的准确性。In the above scheme, the parameters of the syntax error detection sub-model are adjusted according to the first comparison result; the parameters of the target decoder are adjusted according to the second comparison result, and the parameters of the syntax error detection sub-model and the target decoder are continuously updated to ensure that The accuracy of the syntax error detection sub-model and the output of the target decoder.
可选地,在本发明实施例提供的语句鉴定方法中,根据第一比对结果和第二比对结果,调整目标编码器的参数包括:根据第一比对结果和交叉熵损失函数计算第一损失值;根据第二比对结果和交叉熵损失函数计算第二损失值;将第一损失值通过反向传播算法计算待调整的第一参数,将第二损失值通过反向传播算法计算待调整的第二参数;根据第一参数和第二参数,调整目标编码器的参数。Optionally, in the sentence identification method provided by the embodiment of the present invention, adjusting the parameters of the target encoder according to the first comparison result and the second comparison result includes: calculating the first comparison result according to the first comparison result and the cross entropy loss function. a loss value; calculate the second loss value according to the second comparison result and the cross-entropy loss function; calculate the first parameter to be adjusted by the back-propagation algorithm, and calculate the second loss value by the back-propagation algorithm The second parameter to be adjusted; adjust the parameters of the target encoder according to the first parameter and the second parameter.
在上述方案中,待调整的第一参数和待调整的第二参数中包括待调整的参数以及待更新的值,通过确定出的待调整的第一参数和待调整的第二参数,对目标编码器的参数进行调整,起到了联合训练目标编码器的作用。In the above solution, the first parameter to be adjusted and the second parameter to be adjusted include the parameter to be adjusted and the value to be updated. The parameters of the encoder are adjusted, which plays the role of jointly training the target encoder.
可选地,在本发明实施例提供的语句鉴定方法中,根据第一参数和第二参数,调整目标编码器的参数包括:确定语法错误检测任务的第一权重值和语法错误纠错任务的第二权重值;根据第一参数、第一权重值、第二参数和第二权重值,调整目标编码器的参数。Optionally, in the sentence identification method provided in the embodiment of the present invention, adjusting the parameters of the target encoder according to the first parameter and the second parameter includes: determining the first weight value of the grammatical error detection task and the grammatical error correction task. The second weight value; according to the first parameter, the first weight value, the second parameter and the second weight value, the parameters of the target encoder are adjusted.
例如,语法错误检测任务的第一权重值为0.5,语法错误纠错任务的第二权重值为1.0,将待调整的第一参数*0.5+待调整的第二参数*1.0,得到最终调整目标编码器的参数。通过预先设置不同任务的权重值,以便对训练出的目标编码器的训练更有针对性,保证了训练处的目标编码器输出结果的准确性。For example, the first weight value of the syntax error detection task is 0.5, the second weight value of the syntax error correction task is 1.0, and the final adjustment target is obtained by combining the first parameter to be adjusted*0.5+the second parameter to be adjusted*1.0 Encoder parameters. By presetting the weight values of different tasks, the training of the trained target encoder is more targeted, and the accuracy of the output result of the target encoder at the training place is guaranteed.
需要说明的是,对于前述的各方法实施例,为了简单描述,故将其都表述为一系列的动作组合,但是本领域技术人员应该知悉,本发明并不受所描述的动作顺序的限制,因为依据本发明,某些步骤可以采用其他顺序或者同时进行。其次,本领域技术人员也应该知悉,说明书中所描述的实施例均属于优选实施例,所涉及的动作和模块并不一定是本发明所必须的。It should be noted that, for the sake of simple description, the foregoing method embodiments are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence. As in accordance with the present invention, certain steps may be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到根据上述实施例的方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,或者网络设备等)执行本发明各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on this understanding, the technical solutions of the present invention can be embodied in the form of software products in essence or the parts that make contributions to the prior art, and the computer software products are stored in a storage medium (such as ROM/RAM, magnetic disk, CD-ROM), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to execute the methods described in the various embodiments of the present invention.
实施例2Example 2
根据本发明实施例,还提供了一种用于实施上述语句鉴定方法的装置,如图4所示,该装置包括:According to an embodiment of the present invention, an apparatus for implementing the above sentence identification method is also provided. As shown in FIG. 4 , the apparatus includes:
第一获取单元401,用于获取待处理语句;a first obtaining unit 401, configured to obtain a statement to be processed;
第一处理单元402,用于将所述待处理语句输入至目标编码器,处理得到所述待处理语句的语义表示,其中,所述目标编码器为语法错误检测任务和语法错误纠错任务共享的编码器;The first processing unit 402 is used for inputting the statement to be processed into a target encoder, and processing to obtain the semantic representation of the statement to be processed, wherein the target encoder is shared by the grammatical error detection task and the grammatical error correction task the encoder;
第二处理单元403,用于将所述待处理语句的语义表示输入至处理模型,得到处理结果,其中,所述处理结果包括以下之一:语法错误检测结果、语法错误纠错结果。The second processing unit 403 is configured to input the semantic representation of the to-be-processed statement into a processing model to obtain a processing result, wherein the processing result includes one of the following: a grammatical error detection result and a grammatical error correction result.
综上所述,本发明实施例提供的语句鉴定方法,通过第一获取单元401获取待处理语句;第一处理单元402将所述待处理语句输入至目标编码器,处理得到所述待处理语句的语义表示,其中,所述目标编码器为语法错误检测任务和语法错误纠错任务共享的编码器;第二处理单元403将所述待处理语句的语义表示输入至处理模型,得到处理结果,其中,所述处理结果包括以下之一:语法错误检测结果、语法错误纠错结果,达到了通过语法错误检测任务和语法错误纠错任务共享的编码器,使得异质的数据能够相互得到另一方的信息,从而实现了提升系统性能的技术效果,进而解决了由于不同任务的标注数据不同难以直接混合使用导致系统处理任务的性能不佳的技术问题。To sum up, in the sentence identification method provided by the embodiment of the present invention, the to-be-processed sentence is obtained through the first obtaining unit 401; the first processing unit 402 inputs the to-be-processed sentence into the target encoder, and processes the to-be-processed sentence to obtain the to-be-processed sentence The semantic representation of , wherein, the target encoder is an encoder shared by the grammatical error detection task and the grammatical error correction task; the second processing unit 403 inputs the semantic representation of the statement to be processed into the processing model, and obtains the processing result, Wherein, the processing result includes one of the following: a grammatical error detection result and a grammatical error error correction result, achieving an encoder shared by a grammatical error detection task and a grammatical error error correction task, so that heterogeneous data can be obtained from each other. Therefore, the technical effect of improving the performance of the system is realized, and the technical problem of poor performance of the system processing tasks due to the difficulty of direct mixed use of the labeled data of different tasks is solved.
可选地,在本发明实施例提供的语句鉴定装置中,该装置还包括:第二获取单元,用于在将所述待处理语句输入至目标编码器,处理得到所述待处理语句的语义表示之前,获取多个已被标注的语句,其中,所述多个已被标注的语句包括:已被标注语法错误的第一类语句和已被纠错语法错误的第二类语句;第三处理单元,用于将所述第一类语句输入至所述目标编码器,处理得到所述第一类语句的语义表示,将所述第二类语句输入至所述目标编码器,处理得到所述第二类语句的语义表示,第三获取单元,用于将所述第一类语句的语义表示输入至语法错误检测子模型,得到所述第一类语句的语法错误检测结果,将所述第二类语句的语义表示输入至目标解码器,得到所述第二类语句的语法错误纠错结果;对比单元,用于将所述第一类语句的语法错误检测结果与已被标注语法错误进行比对,得到第一比对结果,将所述第二类语句的语法错误纠错结果与已被纠错语法错误进行比对,得到第二比对结果;第一调整单元,用于根据所述第一比对结果和所述第二比对结果,调整所述目标编码器的参数。Optionally, in the sentence identification device provided in the embodiment of the present invention, the device further includes: a second obtaining unit, configured to input the to-be-processed sentence into a target encoder, and process to obtain the semantics of the to-be-processed sentence Before the expression, obtain a plurality of marked sentences, wherein the plurality of marked sentences include: the first type of sentences marked with grammatical errors and the second type of sentences with grammatical errors corrected; the third The processing unit is configured to input the sentence of the first type into the target encoder, process to obtain the semantic representation of the sentence of the first type, input the sentence of the second type to the target encoder, and obtain the the semantic representation of the sentence of the second type, and a third acquisition unit, configured to input the semantic representation of the sentence of the first type into the grammatical error detection sub-model, obtain the grammatical error detection result of the sentence of the first type, The semantic representation of the sentence of the second type is input to the target decoder to obtain the grammatical error correction result of the sentence of the second type; the comparison unit is used to compare the grammatical error detection result of the sentence of the first type with the marked grammatical error Carry out comparison, obtain the first comparison result, and compare the grammatical error correction result of the second type of statement with the grammatical error that has been corrected to obtain the second comparison result; the first adjustment unit is used for according to The first comparison result and the second comparison result adjust the parameters of the target encoder.
可选地,在本发明实施例提供的语句鉴定装置中,所述装置还包括:第二调整单元,用于根据所述第一比对结果调整所述语法错误检测子模型的参数;第三调整单元,用于根据所述第二比对结果调整所述目标解码器的参数。Optionally, in the sentence identification device provided by the embodiment of the present invention, the device further includes: a second adjustment unit, configured to adjust the parameters of the grammatical error detection sub-model according to the first comparison result; a third An adjustment unit, configured to adjust the parameters of the target decoder according to the second comparison result.
可选地,在本发明实施例提供的语句鉴定装置中,所述第一调整单元包括:第一计算模块,用于根据所述第一比对结果和交叉熵损失函数计算第一损失值,根据所述第二比对结果和所述交叉熵损失函数计算第二损失值;第二计算模块,用于将所述第一损失值通过反向传播算法计算待调整的第一参数,将所述第二损失值通过所述反向传播算法计算待调整的第二参数;调整模块,用于根据所述第一参数和所述第二参数,调整所述目标编码器的参数。Optionally, in the sentence identification device provided in the embodiment of the present invention, the first adjustment unit includes: a first calculation module, configured to calculate a first loss value according to the first comparison result and a cross-entropy loss function, Calculate the second loss value according to the second comparison result and the cross-entropy loss function; the second calculation module is configured to calculate the first parameter to be adjusted by using the back-propagation algorithm to calculate the first loss value, The second loss value is calculated by the back-propagation algorithm to calculate the second parameter to be adjusted; the adjustment module is configured to adjust the parameter of the target encoder according to the first parameter and the second parameter.
可选地,在本发明实施例提供的语句鉴定装置中,所述调整模块包括:确定子模块,用于确定所述语法错误检测任务的第一权重值和所述语法错误纠错任务的第二权重值;调整子模块,用于根据所述第一参数、所述第一权重值、所述第二参数和所述第二权重值,调整所述目标编码器的参数。Optionally, in the sentence identification device provided by the embodiment of the present invention, the adjustment module includes: a determination sub-module, configured to determine the first weight value of the grammatical error detection task and the first weight of the grammatical error error correction task. Two weight values; an adjustment sub-module, configured to adjust the parameters of the target encoder according to the first parameter, the first weight value, the second parameter and the second weight value.
可选地,在本发明实施例提供的语句鉴定装置中,所述目标编码器为多层Bi-LSTM编码器,所述目标解码器为多层Bi-LSTM解码器。Optionally, in the sentence identification device provided by the embodiment of the present invention, the target encoder is a multi-layer Bi-LSTM encoder, and the target decoder is a multi-layer Bi-LSTM decoder.
可选地,在本发明实施例提供的语句鉴定装置中,若所述待处理语句为待进行语法错误检测的语句,则所述处理模型为语法错误检测子模型,若所述待处理语句为待进行语法错误纠错的语句,则所述处理模型为多层Bi-LSTM解码器。Optionally, in the statement identification device provided by the embodiment of the present invention, if the to-be-processed statement is a statement to be subjected to grammatical error detection, the processing model is a grammatical error detection sub-model, and if the to-be-processed statement is For sentences to be corrected for syntax errors, the processing model is a multi-layer Bi-LSTM decoder.
此处需要说明的是,上述的第一获取单元401、第一处理单元402和第二处理单元403对应于实施例1中的步骤S201,步骤S202至步骤S203,两个模块与对应的步骤所实现的实例和应用场景相同,但不限于上述实施例一所公开的内容。需要说明的是,上述模块作为装置的一部分可以运行在实施例一提供的计算机终端10中。It should be noted here that the above-mentioned first acquisition unit 401, first processing unit 402 and second processing unit 403 correspond to step S201, steps S202 to S203 in
实施例3Example 3
本发明的实施例可以提供一种计算机终端,该计算机终端可以是计算机终端群中的任意一个计算机终端设备。可选地,在本实施例中,上述计算机终端也可以替换为移动终端等终端设备。Embodiments of the present invention may provide a computer terminal, and the computer terminal may be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the above-mentioned computer terminal may also be replaced by a terminal device such as a mobile terminal.
可选地,在本实施例中,上述计算机终端可以位于计算机网络的多个网络设备中的至少一个网络设备。Optionally, in this embodiment, the above-mentioned computer terminal may be located in at least one network device among multiple network devices of a computer network.
在本实施例中,上述计算机终端可以执行应用程序的语句鉴定方法中以下步骤的程序代码:获取待处理语句;将待处理语句输入至目标编码器,处理得到待处理语句的语义表示,其中,目标编码器为语法错误检测任务和语法错误纠错任务共享的编码器;将待处理语句的语义表示输入至处理模型,得到处理结果,其中,处理结果包括以下之一:语法错误检测结果、语法错误纠错结果。In this embodiment, the above-mentioned computer terminal can execute the program code of the following steps in the statement identification method of the application program: obtaining the statement to be processed; inputting the statement to be processed into the target encoder, and processing to obtain the semantic representation of the statement to be processed, wherein, The target encoder is an encoder shared by the grammatical error detection task and the grammatical error error correction task; the semantic representation of the sentence to be processed is input into the processing model, and the processing result is obtained, wherein the processing result includes one of the following: grammatical error detection result, grammar Error correction result.
上述计算机终端还可以执行应用程序的语句鉴定方法中以下步骤的程序代码:该方法还包括:在将待处理语句输入至目标编码器,处理得到待处理语句的语义表示之前,获取多个已被标注的语句,其中,多个已被标注的语句包括:已被标注语法错误的第一类语句和已被纠错语法错误的第二类语句;将第一类语句输入至目标编码器,处理得到第一类语句的语义表示,将第二类语句输入至目标编码器,处理得到第二类语句的语义表示,将第一类语句的语义表示输入至语法错误检测子模型,得到第一类语句的语法错误检测结果,将第二类语句的语义表示输入至目标解码器,得到第二类语句的语法错误纠错结果;将第一类语句的语法错误检测结果与已被标注语法错误进行比对,得到第一比对结果,将第二类语句的语法错误纠错结果与已被纠错语法错误进行比对,得到第二比对结果;根据第一比对结果和第二比对结果,调整目标编码器的参数。The above-mentioned computer terminal can also execute the program code of the following steps in the statement identification method of the application program: the method further includes: before inputting the statement to be processed into the target encoder, and processing to obtain the semantic representation of the statement to be processed, acquiring a plurality of Annotated sentences, wherein the multiple annotated sentences include: a first-type sentence that has been marked with grammatical errors and a second-type sentence that has been corrected for grammatical errors; input the first-type sentences to the target encoder, and process Obtain the semantic representation of the first type of sentence, input the second type of sentence into the target encoder, process to obtain the semantic representation of the second type of sentence, input the semantic representation of the first type of sentence into the syntax error detection sub-model, and obtain the first type of sentence. The grammatical error detection result of the sentence, input the semantic representation of the second type sentence to the target decoder, and obtain the grammatical error correction result of the second type sentence; compare the grammatical error detection result of the first type sentence with the marked grammatical error Compare, obtain the first comparison result, compare the grammatical error correction result of the second type of sentence with the grammatical error that has been corrected, and obtain the second comparison result; according to the first comparison result and the second comparison As a result, the parameters of the target encoder are adjusted.
上述计算机终端还可以执行应用程序的语句鉴定方法中以下步骤的程序代码:该方法还包括:根据第一比对结果调整语法错误检测子模型的参数;根据第二比对结果调整目标解码器的参数。The above-mentioned computer terminal can also execute the program code of the following steps in the statement identification method of the application program: the method further comprises: adjusting the parameters of the syntax error detection sub-model according to the first comparison result; adjusting the parameters of the target decoder according to the second comparison result; parameter.
上述计算机终端还可以执行应用程序的语句鉴定方法中以下步骤的程序代码:根据第一比对结果和第二比对结果,调整目标编码器的参数包括:根据第一比对结果和交叉熵损失函数计算第一损失值;根据第二比对结果和交叉熵损失函数计算第二损失值;将第一损失值通过反向传播算法计算待调整的第一参数,将第二损失值通过反向传播算法计算待调整的第二参数;根据第一参数和第二参数,调整目标编码器的参数。The above-mentioned computer terminal can also execute the program code of the following steps in the statement identification method of the application program: according to the first comparison result and the second comparison result, adjusting the parameters of the target encoder includes: according to the first comparison result and the cross entropy loss The function calculates the first loss value; calculates the second loss value according to the second comparison result and the cross-entropy loss function; calculates the first parameter to be adjusted through the back propagation algorithm, and calculates the second loss value through the reverse propagation algorithm. The propagation algorithm calculates the second parameter to be adjusted; according to the first parameter and the second parameter, the parameter of the target encoder is adjusted.
上述计算机终端还可以执行应用程序的语句鉴定方法中以下步骤的程序代码:根据第一参数和第二参数,调整目标编码器的参数包括:确定语法错误检测任务的第一权重值和语法错误纠错任务的第二权重值;根据第一参数、第一权重值、第二参数和第二权重值,调整目标编码器的参数。The above-mentioned computer terminal can also execute the program code of the following steps in the statement identification method of the application program: according to the first parameter and the second parameter, adjusting the parameters of the target encoder includes: determining the first weight value of the grammatical error detection task and the grammatical error correction. The second weight value of the wrong task is adjusted; the parameters of the target encoder are adjusted according to the first parameter, the first weight value, the second parameter and the second weight value.
上述计算机终端还可以执行应用程序的语句鉴定方法中以下步骤的程序代码:目标编码器为多层Bi-LSTM编码器,目标解码器为多层Bi-LSTM解码器。The above-mentioned computer terminal can also execute the program code of the following steps in the sentence identification method of the application program: the target encoder is a multi-layer Bi-LSTM encoder, and the target decoder is a multi-layer Bi-LSTM decoder.
上述计算机终端还可以执行应用程序的语句鉴定方法中以下步骤的程序代码:若待处理语句为待进行语法错误检测的语句,则处理模型为语法错误检测子模型,若待处理语句为待进行语法错误纠错的语句,则处理模型为多层Bi-LSTM解码器。The above-mentioned computer terminal can also execute the program code of the following steps in the statement identification method of the application program: if the statement to be processed is a statement to be subjected to grammatical error detection, the processing model is a grammatical error detection submodel, and if the statement to be processed is a grammar to be performed For sentences with error correction, the processing model is a multi-layer Bi-LSTM decoder.
可选地,图5是根据本发明实施例的一种计算机终端的结构框图。如图5所示,该计算机终端A可以包括:一个或多个(图中仅示出一个)处理器和存储器。Optionally, FIG. 5 is a structural block diagram of a computer terminal according to an embodiment of the present invention. As shown in FIG. 5 , the computer terminal A may include: one or more (only one is shown in the figure) processors and memories.
其中,存储器可用于存储软件程序以及模块,如本发明实施例中的语句鉴定方法和装置对应的程序指令/模块,处理器通过运行存储在存储器内的软件程序以及模块,从而执行各种功能应用以及数据处理,即实现上述的语句鉴定方法。存储器可包括高速随机存储器,还可以包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器可进一步包括相对于处理器远程设置的存储器,这些远程存储器可以通过网络连接至终端A。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The memory can be used to store software programs and modules, such as program instructions/modules corresponding to the statement identification method and device in the embodiment of the present invention, and the processor executes various functional applications by running the software programs and modules stored in the memory. And data processing, that is, to realize the above sentence identification method. The memory may include high-speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory may further include memory located remotely from the processor, and these remote memories may be connected to Terminal A through a network. Examples of such networks include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
处理器可以通过传输装置调用存储器存储的信息及应用程序,以执行下述步骤:获取待处理语句;将待处理语句输入至目标编码器,处理得到待处理语句的语义表示,其中,目标编码器为语法错误检测任务和语法错误纠错任务共享的编码器;将待处理语句的语义表示输入至处理模型,得到处理结果,其中,处理结果包括以下之一:语法错误检测结果、语法错误纠错结果。The processor can call the information and application program stored in the memory through the transmission device to perform the following steps: acquiring the statement to be processed; inputting the statement to be processed into the target encoder, and processing to obtain the semantic representation of the statement to be processed, wherein the target encoder It is an encoder shared by the grammatical error detection task and the grammatical error error correction task; the semantic representation of the sentence to be processed is input into the processing model, and the processing result is obtained, wherein the processing result includes one of the following: grammatical error detection result, grammatical error error correction result.
可选的,上述处理器还可以执行如下步骤的程序代码:该方法还包括:在将待处理语句输入至目标编码器,处理得到待处理语句的语义表示之前,获取多个已被标注的语句,其中,多个已被标注的语句包括:已被标注语法错误的第一类语句和已被纠错语法错误的第二类语句;将第一类语句输入至目标编码器,处理得到第一类语句的语义表示,将第二类语句输入至目标编码器,处理得到第二类语句的语义表示,将第一类语句的语义表示输入至语法错误检测子模型,得到第一类语句的语法错误检测结果,将第二类语句的语义表示输入至目标解码器,得到第二类语句的语法错误纠错结果;将第一类语句的语法错误检测结果与已被标注语法错误进行比对,得到第一比对结果,将第二类语句的语法错误纠错结果与已被纠错语法错误进行比对,得到第二比对结果;根据第一比对结果和第二比对结果,调整目标编码器的参数。Optionally, the above-mentioned processor may also execute the program code of the following steps: the method further includes: before inputting the statement to be processed into the target encoder and processing to obtain the semantic representation of the statement to be processed, acquiring a plurality of marked statements , wherein the multiple marked sentences include: the first type of sentences that have been marked with grammatical errors and the second type of sentences that have been corrected for grammatical errors; the first type of sentences are input into the target encoder, and the first Semantic representation of class sentences, input the second class of sentences to the target encoder, process to obtain the semantic representation of the second class of sentences, input the semantic representation of the first class of sentences to the syntax error detection sub-model, and obtain the grammar of the first class of sentences Error detection results, input the semantic representation of the second type of sentences to the target decoder, and obtain the grammatical error correction results of the second type of sentences; compare the grammatical error detection results of the first type of sentences with the marked grammatical errors, Obtain the first comparison result, compare the grammatical error correction result of the second type of sentence with the grammatical error that has been corrected, and obtain the second comparison result; according to the first comparison result and the second comparison result, adjust Parameters for the target encoder.
可选的,上述处理器还可以执行如下步骤的程序代码:该方法还包括:根据第一比对结果调整语法错误检测子模型的参数;根据第二比对结果调整目标解码器的参数。Optionally, the above processor may further execute the program code of the following steps: the method further includes: adjusting the parameters of the syntax error detection sub-model according to the first comparison result; and adjusting the parameters of the target decoder according to the second comparison result.
可选的,上述处理器还可以执行如下步骤的程序代码:根据第一比对结果和第二比对结果,调整目标编码器的参数包括:根据第一比对结果和交叉熵损失函数计算第一损失值;根据第二比对结果和交叉熵损失函数计算第二损失值;将第一损失值通过反向传播算法计算待调整的第一参数,将第二损失值通过反向传播算法计算待调整的第二参数;根据第一参数和第二参数,调整目标编码器的参数。Optionally, the above-mentioned processor may also execute the program code of the following steps: according to the first comparison result and the second comparison result, adjusting the parameters of the target encoder includes: calculating the first comparison result and the cross entropy loss function according to the first comparison result. a loss value; calculate the second loss value according to the second comparison result and the cross-entropy loss function; calculate the first parameter to be adjusted by the back-propagation algorithm, and calculate the second loss value by the back-propagation algorithm The second parameter to be adjusted; adjust the parameters of the target encoder according to the first parameter and the second parameter.
可选的,上述处理器还可以执行如下步骤的程序代码:根据第一参数和第二参数,调整目标编码器的参数包括:确定语法错误检测任务的第一权重值和语法错误纠错任务的第二权重值;根据第一参数、第一权重值、第二参数和第二权重值,调整目标编码器的参数。Optionally, the above-mentioned processor can also execute the program code of the following steps: according to the first parameter and the second parameter, adjusting the parameters of the target encoder includes: determining the first weight value of the grammatical error detection task and the grammatical error correction task. The second weight value; according to the first parameter, the first weight value, the second parameter and the second weight value, the parameters of the target encoder are adjusted.
可选的,上述处理器还可以执行如下步骤的程序代码:目标编码器为多层Bi-LSTM编码器,目标解码器为多层Bi-LSTM解码器。Optionally, the above processor may also execute the program code of the following steps: the target encoder is a multi-layer Bi-LSTM encoder, and the target decoder is a multi-layer Bi-LSTM decoder.
可选的,上述处理器还可以执行如下步骤的程序代码:若待处理语句为待进行语法错误检测的语句,则处理模型为语法错误检测子模型,若待处理语句为待进行语法错误纠错的语句,则处理模型为多层Bi-LSTM解码器。Optionally, the above processor may also execute the program code of the following steps: if the statement to be processed is a statement to be subjected to grammatical error detection, the processing model is a grammatical error detection sub-model, and if the statement to be processed is a grammatical error correction to be performed sentence, the processing model is a multi-layer Bi-LSTM decoder.
采用本发明实施例,提供了一种语句鉴定的方案,通过获取待处理语句;将待处理语句输入至目标编码器,处理得到待处理语句的语义表示,其中,目标编码器为语法错误检测任务和语法错误纠错任务共享的编码器;将待处理语句的语义表示输入至处理模型,得到处理结果,其中,处理结果包括以下之一:语法错误检测结果、语法错误纠错结果,达到了通过语法错误检测任务和语法错误纠错任务共享的编码器,使得异质的数据能够相互得到另一方的信息,从而实现了提升系统性能的技术效果,进而解决了由于不同任务的标注数据不同难以直接混合使用导致系统处理任务的性能不佳的技术问题。The embodiment of the present invention provides a statement identification solution, by acquiring the statement to be processed; inputting the statement to be processed into a target encoder, and processing to obtain the semantic representation of the statement to be processed, wherein the target encoder is a grammatical error detection task The encoder shared with the grammatical error correction task; the semantic representation of the sentence to be processed is input into the processing model, and the processing result is obtained, wherein the processing result includes one of the following: the grammatical error detection result, the grammatical error error correction result, and the achievement of passing The shared encoder between the grammatical error detection task and the grammatical error error correction task enables heterogeneous data to obtain information from the other party, thereby achieving the technical effect of improving system performance, and solving the problem of difficulty in directing direct data due to different labeling data for different tasks. Mixed use of technical issues that lead to poor performance of the system processing tasks.
本领域普通技术人员可以理解,图5所示的结构仅为示意,计算机终端也可以是智能手机(如Android手机、iOS手机等)、平板电脑、掌声电脑以及移动互联网设备(Mobi leInternet Devices,MID)、PAD等终端设备。图5其并不对上述电子装置的结构造成限定。例如,计算机终端10还可包括比图5中所示更多或者更少的组件(如网络接口、显示装置等),或者具有与图5所示不同的配置。Those of ordinary skill in the art can understand that the structure shown in FIG. 5 is only a schematic diagram, and the computer terminal can also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, an applause computer, and a mobile internet device (Mobile Internet Devices, MID). ), PAD and other terminal equipment. FIG. 5 does not limit the structure of the above electronic device. For example, the computer terminal 10 may also include more or fewer components than those shown in FIG. 5 (eg, network interfaces, display devices, etc.), or have a different configuration than that shown in FIG. 5 .
本领域普通技术人员可以理解上述实施例的各种方法中的全部或部分步骤是可以通过程序来指令终端设备相关的硬件来完成,该程序可以存储于一计算机可读存储介质中,存储介质可以包括:闪存盘、只读存储器(Read-Only Memory,ROM)、随机存取器(RandomAccess Memory,RAM)、磁盘或光盘等。Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium can Including: flash disk, read-only memory (Read-Only Memory, ROM), random access device (RandomAccess Memory, RAM), magnetic disk or optical disk, etc.
实施例4Example 4
本发明的实施例还提供了一种存储介质。可选地,在本实施例中,上述存储介质可以用于保存上述实施例一所提供的语句鉴定方法所执行的程序代码。Embodiments of the present invention also provide a storage medium. Optionally, in this embodiment, the above-mentioned storage medium may be used to store the program code executed by the statement identification method provided in the above-mentioned first embodiment.
可选地,在本实施例中,上述存储介质可以位于计算机网络中计算机终端群中的任意一个计算机终端中,或者位于移动终端群中的任意一个移动终端中。Optionally, in this embodiment, the above-mentioned storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:获取待处理语句;将待处理语句输入至目标编码器,处理得到待处理语句的语义表示,其中,目标编码器为语法错误检测任务和语法错误纠错任务共享的编码器;将待处理语句的语义表示输入至处理模型,得到处理结果,其中,处理结果包括以下之一:语法错误检测结果、语法错误纠错结果。Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps: acquiring the statement to be processed; inputting the statement to be processed into the target encoder, and processing to obtain the semantic representation of the statement to be processed, wherein , the target encoder is an encoder shared by the grammatical error detection task and the grammatical error error correction task; the semantic representation of the sentence to be processed is input into the processing model, and the processing result is obtained, wherein the processing result includes one of the following: grammatical error detection result, Syntax error correction result.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:该方法还包括:在将待处理语句输入至目标编码器,处理得到待处理语句的语义表示之前,获取多个已被标注的语句,其中,多个已被标注的语句包括:已被标注语法错误的第一类语句和已被纠错语法错误的第二类语句;将第一类语句输入至目标编码器,处理得到第一类语句的语义表示,将第二类语句输入至目标编码器,处理得到第二类语句的语义表示,将第一类语句的语义表示输入至语法错误检测子模型,得到第一类语句的语法错误检测结果,将第二类语句的语义表示输入至目标解码器,得到第二类语句的语法错误纠错结果;将第一类语句的语法错误检测结果与已被标注语法错误进行比对,得到第一比对结果,将第二类语句的语法错误纠错结果与已被纠错语法错误进行比对,得到第二比对结果;根据第一比对结果和第二比对结果,调整目标编码器的参数。Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps: the method further includes: before inputting the to-be-processed statement into the target encoder and processing to obtain the semantic representation of the to-be-processed statement , to obtain a plurality of marked sentences, wherein the plurality of marked sentences include: the first type of sentences that have been marked with grammatical errors and the second type of sentences that have been corrected for grammatical errors; input the first type of sentences To the target encoder, processing to obtain the semantic representation of the first type of sentence, inputting the second type of sentence to the target encoder, processing to obtain the semantic representation of the second type of sentence, and inputting the semantic representation of the first type of sentence to the syntax error detector. model, obtain the grammatical error detection results of the first type of sentences, input the semantic representation of the second type of sentences to the target decoder, and obtain the grammatical error correction results of the second type of sentences; compare the grammatical error detection results of the first type of sentences with The grammatical errors that have been marked are compared to obtain the first comparison result, and the grammatical error correction results of the second type of sentences are compared with the grammatical errors that have been corrected to obtain the second comparison result; according to the first comparison The result is compared with the second result, and the parameters of the target encoder are adjusted.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:该方法还包括:根据第一比对结果调整语法错误检测子模型的参数;根据第二比对结果调整目标解码器的参数。Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps: the method further includes: adjusting the parameters of the syntax error detection sub-model according to the first comparison result; according to the second comparison The result adjusts the parameters of the target decoder.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:根据第一比对结果和第二比对结果,调整目标编码器的参数包括:根据第一比对结果和交叉熵损失函数计算第一损失值;根据第二比对结果和交叉熵损失函数计算第二损失值;将第一损失值通过反向传播算法计算待调整的第一参数,将第二损失值通过反向传播算法计算待调整的第二参数;根据第一参数和第二参数,调整目标编码器的参数。Optionally, in this embodiment, the storage medium is configured to store program codes for performing the following steps: according to the first comparison result and the second comparison result, adjusting the parameters of the target encoder includes: according to the first comparison result Calculate the first loss value according to the result and the cross-entropy loss function; calculate the second loss value according to the second comparison result and the cross-entropy loss function; calculate the first loss value through the back-propagation algorithm to calculate the first parameter to be adjusted, The second loss value is calculated by the back-propagation algorithm to calculate the second parameter to be adjusted; according to the first parameter and the second parameter, the parameter of the target encoder is adjusted.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:根据第一参数和第二参数,调整目标编码器的参数包括:确定语法错误检测任务的第一权重值和语法错误纠错任务的第二权重值;根据第一参数、第一权重值、第二参数和第二权重值,调整目标编码器的参数。Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps: according to the first parameter and the second parameter, adjusting the parameters of the target encoder includes: determining the first parameter of the syntax error detection task The weight value and the second weight value of the syntax error correction task; according to the first parameter, the first weight value, the second parameter and the second weight value, the parameters of the target encoder are adjusted.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:目标编码器为多层Bi-LSTM编码器,目标解码器为多层Bi-LSTM解码器。Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps: the target encoder is a multi-layer Bi-LSTM encoder, and the target decoder is a multi-layer Bi-LSTM decoder.
可选地,在本实施例中,存储介质被设置为存储用于执行以下步骤的程序代码:若待处理语句为待进行语法错误检测的语句,则处理模型为语法错误检测子模型,若待处理语句为待进行语法错误纠错的语句,则处理模型为多层Bi-LSTM解码器。Optionally, in this embodiment, the storage medium is configured to store program codes for executing the following steps: if the statement to be processed is a statement to be subjected to syntax error detection, the processing model is a syntax error detection sub-model; The processing sentence is a sentence to be corrected for syntax errors, and the processing model is a multi-layer Bi-LSTM decoder.
上述本发明实施例序号仅仅为了描述,不代表实施例的优劣。The above-mentioned serial numbers of the embodiments of the present invention are only for description, and do not represent the advantages or disadvantages of the embodiments.
在本发明的上述实施例中,对各个实施例的描述都各有侧重,某个实施例中没有详述的部分,可以参见其他实施例的相关描述。In the above-mentioned embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
在本申请所提供的几个实施例中,应该理解到,所揭露的技术内容,可通过其它的方式实现。其中,以上所描述的装置实施例仅仅是示意性的,例如所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,单元或模块的间接耦合或通信连接,可以是电性或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. The device embodiments described above are only illustrative, for example, the division of the units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components may be combined or Integration into another system, or some features can be ignored, or not implemented. On the other hand, the shown or discussed mutual coupling or direct coupling or communication connection may be through some interfaces, indirect coupling or communication connection of units or modules, and may be in electrical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit. The above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可为个人计算机、服务器或者网络设备等)执行本发明各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、移动硬盘、磁碟或者光盘等各种可以存储程序代码的介质。The integrated unit, if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes .
以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本发明的保护范围。The above are only the preferred embodiments of the present invention. It should be pointed out that for those skilled in the art, without departing from the principles of the present invention, several improvements and modifications can be made. It should be regarded as the protection scope of the present invention.
Claims (14)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910390785.0A CN111914540B (en) | 2019-05-10 | 2019-05-10 | Sentence identification method and device, storage medium and processor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910390785.0A CN111914540B (en) | 2019-05-10 | 2019-05-10 | Sentence identification method and device, storage medium and processor |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111914540A true CN111914540A (en) | 2020-11-10 |
CN111914540B CN111914540B (en) | 2024-12-10 |
Family
ID=73242930
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910390785.0A Active CN111914540B (en) | 2019-05-10 | 2019-05-10 | Sentence identification method and device, storage medium and processor |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111914540B (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113822044A (en) * | 2021-09-29 | 2021-12-21 | 深圳市木愚科技有限公司 | Grammar error correction data generating method, device, computer equipment and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1269923A (en) * | 1997-02-07 | 2000-10-11 | 诺基亚流动电话有限公司 | Information coding method and device using error correction and error detection |
WO2013191662A1 (en) * | 2012-06-22 | 2013-12-27 | National University Of Singapore | Method for correcting grammatical errors of an input sentence |
WO2014025135A1 (en) * | 2012-08-10 | 2014-02-13 | 에스케이텔레콤 주식회사 | Method for detecting grammatical errors, error detecting apparatus for same, and computer-readable recording medium having the method recorded thereon |
CN109243433A (en) * | 2018-11-06 | 2019-01-18 | 北京百度网讯科技有限公司 | Audio recognition method and device |
WO2019024050A1 (en) * | 2017-08-03 | 2019-02-07 | Lingochamp Information Technology (Shanghai) Co., Ltd. | Deep context-based grammatical error correction using artificial neural networks |
CN109461438A (en) * | 2018-12-19 | 2019-03-12 | 合肥讯飞数码科技有限公司 | A kind of audio recognition method, device, equipment and storage medium |
-
2019
- 2019-05-10 CN CN201910390785.0A patent/CN111914540B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1269923A (en) * | 1997-02-07 | 2000-10-11 | 诺基亚流动电话有限公司 | Information coding method and device using error correction and error detection |
WO2013191662A1 (en) * | 2012-06-22 | 2013-12-27 | National University Of Singapore | Method for correcting grammatical errors of an input sentence |
WO2014025135A1 (en) * | 2012-08-10 | 2014-02-13 | 에스케이텔레콤 주식회사 | Method for detecting grammatical errors, error detecting apparatus for same, and computer-readable recording medium having the method recorded thereon |
WO2019024050A1 (en) * | 2017-08-03 | 2019-02-07 | Lingochamp Information Technology (Shanghai) Co., Ltd. | Deep context-based grammatical error correction using artificial neural networks |
CN109243433A (en) * | 2018-11-06 | 2019-01-18 | 北京百度网讯科技有限公司 | Audio recognition method and device |
CN109461438A (en) * | 2018-12-19 | 2019-03-12 | 合肥讯飞数码科技有限公司 | A kind of audio recognition method, device, equipment and storage medium |
Non-Patent Citations (2)
Title |
---|
CHEN LI ET AL: "A Hybrid System for Chinese Grammatical Error Diagnosis and Correction", 《PROCEEDINGS OF THE 5TH WORKSHOP ON NATURAL LANGUAGE PROCESSING TECHNIQUES FOR EDUCATIONAL APPLICATIONS》, 19 July 2018 (2018-07-19) * |
陈珊珊: "自动作文评分模型及方法研究", 《中国优秀硕士学位论文全文数据库》, 15 February 2018 (2018-02-15) * |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113822044A (en) * | 2021-09-29 | 2021-12-21 | 深圳市木愚科技有限公司 | Grammar error correction data generating method, device, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN111914540B (en) | 2024-12-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107291867B (en) | Dialog processing method, device and equipment based on artificial intelligence and computer readable storage medium | |
CN107463601B (en) | Dialog understanding system construction method, device and equipment based on artificial intelligence and computer readable storage medium | |
CN112597754A (en) | Text error correction method and device, electronic equipment and readable storage medium | |
US20210216913A1 (en) | Prediction method, apparatus, and system for performing an image search | |
CN111523305A (en) | Text error correction method, device and system | |
CN111310440A (en) | Text error correction method, device and system | |
CN107705034A (en) | Mass-rent platform implementation method and device, storage medium and electronic equipment | |
CN110969327B (en) | Work order dispatching method, device, system and data processing method | |
CN108388549B (en) | Information conversion method, information conversion device, storage medium and electronic device | |
CN111159379B (en) | A method, device and system for automatically generating questions | |
CN111914540A (en) | Statement identification method and device, storage medium and processor | |
CN112447168A (en) | Voice recognition system and method, sound box, display device and interaction platform | |
CN110929866A (en) | Training method, device and system of neural network model | |
CN111625628B (en) | Information processing method and device, storage medium and processor | |
CN115905497B (en) | Method, device, electronic equipment and storage medium for determining reply sentence | |
CN112396444A (en) | Intelligent robot response method and device | |
CN110837562A (en) | Case processing method, device and system | |
CN113722466B (en) | Correction model training method, correction method, apparatus, electronic equipment and medium | |
CN111144973B (en) | Question ranking method and computer-readable storage medium | |
CN111435418A (en) | Robot personalized object identification method and device, storage medium and robot | |
CN114936561B (en) | Speech text processing method and device, storage medium and processor | |
CN118690877B (en) | Natural language model generation method and data processing method | |
CN111523952B (en) | Information extraction method and device, storage medium and processor | |
CN110096255B (en) | Rule degradation processing method, device and system and data processing method | |
CN116089571A (en) | Data labeling method, device and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |