A proofreading method and device for characteristic speech

By building an AC automaton and using Ngram segmentation and similarity calculation, the problem of semantic inaccuracy in characteristic discourse proofreading is solved, and efficient and accurate proofreading results are achieved, which is suitable for proofreading scenarios of long-word discourse.

CN118428354BActive Publication Date: 2024-10-22NANJING DAHAN NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410867895.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-01
Publication Date
2024-10-22
Estimated Expiration
2044-07-01

AI Technical Summary

Technical Problem

It is difficult to effectively proofread featured utterances with existing technology, especially because they are long and may involve inaccuracies in semantics or stance. Traditional thesaurus and deep learning methods cannot meet the needs when generating incorrect words, and training data is a big challenge.

Method used

By building an AC automaton, we collect and segment featured utterances, use Ngram to segment fragments and associate them with complete sentences, match and merge fragments to calculate similarity and confusion, and only retain proofreading results with low confusion to achieve proofreading.

Benefits of technology

It improves the accuracy and efficiency of featured discourse proofreading, and is especially suitable for proofreading long words. The efficiency is increased by up to 120 times. It is basically not affected by the number of featured discourses and is suitable for rigorous scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118428354B_ABST
    Figure CN118428354B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and device for proofreading characteristic discourses. The method comprises the following steps: constructing an AC automaton: collecting all characteristic discourses with three characters or more, segmenting the characteristic discourses into segments by Ngram, associating the characteristic discourses with the segmented segments, and putting the characteristic discourses and the segmented segments into the AC automaton to form a characteristic discourse AC automaton; text proofreading: inputting a text to be proofread, excluding correct characteristic discourses, segmenting the remaining contents, matching a segment SUB containing the characteristic discourse, merging all SUBs in sequence, calculating the similarity with the corresponding FULL, calculating the similarity trend, using the trend to use the merged SUB as a suspected error MayErr_SUB, calculating the perplexity of the original content of MayErr_SUB and the perplexity of the replaced content, and retaining the one with the lower perplexity as the proofreading result.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of automatic text proofreading, and in particular relates to a proofreading method and device for characteristic speech. Background Art

[0002] Many existing document proofreading methods use a word library, where the word library contains a comparison of incorrect words and correct words. This method can help users detect and correct spelling and grammatical errors to a certain extent. However, there are some challenges in proofreading special words.

[0003] Characteristic utterances may be long, including phrases, short sentences, and professional terms, which makes it difficult to exhaustively list normal input errors, because errors in characteristic utterances may appear in many ways. Errors in characteristic utterances are not limited to spelling and grammar, but may also involve inaccuracies in semantics or stance. Traditional word banks are difficult to effectively deal with these problems.

[0004] For example: "High-value patents" transformation and application, "100 questions" on trademark registration. This is a special phrase. When this sentence appears in the article, it must be exactly the same as this sentence. The order cannot be reversed, the content cannot be added, and the punctuation marks cannot be changed.

[0005] Among the existing proofreading methods, some research institutions have tried to use data augmentation to generate incorrect words to increase the coverage of the vocabulary. However, due to the particularity of special discourse, the incorrect words generated by this data augmentation method usually do not conform to the errors caused by normal input, and therefore are not sufficient to meet the needs of special discourse proofreading.

[0006] In addition, some research institutions have tried to solve the proofreading problem through deep learning methods. They usually use a seq2seq model to generate another sentence based on one sentence. The data for training the model is one line of data, and two sentences in a line are separated by a tab. The left side is the wrong sentence and the right side is the correct sentence. The final result will ensure that most of the original sentence remains unchanged, and only part of the content is changed (replacement, addition, reduction, and exchange of text). Due to the uncontrollability and unexplainability of the generated results of the deep learning model, it is not suitable for scenes with very high rigor of characteristic discourse. In addition, in this method, training data is very important, and how to find appropriate and reasonable wrong sentences is also a big challenge.

[0007] Therefore, it is necessary to propose a proofreading method that is more suitable for characteristic discourse in order to solve the problems existing in the existing methods and improve the accuracy and comprehensiveness of proofreading. Summary of the invention

[0008] In view of the above technical problems, the present invention discloses a proofreading method and device for characteristic speech. Different from the previously mentioned method of collecting correct and incorrect word pairs or correct and incorrect sentence pairs, the proofreading of characteristic speech can be achieved by only collecting correct sentences.

