Text error correction method and device based on large model, medium and equipment

Through the text error correction method based on the big model, segment the text to form a statement list, perform primary and secondary error correction, and use the longest common sub-sequence algorithm to determine the location, solving the problem of low accuracy of traditional error correction methods and achieving more Efficient and accurate text correction.

CN119067102APending Publication Date: 2024-12-03SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411195784.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2024-12-03

AI Technical Summary

Technical Problem

Traditional text error correction methods rely on rule matching methods, which are difficult to cover all possible error situations, resulting in low error correction accuracy.

Method used

Using text error correction method based on large models, split text through separators to form the original statement list, use the first large model to perform one-time error correction processing, the second large model to perform secondary error correction based on context, and use the longest common subsequence The algorithm determines the error correction position.

Benefits of technology

Improve the accuracy and coverage of text error correction, utilize the context processing capabilities of the big model to understand text information more comprehensively, and reduce the need for manual participation and rule base construction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119067102A_ABST
    Figure CN119067102A_ABST
Patent Text Reader

Abstract

The invention provides a text error correction method and device based on a large model, a medium and equipment. The method comprises the following steps: receiving a text error correction request of a user; determining a text to be corrected and a separator list; identifying each separator in the text to be corrected, and segmenting the text between every two discontinuous and nearest separators as an original text statement; performing error correction processing on the original text statements in the original text statement list by utilizing a first large model to obtain primary error correction text statements; inputting a primary error correction text statement in the primary error correction text statement list and a context statement of the primary error correction text statement into a second large model to obtain a secondary error correction text statement; and determining error correction position data, and returning the original text statement list, the secondary error correction text statement list and the error correction position data to the user. According to the invention, the accuracy of error correction can be improved, and manpower and time costs are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of text processing technology, and in particular to a text error correction method and device, medium, and equipment based on a large model. Background Art

[0002] In the information age, the accuracy of text data is crucial for the transmission and application of information. However, due to various factors, such as human input errors, language complexity, etc., various errors often exist in texts. In order to improve the quality of text, it is particularly important to develop an efficient text error correction system. Traditional text error correction methods mainly rely on rule matching methods. Although the rule matching method has achieved certain results, it has limitations. Because the rule matching method matches and corrects texts through a preset rule library, the construction of the rule library requires a lot of manpower and time, and it is difficult to cover all possible error situations, so the accuracy of error correction needs to be improved. Summary of the invention

[0003] In response to at least one of the above technical problems, an embodiment of the present invention provides a text error correction method and device, medium, and equipment based on a large model.

[0004] According to the first aspect, the text error correction method based on the large model provided by the embodiment of the present invention includes:

[0005] Receive text correction requests from users;

[0006] Determine the text to be corrected and the separator list according to the text correction request;

[0007] According to the delimiter list, each delimiter in the text to be corrected is identified, the text between each two discontinuous and closest delimiters is segmented as an original text sentence, and each original text sentence obtained by segmentation is formed into an original text sentence list;

[0008] Using the first large model, each original text sentence in the original text sentence list is corrected to obtain a corresponding first-corrected text sentence; and according to the arrangement order of each original text sentence in the original text sentence list, each corresponding first-corrected text sentence is formed into a first-corrected text sentence list;

[0009] Input each primary error correction text sentence and the context sentence of the primary error correction text sentence in the primary error correction text sentence list into the second largest model, so that the second largest model corrects the primary error correction text sentence according to the context sentence to obtain the corresponding secondary error correction text sentence; and form a secondary error correction text sentence list with the corresponding secondary error correction text sentences according to the arrangement order of each primary error correction text sentence in the primary error correction text sentence list;

[0010] The error correction position data is determined according to the longest common subsequence algorithm, and the original text sentence list, the secondary error correction text sentence list and the error correction position data are returned to the user.

[0011] In one embodiment, determining the error correction position data according to the longest common subsequence algorithm, and returning the original text sentence list, the secondary error correction text sentence list and the error correction position data to the user, comprises:

[0012] According to the longest common subsequence algorithm, determine the error correction position list corresponding to each original text sentence in the original text sentence list and the error correction position list corresponding to each secondary error correction text sentence in the secondary error correction text sentence list; each error correction position in the error correction position list of a text sentence is the position of the error correction text in the text sentence;

[0013] According to the respective error correction position lists of the original text sentences, a first overall error correction list corresponding to the original text sentence list is determined; according to the respective error correction position lists of the secondary error correction text sentences, a second overall error correction list corresponding to the secondary error correction text sentence list is determined; the overall error correction list corresponding to a text sentence list is the position of the error correction text in the text sentence list;

[0014] The original text sentence list, the first overall error correction list, the secondary error correction text sentence list and the second overall error correction list are returned to the user.

[0015] In one embodiment, determining the text to be corrected and the separator list according to the text correction request includes:

