Chinese text correction method and device based on spelling check and computer equipment

By extracting domain features from document texts in specific fields, building specific domain search text and case templates, and correcting them with the text input to be corrected, the problem of poor error correction in specific fields is solved, and more efficient and accurate text correction is achieved.

CN119886116AActive Publication Date: 2025-04-25BEIJING INST OF TECH

Patent Information

Application Number
CN202411643354.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-18
Publication Date
2025-04-25
Estimated Expiration
2044-11-18

AI Technical Summary

Technical Problem

The existing spell checking methods have poor error correction in specific fields, mainly due to the lack of domain-specific labeled data and the need to develop supervised error correction models separately, resulting in limited performance and high development costs.

Method used

The Chinese text correction method based on spell check is adopted to extract domain features from document texts in specific fields, build specific domain search text and case templates, and input them into the pre-trained language model for correction, avoiding the need for supervised training.

Benefits of technology

It improves the spell check adaptability of language models in specific fields, enhances the accuracy and efficiency of error correction, and reduces the cost of model fine-tuning.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119886116A_ABST
    Figure CN119886116A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of Chinese text correction, in particular to a Chinese text correction method and device based on spelling check, computer equipment and a storage medium. Related correction cases are extracted from the case pool of the specific field, a specific field case template is constructed, the to-be-corrected Chinese text, the specific field retrieval text and the specific field case template are combined to serve as input data to be transmitted to the pre-training model, and external field knowledge and the related correction cases are introduced to serve as demonstration. And the language model is guided to perform accurate text correction, so that the language model is prevented from generating excessive information irrelevant to a text correction result, and the accuracy of identifying and correcting errors of characters in a specific field by the language model is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of Chinese text correction, and in particular to a Chinese text correction method, device, computer equipment and storage medium based on spelling check. Background Art

[0002] Spelling check technology aims to automatically identify and correct incorrect characters in Chinese texts using intelligent methods. It is a basic task in natural language processing and is widely used in downstream tasks such as speech recognition, summarization, and machine translation. Therefore, spelling correction technology has become an indispensable and important technical means in the field of computer technology.

[0003] The development of spelling technology is closely related to the performance of language models. Early spelling check methods mainly used language knowledge to manually design rules. Since then, with the development of machine learning, spelling checkers have begun to use probabilistic language models to detect error locations, and use confusion sets and character similarities to correct potential misspelled characters and determine candidate correct characters, and finally score the replacement sentences to determine the best correction solution. In recent years, with the rapid development of deep learning, benefiting from the powerful understanding ability of pre-trained language models, practitioners and researchers have adopted pre-trained language models as a basis to further develop spelling correction models. Studies have found that the most important cause of spelling errors is the similarity of phonetics and morphology. Therefore, a series of studies have incorporated multimodal information such as phonetics, morphology, and context into spelling correction models.

[0004] In actual application scenarios, users are often in a specific industry or field, which leads to the fact that the error types of users in different industries often have domain characteristics. However, most of the existing methods require supervised training based on labeled data sets, and develop Chinese spelling correction models on a large number of general manually labeled data sets. Unfortunately, these models often cannot show substantial correction effects in specific fields. Therefore, enabling error correction models to correct errors in different fields has become a difficult problem that needs to be solved urgently. Specifically, this problem is mainly manifested in two aspects. First, labeled data in specific fields is difficult to obtain, which leads to the inability of existing supervised training methods to perform sufficient training, thereby limiting the performance of such methods; second, if there is a need to correct data in multiple fields at the same time, it is necessary to develop corresponding supervised error correction models for each field separately, which is undoubtedly time-consuming and labor-intensive. Summary of the invention

[0005] Based on this, the purpose of the present invention is to provide a Chinese text correction method, device, computer equipment and storage medium based on spelling check, apply retrieval enhancement technology to spelling check, so that the pre-trained model can directly contact the unlabeled data in a specific field, without the need for supervised training, avoiding the cost of fine-tuning, and improving the adaptability of the model in spelling check applications, thereby achieving the purpose of improving text correction. The technical solution is as follows:

[0006] In a first aspect, an embodiment of the present application provides a Chinese text correction method based on spelling check, comprising the following steps:

[0007] Obtaining a Chinese text to be corrected and a document text of a specific field of the Chinese text to be corrected, wherein the document text includes a plurality of document block texts;

[0008] Performing feature extraction on the Chinese text to be corrected and the plurality of document block texts to obtain feature vectors of the Chinese text to be corrected and the plurality of document block texts;

[0009] According to the feature vectors of the Chinese text to be corrected and the plurality of document block texts, a plurality of target document block texts are extracted from the plurality of document block texts to construct a specific domain retrieval text of the Chinese text to be corrected;

[0010] Constructing a case pool of a specific field of the Chinese text to be corrected, wherein the case pool includes several groups of specific text samples;

[0011] According to the Chinese text to be corrected, extracting several groups of target specific text samples from the case pool of the specific field, and constructing a specific field case template for the Chinese text to be corrected;

[0012] The Chinese text to be corrected and the specific field retrieval text and specific field case template of the Chinese text to be corrected are combined to construct an instruction sequence of the Chinese text to be corrected; the instruction sequence of the Chinese text to be corrected is input into a pre-trained large language model for text correction to obtain a correction result of the Chinese text to be corrected.

[0013] In a second aspect, an embodiment of the present application provides a Chinese text correction device based on spelling check, comprising:

[0014] A text acquisition module, used for acquiring a Chinese text to be corrected and a document text of a specific field of the Chinese text to be corrected, wherein the document text includes a plurality of document block texts;

[0015] A feature extraction module, used for extracting features from the Chinese text to be corrected and the plurality of document block texts, and obtaining feature vectors of the Chinese text to be corrected and the plurality of document block texts;

[0016] A text retrieval module, for extracting a plurality of target document blocks from the plurality of document blocks according to the feature vectors of the Chinese text to be corrected and the plurality of document blocks, and constructing a specific domain retrieval text of the Chinese text to be corrected;

[0017] A case pool construction module, used to construct a case pool of a specific field of the Chinese text to be corrected, wherein the case pool includes several groups of specific text samples;

[0018] A case template construction module is used to extract a plurality of target specific text samples from the case pool of the specific field according to the Chinese text to be corrected, and construct a specific field case template for the Chinese text to be corrected;

[0019] The text correction module is used to combine the Chinese text to be corrected and the specific field retrieval text and specific field case template of the Chinese text to be corrected to construct an instruction sequence of the Chinese text to be corrected; input the instruction sequence of the Chinese text to be corrected into a pre-trained large language model for text correction to obtain the correction result of the Chinese text to be corrected.

