Chinese statement error correction method and system based on semantic recognition

By constructing semantic graphs and common sense subgraphs, and combining graph energy and gradient deviation detection algorithms, the problems of insufficient common sense reasoning and cross-sentence understanding in existing technologies are solved, and more efficient Chinese sentence correction is achieved.

CN120911449AInactive Publication Date: 2025-11-07PUYANG VOCATIONAL & TECHN COLLEGE
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510949885.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-11-07
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

Existing semantic recognition-based Chinese sentence correction methods lack common sense reasoning ability and cross-sentence understanding, resulting in a high error rate in the correction results.

Method used

A semantic graph is constructed and a commonsense subgraph is retrieved. Error nodes are located by computing graph energy and gradient deviation detection algorithms, and error correction is performed in conjunction with the commonsense subgraph.

Benefits of technology

It improves the accuracy and precision of Chinese sentence correction, reduces misjudgments and omissions, and significantly enhances the correction effect, especially when dealing with polysemous words, ambiguous sentences and long sentence dependencies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120911449A_ABST
    Figure CN120911449A_ABST
Patent Text Reader

Abstract

The invention provides a Chinese statement error correction method and system based on semantic recognition, and relates to the technical field of natural language processing, and the method comprises the steps: obtaining a statement to be corrected; constructing a semantic graph of the statement to be corrected; taking the semantic graph nodes as retrieval targets, and retrieving and constructing common sense sub-graphs of the semantic graph; graph energy describing semantic consistency between the semantic graph nodes and the related common sense sub-graph nodes is calculated, and the graph energy and the semantic consistency are in negative correlation; under the condition that the graph energy is greater than preset graph energy, positioning error nodes in the statement to be corrected through a gradient deviation detection algorithm in combination with semantic consistency; and error correction is carried out on error nodes by combining the common sense sub-graph and graph energy. According to the Chinese statement error correction method based on semantic recognition, the deep meaning of a sentence can be more accurately understood by introducing a semantic graph and a common sense sub-graph, and the defects of a traditional method in the aspects of context understanding and common sense reasoning are overcome.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of natural language processing, in particular to a Chinese sentence error correction method and system based on semantic recognition. BACKGROUND

[0002] Semantic recognition refers to the understanding of words, phrases or sentences in text or language through computer technology, so as to recognize its actual meaning. This technology usually uses natural language processing (NLP) methods such as syntax analysis, part-of-speech tagging, dependency relationship analysis, named entity recognition, etc. to capture semantic information in language. Chinese sentence error correction refers to correcting errors in grammar, spelling, vocabulary or semantics in Chinese sentences through automated means, so that the sentence is more in line with language norms and expression intent. This usually involves spelling errors, grammatical structure problems, context logic problems, etc.

[0003] The most core difficulty in Chinese sentence error correction is the lack of clear criteria and boundaries for semantic errors, i.e. the same sentence may be semantically correct or incorrect in different contexts, and the model has difficulty in unifying the criteria. As an ideographic language, Chinese has complex grammar and semantics. Traditional error correction methods often focus on surface errors (such as spelling errors, punctuation errors), but lack effective identification of potential semantic errors in sentences. By introducing semantic recognition technology, the meaning of the sentence can be understood in depth, and semantic inconsistencies or context inconsistencies can be automatically identified and corrected, thereby improving the error correction effect. Especially in the case of ambiguous words, polysemous words or long sentence dependency relationships, semantic-based error correction methods can more accurately capture the complex semantic level of language, significantly improving the quality and accuracy of Chinese sentences.

[0004] However, existing Chinese sentence error correction methods based on semantic recognition lack common sense reasoning ability and cross-sentence understanding, often failing to accurately capture the deep semantics in the context, resulting in high error rate of correction results. SUMMARY

[0005] In view of the above deficiencies of the prior art, the purpose of the embodiments of the present application is to provide a Chinese sentence error correction method based on semantic recognition, which can solve the technical problem that the existing Chinese sentence error correction method based on semantic recognition lacks common sense reasoning ability and cross-sentence understanding, often failing to accurately capture the deep semantics in the context, resulting in high error rate of correction results.

[0006] The first aspect of the embodiments of the present application proposes a Chinese sentence error correction method based on semantic recognition, comprising:

[0007] S1: obtaining a sentence to be corrected;

[0008] S2: constructing a semantic graph of the sentence to be corrected;

[0009] S3: taking the semantic graph node as a retrieval target, retrieving and constructing a common sense subgraph of the semantic graph;

[0010] S4: calculating a graph energy describing semantic consistency between the semantic graph node and a related common sense subgraph node, wherein the graph energy is negatively correlated with the semantic consistency;