[0009] To achieve the above object, the technical solution adopted by the present invention is: a method for proofreading characteristic speech, which specifically comprises the following steps:

[0010] Step 1, constructing an AC automaton: collect all characteristic utterances with three characters or more, segment the characteristic utterances into Ngram segments, associate the characteristic utterances with the segmented segments, and put the characteristic utterances and the segmented segments into an AC automaton to form a characteristic utterance AC automaton.

[0011] Step 2, text proofreading: pass in the text to be proofread, use the characteristic discourse AC automaton to find the correct characteristic discourse in the text, exclude proofreading, divide the remaining content into sentences, match the segment (SUB) containing the characteristic discourse through the characteristic discourse AC automaton, merge all the segments (SUB) in sequence, calculate the similarity with the corresponding complete characteristic discourse, calculate the similarity trend, and use the trend to take the merged segment (SUB) as a suspected error (MayErr_SUB), and use the perplexity to calculate the perplexity of the original content of the suspected error (MayErr_SUB) and the perplexity of the replaced content, and retain the one with the lowest perplexity as the proofreading result.

[0012] Furthermore, step 1 specifically includes the following steps:

[0013] Step 11, construct a corpus of characteristic discourse: collect the characteristic discourse list and put it into a txt text file, one characteristic discourse per line, and the length of the characteristic discourse must be greater than or equal to 3 words.

[0014] Step 12, build a special discourse AC automaton: AC automaton is generally used for sensitive word checking and accurate matching. Its advantage is fast speed. Therefore, the special discourse data set is passed into the AC automaton and marked as complete special discourse (FULL). It should be noted that if only the original sentence is passed in, the AC automaton can only find the original sentence, that is, it can only find the correct special discourse, but the wrong special discourse in the article cannot be found. At this time, we need to split the original sentence into Ngrams, put the fragments into the AC automaton and mark them as fragments (SUB). At the same time, SUB is associated with FULL so that the corresponding complete special discourse (FULL) can be found through the fragments (SUB). As a preferred method, according to experiments, the complete special discourse (FULL) is split into Ngram-3, Ngram-4, and Ngram-5. If there are wrong special discourses in the text to be proofread, the correct fragments of the special discourse can be found by matching the fragments (SUB), and then the corresponding complete special discourse (FULL) can be found.

[0015] Further, step 21, pre-proofreading processing: receiving the text to be proofread, matching all the complete characteristic discourse (FULL) content in the text through the characteristic discourse AC automaton and recording the position range, excluding this part of the content from proofreading. Using punctuation marks as delimiters, the remaining content is processed into sentences.

[0016] Step 22, proofreading sentence content: loop through all sentences and match the content of the segment (SUB) containing the characteristic speech through the characteristic speech AC automaton;

[0017] Find all the corresponding complete featured words (FULL) through the matched segments (SUB), and record all FULLs and the corresponding SUBs as well as the position (start, end) of the article where the SUBs are located. For example:

[0018] FULL_1: SUB1(start,end), SUB2(start,end), SUB3(start,end)……

[0019] FULL_2: SUB2(start,end), SUB8(start,end), SUB9(start,end)……

[0020] After all the sentences are traversed, all the recorded complete featured utterances (FULL) are traversed, all the segments (SUB) are merged in sequence, the similarity with the corresponding complete featured utterances is calculated, and the similarity trend is calculated. If the trend is found to be decreasing, the highest similarity merged segment (SUB) combination (such as SUB1+SUB2 combination) is considered to be the most likely featured utterance that made the mistake.

[0021] Furthermore, a threshold is set for the similarity between the merged SUB and the corresponding FULL. If the highest similarity score is greater than the threshold, it is considered to meet the recording conditions. All such merged segment (SUB) records are recorded as suspected errors MayErr_SUB, and the relevant complete featured speech (FULL) and its similarity are recorded.

[0022] For example: MayErr_SUB1: FULL_1, similarity: 0.8;

[0023] MayErr_SUB2: FULL_2, similarity: 0.82;

[0024] MayErr_SUB3: FULL_4, similarity: 0.86;

[0025] MayErr_SUB1: FULL_5, similarity: 0.8;