[0016] Determining the text to be corrected according to the correction text parameter in the text correction request;

[0017] Determine whether the text error correction request carries a user-defined delimiter list; if so, use the user-defined delimiter list as the delimiter list for subsequent use; otherwise, use the predefined default delimiter list as the delimiter list for subsequent use.

[0018] In one embodiment, the first large model is used to perform error correction processing on each original text sentence in the original text sentence list to obtain a corresponding first-corrected text sentence, including:

[0019] Each original text sentence in the original text sentence list is concatenated with the first large model prompt information to obtain the first input content, and the first input content is input into the first large model to obtain a correction text sentence corresponding to the original text sentence; wherein the first large model prompt information is used to prompt the first large model of the correction requirements that need to be paid attention to when correcting errors.

[0020] In one embodiment, the step of inputting each primary error correction text sentence in the primary error correction text sentence list and the context sentence of the primary error correction text sentence into the second large model, so that the second large model corrects the primary error correction text sentence according to the context sentence to obtain the corresponding secondary error correction text sentence, comprises:

[0021] The first N first-time error correction text sentences of each first-time error correction text sentence are used as the preceding context, and the last N first-time error correction text sentences of each first-time error correction text sentence are used as the subsequent content;

[0022] Each first-correction text sentence, the preceding context of the first-correction text sentence, the subsequent content of the first-correction text sentence, and the second large model prompt information are spliced ​​to obtain the second input content, and the second input content is input into the second large model to obtain the second error correction text sentence corresponding to the first error correction text sentence; wherein the second large model prompt information is used to prompt the second large model of the error correction requirements that need to be paid attention to when correcting errors.

[0023] In one embodiment, the step of inputting each primary error correction text sentence in the primary error correction text sentence list and the context sentence of the primary error correction text sentence into the second large model so that the second large model corrects the primary error correction text sentence according to the context sentence to obtain the corresponding secondary error correction text sentence further includes:

[0024] For each of the first N first error correction text statements at the head of the first error correction text statement list, all the first error correction text statements preceding the first error correction text statement are used as the front context of the first error correction text statement;

[0025] For each of the last N first-time error correction text statements at the end of the first-time error correction text statement list, all the first-time error correction text statements following the first-time error correction text statement are used as subsequent content of the first-time error correction text statement.

[0026] In one embodiment, the first large model and the second large model are both started based on the VLLM framework; the VLLM framework supports multiple large models and provides a unified dialogue interface; the VLLM framework receives the input content through the dialogue interface, selects a matching large model to execute the task based on the input content, and returns the execution result through the dialogue interface.

[0027] According to the second aspect, the text error correction device based on the large model provided by the embodiment of the present invention includes:

[0028] A request receiving module, used to receive a text error correction request from a user;

[0029] An information determination module, used to determine the text to be corrected and the separator list according to the text correction request;

[0030] A text segmentation module is used to identify the delimiters in the text to be corrected according to the delimiter list, segment the text between each two discontinuous and closest delimiters as an original text sentence, and form an original text sentence list with the original text sentences obtained by segmentation;

[0031] A primary error correction module is used to perform error correction processing on each original text sentence in the original text sentence list using the first large model to obtain a corresponding primary error correction text sentence; and according to the arrangement order of each original text sentence in the original text sentence list, the corresponding primary error correction text sentences are formed into a primary error correction text sentence list;

[0032] A secondary error correction module is used to input each primary error correction text sentence in the primary error correction text sentence list and the context sentence of the primary error correction text sentence into the second large model, so that the second large model corrects the primary error correction text sentence according to the context sentence to obtain the corresponding secondary error correction text sentence; and according to the arrangement order of each primary error correction text sentence in the primary error correction text sentence list, the corresponding secondary error correction text sentences are formed into a secondary error correction text sentence list;

[0033] A result returning module is used to determine the error correction position data according to the longest common subsequence algorithm, and return the original text sentence list, the secondary error correction text sentence list and the error correction position data to the user.

[0034] According to a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed in a computer, enables the computer to execute the method provided in the first aspect.

[0035] According to a fourth aspect, an embodiment of the present invention provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, the method provided in the first aspect is implemented.

[0036] The text error correction method, device, medium, and equipment based on the large model provided by the embodiment of the present invention use separators to divide the text to be corrected to form a list of original text sentences, use the first large model to perform error correction processing on each original text sentence to obtain the corresponding first error correction text sentence, and the second large model corrects the first error correction text sentence based on the context to obtain a second error correction text sentence. The error correction position is determined by the longest common subsequence algorithm, and then the original text sentence list, the second error correction text sentence list, and the error correction position data are returned to the user. It can be seen that in the above process, two error corrections are performed, and the second error correction also uses the powerful context processing capability of the large model technology to more comprehensively understand the context information of the text and more accurately identify and correct errors in the text. Moreover, the input content of the two large models includes prompt information, which helps the large model to accurately identify and correct errors in the text. In addition, by using the longest common subsequence algorithm, by comparing the original text sentence and the second error correction text sentence, the position information of the error correction text can be accurately obtained, which helps the user understand the specific location of the error and provides valuable information for subsequent text processing and analysis. The whole process has low manual involvement, which can reduce labor costs. There is no need to build a rule base, which can also reduce the time and manpower required for construction. BRIEF DESCRIPTION OF THE DRAWINGS