[0020] In a third aspect, an embodiment of the present application provides a computer device, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor; when the computer program is executed by the processor, the steps of the Chinese text correction method based on spelling check as described in the first aspect are implemented.

[0021] In a fourth aspect, an embodiment of the present application provides a storage medium, wherein the storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the Chinese text correction method based on spelling check as described in the first aspect are implemented.

[0022] In an embodiment of the present application, domain feature information is extracted from document texts in a specific domain to construct a specific domain retrieval text, and related text cases are extracted from a case pool in a specific domain to construct a specific domain case template. The Chinese text to be corrected, the specific domain retrieval text, and the specific domain case template are combined and passed to a pre-trained large language model as input data. By introducing external domain knowledge and related cases as demonstrations, the language model is guided to perform accurate text correction, which prevents the language model from generating too much information that is irrelevant to the text correction results, thereby improving the accuracy of the language model in identifying and correcting errors in characters in a specific domain.

[0023] For better understanding and implementation, the present invention is described in detail below with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1A flowchart of a Chinese text correction method based on spelling check provided by an embodiment of the present application;

[0025] Figure 2 A schematic diagram of the flow of S2 in a Chinese text correction method based on spelling check provided in one embodiment of the present application;

[0026] Figure 3 A schematic diagram of the flow of S3 in a Chinese text correction method based on spelling check provided in one embodiment of the present application;

[0027] Figure 4 A schematic diagram of the flow of S4 in a Chinese text correction method based on spelling check provided in one embodiment of the present application;

[0028] Figure 5 A schematic diagram of the flow of S41 in a Chinese text correction method based on spelling check provided in one embodiment of the present application;

[0029] Figure 6 A schematic diagram of the flow of S5 in a Chinese text correction method based on spelling check provided in one embodiment of the present application;

[0030] Figure 7 A schematic diagram of the flow of S55 in a Chinese text correction method based on spelling check provided in one embodiment of the present application;

[0031] Figure 8 A schematic diagram of the structure of a Chinese text correction device based on spelling check provided by an embodiment of the present application;

[0032] Fig. 9 A schematic diagram of the structure of a computer device provided for one embodiment of the present application. DETAILED DESCRIPTION

[0033] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0034] The terms used in this application are for the purpose of describing specific embodiments only and are not intended to limit this application. The singular forms of "a", "said" and "the" used in this application and the appended claims are also intended to include plural forms unless the context clearly indicates other meanings. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0035] It should be understood that, although the terms first, second, third, etc. may be used in the present application to describe various information, these information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" / "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determination".

[0036] See also Figure 1 , Figure 1 A flowchart of a Chinese text correction method based on spelling check provided in one embodiment of the present application is provided, wherein the method comprises the following steps:

[0037] S1: Obtain a Chinese text to be corrected and a document text of a specific field of the Chinese text to be corrected.

[0038] The executor of the Chinese text correction method based on spelling check is a text correction device (hereinafter referred to as the correction device). In an optional embodiment, the correction device can be a computer device, and the computer device can be a server or a server cluster composed of multiple computer devices, which is used to establish a network connection with a client.

[0039] In this embodiment, the correction device can obtain the Chinese text to be corrected and a longer document in a specific field of the Chinese text to be corrected by connecting to the database.

[0040] In order to facilitate the retrieval of more relevant document text information, the correction device divides the longer document in a specific field into blocks according to specific rules, such as word limit, punctuation marks, etc., to obtain the document text in the specific field of the Chinese text to be corrected, wherein the document text includes a plurality of document block texts, as follows:

[0041] The longer documents in the specific field are W = [w1, w2, ..., w N ], N is the text length of the document, indicating the total length of the characters contained. The correction device sets the document length of each document block text to be between [N / 2, 2N]. The correction device first divides the document into sentences of different text lengths according to punctuation marks. If the text length of the sentence is between [N / 2, 2N], it is divided into a separate document block text. If the text length of the sentence is less than N / 2, it is merged with the subsequent sentence until the text length of the merged sentence is between [N / 2, 2N]. If the text length of the sentence is greater than 2N, it is split into two segments. The document text Set finally formed by several document block texts docs={D1,D2,…,D s}, where Set docs is the document text, D s The text of the sth document block.

[0042] The correction device encodes the dictionary data to obtain a pinyin encoding representation and a glyph encoding representation of the dictionary data. Specifically, the correction device obtains the pinyin information of several characters in the dictionary data through a pinyin information extraction tool to obtain a pinyin encoding representation of the dictionary data. The pinyin information extraction tool can use a Python library named pinyin; the correction device disassembles the glyph information of several characters in the dictionary data through a glyph information extraction tool to obtain a pinyin encoding representation of the dictionary data. The glyph information extraction tool can use a Python library named python_chaizi.

[0043] S2: extracting features of the Chinese text to be corrected and the multiple document block texts to obtain feature vectors of the Chinese text to be corrected and the multiple document block texts.

[0044] In this embodiment, the correction device performs feature extraction on the Chinese text to be corrected and several document block texts to obtain feature vectors of the Chinese text to be corrected and several document block texts, wherein the feature vectors include semantic feature vectors, phonetic feature vectors and visual morphology feature vectors.

[0045] See also Figure 2 , Figure 2 The flowchart of S2 in the Chinese text correction method based on spelling check provided in one embodiment of the present application includes steps S21 to S23, which are as follows:

[0046] S21: extracting semantic information from the Chinese text to be corrected and the multiple document block texts to obtain semantic information sequences of the Chinese text to be corrected and the multiple document block texts; converting the semantic information sequences into feature vectors to obtain semantic feature vectors of the Chinese text to be corrected and the multiple document block texts.

[0047] In this embodiment, the correction device extracts semantic information from the Chinese text to be corrected and the plurality of document block texts to obtain semantic information sequences of the Chinese text to be corrected and the plurality of document block texts.

[0048] Specifically, the correction device can use the BERT (Bidirectional Encoder Representation from Transformers) language model, input the Chinese text to be corrected and several document block texts into the BERT language model respectively, and convert the text into a vector sequence E = [e1, e2, e3, ..., e N ], where e i The vectorized representation of the i-th character is represented, and the sequence in the vector form is converted into a semantic information sequence to obtain the semantic information sequence of the Chinese text to be corrected and the semantic information sequence of the plurality of document block texts, wherein the semantic information sequence is:

[0049] H=[h1,h2,h3,…,h N ]=PLMEncoder(E)

[0050] Among them, H is the semantic information sequence, h N Represents the semantic information vector of the Nth character. PLMEncoder is a semantic encoding component in the language model, which is used to encode the input text into a hidden representation.