[0026] Furthermore, since the featured utterances contain some punctuation marks, the punctuation marks of the separators are limited to period, exclamation mark, comma, question mark, horizontal tab, line feed, and carriage return.

[0027] Furthermore, the similarity is calculated using the edit distance method similarity = distance(content(SUB-X_start, SUB-Y_end), FULL), where content is the original text, SUB-X is the first SUB, and SUB-Y is a subsequent SUB.

[0028] For example:

[0029] SUB1 ->Similarity:0.2

distance(content(SUB1_start, SUB1_end), FULL_1)

[0030] SUB1 + SUB2 ->Similarity:0.6

distance(content (SUB1_start, SUB2_end),FULL_1)

[0031] SUB1 + SUB2 + SUB3 ->Similarity:0.8

distance(content (SUB1_start,SUB3_end), FULL_1)

[0032] SUB1 + SUB2 + SUB3 + SUB4 ->Similarity:0.5

distance(content (SUB1_start, SUB4_end), FULL_1)

[0033] Furthermore, the similarity threshold is set as follows: when the length of the complete characteristic speech (FULL) is greater than or equal to 5, the threshold is 0.8, when the length is equal to 4, it is 0.7, and when the length is equal to 3, it is 0.66.

[0034] Furthermore, the suspected errors MayErr_SUB are filtered again. If there is an inclusion relationship between the suspected errors, the larger range is retained. If there is a suspected error MayErr_SUB for multiple complete feature utterances (FULL), only the one with the largest similarity is retained. If the similarities are the same, the complete forms of different feature utterances are replaced with the text in the MayErr_SUB range in the original text to calculate the perplexity, and the one with the lowest perplexity is retained.

[0035] Furthermore, it also includes step 23, confirming the error result: looping through all suspected errors, first calculating the perplexity of the original error range for each suspected error, and then calculating the perplexity of replacing the complete characteristic speech (FULL) of the suspected error MayErr_SUB with the text in the MayErr_SUB range in the original text. If the perplexity of the original text is greater than the perplexity calculated after the replacement, it is considered that correction is required.

[0036] The present invention also defines a proofreading device for characteristic speech, comprising: a memory and a processor; the memory is used to store programs; the processor is used to execute the programs to implement the various steps of the proofreading method for characteristic speech as described above.

[0037] The present invention has the following beneficial effects:

[0038] 1. The characteristic speech itself is relatively long, and its usage scenario is usually in a specific field unit. It is impossible to collect common erroneous content on a large scale through the Internet. If traditional data enhancement is used, the error form cannot be controlled, and errors that are basically impossible to occur will be created. The present invention greatly improves the implementation efficiency by only collecting correct and complete characteristic speech sentences for recognition and proofreading.

[0039] 2. During the development of the present invention, many matching methods were tried, such as using full-text search tools such as lucene and es to assist fuzzy queries. The efficiency was acceptable when the number of distinctive words was small, but the search efficiency dropped sharply after reaching 8,000. The efficiency was improved by 120 times by proofreading 5 million articles through the slicing of the present invention combined with the AC automaton method, and it was basically not affected by the number of distinctive words, and the proofreading efficiency tended to be constant.

[0040] 3. The present invention has a higher proofreading accuracy rate for special speeches with long words, and is particularly suitable for proofreading quoted speeches, quoted slogans, quoted special speeches, etc. BRIEF DESCRIPTION OF THE DRAWINGS

[0041] Figure 1 A process of constructing an AC automaton for the proofreading method of the characteristic speech according to an embodiment of the present invention.

[0042] Figure 2 This is the text proofreading process of the proofreading method for the characteristic speech according to the embodiment of the present invention. DETAILED DESCRIPTION

[0043] To facilitate understanding by those skilled in the art, the present invention is further described below in conjunction with embodiments and drawings.

[0044] The proofreading method of the characteristic speech of this embodiment includes the following steps:

[0045] A. Construct a corpus of characteristic discourse. Collect a list of commonly used characteristic discourses and put them into a txt file, one term per line. The length of characteristic discourses must be greater than or equal to 3 characters.