[0037] Figure 1 It is a flowchart of a text error correction method based on a large model in one embodiment of the present invention;

[0038] Figure 2 It is a structural block diagram of a text error correction device based on a large model in one embodiment of the present invention. DETAILED DESCRIPTION

[0039] In a first aspect, an embodiment of the present invention provides a text error correction method based on a large model, see Figure 1 The method comprises the following steps S110 to S160:

[0040] S110, receiving a text error correction request from a user;

[0041] S120, determining the text to be corrected and a separator list according to the text correction request;

[0042] In one embodiment, determining the text to be corrected and the separator list according to the text correction request in S120 may include:

[0043] 1. Determine the text to be corrected according to the correction text parameter in the text correction request;

[0044] 2. Determine whether the text error correction request carries a user-defined delimiter list; if so, use the user-defined delimiter list as the delimiter list for subsequent use; otherwise, use the predefined default delimiter list as the delimiter list for subsequent use.

[0045] The error correction text parameter may be a unique identifier of the text to be corrected, or may be the text to be corrected itself. The error correction text parameter in the text correction request is non-empty.

[0046] Where, the separator list, for example, [".","?"","!"",";","\n"].

[0047] S130, identifying each delimiter in the text to be corrected according to the delimiter list, segmenting the text between each two discontinuous and closest delimiters as an original text sentence, and forming an original text sentence list with each original text sentence obtained by segmentation;

[0048] In actual scenarios, the text to be corrected is segmented according to the separator list to ensure that the separator is at the end of the sentence. If there are multiple consecutive separators in the text to be corrected, the last separator is processed to avoid generating empty sentences to be corrected. Identify the separators in the text to be corrected, and then treat the text between each two discontinuous and closest separators as an original text sentence. The original text sentence list can be represented as A.

[0049] S140, using the first large model to perform error correction processing on each original text sentence in the original text sentence list to obtain a corresponding first-corrected text sentence; and according to the arrangement order of each original text sentence in the original text sentence list, the corresponding first-corrected text sentences are formed into a first-corrected text sentence list;

[0050] That is, by inputting each original text sentence into the first large model, the corresponding first-correction text sentence can be obtained. The first-correction text sentences obtained are formed into a first-correction text sentence list, and the arrangement order of each first-correction text sentence in the first-correction text sentence list is the same as the arrangement order of each corresponding original text sentence in the original text sentence list.

[0051] In one embodiment, the step of using the first large model to perform error correction processing on each original text sentence in the original text sentence list to obtain a corresponding error-corrected text sentence in S140 may include: splicing each original text sentence in the original text sentence list with the first large model prompt information to obtain the first input content, inputting the first input content into the first large model to obtain an error-corrected text sentence corresponding to the original text sentence; wherein the first large model prompt information is used to prompt the first large model of error correction requirements that need to be paid attention to when performing error correction. The error-corrected text sentence list may be represented as B.

[0052] It can be seen that the original text sentence is concatenated with the prompt information of the first large model to obtain the first input content, and the first input content is input into the first large model. The first large model can perform error correction processing on the original text sentence according to the prompt content of the first large model to obtain the corresponding first-corrected text sentence.

[0053] The first large model prompt information is used to guide the first large model to perform specific tasks, and is used to prompt the large model what information it should pay attention to, how to process the information, and what kind of output it expects. The first large model prompt information prompts the large model to focus on checking and correcting typos, multiple words, missing words, and grammatical errors in the text, and restricts the large model to correct grammatical errors without changing the original meaning of the input text, prohibiting the return of any analysis process, and only returning the modified text content.

[0054] Specifically, the first large model and the second large model used subsequently are both started based on the VLLM framework; the VLLM framework supports multiple large models and provides a unified dialogue interface; the VLLM framework receives the input content through the dialogue interface, selects a matching large model to execute the task based on the input content, and returns the execution result through the dialogue interface.

[0055] Therefore, through a unified dialogue interface, the spliced ​​first input content is passed to the first large model, and the first large model performs error correction processing. Through the unified dialogue interface, the first error correction text sentence output by the first large model can be obtained. Through the dialogue interface and the VLLM framework, the execution subject of the embodiment of the present invention, that is, the text error correction service, is decoupled from the first large model, ensuring the flexibility and extensibility of the text error correction service, and the appropriate large model can be selected as needed to process the text error correction task. The output of the large model can be limited by prompt information.