[0051] The correction device converts the semantic information sequence into a feature vector to obtain the semantic feature vectors of the Chinese text to be corrected and the multiple document block texts. Specifically, the correction device converts the obtained semantic information sequence representation into a feature vector using a mean method, a linear transformation or a maximum pooling method to obtain the semantic feature vectors of the Chinese text to be corrected and the multiple document block texts, wherein the semantic feature vector is:

[0052] h=tran(H)=tran([h1,h2,h3,…,h N ])

[0053] Among them, h is the semantic feature vector, and tran(*) represents the feature vector conversion function.

[0054] S22: Using a preset pinyin conversion tool, extract pinyin information from the Chinese text to be corrected and the multiple document block texts to obtain a pinyin information sequence of the Chinese text to be corrected and the multiple document block texts, perform feature vector conversion on the pinyin information sequence to obtain a pinyin feature vector of the Chinese text to be corrected and the multiple document block texts.

[0055] In this embodiment, the correction device uses a preset pinyin conversion tool to extract pinyin information of the Chinese text to be corrected and several document block texts, obtain the pinyin information sequence of the Chinese text to be corrected and several document block texts, convert the pinyin information sequence into a feature vector, and obtain the pinyin feature vector of the Chinese text to be corrected and several document block texts.

[0056] Specifically, the correction device uses a preset pinyin conversion tool to extract the pinyin information such as initial consonants, finals and tones of several characters in the Chinese text to be corrected and several document block texts, and obtains the pinyin information sequence of the Chinese text to be corrected and several document block texts. The correction device uses an LSTM (Long Short-Term Memory) model to convert the pinyin information sequence into a feature vector, and obtains the pinyin feature vector of the Chinese text to be corrected and several document block texts.

[0057] S23: Using an image feature encoding method, extract visual morphological information of the Chinese text to be corrected and the several document block texts to obtain a visual morphological information sequence of the Chinese text to be corrected and the several document block texts, convert the visual morphological information sequence into a feature vector to obtain a visual morphological feature vector of the Chinese text to be corrected and the several document block texts.

[0058] In this embodiment, the correction device adopts an image feature encoding method to extract visual morphological information of the Chinese text to be corrected and several document block texts, obtain a visual morphological information sequence of the Chinese text to be corrected and several document block texts, convert the visual morphological information sequence into a feature vector, and obtain a visual morphological feature vector of the Chinese text to be corrected and several document block texts.

[0059] Specifically, the correction device extracts visual morphological information from the n×n pixel images corresponding to each character in the Chinese text to be corrected and the several document block texts, processes the character images using a CNN model with a width of f, and obtains a visual morphological information sequence of the Chinese text to be corrected and the several document block texts. The correction device generates a morphological embedding method through a max-pooling operation, performs feature vector conversion on the visual morphological information sequence, and obtains the visual morphological feature vectors of the Chinese text to be corrected and the several document block texts.

[0060] S3: extracting a plurality of target document blocks from the plurality of document blocks according to the feature vectors of the Chinese text to be corrected and the plurality of document blocks, and constructing a specific domain retrieval text of the Chinese text to be corrected.

[0061] In this embodiment, the correction device extracts a plurality of target document blocks from the plurality of document blocks according to the feature vectors of the Chinese text to be corrected and the plurality of document blocks, and constructs a specific domain retrieval text of the Chinese text to be corrected.

[0062] See also Figure 3 , Figure 3 The flowchart of S3 in the Chinese text correction method based on spelling check provided in one embodiment of the present application includes steps S31 to S32, which are as follows:

[0063] S31: respectively concatenate the semantic feature vectors, phonetic feature vectors and visual morphological feature vectors of the Chinese text to be corrected and the same document block text to obtain original multimodal vectors of the Chinese text to be corrected and several document block texts, perform dimension conversion on the original multimodal vectors to obtain final multimodal vectors of the Chinese text to be corrected and several document block texts.

[0064] In this embodiment, the correction device concatenates the semantic feature vectors, phonetic feature vectors and visual morphological feature vectors of the Chinese text to be corrected and the same document block text respectively to obtain the original multimodal vectors of the Chinese text to be corrected and several document block texts.

[0065] The correction device uses a fully connected layer to perform dimension conversion on the original multimodal vector to obtain the final multimodal vector of the Chinese text to be corrected and several document block texts.

[0066] S32: Based on the final multimodal vectors of the Chinese text to be corrected and the several document block texts, the similarity between the Chinese text to be corrected and the several document block texts is obtained; based on the similarity, several target document block texts are extracted from the several document block texts to construct a specific domain retrieval text of the Chinese text to be corrected.

[0067] In this embodiment, the correction device obtains the similarity between the Chinese text to be corrected and the multiple document block texts according to the final multimodal vectors of the Chinese text to be corrected and the multiple document block texts.

[0068] Specifically, the correction device adopts the Euclidean distance calculation method to obtain the Euclidean distance between the Chinese text to be corrected and the several document block texts according to the final multimodal vectors of the Chinese text to be corrected and the several document block texts as the similarity between the Chinese text to be corrected and the several document block texts.

[0069] The correction device arranges the several document block texts in ascending order according to the relevance, confirms the first f document block texts as target document block texts, extracts several target document block texts from the several document block texts, and constructs the specific field retrieval text of the Chinese text to be corrected.

[0070] S4: Construct a case pool in a specific field of the Chinese text to be corrected.

[0071] In this embodiment, the correction device constructs a case pool of a specific field for the Chinese text to be corrected, wherein the case pool includes several groups of specific text samples.

[0072] See also Figure 4 , Figure 4 The flowchart of S4 in the Chinese text correction method based on spelling check provided in one embodiment of the present application includes steps S41 to S44, which are specifically as follows:

[0073] S41: Obtain several correct texts in a specific field of the Chinese text to be corrected, and construct several types of confusion sets.

[0074] In this embodiment, the correction device obtains several correct texts in a specific field of the Chinese text to be corrected, and constructs several types of confusion sets, wherein the confusion set includes confusion subsets corresponding to several characters, and the confusion subsets include confusion probabilities between the characters and several corresponding similar characters.

[0075] Specifically, the confusion set includes a pinyin confusion set and a visual morphology confusion set; the pinyin confusion set includes a pinyin confusion subset corresponding to a number of characters, and the pinyin confusion subset includes the pinyin confusion probability between the character and a number of corresponding similar characters; the visual morphology confusion set includes a visual morphology confusion subset corresponding to a number of characters, and the visual morphology confusion subset includes the visual morphology confusion probability between the character and a number of corresponding similar characters. Figure 5 , Figure 5 The flowchart of S41 in the Chinese text correction method based on spelling check provided in one embodiment of the present application includes steps S411 to S413, which are specifically as follows:

[0076] S411: Traverse the characters in the preset dictionary to obtain the pinyin information vectors and visual morphological feature vectors of several characters.

[0077] In this embodiment, the correction device traverses the characters in the preset dictionary to obtain the pinyin information vectors and visual morphological feature vectors of several characters. For the specific embodiment, reference may be made to steps S22 to S23, which will not be described in detail here.

[0078] S412: Calculate similarity based on the pinyin feature vectors and visual morphology feature vectors of the characters respectively to obtain the pinyin similarity and visual morphology similarity between the characters; obtain a number of similar characters corresponding to the characters based on the pinyin similarity, visual morphology similarity and corresponding similarity thresholds, and construct a pinyin similar character set and a visual morphology similar character set corresponding to the characters.

[0079] In this embodiment, the correction device adopts a similarity calculation method to perform similarity calculation based on the pinyin feature vectors and visual morphology feature vectors of the characters to obtain the pinyin similarity and visual morphology similarity between the characters, wherein the pinyin similarity is:

[0080]

[0081] In the formula, is the phonetic similarity between the i-th character and the j-th character, is the pinyin feature vector of the ith character, is the pinyin feature vector of the jth character.

[0082] The visual morphology similarity is:

[0083]

[0084] In the formula, is the visual morphological similarity between the i-th character and the j-th character, is the visual morphological feature vector of the i-th character, is the visual morphological feature vector of the jth character.

[0085] The correction device obtains a number of similar characters corresponding to the characters according to the pinyin similarity, visual morphology similarity and the corresponding similarity threshold, and constructs a number of pinyin similar character sets and visual morphology similar character sets corresponding to the characters. Specifically, if the pinyin similarity is greater than the corresponding similarity threshold, a number of pinyin similar characters corresponding to the characters are obtained, and a number of pinyin similar character sets corresponding to the characters are constructed; if the visual morphology similarity is greater than the corresponding similarity threshold, a number of visual morphology similar characters corresponding to the characters are obtained, and a number of visual morphology similar character sets corresponding to the characters are constructed.

[0086] S413: Calculate the confusion probability based on the pinyin similarity and visual morphology similarity between the characters in the pinyin similar character set and the visual morphology similar character set corresponding to the several characters and the corresponding several similar characters, obtain the pinyin confusion probability and visual morphology confusion probability between the several characters and several similar characters, and construct the pinyin confusion set and the visual morphology confusion set.

[0087] In this embodiment, the correction device calculates the confusion probability according to the pinyin similarity and visual morphology similarity between the characters in the pinyin similar character set and the visual morphology similar character set corresponding to the several characters and the corresponding several similar characters, obtains the pinyin confusion probability and visual morphology confusion probability between the several characters and the several similar characters, and constructs the pinyin confusion set and the visual morphology confusion set, wherein the pinyin confusion probability is:

[0088]

[0089] In the formula, p pe (char k |char i ) is the phonetic confusion probability between the ith character and the corresponding kth similar character, is the phonetic similarity between the ith character and the corresponding kth similar character, m is the number of similar characters, is the phonetic similarity between the ith character and the corresponding tth similar character.

[0090] The visual morphology confusion probability is:

[0091]

[0092] In the formula, p ge (char k |char i ) The visual morphological confusion probability between the ith character and the corresponding kth similar character, is the visual morphological similarity between the ith character and the corresponding kth similar character, is the visual morphological similarity between the ith character and the corresponding tth similar character.

[0093] The pinyin confusion probability and visual morphology confusion probability between the same character and several corresponding similar characters are combined respectively to construct the pinyin confusion set and the visual morphology confusion set. Through the similarity calculation method, several pinyin similar characters and visual morphology similar characters corresponding to several characters are determined, and based on the pinyin similarity and visual morphology similarity, the corresponding pinyin confusion probability and visual morphology confusion probability are calculated respectively, thereby realizing the construction of a confusion set driven by the similarity theory, so that each similar character in the confusion set has a separate confusion probability that can better reflect the similarity with the corresponding character, so that characters with high similarity are selected with a higher probability to construct case templates and improve the accuracy of text correction.

[0094] S42: Obtaining first sampling probabilities of a plurality of characters in the correct text, and determining a plurality of characters to be replaced in the correct text according to the first sampling probabilities and a preset first sampling probability threshold.

[0095] In this embodiment, the correction device obtains first sampling probabilities of a plurality of characters in the correct text, wherein the first sampling probabilities are used to determine whether the characters are replaced.

[0096] The correction device is based on the first sampling probability and a preset first sampling probability threshold, determining a number of characters to be replaced in the correct text, specifically, to ensure that the number of spelling errors contained in different texts is somewhat different, the first sampling probability threshold is a dynamically changing threshold. If the first sampling probability of the character is greater than or equal to the first sampling probability threshold, the character is determined to be replaced with a corresponding character in the confusion set.

[0097] S43: obtaining second sampling probabilities of the characters to be replaced, and determining confusion subsets corresponding to the characters to be replaced according to the second sampling probabilities and a preset second sampling probability threshold.

[0098] In this embodiment, the correction device obtains the second sampling probability of the plurality of characters to be replaced. The second sampling probability is used to determine the type of confusion set used for character replacement.

[0099] The correction device determines the confusion subsets corresponding to the characters to be replaced according to the second sampling probability and the preset second sampling probability threshold. Specifically, the correction device determines the confusion sets corresponding to the characters to be replaced as a pinyin confusion set or a visual morphology confusion set according to the second sampling probability and the preset second sampling probability threshold, as follows:

[0100]

[0101] Where D * The confusion set for the type of character replacement used, D pe is the pinyin confusion set, D ge is the visual morphology confusion set, and β is the second sampling probability threshold.

[0102] The correction device uses the confusion subset of the characters in the confusion set that are the same as the character to be replaced as the confusion subset corresponding to the character to be replaced, and determines a plurality of confusion subsets corresponding to the character to be replaced.

[0103] S44: obtaining third sampling probabilities of several characters in the confusion subset corresponding to the several characters to be replaced, and confirming target characters corresponding to the several characters to be replaced according to the third sampling probabilities and confusion probabilities between the characters in the corresponding confusion subset and the corresponding several similar characters.

[0104] In this embodiment, the correction device obtains third sampling probabilities of several characters in the confusion subset corresponding to the several characters to be replaced, wherein the third sampling probability is used to determine similar characters in the confusion subset corresponding to the character to be replaced;