[0011] S5: in a case where the graph energy is greater than a preset graph energy, locating an error node in the sentence to be corrected by a gradient deviation detection algorithm in combination with the semantic consistency;

[0012] S6: correcting the error node in combination with the common sense subgraph and the graph energy.

[0013] The second aspect of the embodiment of the present application provides a Chinese sentence correction system based on semantic recognition, comprising a processor and a memory.

[0014] The memory stores programs or instructions executable on the processor, and the programs or instructions are executed by the processor to implement the steps of the Chinese sentence correction method based on semantic recognition of the first aspect.

[0015] The technical scheme provided by the embodiment of the present application has at least the following beneficial effects:

[0016] In the embodiment of the present application, the Chinese sentence correction method based on semantic recognition can more accurately understand the deep meaning of the sentence by introducing the semantic graph and the common sense subgraph, overcoming the shortcomings of traditional methods in context understanding and common sense reasoning. First, the semantic graph construction can effectively capture the dependency relationship between words, and the knowledge background of the model is enriched through the common sense subgraph extension. By calculating the graph energy, the method can accurately evaluate the semantic consistency of the sentence, locate the potential error node, and then efficiently detect the error through the gradient deviation detection algorithm. Finally, the error is corrected in combination with the common sense reasoning, so that the model is not limited to local grammar structure, but can understand a wider context and common sense of the real world, significantly improving the correction accuracy and reducing false positives and false negatives. BRIEF DESCRIPTION OF DRAWINGS

[0017] The accompanying drawings are included to provide a further understanding of the embodiments of the present application, and are incorporated herein and constitute a part of the detailed description. It should be apparent to those skilled in the art that the accompanying drawings are only a few embodiments of the present application, and other drawings can be obtained from the accompanying drawings without creative labor.

[0018] Figure 1 is a flowchart of a Chinese sentence correction method based on semantic recognition provided by the embodiment of the present application;

[0019] Figure 2is a structural schematic diagram of a Chinese sentence error correction system based on semantic recognition provided by an embodiment of the present application. DETAILED DESCRIPTION

[0020] In order for those skilled in the art to better understand the technical solutions in the embodiments of the present application, the technical solutions of the present application will be described clearly and completely below in conjunction with the drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. It should be understood that these descriptions are only exemplary and are not used to limit the scope of the present application. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative labor should belong to the scope of protection of the present application.

[0021] The Chinese sentence error correction method based on semantic recognition provided by the embodiments of the present application will be described in detail below in conjunction with the drawings, specific embodiments and application scenarios.

[0022] Reference is made to the accompanying drawings Figure 1 , which shows a flowchart of a Chinese sentence error correction method based on semantic recognition provided by an embodiment of the present application.

[0023] The embodiments of the present application provide a Chinese sentence error correction method based on semantic recognition, which can include the following steps:

[0024] S1: obtaining a sentence to be corrected.

[0025] The sentence to be corrected refers to a Chinese sentence or text that needs to be processed by semantic error correction.

[0026] S2: constructing a semantic graph of the sentence to be corrected.

[0027] The semantic graph is a graph structure constructed by analyzing the words and their mutual relationships in the sentence to be corrected. The nodes of the graph represent the words in the sentence, and the edges represent the semantic or dependency relationships between the words. By constructing the semantic graph, the grammatical and semantic relationships between the words in the sentence can be clearly revealed. In this way, the model can effectively identify the structure and potential errors of the sentence, especially for long sentences or complex structured sentences. The semantic graph can provide more rich context information than the traditional syntax tree, thereby improving the accuracy of sentence error correction.

[0028] In one possible implementation, S2 specifically includes:

[0029] S201: obtaining the words in the sentence to be corrected and the inter-word distance between the words.

[0030] Specifically, the inter-word distance can be directly obtained by a dependency syntax analysis tool.

[0031] S202: Obtain the word types and dependency relationships of each word in the sentence to be corrected using a dependency syntax analysis tool.

[0032] The dependency syntax analysis tool can be Stanford Parser, LTP, etc.

[0033] S203: Construct a semantic graph according to the word types and dependency relationships, wherein the nodes of the semantic graph are the words in the sentence to be corrected, the node attributes are the word types of the corresponding words, the edges of the semantic graph are the dependency relationships between the words, and the edge weights are negatively correlated with the word distances.

[0034] The calculation formula of the edge weight is specifically:

[0035]