[0056] S150, inputting each primary error correction text sentence and the context sentence of the primary error correction text sentence in the primary error correction text sentence list into the second largest model, so that the second largest model corrects the primary error correction text sentence according to the context sentence to obtain a corresponding secondary error correction text sentence; and forming a secondary error correction text sentence list with the corresponding secondary error correction text sentences according to the arrangement order of each primary error correction text sentence in the primary error correction text sentence list;

[0057] In one embodiment, the step of inputting each primary error correction text sentence in the primary error correction text sentence list and the context sentence of the primary error correction text sentence into the second large model so that the second large model corrects the primary error correction text sentence according to the context sentence to obtain the corresponding secondary error correction text sentence in S150 may include:

[0058] 11. The first N first-time error correction text sentences of each first-time error correction text sentence are used as the preceding context, and the last N first-time error correction text sentences of each first-time error correction text sentence are used as the subsequent content;

[0059] 12. Concatenate each primary error correction text sentence, the preceding context of the primary error correction text sentence, the subsequent content of the primary error correction text sentence, and the second large model prompt information to obtain the second input content, and input the second input content into the second large model to obtain the secondary error correction text sentence corresponding to the primary error correction text sentence; wherein the second large model prompt information is used to prompt the second large model of the error correction requirements that need to be paid attention to when performing error correction.

[0060] Here, N can be set as needed, for example, N is 3.

[0061] For example, the first three first-correction text sentences of each first-correction text sentence are used as the preceding context, and the last three first-correction text sentences of each first-correction text sentence are used as the subsequent content. Each first-correction text sentence, its preceding context, its subsequent content, and the prompt information of the second largest model are spliced ​​to obtain the second input content. The second input content is input into the second largest model to obtain the secondary error correction text sentence corresponding to the first-correction text sentence.

[0062] Further, the step of inputting each primary error correction text sentence in the primary error correction text sentence list and the context sentence of the primary error correction text sentence into the second largest model so that the second largest model corrects the primary error correction text sentence according to the context sentence to obtain the corresponding secondary error correction text sentence in S150 may also include:

[0063] 21. For each of the first N first error correction text statements at the head of the first error correction text statement list, all the first error correction text statements preceding the first error correction text statement are used as the front context of the first error correction text statement;

[0064] 22. For each of the last N first-error-correction text statements at the end of the first-error-correction text statement list, all the first-error-correction text statements following the first-error-correction text statement are used as subsequent contents of the first-error-correction text statement.

[0065] For example, when N is 3, the first error correction text sentence is located in the first 3 of the head of the first error correction text sentence list, that is, the first error correction text sentence is located in the first, second or third of the head of the first error correction text sentence list, then all the first error correction text sentences in front of the first error correction text sentence are used as the preceding context of the first error correction text sentence; if there is no first error correction text sentence in front of the first error correction text sentence, the preceding context is empty.

[0066] For example, when N is 3, the first error correction text sentence is located in the last 3 at the end of the first error correction text sentence list, that is, the first error correction text sentence is located in the first-to-last, second-to-last or third-to-last at the end of the first error correction text sentence list, then all the first error correction text sentences after the first error correction text sentence are regarded as the subsequent content of the first error correction text sentence; if there is no first error correction text sentence after the first error correction text sentence, the subsequent content is empty.

[0067] It can be seen that when the first correction text sentence is located at the beginning or end of the first correction text sentence list, resulting in the number of preceding contexts or subsequent contents being less than N, the number of sentences that actually exist will be used for construction. For example, the second first correction text sentence in the first correction text sentence list uses the first correction text sentence of the previous sentence as its preceding context, and the first correction text sentences of the following three sentences as its subsequent contents; the last first correction text sentence in the first correction text sentence list uses the first three sentences as the preceding context, and its subsequent contents are empty. The prompt information of the second largest model focuses on ensuring that the second largest model can fully understand and utilize the context information of the first correction text sentence for correction. The prompt information of the second largest model guides the second largest model to correct the first correction text sentence based on the preceding context and subsequent contents, and gives a corrected second correction text sentence that is consistent with the context on the basis of comprehensive consideration of the context information of the text.

[0068] Among them, the second largest model prompt information limits the second largest model through prompts to ensure that there are no typos, multiple missing words, grammatical errors and punctuation errors in the corrected text, and pay attention to the contextual consistency of names, behaviors, dates, etc. It is forbidden to return any analysis process, and only return the modified text content to ensure the content is accurate and smooth.

[0069] It can be seen that after completing the first correction, in order to ensure the accuracy of the correction result, a second correction based on the context is introduced. The core of this task is to make full use of the reference context text to provide richer background information for the correction process.

[0070] Specifically, a unified dialogue interface can be called to input the constructed second input content into the second largest model, so as to use the second largest model for secondary error correction. The secondary error correction text sentence output by the second largest model is obtained by calling the unified dialogue interface. Among them, the unified dialogue interface will decide whether to use the first largest model or the second largest model for error correction according to the input content.