[0046] B. Construct the characteristic discourse AC automaton, such as Figure 1 As shown. AC automata are generally used for sensitive word checking and accurate matching, and their advantage is fast speed. Therefore, we pass the characteristic discourse dataset into the AC automata and mark it as complete form (FULL). It should be noted that if only the original sentence is passed in, this AC automata can only find the original sentence, that is, it can only find the correct characteristic discourse, but the wrongly written (wrong characteristic discourse) in the article cannot be found. At this time, we need to perform Ngram segmentation on the characteristic discourse in the dataset, put the fragment into the AC automata and mark it as a fragment (SUB), and associate SUB with FULL so that the corresponding complete characteristic discourse (FULL) can be found through the fragment (SUB). Based on experience and experiments, we divide the characteristic discourse into Ngram-3, Ngram-4, and Ngram-5. If part of the characteristic discourse is written incorrectly, the correct characteristic discourse fragment can be matched based on the fragment.

[0047] like Figure 2 The proofreading process shown includes the following steps:

[0048] Pre-processing before proofreading:

[0049] After receiving the text to be proofread, the AC automaton of the characteristic discourse is used to match the content of all complete characteristic discourses (FULL) in the text and record the position range. This part of the content is excluded from proofreading.

[0050] The remaining content is divided into sentences using punctuation marks as separators. Since the characteristic discourse contains some punctuation marks, the punctuation marks involved in the segmentation after manual sorting are. ! ,? \t\n\r.

[0051] Proofread sentence content:

[0052] Loop through all sentences and match the content of the segment (SUB) containing the characteristic discourse through the characteristic discourse AC automaton;

[0053] Through the matched segment (SUB), find all the complete featured discourses (FULL) corresponding to the segment, and record all FULLs and the corresponding SUBs as well as the position (start, end) of the article where the SUBs are located.

[0054]

[0055] After all the sentences are traversed, all the recorded complete characteristic utterances (FULL) are traversed, all the segments (SUB) are merged in sequence, the similarity with the corresponding complete characteristic utterances is calculated, and the similarity trend is calculated.

[0056] The similarity is calculated using the edit distance method similarity = distance(content(SUB-X_start,SUB-Y_end), FULL), where content is the original text, SUB-X is the first SUB, and SUB-Y is the second SUB.

[0057]

[0058] When the trend is found to be decreasing, the combination with the highest similarity is considered to be the most likely erroneous featured utterance. If the highest similarity score is greater than the threshold, it is considered to meet the recording conditions. All such merged fragment records are recorded as suspected errors MayErr_SUB, and the relevant complete featured utterance (FULL) and its similarity are recorded.

[0059] For example:

[0060]

[0061] The similarity threshold is set as follows: when the length of the complete feature speech (FULL) is greater than or equal to 5, it is 0.8; when the length is equal to 4, it is 0.7; and when the length is equal to 3, it is 0.66.

[0062] Filter the suspected errors MayErr_SUB again. If there is an inclusion relationship between the suspected errors, keep the one with a larger range. If there is a suspected error MayErr_SUB with multiple complete feature utterances (FULL), only keep the one with a larger similarity. If the similarities are the same, replace the different complete feature utterances with the text in the MayErr_SUB range in the original text to calculate the perplexity and keep the one with a lower perplexity.

[0063] Confirm the error result:

[0064] Loop through all suspected errors, and for each suspected error, first calculate the perplexity of the original error range, and then calculate the perplexity of replacing the complete feature speech (FULL) of the suspected error MayErr_SUB with the text in the MayErr_SUB range in the original text. If the perplexity of the original text is greater than the perplexity calculated after replacement, it is considered that correction is needed.

[0065] The above embodiments are only for illustrating the technical idea of ​​the present invention, and cannot be used to limit the protection scope of the present invention. Any changes made on the basis of the technical solution in accordance with the technical idea proposed by the present invention shall fall within the protection scope of the present invention.

Claims

1. A proofreading method for characteristic discourse, It is characterized in that The specific steps include: Step 1, constructing an AC automaton: collect all characteristic utterances with three characters or more, the characteristic utterance data set is the complete characteristic utterance FULL, segment the characteristic utterance into Ngram segments, associate the characteristic utterance with the segmented segments, and put the characteristic utterance and the segmented segments into the AC automaton to form a characteristic utterance AC automaton; Step 2, text proofreading: pass in the text to be proofread, use the characteristic discourse AC automaton to find the correct characteristic discourse in the text, exclude proofreading, divide the remaining content into sentences, match the segment SUB containing the characteristic discourse through the characteristic discourse AC automaton, merge all SUBs in sequence, calculate the similarity with the corresponding FULL, calculate the similarity trend, and use the trend to identify the merged SUB as the suspected error MayErr_SUB. Calculate the perplexity of the original content of MayErr_SUB and the perplexity of the replaced content through the perplexity, and retain the one with the lowest perplexity as the proofreading result.