[0036] wherein, represents the edge weight between the ith node and the jth node in the semantic graph, represents the word distance between the words corresponding to the ith node and the jth node in the sentence to be corrected, represents the function, represents the attenuation factor controlling the degree of influence of the word distance on the edge weight.

[0037] Specifically, the entire process accurately obtains the word types and dependency relationships between the words in the sentence to be corrected through the dependency syntax analysis tool, which can comprehensively capture the grammatical structure information of the sentence. By constructing a semantic graph, not only can the direct grammatical relationships between the words be represented, but also the long-range dependency problem can be solved by calculating the negatively correlated edge weight of the word distance, thereby making up for the insufficient handling of long sentence structures or complex dependency relationships in traditional methods. By adjusting the edge weight through the soft-max (softmax) function, the influence of the dependency relationship has the ability to dynamically adjust, further improving the adaptability of the semantic graph to local and long-range dependencies in the correction process, and enhancing the overall accuracy and generalization ability of the model.

[0038] S3: Take the nodes of the semantic graph as the retrieval target, retrieve and construct a common sense subgraph of the semantic graph.

[0039] The common sense subgraph is a graph structure constructed by retrieving external knowledge bases or common sense information related to the nodes of the semantic graph. It is composed of some nodes and edges, and these nodes represent specific common sense entities (such as people, places, and objects), while the edges represent the relationships between entities (such as "belongs to", "acts on", etc.). The common sense subgraph usually comes from external knowledge graphs such as CN-DBpedia, etc., and covers general knowledge and common sense in the real world. By combining these common sense information with the semantic graph, the semantic background of the sentence can be enriched, helping to correct potential semantic errors.

[0040] By searching and constructing the common sense subgraph, the model can not only be limited to the surface structure of the sentence, but also understand the common sense information behind the sentence. This common sense reasoning ability can effectively make up for the shortcomings of the model in semantic recognition, especially in the face of polysemous words, ambiguous sentences or unclear context, it can provide more background knowledge, which helps to improve the accuracy of sentence correction.

[0041] In a possible implementation, S3 specifically includes:

[0042] S301: Retrieving polysemous words corresponding to the semantic graph node to expand the semantic graph node, wherein each polysemous word is a semantic graph node.

[0043] Specifically, the polysemous words can be obtained by screening the nodes in the semantic graph through a predefined polysemous word table (such as the polysemous word library of HowNet or CN-DBpedia).

[0044] S302: Match the expanded semantic graph node to the target entity of the external knowledge graph through entity linking technology, wherein the cosine similarity between the target entity and the semantic graph node with a linking relationship is greater than a preset cosine similarity.

[0045] Optionally, the entity linking technology can be the entity linking module of LTP, and the external knowledge graph can be CN-DBpedia. It should be noted that the size of the preset cosine similarity can be set according to actual needs, which is not limited in the present application.

[0046] S303: Take each target entity as a common sense subgraph node, expand the common sense relationship of each target entity through breadth-first search, and obtain the edges of each common sense subgraph node, wherein the common sense relationship includes a category relationship describing the type of the target entity, an action-object relationship describing the action object of the target entity, an attribute relationship describing the inherent attribute of the target entity, and a constraint relationship describing the prohibited behavior of the target entity, wherein the expansion layer is a preset expansion layer.

[0047] Wherein, the breadth-first search is an algorithm for traversing the graph structure, starting from the given target entity node, searching its adjacent nodes layer by layer, and continuing to search until the preset expansion layer is reached.

[0048] The common sense relationship refers to various types of relationships between the target entity and other entities, including: category relationship: describing the type or classification of the target entity, such as "apple is a fruit". Action-object relationship: describing the relationship between the target entity and its action object, such as "doctor treats patient". Attribute relationship: describing the inherent attribute of the target entity, such as "apple is red". Constraint relationship: describing the behavior or restriction that the target entity can perform, such as "apple cannot fly".

[0049] It should be noted that the breadth search can comprehensively collect the background information of the target entity by expanding the multi-layer common sense relationship of the target entity, and enrich the nodes and edges of the common sense subgraph. This not only enhances the model's understanding of multi-dimensional information of the entity, but also can handle complex entity relationships and provide more accurate semantic reasoning capabilities. Through the preset number of expansion layers, the depth and efficiency of the search can be effectively balanced, making the common sense reasoning more comprehensive and efficient.