[0105] The correction device is based on the third sampling probability and the confusion probability between the character in the corresponding confusion subset and the corresponding several similar characters, confirm the target characters in the confusion set corresponding to the several characters to be replaced. Specifically, the correction device confirms the target characters corresponding to the several characters to be replaced according to the third sampling probability, the confusion probability between the character in the corresponding confusion subset and the corresponding several similar characters and the judgment formula, if the third sampling probability of the character to be replaced satisfies the judgment formula, wherein the judgment formula is:

[0106]

[0107] In the formula, is the target character in the confusion subset corresponding to the i-th character to be replaced, char k To confuse the k-th similar character in the subset, p(char k |char i ) is the confusion probability between the ith character and the corresponding kth similar character.

[0108] S45: replacing the target character with the corresponding character to be replaced in the correct text, constructing a plurality of replacement texts corresponding to the correct text, and respectively combining a plurality of the correct texts with the corresponding replacement texts to construct a plurality of groups of the specific text samples.

[0109] S5: According to the Chinese text to be corrected, extract several groups of target specific text samples from the case pool of the specific field, and construct a specific field case template of the Chinese text to be corrected.

[0110] In this embodiment, the correction device extracts several groups of target specific text samples from the case pool of the specific field according to the Chinese text to be corrected, and constructs a specific field case template of the Chinese text to be corrected.

[0111] See also Figure 6 , Figure 6 The flowchart of S5 in the Chinese text correction method based on spelling check provided in one embodiment of the present application includes steps S51 to S54, which are specifically as follows:

[0112] S51: Calculate the context probability of several groups of specific text samples in the case pool of the specific field respectively to obtain context probability data of the several groups of specific text samples.

[0113] In this embodiment, the correction device adopts the same language model as step S21, and inputs several groups of specific text samples in the case pool of the specific field into the above language model to perform context probability calculation, and obtains context probability data of several groups of the specific text samples, wherein the context probability data of the specific text samples includes the probabilities between several context characters of the correct text and the replacement text.

[0114] S52: Obtain the text length of several groups of the specific text samples, obtain the fluency of the correct text and the replacement text in the several groups of the specific text samples according to the text length of the several groups of the specific text samples, context probability data and a preset fluency calculation algorithm, subtract the fluency of the replacement text and the correct text in the same group of the specific text samples, and obtain the fluency difference of the several groups of the specific text samples.

[0115] In this embodiment, the correction device obtains the text lengths of several groups of the specific text samples. Specifically, the text lengths of the correct text and the replacement text in the specific text samples are consistent. The text length of the correct text or the replacement text can be used as the text length of the corresponding specific text sample.

[0116] The correction device obtains the fluency of the correct text and the replacement text in the several groups of the specific text samples according to the text length, context probability data and the preset fluency calculation algorithm of the several groups of the specific text samples, and subtracts the fluency of the replacement text and the correct text in the same group of the specific text samples to obtain the fluency difference of the several groups of the specific text samples, wherein the fluency calculation algorithm is:

[0117]

[0118] In the formula, fluency is fluency, x is the length of the text, and x i is the i-th character in the text, x <i is the previous character of the i-th character in the text, P(x i |x <i ) is the given context character x i and x <i The probability between .

[0119] S53: Perform preliminary correction processing on the Chinese text to be corrected to obtain preliminary corrected Chinese text, combine the Chinese text to be corrected and the preliminary corrected Chinese text to obtain a corrected text sample; perform context probability calculation on the corrected text sample to obtain context probability data of the corrected text sample.

[0120] In this embodiment, the correction device performs preliminary correction processing on the Chinese text to be corrected to obtain a preliminary corrected Chinese text, and combines the Chinese text to be corrected and the preliminary corrected Chinese text to obtain a corrected text sample. Specifically, the correction device inputs the Chinese text to be corrected into the same language model in S51 for preliminary correction processing to obtain a preliminary corrected Chinese text.

[0121] The correction device performs context probability calculation on the corrected text sample to obtain context probability data of the corrected text sample, wherein the context probability data of the corrected text sample includes the probabilities between several context characters of the Chinese text to be corrected and the preliminary corrected Chinese text. For a specific implementation example, please refer to step S51, which will not be repeated here.

[0122] S54: Obtain the text length of the corrected text sample, obtain the fluency of the Chinese text to be corrected and the preliminary corrected Chinese text in the corrected text sample according to the text length of the corrected text sample, context probability data and the fluency calculation algorithm, subtract the fluency of the preliminary corrected Chinese text and the Chinese text to be corrected, and obtain the fluency difference of the corrected text sample.

[0123] In this embodiment, the correction device obtains the text length of the corrected text sample, obtains the fluency of the Chinese text to be corrected and the preliminary corrected Chinese text in the corrected text sample according to the text length of the corrected text sample, the context probability data and the fluency calculation algorithm, subtracts the fluency of the preliminary corrected Chinese text and the Chinese text to be corrected, and obtains the fluency difference of the corrected text sample. For the specific embodiment, please refer to step S52, which will not be repeated here.

[0124] S55: extracting several groups of target specific text samples from the several groups of specific text samples according to the fluency difference and text length of the corrected text samples and several groups of specific text samples, and constructing a specific domain case template for the Chinese text to be corrected.

[0125] In this embodiment, the correction device extracts several groups of target specific text samples from several groups of specific text samples based on the fluency difference and text length of the correction text samples and several groups of specific text samples, and constructs a specific field case template for the Chinese text to be corrected.

[0126] See also Figure 7 , Figure 7 The flowchart of S55 in the Chinese text correction method based on spelling check provided in one embodiment of the present application includes steps S551 to S552, which are specifically as follows:

[0127] S551: If the text length of the corrected text sample differs from that of the specific text sample by a preset text length threshold, the specific text sample is used as a candidate specific text sample to obtain a plurality of candidate specific text samples.

[0128] If the text length of the corrected text sample differs from that of the specific text sample by a preset text length threshold, in this embodiment, the correction device uses the specific text sample as a candidate specific text sample to obtain a plurality of candidate specific text samples.

[0129] S552: Adopting a proximity distance calculation method, according to the fluency difference between the corrected text sample and the several candidate specific text samples, obtain the proximity distance between the corrected text sample and the several candidate specific text samples; according to the proximity distance, obtain several groups of candidate specific text samples that are closest to the corrected text sample in proximity distance as target specific text samples, and extract several groups of target specific text samples from the several groups of specific text samples.