[0071] Among them, the arrangement order of each secondary error correction text sentence in the secondary error correction text sentence list is consistent with the arrangement order of each corresponding primary error correction text sentence in the secondary error correction text sentence list and the arrangement order of each corresponding original text sentence in the original text sentence list. The secondary error correction text sentence list can be represented as C. It can be seen that the number and arrangement order of sentences in lists A, B, and C are all consistent.

[0072] S160. Determine error correction position data according to the longest common subsequence algorithm, and return the original text sentence list, the secondary error correction text sentence list and the error correction position data to the user.

[0073] It is understandable that after completing the secondary error correction, in order to facilitate subsequent text analysis, proofreading, etc., the sentence correction position calculation task based on the longest common subsequence algorithm is introduced. The core of this task is to determine the difference between the secondary error correction text sentence and the original text sentence, and then accurately identify the specific location of the error correction.

[0074] In one embodiment, determining the error correction position data according to the longest common subsequence algorithm in S160, and returning the original text sentence list, the secondary error correction text sentence list and the error correction position data to the user, may include the following three steps:

[0075] 1. According to the longest common subsequence algorithm, determine the error correction position list corresponding to each original text sentence in the original text sentence list and the error correction position list corresponding to each secondary error correction text sentence in the secondary error correction text sentence list; each error correction position in the error correction position list of a text sentence is the position of the error correction text in the text sentence;

[0076] It can be seen that each original text sentence in the original text sentence list has its own error correction position list, in which each position that has changed in the original text sentence is recorded. Each secondary error correction text sentence in the secondary error correction text sentence list has its own error correction position list, in which each position that has changed in the secondary error correction text sentence is recorded.

[0077] Specifically, the implementation process of step 1 generally includes: traversing list A and list C, obtaining an original text sentence and a corresponding secondary error correction text sentence. Using the longest common subsequence algorithm to find the longest common subsequence between the two sentences, thereby determining the difference between them and finally obtaining the error correction position.

[0078] Among them, the core idea of ​​the longest common subsequence algorithm is to find the longest subsequence shared by two sequences. In an embodiment of the present invention, a statement is a sequence. The algorithm will traverse the two sequences character by character, and use the method of dynamic programming to record the longest common subsequence to form a path. In this process, the algorithm will maintain a two-dimensional table T. Comparing the characters in the two sequences, the number of rows and columns of this two-dimensional table T correspond to the lengths of the two sequences respectively. Each element T[i][j] in the two-dimensional table represents the length of the longest common subsequence between the first i characters of the original text sentence and the first j characters of the secondary error correction text sentence. During the execution of the algorithm, the two statements will be traversed character by character. For the character si in the original text sentence and the character tj in the secondary error correction text sentence, the algorithm will perform the following operations: If si and tj are equal, then the value of T[i][j] is T[i-1][j-1] plus 1, because si and tj can be added to the longest common subsequence. If si and tj are not equal, the algorithm needs to decide whether to ignore si or tj so that the remaining parts can form a longer common subsequence. The algorithm compares T[i-1][j] and T[i][j-1] and selects the larger value as the value of T[i][j].

[0079] After traversing all the character pairs, the value of the last position of the two-dimensional table is the length of the longest common subsequence of the two strings. Backtrack from the last position of the table. If the current character pairs are not equal, check the two adjacent cells, namely T[i-1][j] and T[i][j-1], and choose the one with the larger value to backtrack. If T[i-1][j] is selected, i is added to the error correction position list corresponding to the original text sentence. If T[i][j-1] is selected, j is added to the error correction position list of the secondary error correction text sentence. Through this process, the error correction position list corresponding to each original text sentence and the error correction position list corresponding to each secondary error correction text sentence can be obtained.

[0080] For example, if there are three statements in List A and List C, List A will correspond to three error correction position lists, which can be called List D, that is, there are three List Ds; List C will also correspond to three error correction position lists, which can be called List E, that is, there are three List Es.

[0081] 2. Determine a first overall error correction list corresponding to the original text sentence list according to the error correction position lists of the original text sentences; determine a second overall error correction list corresponding to the secondary error correction text sentence list according to the error correction position lists of the secondary error correction text sentences; the overall error correction list corresponding to a text sentence list is the position of the error correction text in the text sentence list;

[0082] It is understandable that the position in the error correction position list is only the position of the error correction text in the sequence of the current sentence. The position in the overall error correction list is the position of the error correction text in the long sequence formed by all sentences.

[0083] 3. Return the original text sentence list, the first overall error correction list, the secondary error correction text sentence list and the second overall error correction list to the user.