[0050] Specifically, through multi-step expansion and fusion, the richness and accuracy of the semantic graph can be effectively enhanced. First, ambiguous words are retrieved and the semantic graph nodes are expanded, which can effectively capture the multiple meanings of words and solve ambiguity problems. Second, entity linking technology matches the semantic graph nodes with entities in the external knowledge graph, thereby providing the semantic graph with more extensive common sense information and improving the accuracy of semantic understanding. Finally, the breadth search expands the common sense relationship, which can deeply mine the multi-dimensional relationship between the target entity and other entities, and construct a comprehensive common sense subgraph. Through the organic combination of these steps, the overall scheme can better solve the problems of semantic ambiguity, long-range dependence and common sense reasoning, and improve the accuracy and intelligence of Chinese sentence correction.

[0051] S4: Calculate the graph energy representing the semantic consistency between the semantic graph nodes and the related common sense subgraph nodes, wherein the graph energy is negatively correlated with the semantic consistency.

[0052] The semantic consistency refers to the matching degree between the semantic graph nodes (words in the sentence) and the common sense subgraph nodes (common sense entities), which measures their semantic similarity or consistency. The graph energy is a measure calculated based on the semantic consistency, representing the overall semantic compatibility between the semantic graph and the common sense subgraph. The value of the graph energy is negatively correlated with the semantic consistency, i.e. the higher the semantic consistency, the lower the graph energy, indicating better matching between the semantic graph and the common sense subgraph. A low graph energy indicates that there are fewer semantic errors in the sentence, and vice versa, indicating that there are larger semantic inconsistencies, which may need to be corrected.

[0053] By calculating the semantic consistency and the graph energy, the degree of fit between the semantics and the common sense in the sentence can be quantified. The calculation of the graph energy helps to effectively identify semantic anomalies and can find parts that are not logically consistent or violate common sense, providing a scientific basis for subsequent error localization and correction. This method can more accurately identify semantic errors than traditional grammar-based correction methods, improving the accuracy and effectiveness of correction.

[0054] In one possible implementation, S4 specifically includes:

[0055] S401: Calculate the semantic compatibility, i.e. the semantic consistency, between the semantic graph nodes and the common sense subgraph nodes using an exponential function and a sigmoid activation function.

[0056] The calculation formula is specifically:

[0057]

[0058] wherein, denotes a natural exponential function, and denote embedding vectors of semantic graph nodes and common sense subgraph nodes respectively, denotes a scaling parameter controlling the influence degree of the Euclidean distance pair calculation result, denotes an activation function, denotes splicing and , denotes a learnable weight vector adjusting the importance of different features, and the superscript T denotes transposition, denotes semantic compatibility of semantic graph nodes and common sense subgraph nodes , wherein the common sense subgraph node v is a target entity having a matching relationship with the semantic graph node .

[0059] wherein, the exponential term (embedding similarity) captures intuitive semantic similarity (such as a small difference in embedding between “Apple mobile phone” and “Apple company”), and the sigmoid term (nonlinear feature combination) captures more complex semantic relationships (such as the implicit relationship that “Apple mobile phone” is “a product of Apple company”). Multiplying the two can integrate both types of information to more comprehensively measure semantic compatibility.

[0060] Specifically, the embedding vector can be a Word2Vec embedding vector. By combining the exponential function and the sigmoid activation function, intuitive semantic similarity and more complex implicit relationships between semantic graph nodes and common sense subgraph nodes can be captured. The exponential function measures the similarity of embedding vectors through the Euclidean distance, and the sigmoid function can handle more complex nonlinear feature combinations. Splicing the embedding vectors and introducing a learnable weight vector allows the model to flexibly adjust the importance of features, thereby more accurately evaluating semantic compatibility. This method can enhance the accuracy and expressiveness of semantic matching and improve semantic reasoning ability, especially when dealing with polysemous words and long-distance dependencies.

[0061] S402: Calculate the semantic feature difference between the semantic feature vectors of the semantic graph edge and the common sense subgraph edge, wherein the common sense subgraph nodes included in the common sense subgraph edge include one of the semantic graph nodes corresponding to the semantic graph edge.

[0062] The calculation formula of the feature difference is specifically:

[0063]

[0064] wherein, denotes the semantic feature difference value, denotes the cosine function, and denote the semantic feature vectors of the semantic graph edge and the common sense subgraph edge, respectively.

[0065] It should be noted that by calculating the cosine similarity between the semantic feature vectors, the semantic feature difference between the semantic graph edge and the common sense subgraph edge can be accurately measured. The cosine similarity can effectively evaluate the similarity of the two in the vector space, thereby identifying the semantic inconsistency or conflict. By comparing the feature vectors, the model can capture more detailed semantic differences and avoid superficial similarity errors. This calculation method makes the matching of semantic relationships more accurate, which helps to correct semantic errors in sentences, especially in complex semantic structures to improve recognition.