[0130] In this embodiment, the correction device adopts a proximity distance calculation method to obtain the proximity distance between the corrected text sample and the plurality of candidate specific text samples according to the fluency difference between the corrected text sample and the plurality of candidate specific text samples, wherein the proximity distance is:

[0131] distance ir =|Δfluency i -Δfluency r |

[0132] Where, distance iris the proximity distance between the i-th corrected text sample and the r-th candidate specific text sample, Δfluency i is the fluency difference of the i-th corrected text sample, Δfluency r is the fluency difference of the rth candidate specific text sample.

[0133] That is, when the two have close relative fluency, the closer the proximity distance between the two text samples is, the closer the value is to 0, otherwise the value is larger. The correction device obtains several groups of candidate specific text samples that are closest to the proximity distance of the correction text sample based on the proximity distance as target specific text samples, and extracts several groups of target specific text samples from the several groups of specific text samples.

[0134] S6: Combine the Chinese text to be corrected and the specific field retrieval text and specific field case template of the Chinese text to be corrected to construct an instruction sequence of the Chinese text to be corrected; input the instruction sequence of the Chinese text to be corrected into a pre-trained large language model for text correction to obtain a correction result of the Chinese text to be corrected.

[0135] The pre-trained large language model can adopt advanced language models such as ChatGPT and Qwen, and can perform text correction according to the prompts of the spelling check task. By introducing external domain knowledge and related cases as demonstrations, the language model is trained, which effectively enhances the knowledge background of the pre-trained language model, makes up for the lack of knowledge in specific fields in the pre-trained language model, and further limits the language model to generate error correction text according to the standard paradigm, preventing the language model from generating too much information irrelevant to the standard results, and improving the language model's recognition and correction of errors in characters in specific fields.

[0136] In this embodiment, the correction device combines the Chinese text to be corrected and the specific field retrieval text and specific field case template of the Chinese text to be corrected to construct an instruction sequence of the Chinese text to be corrected; inputs the instruction sequence of the Chinese text to be corrected into a pre-trained large language model for text correction to obtain the correction result of the Chinese text to be corrected.

[0137] By extracting domain feature information from document texts in a specific domain, constructing a specific domain retrieval text, and extracting relevant text cases from a case pool in a specific domain, constructing a specific domain case template, the Chinese text to be corrected, the specific domain retrieval text, and the specific domain case template are combined and passed to the pre-trained model as input data. By introducing external domain knowledge and relevant cases as demonstrations, the language model is guided to perform accurate text correction, preventing the language model from generating too much information irrelevant to the text correction results, and improving the accuracy of the language model in identifying and correcting errors in characters in specific domains.

[0138] Please refer to Figure 8 , Figure 8 This is a schematic diagram of the structure of a Chinese text correction device based on spelling check provided by an embodiment of the present application. The device can implement all or part of the Chinese text correction device based on spelling check through software, hardware, or a combination of both. The device 8 includes:

[0139] A text obtaining module 81 is used to obtain a Chinese text to be corrected and a document text of a specific field of the Chinese text to be corrected, wherein the document text includes a plurality of document block texts;

[0140] A feature extraction module 82 is used to extract features from the Chinese text to be corrected and the plurality of document block texts to obtain feature vectors of the Chinese text to be corrected and the plurality of document block texts;

[0141] A text retrieval module 83 is used to extract a plurality of target document blocks from the plurality of document blocks according to the feature vectors of the Chinese text to be corrected and the plurality of document blocks, and construct a specific domain retrieval text of the Chinese text to be corrected;

[0142] A case pool building module 84 is used to build a case pool of a specific field of the Chinese text to be corrected, wherein the case pool includes several groups of specific text samples;

[0143] A case template construction module 85 is used to extract a plurality of target specific text samples from the case pool of the specific field according to the Chinese text to be corrected, and to construct a specific field case template for the Chinese text to be corrected;

[0144] The text correction module 86 is used to combine the Chinese text to be corrected and the specific field retrieval text and specific field case template of the Chinese text to be corrected to construct an instruction sequence of the Chinese text to be corrected; input the instruction sequence of the Chinese text to be corrected into the pre-trained large language model for text correction to obtain the correction result of the Chinese text to be corrected.

[0145] In an embodiment of the present application, a Chinese text to be corrected and a document text of a specific field of the Chinese text to be corrected are obtained through a text acquisition module, wherein the document text includes a plurality of document block texts; a feature extraction module is used to perform feature extraction on the Chinese text to be corrected and the plurality of document block texts to obtain feature vectors of the Chinese text to be corrected and the plurality of document block texts; a text retrieval module is used to extract a plurality of target document block texts from the plurality of document block texts according to the feature vectors of the Chinese text to be corrected and the plurality of document block texts to construct a retrieval text of the specific field of the Chinese text to be corrected; a case pool construction module is used to construct a case pool. The case pool of the specific field of the Chinese text to be corrected, wherein the case pool includes several groups of specific text samples; through the case template construction module, according to the Chinese text to be corrected, several groups of target specific text samples are extracted from the case pool of the specific field to construct the case template of the specific field of the Chinese text to be corrected; through the text correction module, the Chinese text to be corrected and the specific field search text and the specific field case template of the Chinese text to be corrected are combined to construct the instruction sequence of the Chinese text to be corrected; the instruction sequence of the Chinese text to be corrected is input into the pre-trained large language model for text correction to obtain the correction result of the Chinese text to be corrected. By extracting domain feature information from the document text of the specific field, constructing the specific field search text, and extracting relevant text cases from the case pool of the specific field, constructing the specific field case template, combining the Chinese text to be corrected, the specific field search text, and the specific field case template, passing them to the pre-trained model as input data, and by introducing external domain knowledge and relevant cases as demonstrations, guiding the language model to perform accurate text correction, preventing the language model from generating too much information irrelevant to the text correction result, and improving the accuracy of the language model in recognizing and correcting the errors of the characters in the specific field.

[0146] Please refer to Fig. 9 , Fig. 9 The computer device 9 is a schematic diagram of a structure of a computer device provided in an embodiment of the present application. The computer device 9 includes: a processor 91, a memory 92, and a computer program 93 stored in the memory 92 and executable on the processor 91; the computer device may store a plurality of instructions, which are suitable for being loaded and executed by the processor 91 Figures 1 to 7 The method steps of the embodiment shown in the figure can be specifically performed as follows: Figures 1 to 7 The specific description is not repeated here.