[0084] For example, the original text sentence list is: [“It’s really hard for dogs,”, “I met a liar”], which includes two original text sentences. The secondary error correction text sentence list is [“It’s really sad,”, “I met a liar.”]. It can be seen that the two error correction position lists corresponding to the two original text sentences are: [2] and [3]. The two error correction position lists corresponding to the two error correction text sentences are: [2] and [3, 5]. The first overall error correction list corresponding to the determined original text sentence list is [2,7], and the second overall error correction list corresponding to the secondary error correction text sentence list is [2,7,9]. The content returned to the user includes “It’s really hard for dogs, I met a liar”, [2,7], “It’s really sad, I met a liar” and [2,7,9].

[0085] It can be seen that the embodiment of the present invention combines the big model technology with the longest common subsequence algorithm to realize a solution for accurately identifying and correcting text errors. By utilizing the powerful context processing capabilities of the big model technology, the context information of the text can be more comprehensively understood, and errors in the text can be more accurately identified and corrected. Moreover, through specific prompt information, the big model can accurately identify and correct errors in the text. Moreover, by using the longest common subsequence algorithm, by comparing the original text sentence and the secondary error correction text sentence, the location information of the error correction text can be accurately obtained, which helps the user understand the specific location where the error occurred, and provides valuable information for subsequent text processing and analysis. In addition, the embodiment of the present invention decouples the text correction function from the big model, allowing the big model to be replaced, optimized or fine-tuned as needed according to actual needs to adapt to the text correction needs in different fields and scenarios, ensuring the flexibility and scalability of the text correction service.

[0086] In a second aspect, an embodiment of the present invention provides a text error correction device based on a large model, see Figure 2 , the device 100 comprises:

[0087] A request receiving module 110, configured to receive a text error correction request from a user;

[0088] An information determination module 120, configured to determine the text to be corrected and a separator list according to the text correction request;

[0089] The text segmentation module 130 is used to identify the separators in the text to be corrected according to the separator list, segment the text between each two discontinuous separators that are closest to each other as an original text sentence, and form an original text sentence list with the original text sentences obtained by segmentation;

[0090] The primary error correction module 140 is used to perform error correction processing on each original text sentence in the original text sentence list using the first large model to obtain a corresponding primary error correction text sentence; and form a primary error correction text sentence list with the corresponding primary error correction text sentences according to the arrangement order of the original text sentences in the original text sentence list;

[0091] The secondary error correction module 150 is used to input each primary error correction text sentence and the context sentence of the primary error correction text sentence in the primary error correction text sentence list into the second large model, so that the second large model corrects the primary error correction text sentence according to the context sentence to obtain the corresponding secondary error correction text sentence; and according to the arrangement order of each primary error correction text sentence in the primary error correction text sentence list, the corresponding secondary error correction text sentences are formed into a secondary error correction text sentence list;

[0092] The result returning module 160 is used to determine the error correction position data according to the longest common subsequence algorithm, and return the original text sentence list, the secondary error correction text sentence list and the error correction position data to the user.

[0093] In one embodiment, the result returning module is specifically used to: determine, according to the longest common subsequence algorithm, the error correction position list corresponding to each original text sentence in the original text sentence list and the error correction position list corresponding to each secondary error correction text sentence in the secondary error correction text sentence list; each error correction position in the error correction position list of a text sentence is the position of the error correction text in the text sentence; according to the error correction position list of each original text sentence, determine the first overall error correction list corresponding to the original text sentence list; according to the error correction position list of each secondary error correction text sentence, determine the second overall error correction list corresponding to the secondary error correction text sentence list; the overall error correction list corresponding to a text sentence list is the position of the error correction text in the text sentence list; return the original text sentence list, the first overall error correction list, the secondary error correction text sentence list and the second overall error correction list to the user.

[0094] In one embodiment, the information determination module is specifically used to: determine the text to be corrected based on the correction text parameters in the text correction request; determine whether the text correction request carries a user-defined delimiter list; if so, use the user-defined delimiter list as the delimiter list for subsequent use; otherwise, use the predefined default delimiter list as the delimiter list for subsequent use.

[0095] In one embodiment, the primary error correction module is specifically used to: concatenate each original text sentence in the original text sentence list with the first large model prompt information to obtain the first input content, input the first input content into the first large model, and obtain a primary error correction text sentence corresponding to the original text sentence; wherein, the first large model prompt information is used to prompt the first large model of error correction requirements that need to be paid attention to when performing error correction.

[0096] In one embodiment, the secondary error correction module is specifically used to: use the first N primary error correction text sentences of each primary error correction text sentence as the preceding context, and use the last N primary error correction text sentences of each primary error correction text sentence as the subsequent content; splice each primary error correction text sentence, the preceding context of the primary error correction text sentence, the subsequent content of the primary error correction text sentence, and the second large model prompt information to obtain the second input content, input the second input content into the second large model, and obtain the secondary error correction text sentence corresponding to the primary error correction text sentence; wherein, the second large model prompt information is used to prompt the second large model of the error correction requirements that need to be paid attention to when performing error correction.