[0066] S403: Detect the semantic conflict value between the semantic graph edge and the common sense subgraph edge by the conflict detection function.

[0067] The calculation formula of the semantic conflict value is specifically:

[0068]

[0069] wherein, denotes the maximum value, denotes the conflict detection function, denotes the semantic graph edge corresponding to node i and node j in the semantic graph, denotes the common sense subgraph.

[0070] wherein, the parameter calculates whether the semantic graph edge corresponding to ij conforms to the constraint of the common sense subgraph. If so, the value is 0, i.e. it conforms to the constraint in the common sense subgraph, otherwise, the value is 1, i.e. it violates the constraint in the common sense subgraph.

[0071] It should be noted that the conflict detection function can effectively identify the inconsistency between the semantic graph edge and the common sense subgraph edge. If the edge in the semantic graph does not conform to the constraint in the common sense subgraph, the conflict detection function will mark these conflicts, and then the maximum value function is weighted to highlight the part that does not conform to the common sense. This mechanism can help the model to discover potential semantic errors or contradictions, especially in complex semantic relationships, which helps to improve the accuracy of sentence correction. Through such a detection process, the model can more accurately judge whether the semantics is reasonable, effectively avoiding the propagation of semantic errors.

[0072] S404: Calculate the graph energy of semantic consistency between the description semantic graph node and the related common sense subgraph node by combining semantic consistency, semantic feature difference and semantic conflict value.

[0073] The calculation formula of the graph energy is specifically:

[0074]

[0075]

[0076] wherein, represents the graph energy of semantic consistency between the description semantic graph node and the related common sense subgraph node, represents the energy conversion function for converting semantic consistency into energy.

[0077] Specifically, the semantic consistency is quantified based on the graph energy, which can comprehensively measure the semantic consistency between the semantic graph node and the common sense subgraph node. First, by combining the exponential function and the sigmoid function, intuitive semantic similarity and more complex implicit relationships can be captured at the same time, improving the accuracy of semantic matching. Second, by calculating the semantic feature difference and the conflict detection function, the contradictions and inconsistencies between the semantic graph and the common sense subgraph can be accurately identified, thereby effectively judging the errors in the sentence. Finally, the calculation of the graph energy integrates semantic consistency, feature difference and conflict information, making the sentence correction more comprehensive and detailed. This method effectively improves the reasoning ability at the semantic level, and for complex long sentences and sentences with strong context dependence, it can provide higher correction accuracy and accuracy.

[0078] S5: In the case where the graph energy is greater than the preset graph energy, combine the semantic consistency and locate the error node in the sentence to be corrected by the gradient deviation detection algorithm.

[0079] wherein, the gradient deviation detection algorithm is an algorithm based on optimization method, which uses the gradient information of the graph energy to find the error node in the semantic graph. By calculating the gradient of the graph energy with respect to the semantic graph node, the algorithm can identify the area with larger graph energy, thereby locating the potential semantic error node. The error node refers to the word or relationship in the semantic graph that is inconsistent with the common sense subgraph or semantically unreasonable. The gradient deviation detection algorithm can accurately locate the error node in the sentence by calculating the change of the graph energy, and further optimize the detection result by combining the semantic consistency. Unlike traditional rule-based methods, this gradient-based detection method can efficiently capture semantic-level abnormalities and can adapt to complex context changes, helping to improve the accuracy of sentence correction, especially in the case of polysemous words and long sentence dependence, it can effectively avoid misjudgment and omission.

[0080] It should be noted that the size of the preset graph energy can be set by the person skilled in the art according to actual needs, and the present application does not limit this.

[0081] In one possible implementation, S5 specifically includes:

[0082] S501: Calculate the gradient value of each semantic graph node corresponding to the to-be-corrected sentence relative to the graph energy.

[0083] In one possible implementation, the calculation formula of the gradient value is specifically:

[0084]

[0085] wherein, denotes the embedding vector of the u-th semantic graph node relative to the graph energy .

[0086] It should be noted that this method of calculating the gradient value can quantify the relationship between the semantic graph node embedding vector and the graph energy, and then measure the influence of the node on the overall graph energy. By calculating the gradient, it can be identified which nodes play a key role in semantic consistency and graph energy, thereby helping to accurately locate the error nodes. Using the Euclidean norm (L2 norm) to calculate the gradient value can ensure the sensitivity and stability of the node changes, avoid overfitting, and improve the generalization ability of the model in complex semantic structures.

[0087] S502: Sort the corresponding semantic graph nodes according to the gradient value.

[0088] S503: Calculate the semantic consistency of each semantic graph node relative to the common sense subgraph node after sorting.