[0147] Among them, the processor 91 may include one or more processing cores. The processor 91 uses various interfaces and lines to connect various parts in the server, and executes various functions and processes data of the Chinese text correction device 8 based on spelling check by running or executing instructions, programs, code sets or instruction sets stored in the memory 92, and calling the data in the memory 92. Optionally, the processor 91 can be implemented in at least one hardware form of digital signal processing (Digital Signal Processing, DSP), field programmable gate array (Field-Programmable Gate Array, FPGA), and programmable logic array (Programble Logic Array, PLA). The processor 91 can integrate one or more combinations of a central processing unit 91 (Central Processing Unit, CPU), a graphics processor 91 (Graphics Processing Unit, GPU) and a modem. Among them, the CPU mainly processes the operating system, user interface and application programs; the GPU is responsible for rendering and drawing the content to be displayed on the touch display screen; the modem is used to process wireless communication. It can be understood that the above-mentioned modem may not be integrated into the processor 91, and it can be implemented by a single chip.

[0148] Among them, the memory 92 may include a random access memory 92 (Random Access Memory, RAM), and may also include a read-only memory 92 (Read-Only Memory). Optionally, the memory 92 includes a non-transitory computer-readable storage medium. The memory 92 can be used to store instructions, programs, codes, code sets or instruction sets. The memory 92 may include a program storage area and a data storage area, wherein the program storage area may store instructions for implementing an operating system, instructions for at least one function (such as touch instructions, etc.), instructions for implementing the above-mentioned various method embodiments, etc.; the data storage area may store data involved in the above-mentioned various method embodiments, etc. The memory 92 may also be optionally at least one storage device located away from the aforementioned processor 91.

[0149] The present application also provides a storage medium that can store multiple instructions, which are suitable for the processor to load and execute the above-mentioned Figures 1 to 7 For the specific implementation process, please refer to Figures 1 to 7 The specific description is not repeated here.

[0150] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.

[0151] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0152] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0153] In the embodiments provided by the present invention, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic. For example, the division of the modules or units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0154] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0155] 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 separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0156] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present invention implements all or part of the processes in the above-mentioned embodiment method, and can also be completed by instructing the relevant hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by a processor, the steps of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc.

[0157] The present invention is not limited to the above-mentioned embodiments. If various changes or modifications to the present invention do not depart from the spirit and scope of the present invention, and if these changes and modifications fall within the scope of the claims and equivalent technologies of the present invention, the present invention is also intended to include these changes and modifications.

Claims

1. A Chinese text correction method based on spelling check, characterized in that: The following steps are involved: Obtaining a Chinese text to be corrected and a document text of a specific field of the Chinese text to be corrected, wherein the document text includes a plurality of document block texts; Performing feature extraction on the Chinese text to be corrected and the plurality of document block texts to obtain feature vectors of the Chinese text to be corrected and the plurality of document block texts; According to the feature vectors of the Chinese text to be corrected and the plurality of document block texts, a plurality of target document block texts are extracted from the plurality of document block texts to construct a specific domain retrieval text of the Chinese text to be corrected; Constructing a case pool of a specific field of the Chinese text to be corrected, wherein the case pool includes several groups of specific text samples; According to the Chinese text to be corrected, extracting several groups of target specific text samples from the case pool of the specific field, and constructing a specific field case template for the Chinese text to be corrected; The Chinese text to be corrected and the specific field retrieval text and specific field case template of the Chinese text to be corrected are combined to construct an instruction sequence of the Chinese text to be corrected; the instruction sequence of the Chinese text to be corrected is input into a pre-trained large language model for text correction to obtain a correction result of the Chinese text to be corrected.

2. The Chinese text correction method based on spelling check according to claim 1, characterized in that: The feature vectors include semantic feature vectors, phonetic feature vectors and visual morphology feature vectors; The step of extracting features from the Chinese text to be corrected and the plurality of document block texts to obtain feature vectors of the Chinese text to be corrected and the plurality of document block texts comprises the following steps: Extracting semantic information from the Chinese text to be corrected and the plurality of document block texts to obtain a semantic information sequence of the Chinese text to be corrected and the plurality of document block texts; converting the semantic information sequence into a feature vector to obtain a semantic feature vector of the Chinese text to be corrected and the plurality of document block texts; Using a preset pinyin conversion tool, extracting pinyin information from the Chinese text to be corrected and the plurality of document block texts to obtain a pinyin information sequence of the Chinese text to be corrected and the plurality of document block texts, performing feature vector conversion on the pinyin information sequence to obtain a pinyin feature vector of the Chinese text to be corrected and the plurality of document block texts; An image feature encoding method is adopted to extract visual morphological information of the Chinese text to be corrected and several document block texts to obtain a visual morphological information sequence of the Chinese text to be corrected and several document block texts, and the visual morphological information sequence is converted into a feature vector to obtain a visual morphological feature vector of the Chinese text to be corrected and several document block texts.

3. The Chinese text correction method based on spelling check according to claim 2 is characterized in that: The method extracts a plurality of target document blocks from the plurality of document blocks according to the feature vectors of the Chinese text to be corrected and the plurality of document blocks, and constructs a specific domain retrieval text of the Chinese text to be corrected, including the steps of: Separately concatenate the semantic feature vectors, phonetic feature vectors, and visual morphology feature vectors of the Chinese text to be corrected and the same document block text to obtain original multimodal vectors of the Chinese text to be corrected and the multiple document block texts, and perform dimension conversion on the original multimodal vectors to obtain final multimodal vectors of the Chinese text to be corrected and the multiple document block texts; Based on the final multimodal vectors of the Chinese text to be corrected and the several document block texts, the similarity between the Chinese text to be corrected and the several document block texts is obtained. Based on the similarity, several target document block texts are extracted from the several document block texts to construct a specific field retrieval text of the Chinese text to be corrected.

4. The Chinese text correction method based on spelling check according to claim 3 is characterized in that: The step of constructing a case pool in a specific field of the Chinese text to be corrected comprises the following steps: Obtaining a plurality of correct texts in a specific field of the Chinese text to be corrected, and constructing a plurality of types of confusion sets, wherein the confusion sets include confusion subsets corresponding to a plurality of characters, and the confusion subsets include confusion probabilities between the characters and a plurality of corresponding similar characters; Obtaining first sampling probabilities of a plurality of characters in the correct text, and determining a plurality of characters to be replaced in the correct text according to the first sampling probability and a preset first sampling probability threshold, wherein the first sampling probability is used to determine whether a character is to be replaced; Obtaining second sampling probabilities of the characters to be replaced, and determining confusion subsets corresponding to the characters to be replaced according to the second sampling probabilities and a preset second sampling probability threshold, wherein the second sampling probability is used to determine the type of confusion set used for character replacement; Obtaining third sampling probabilities of several characters in the confusion subsets corresponding to the several characters to be replaced, and confirming target characters corresponding to the several characters to be replaced according to the third sampling probabilities and confusion probabilities between the characters in the corresponding confusion subsets and the corresponding several similar characters; The target character replaces the corresponding character to be replaced in the correct text, constructs a plurality of replacement texts corresponding to the correct text, and respectively combines a plurality of the correct texts with the corresponding replacement texts to construct a plurality of groups of the specific text samples.