2. The method for proofreading characteristic speech according to claim 1, It is characterized in that Step 1 specifically includes the following steps: Step 11, construct a corpus of characteristic discourse: collect the characteristic discourse list and put it into a txt text file, one characteristic discourse per line, and the length of the characteristic discourse must be greater than or equal to 3 words; Step 12, constructing the characteristic discourse AC automaton: passing the characteristic discourse dataset into the AC automaton and marking it as complete characteristic discourse FULL; The complete characteristic utterance FULL is segmented into Ngrams, and the segmented segments are also put into the AC automaton and marked as segments SUB. At the same time, SUB is associated with FULL so that the corresponding FULL can be found through SUB.

3. The method for proofreading characteristic speech according to claim 2, Features: The characteristic discourse sentences are segmented into Ngram-3, Ngram-4 and Ngram-5.

4. The method for proofreading characteristic speech according to claim 1, It is characterized in that Step 2 specifically includes the following steps: Step 21, pre-proofreading processing: receiving the text to be proofread, matching all FULL contents in the text through the characteristic discourse AC automaton and recording the position range, and excluding this part of the content from proofreading; Use punctuation marks as separators to separate the remaining content into sentences; Step 22, proofread the sentence content: loop through all sentences and match the content containing SUB through the characteristic discourse AC automaton; Find all corresponding FULLs through the matched SUBs, and record all FULLs and corresponding SUBs as well as the position (start, end) of the article where the SUBs are located; After all clauses are traversed, all recorded FULLs are traversed, all SUBs are merged in sequence, the similarity with the corresponding FULLs is calculated, and the similarity trend is calculated; When it is found that the trend is decreasing, the merged SUB combination with the highest similarity is considered to be the characteristic utterance that made the error.

5. The method for proofreading characteristic speech according to claim 4, Features: A threshold is set for the similarity between the combined SUB and the corresponding FULL. If the highest similarity score is greater than the threshold, it is considered to meet the recording conditions. All such combined records are recorded as suspected errors MayErr_SUB, and the related FULL and its similarity are recorded.

6. The method for proofreading characteristic speech according to claim 4, Features: Limit the punctuation marks for separators to period, exclamation mark, comma, question mark, horizontal tab, line feed, and carriage return; The similarity is calculated using the edit distance method similarity = distance(content(SUB-X_start, SUB-Y_end), FULL), where content is the original text, SUB-X is the first SUB, and SUB-Y is a subsequent SUB.

7. The method for proofreading characteristic speech according to claim 5, Features: The similarity threshold is set as follows: when the length of FULL is greater than or equal to 5, the threshold is 0.8; when the length of FULL is equal to 4, the threshold is 0.7; when the length of FULL is equal to 3, the threshold is 0.

66.

8. The method for proofreading characteristic speech according to claim 5, Features: Filter the suspected errors MayErr_SUB again. If there is an inclusion relationship between the suspected errors, retain the SUB with a larger range. If there is a suspected error MayErr_SUB for multiple FULLs, only retain the FULL with a larger similarity. If a suspected error MayErr_SUB for multiple FULLs with the same similarity, replace the different FULLs with the text in the MayErr_SUB range in the original text to calculate the perplexity, and retain the FULL with a lower perplexity.

9. The method for proofreading characteristic speech according to claim 5 or 8, Features: Step 23, confirm the error result: loop through all suspected errors, and for each suspected error, first calculate the perplexity of the original error range, and then calculate the perplexity of replacing the suspected error FULL with the text in the suspected error range in the original text. If the original text perplexity is greater than the perplexity calculated after replacement, it is considered that correction is required.

10. A proofreading device for characteristic speech, It is characterized in that include: Memory and processor; The memory is used to store programs; The processor is used to execute the program to implement the various steps of the method for proofreading characteristic speech as described in any one of claims 1-9.