[0089] wherein, the calculation method of the semantic consistency is the same as the principle of .

[0090] S504: Output the semantic graph node with a semantic consistency value less than a preset semantic consistency value as an error node.

[0091] It should be noted that the size of the error node can be set by the person skilled in the art according to actual needs, and the present application does not limit this.

[0092] Specifically, the process can accurately locate the potential error nodes in the sentence by calculating the gradient values of the semantic graph nodes relative to the graph energy. The ranking of the gradient values helps the model identify the parts that need to be corrected the most, so that the nodes with greater impact are prioritized. By further calculating the semantic consistency, the model can ensure a high degree of matching to the common sense subgraph nodes, thereby improving the accuracy of the correction. When the semantic consistency is lower than the preset value, the system can efficiently identify and output the error nodes. This step-by-step screening and optimization process can enhance the model's semantic understanding ability and improve the correction effect, especially in complex sentences and long-range dependencies.

[0093] S6: Correcting the error nodes in combination with the common sense subgraph and the graph energy.

[0094] In one possible implementation, S6 specifically includes:

[0095] S601: Retrieving candidate words for the error node corresponding words from the common sense subgraph.

[0096] Specifically, the candidate words for the error node corresponding words can be retrieved from the common sense subgraph through traversal retrieval.

[0097] S602: Replacing the corresponding error nodes in the semantic graph with the candidate words to obtain multiple corrected semantic graphs.

[0098] S603: Calculating the corrected semantic graph energy corresponding to each corrected semantic graph.

[0099] S604: Outputting the corrected sentence corresponding to the corrected semantic graph with the minimum corrected semantic graph energy as the correction result of each error correction node.

[0100] S605: Outputting the corrected sentence to complete the error correction of the sentence to be corrected.

[0101] Specifically, through the retrieval and replacement of candidate words, different correction schemes can be flexibly explored, providing multiple possible correction results. Each corrected semantic graph is calculated by the graph energy to ensure that the selected correction scheme is not only semantically consistent but also consistent with the common sense constraints. By selecting the corrected semantic graph with the minimum graph energy, the process can effectively avoid incorrect semantic reasoning and ensure that the corrected sentence is more accurate in terms of semantics and structure. This step-by-step optimization process, combined with common sense reasoning and graph energy evaluation, can significantly improve the accuracy and effectiveness of the correction, especially in complex sentences or situations with large changes in context.

[0102] In one possible implementation, after S6, it further includes:

[0103] Determine whether the energy of the error correction statement graph is less than or equal to the preset graph energy. If so, output the error correction statement as the error correction result of the statement to be corrected. Otherwise, return to step S5 and perform a second error correction on the error correction statement until the energy of the error correction statement graph is less than the preset graph energy.

[0104] In one possible implementation, the formula for determining whether the energy of the error-correcting statement graph is less than the preset graph energy is as follows:

[0105]

[0106] in, A semantic graph representing the error correction statement. Represents a common-sense subgraph. Description and Graph energy with semantic consistency between them.

[0107] It should be noted that through continuous evaluation and iterative optimization of graph energy, the semantic consistency between the corrected statement and the common sense subgraph is ensured to meet the expected standards. Initial correction results may be imperfect; through repeated optimization, the quality of the corrected statement can be gradually improved until the optimal solution is reached. Graph energy, as the optimization standard, can automatically adjust the correction strategy during each correction, ensuring that the final output statement conforms to grammatical rules and possesses reasonable semantic consistency, thereby improving the accuracy and robustness of the correction.

[0108] In practical applications, this solution combines semantic graphs and common-sense subgraphs to construct a precise Chinese sentence correction method. First, a semantic graph is built using dependency parsing and word relationships to comprehensively capture the grammatical structure and semantic dependencies within sentences. Next, common-sense reasoning and breadth-first search are used to expand the common-sense subgraph, enriching the background knowledge of the sentences and improving the accuracy of semantic understanding. Then, a graph energy evaluation mechanism is used, along with gradient bias detection and semantic consistency judgment, to locate error nodes. Through multiple optimizations, the final output sentence is ensured to conform to grammatical and common-sense standards, effectively reducing the error rate and improving the accuracy of the correction results.

[0109] The beneficial effects of the technical solutions provided in the embodiments of the present invention include at least the following:

[0110] In the embodiment of the present application, the Chinese sentence error correction method based on semantic recognition can more accurately understand the deep meaning of the sentence by introducing semantic graphs and common sense subgraphs, overcoming the shortcomings of traditional methods in context understanding and common sense reasoning. First, semantic graph construction can effectively capture the dependency relationship between words, and through common sense subgraph expansion, the knowledge background of the model is enriched. By calculating the graph energy, the method can accurately evaluate the semantic consistency of the sentence, locate the potential error nodes, and then efficiently detect errors through the gradient deviation detection algorithm. Finally, combined with common sense reasoning for error correction, the model is not limited to local grammar structure, but can also understand a wider context and common sense in the real world, significantly improving the accuracy of error correction and reducing false positives and false negatives.

[0111] Referring to the accompanying drawings Figure 2 , a structure schematic diagram of a Chinese sentence error correction system based on semantic recognition provided by an embodiment of the present application is shown.

[0112] The embodiment of the present application provides a Chinese sentence error correction system 20 based on semantic recognition, comprising a processor 201 and a memory 202.

[0113] The memory 202 stores programs or instructions executable on the processor 201, and the programs or instructions are executed by the processor 201 to realize the steps of the above-mentioned Chinese sentence error correction method based on semantic recognition, and can achieve the same technical effects. To avoid repetition, the present application will not be described again.

[0114] It should be understood that the processor 201 in the embodiment of the present application can be a central processing unit (CPU), and the processor can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), ready-to-program gate arrays (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc.

[0115] It is also to be understood that the memory 202 in embodiments of the present application can be volatile or nonvolatile memory, or can include both volatile and nonvolatile memory. Nonvolatile memory can be read-only memory (ROM), programmable ROM (PROM), erasable programmable ROM (EPROM), electrically EPROM (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), which is used as external cache. By way of example, and not limitation, many forms of random access memory can be used, such as static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double-data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), Synchlink DRAM (SLDRAM), and direct Rambus RAM (DR RAM).

[0116] The above-described embodiments can be implemented in whole or in part by software, hardware (e.g., circuitry), firmware, or any combination of the three. When implemented in software, the above-described embodiments can be implemented in the form of one or more computer programs that are stored in a computer-readable storage medium. The computer-readable storage medium stores one or more computer instructions or computer programs that, when loaded into a computer, cause the computer to perform the processes or functions described in the embodiments of the present application. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable apparatus. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, such as from a website, a computer, a server, or a data center to another website, computer, server, or data center, via a wired (e.g., infrared, wireless, microwave, etc.) manner. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that contains one or more collections of available media. The available media can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium. The semiconductor medium can be a solid-state disk.

[0117] It should be understood that the size of the sequence number of each process described above in various embodiments of the present application does not mean the order of execution, and the execution order of each process should be determined by its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0118] Those of ordinary skill in the art can realize that the units and algorithm steps of the examples described in conjunction with the embodiments disclosed herein can be realized in electronic hardware, or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. A skilled person can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present application.

[0119] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described devices, apparatuses, and units can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.

[0120] In several embodiments provided by the present application, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other manners. For example, the embodiments of the apparatus described above are merely schematic. For example, the division of the units is only a logical function division. There can be another division manner for the actual implementation. For example, a plurality of units or components can be combined or integrated into another device, or some features can be ignored or not executed. In addition, the displayed or discussed mutual couplings or direct couplings or communication connections between different units, can be indirect couplings or communication connections through some interfaces, devices or units, and can be in electrical, mechanical or other forms.

[0121] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

[0122] In addition, each functional unit in each embodiment of the present application can be integrated into a processing unit, or each unit can be physically present separately, or two or more units can be integrated into one unit.

[0123] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the part of the technical solutions that essentially contribute to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, and various media that can store program codes.

[0124] The embodiment of the present application provides a readable storage medium, which includes: a program or instruction stored on the readable storage medium, the program or instruction is executed by a processor to realize the steps of the above-mentioned Chinese sentence error correction method based on semantic recognition, and the same technical effect can be achieved. To avoid repetition, the present application will not be described again.

[0125] It should be pointed out finally that the above embodiments are only used to illustrate the technical solutions of the embodiments of the present application, but not to limit them. Although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those skilled in the art that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced equivalently; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application. Any changes or replacements that can be easily thought of by those skilled in the art within the technical scope disclosed by the present application should be covered within the protection scope of the present application.

Claims

1. A Chinese sentence error correction method based on semantic recognition, characterized in that, The method comprises: S1: obtaining a to-be-corrected sentence; S2: constructing a semantic graph of the to-be-corrected sentence; S3: taking a semantic graph node as a search target, searching and constructing a common sense subgraph of the semantic graph; S4: calculating a graph energy describing semantic consistency between the semantic graph node and a related common sense subgraph node, wherein the graph energy is negatively correlated with the semantic consistency; S5: in the case that the graph energy is greater than a preset graph energy, locating an error node in the to-be-corrected sentence by a gradient deviation detection algorithm in combination with the semantic consistency; S6: correcting the error node in combination with the common sense subgraph and the graph energy.