5. The Chinese text correction method based on spelling check according to claim 4 is characterized in that: The confusion set includes a pinyin confusion set and a visual morphology confusion set; the pinyin confusion set includes pinyin confusion subsets corresponding to a number of characters, and the pinyin confusion subsets include pinyin confusion probabilities between the character and a number of corresponding similar characters; The visual morphology confusion set includes visual morphology confusion subsets corresponding to a plurality of characters, and the visual morphology confusion subsets include visual morphology confusion probabilities between the character and a plurality of corresponding similar characters; The construction of several types of obfuscation sets includes the following steps: Traverse the characters in the preset dictionary to obtain the pinyin information vectors and visual morphological feature vectors of several characters; Calculate similarity based on the pinyin feature vectors and visual morphology feature vectors of the characters respectively to obtain the pinyin similarity and visual morphology similarity between the characters; obtain a number of similar characters corresponding to the characters based on the pinyin similarity, visual morphology similarity and corresponding similarity thresholds, and construct a pinyin similar character set and a visual morphology similar character set corresponding to the characters; Confusion probability is calculated based on the pinyin similarity and visual morphology similarity between the characters in the pinyin similar character set and the visual morphology similar character set corresponding to the several characters and the corresponding several similar characters, to obtain the pinyin confusion probability and visual morphology confusion probability between the several characters and several similar characters, and to construct the pinyin confusion set and the visual morphology confusion set.

6. The Chinese text correction method based on spelling check according to claim 2, characterized in that: The method of extracting a plurality of target specific text samples from the case pool of the specific field according to the Chinese text to be corrected, and constructing a specific field case template of the Chinese text to be corrected comprises the following steps: Calculating the context probability of several groups of specific text samples in the case pool of the specific field respectively to obtain context probability data of the several groups of the specific text samples, wherein the context probability data of the specific text samples includes the probabilities between several context characters of the correct text and the replacement text; The text lengths of several groups of the specific text samples are obtained, and the fluency of the correct text and the replacement text in the several groups of the specific text samples is obtained according to the text lengths of the several groups of the specific text samples, the context probability data and the preset fluency calculation algorithm, and the fluency of the replacement text and the correct text in the same group of the specific text samples is subtracted to obtain the fluency difference of the several groups of the specific text samples, wherein the fluency calculation algorithm is: In the formula, fluency is fluency, x is the length of the text, and x i is the i-th character in the text, x <i is the previous character of the i-th character in the text, P(x i |x <i ) is the given context character x i and x <i The probability between Performing preliminary correction processing on the Chinese text to be corrected to obtain a preliminary corrected Chinese text, combining the Chinese text to be corrected and the preliminary corrected Chinese text to obtain a corrected text sample; performing context probability calculation on the corrected text sample to obtain context probability data of the corrected text sample, wherein the context probability data of the corrected text sample includes probabilities between a plurality of context characters of the Chinese text to be corrected and the preliminary corrected Chinese text; Obtaining the text length of the corrected text sample, obtaining the fluency of the Chinese text to be corrected and the preliminary corrected Chinese text in the corrected text sample according to the text length of the corrected text sample, context probability data and the fluency calculation algorithm, subtracting the fluency of the preliminary corrected Chinese text from the Chinese text to be corrected to obtain the fluency difference of the corrected text sample; According to the fluency difference and text length of the corrected text sample and several groups of specific text samples, several groups of target specific text samples are extracted from the several groups of specific text samples to construct a specific field case template for the Chinese text to be corrected.

7. The Chinese text correction method based on spelling check according to claim 6 is characterized in that: The method extracts several groups of target specific text samples from several groups of specific text samples according to the fluency difference and text length of the corrected text sample and several groups of specific text samples, including the steps of: If the text length of the corrected text sample differs from that of the specific text sample by a preset text length threshold, the specific text sample is used as a candidate specific text sample to obtain a plurality of candidate specific text samples; A proximity distance calculation method is adopted to obtain the proximity distance between the corrected text sample and several candidate specific text samples according to the fluency difference between the corrected text sample and several candidate specific text samples; according to the proximity distance, several groups of candidate specific text samples with the closest proximity distance to the corrected text sample are obtained as target specific text samples, and several groups of target specific text samples are extracted from the several groups of specific text samples.

8. A Chinese text correction device based on spelling check, characterized in that: include: A text acquisition module, used for acquiring a Chinese text to be corrected and a document text of a specific field of the Chinese text to be corrected, wherein the document text includes a plurality of document block texts; A feature extraction module, used for extracting features from the Chinese text to be corrected and the plurality of document block texts, and obtaining feature vectors of the Chinese text to be corrected and the plurality of document block texts; A text retrieval module, for extracting a plurality of target document blocks from the plurality of document blocks according to the feature vectors of the Chinese text to be corrected and the plurality of document blocks, and constructing a specific domain retrieval text of the Chinese text to be corrected; A case pool construction module, used to construct a case pool of a specific field of the Chinese text to be corrected, wherein the case pool includes several groups of specific text samples; A case template construction module is used to extract a plurality of target specific text samples from the case pool of the specific field according to the Chinese text to be corrected, and construct a specific field case template for the Chinese text to be corrected; The text correction module is used to combine the Chinese text to be corrected and the specific field retrieval text and specific field case template of the Chinese text to be corrected to construct an instruction sequence of the Chinese text to be corrected; input the instruction sequence of the Chinese text to be corrected into a pre-trained large language model for text correction to obtain the correction result of the Chinese text to be corrected.

9. A computer device, characterized in that: include: A processor, a memory, and a computer program stored in the memory and executable on the processor; when the computer program is executed by the processor, the steps of the Chinese text correction method based on spelling check as described in any one of claims 1 to 7 are implemented.

10. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the Chinese text correction method based on spelling check according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Named entity recognition method for Chinese medical records

    CN111783466A

  • Speech recognition text error correction method and system in specific field and storage medium

    CN112489655A

  • Text error correction method and device

    CN113051894A

  • Selling error correction model training method, spelling error correction method and storage medium

    CN115455948A

  • Video retrieval method and device based on multiple modes, electronic equipment and storage medium

    CN116628263A

Cited By

  • Chinese spelling error correction method based on multi-modal enhancement

    CN120579543A