[0097] In one embodiment, the secondary error correction module is specifically used to: for each of the first N primary error correction text statements located at the head of the primary error correction text statement list, all the primary error correction text statements before the primary error correction text statement are used as the preceding context of the primary error correction text statement; for each of the last N primary error correction text statements located at the tail of the primary error correction text statement list, all the primary error correction text statements after the primary error correction text statement are used as the subsequent content of the primary error correction text statement.

[0098] In one embodiment, the first large model and the second large model are both started based on the VLLM framework; the VLLM framework supports multiple large models and provides a unified dialogue interface; the VLLM framework receives the input content through the dialogue interface, selects a matching large model to execute the task based on the input content, and returns the execution result through the dialogue interface.

[0099] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0100] In a third aspect, an embodiment of the present invention provides a computer-readable medium, on which computer instructions are stored. When the computer instructions are executed by a processor, the processor executes the method provided in the first aspect.

[0101] Specifically, a system or device equipped with a storage medium can be provided, on which software program code that implements the functions of any of the above-mentioned embodiments is stored, and a computer (or CPU or MPU) of the system or device can be enabled to read and execute the program code stored in the storage medium.

[0102] In this case, the program code itself read from the storage medium can realize the function of any one of the above-mentioned embodiments, and thus the program code and the storage medium storing the program code constitute a part of the present invention.

[0103] The storage medium embodiments for providing the program code include a floppy disk, a hard disk, a magneto-optical disk, an optical disk (such as CD-ROM, CD-R, CD-RW, DVD-ROM, DVD-RAM, DVD-RW, DVD+RW), a magnetic tape, a non-volatile memory card, and a ROM. Alternatively, the program code can be downloaded from a server computer by a communication network.

[0104] In addition, it should be clear that the functions of any of the above embodiments can be implemented not only by executing the program code read by the computer, but also by enabling an operating system operating on the computer to complete part or all of the actual operations based on instructions from the program code.

[0105] In addition, it can be understood that the program code read from the storage medium is written to a memory provided in an expansion board inserted into the computer or to a memory provided in an expansion module connected to the computer, and then based on the instructions of the program code, a CPU installed on the expansion board or expansion module is enabled to perform part or all of the actual operations, thereby realizing the functions of any of the above-mentioned embodiments.

[0106] It is understandable that the explanation, specific implementation methods, beneficial effects, examples, etc. of the relevant contents in the computer-readable medium provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

[0107] In a fourth aspect, an embodiment of the present specification provides a computing device, including a memory and a processor, wherein the memory stores executable code, and when the processor executes the executable code, it implements the method in any embodiment of the specification.

[0108] It is understandable that the explanation, specific implementation, beneficial effects, examples, etc. of the relevant contents in the computing device provided in the embodiment of the present invention can be found in the corresponding parts of the method provided in the first aspect, and will not be repeated here.

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

[0110] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the present invention can be implemented by hardware, software, widgets, or any combination thereof. When implemented by software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium.

[0111] The specific implementation methods described above further illustrate the objectives, technical solutions and beneficial effects of the present invention in detail. It should be understood that the above description is only a specific implementation method of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent substitutions, improvements, etc. made on the basis of the technical solution of the present invention should be included in the scope of protection of the present invention.

Claims

1. A text error correction method based on a large model, characterized in that: include: Receive text correction requests from users; Determine the text to be corrected and the separator list according to the text correction request; According to the delimiter list, each delimiter in the text to be corrected is identified, the text between each two discontinuous and closest delimiters is segmented as an original text sentence, and each original text sentence obtained by segmentation is formed into an original text sentence list; Using the first large model, each original text sentence in the original text sentence list is corrected to obtain a corresponding first-corrected text sentence; and according to the arrangement order of each original text sentence in the original text sentence list, each corresponding first-corrected text sentence is formed into a first-corrected text sentence list; Input each primary error correction text sentence and the context sentence of the primary error correction text sentence in the primary error correction text sentence list into the second largest model, so that the second largest model corrects the primary error correction text sentence according to the context sentence to obtain the corresponding secondary error correction text sentence; and form a secondary error correction text sentence list with the corresponding secondary error correction text sentences according to the arrangement order of each primary error correction text sentence in the primary error correction text sentence list; The error correction position data is determined according to the longest common subsequence algorithm, and the original text sentence list, the secondary error correction text sentence list and the error correction position data are returned to the user.