2. The method according to claim 1, wherein, The S2 specifically comprises: S201: obtaining words in the to-be-corrected sentence and word-to-word distances between the words; S202: obtaining word parts of speech and dependency relationships of the words in the to-be-corrected sentence by using a dependency syntax analysis tool; S203: constructing the semantic graph according to the word parts of speech and the dependency relationships, wherein a node of the semantic graph is a word in the to-be-corrected sentence, a node attribute is a word part of speech of a word corresponding to the node, an edge of the semantic graph is a dependency relationship between the words, and an edge weight is negatively correlated with the word-to-word distance.

3. The method according to claim 1, wherein, The S3 specifically comprises: S301: searching for polysemous words corresponding to the semantic graph node to expand the semantic graph node, wherein each polysemous word is taken as a semantic graph node; S302: matching the expanded semantic graph node to a target entity of an external knowledge graph by an entity linking technology, wherein a cosine similarity between the target entity and a semantic graph node having a linking relationship is greater than a preset cosine similarity; S303: taking each target entity as a common sense subgraph node, extending a common sense relationship of each target entity by breadth search to obtain an edge of each common sense subgraph node, wherein the common sense relationship comprises a category relationship describing a type of the target entity, an action-object relationship describing an action object of the target entity, an attribute relationship describing an inherent attribute of the target entity, and a constraint relationship describing an action prohibited to be performed by the target entity, and an expansion layer number is a preset expansion layer number.

4. The method according to claim 1, wherein, The S4 specifically comprises: S401: calculating a semantic compatibility between the semantic graph node and the common sense subgraph node, i.e., the semantic consistency, in combination with an exponential function and a sigmoid activation function; S402: calculating a semantic feature difference between semantic feature vectors of edges of the semantic graph and edges of the common sense subgraph, wherein the common sense subgraph nodes included in the edges of the common sense subgraph include one of the semantic graph nodes corresponding to the edges of the semantic graph; S403: detecting a semantic conflict value between the edges of the semantic graph and the edges of the common sense subgraph by a conflict detection function; S404: calculating a graph energy describing semantic consistency between the semantic graph node and the related common sense subgraph node in combination with the semantic consistency, the semantic feature difference, and the semantic conflict value.

5. The method according to claim 1, wherein, The S5 specifically comprises: S501: calculating gradient values of each semantic graph node corresponding to the to-be-corrected sentence relative to the graph energy; S502: sort the corresponding semantic graph nodes according to the gradient value size; S503: calculate the semantic consistency of each sorted semantic graph node relative to the common sense subgraph node; S504: output the semantic graph node with a semantic consistency value less than a preset semantic consistency value as the error node.

6. The method according to claim 5, wherein, The calculation formula of the gradient value is specifically: ; wherein, denotes an embedding vector of the u-th semantic graph node a gradient value with respect to the graph energy .

7. The method according to claim 1, wherein, The S6 specifically includes: S601: retrieve candidate words of the error node corresponding words from the common sense subgraph; S602: replace the corresponding error nodes in the semantic graph with the candidate words to obtain a plurality of corrected semantic graphs; S603: calculate the corrected semantic graph energy corresponding to each corrected semantic graph; S604: output the error correction result of each error correction node as the error correction result of the error correction sentence corresponding to the corrected semantic graph with the minimum corrected semantic graph energy; S605: output the error correction sentence to complete the error correction of the to-be-corrected sentence.

8. The method according to claim 7, wherein, After the S6, it further includes: determining whether the error correction sentence graph energy is less than or equal to the preset graph energy, if yes, outputting the error correction sentence as the error correction result of the to-be-corrected sentence, otherwise, returning to step S5 to perform secondary error correction on the error correction sentence until the error correction sentence graph energy is less than the preset graph energy.

9. The method according to claim 8, wherein, The formula for determining whether the error correction sentence graph energy is less than the preset graph energy is: ; wherein, represents a semantic graph corresponding to the error correction sentence, represents a common sense sub-graph, represents a graph describing the semantic consistency between the graph energy.

10. A Chinese sentence error correction system based on semantic recognition, characterized in that, It includes: a processor and a memory; The memory stores programs or instructions executable on the processor, and the programs or instructions are executed by the processor to implement the steps of the Chinese sentence error correction method based on semantic recognition in any one of claims 1 to 9.