2. The method according to claim 1, characterized in that The determining the error correction position data according to the longest common subsequence algorithm, and returning the original text sentence list, the secondary error correction text sentence list and the error correction position data to the user, comprises: According to the longest common subsequence algorithm, determine the error correction position list corresponding to each original text sentence in the original text sentence list and the error correction position list corresponding to each secondary error correction text sentence in the secondary error correction text sentence list; each error correction position in the error correction position list of a text sentence is the position of the error correction text in the text sentence; According to the respective error correction position lists of the original text sentences, a first overall error correction list corresponding to the original text sentence list is determined; according to the respective error correction position lists of the secondary error correction text sentences, a second overall error correction list corresponding to the secondary error correction text sentence list is determined; the overall error correction list corresponding to a text sentence list is the position of the error correction text in the text sentence list; The original text sentence list, the first overall error correction list, the secondary error correction text sentence list and the second overall error correction list are returned to the user.

3. The method according to claim 1, characterized in that The step of determining the text to be corrected and the separator list according to the text error correction request includes: Determining the text to be corrected according to the correction text parameter in the text correction request; Determine whether the text error correction request carries a user-defined delimiter list; if so, use the user-defined delimiter list as the delimiter list for subsequent use; otherwise, use the predefined default delimiter list as the delimiter list for subsequent use.

4. The method according to claim 1, characterized in that: The first large model is used to perform error correction processing on each original text sentence in the original text sentence list to obtain a corresponding error-corrected text sentence, including: Each original text sentence in the original text sentence list is concatenated with the first large model prompt information to obtain the first input content, and the first input content is input into the first large model to obtain a correction text sentence corresponding to the original text sentence; wherein the first large model prompt information is used to prompt the first large model of the correction requirements that need to be paid attention to when correcting errors.

5. The method according to claim 1, characterized in that The step of inputting each primary error correction text sentence in the primary error correction text sentence list and the context sentence of the primary error correction text sentence into the second largest model, so that the second largest model corrects the primary error correction text sentence according to the context sentence to obtain the corresponding secondary error correction text sentence, comprises: The first N first-time error correction text sentences of each first-time error correction text sentence are used as the preceding context, and the last N first-time error correction text sentences of each first-time error correction text sentence are used as the subsequent content; Each first-correction text sentence, the preceding context of the first-correction text sentence, the subsequent content of the first-correction text sentence, and the second large model prompt information are spliced ​​to obtain the second input content, and the second input content is input into the second large model to obtain the second error correction text sentence corresponding to the first error correction text sentence; wherein the second large model prompt information is used to prompt the second large model of the error correction requirements that need to be paid attention to when correcting errors.

6. The method according to claim 5, characterized in that The step of inputting each primary error correction text sentence in the primary error correction text sentence list and the context sentence of the primary error correction text sentence into the second largest model, so that the second largest model corrects the primary error correction text sentence according to the context sentence to obtain the corresponding secondary error correction text sentence, further comprising: For each of the first N first error correction text statements at the head of the first error correction text statement list, all the first error correction text statements preceding the first error correction text statement are used as the front context of the first error correction text statement; For each of the last N first-time error correction text statements at the end of the first-time error correction text statement list, all the first-time error correction text statements following the first-time error correction text statement are used as subsequent content of the first-time error correction text statement.

7. The method according to claim 4 or 5, characterized in that: The first large model and the second large model are both started based on the VLLM framework; the VLLM framework supports multiple large models and provides a unified dialogue interface; the VLLM framework receives the input content through the dialogue interface, selects a matching large model to execute the task based on the input content, and returns the execution result through the dialogue interface.

8. A text error correction device based on a large model, characterized in that: include: A request receiving module, used to receive a text error correction request from a user; An information determination module, used to determine the text to be corrected and the separator list according to the text correction request; A text segmentation module is used to identify the delimiters in the text to be corrected according to the delimiter list, segment the text between each two discontinuous and closest delimiters as an original text sentence, and form an original text sentence list with the original text sentences obtained by segmentation; A primary error correction module is used to perform error correction processing on each original text sentence in the original text sentence list using the first large model to obtain a corresponding primary error correction text sentence; and according to the arrangement order of each original text sentence in the original text sentence list, the corresponding primary error correction text sentences are formed into a primary error correction text sentence list; A secondary error correction module is used to input each primary error correction text sentence in the primary error correction text sentence list and the context sentence of the primary error correction text sentence into the second large model, so that the second large model corrects the primary error correction text sentence according to the context sentence to obtain the corresponding secondary error correction text sentence; and according to the arrangement order of each primary error correction text sentence in the primary error correction text sentence list, the corresponding secondary error correction text sentences are formed into a secondary error correction text sentence list; A result returning module is used to determine the error correction position data according to the longest common subsequence algorithm, and return the original text sentence list, the secondary error correction text sentence list and the error correction position data to the user.

9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed in a computer, the computer is caused to execute the method according to any one of claims 1 to 7.

10. A computing device, characterized in that The method comprises a memory and a processor, wherein the memory stores executable codes, and when the processor executes the executable codes, the method according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Long text correction method, system and equipment based on large model and storage medium

    CN121387977A

  • Large model-based long text correction method, system, device and storage medium

    CN121387977B