Text error correction method, device and computer readable medium

By obtaining and analyzing the co-occurrence feature information of text and adjacent text in the table and calculating the sorting score, the problem that traditional error correction solutions cannot handle two-dimensional text is solved, and accurate error correction of table text is achieved.

CN113919327BActive Publication Date: 2024-11-08ALIBABA GROUP HOLDING LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202010647975.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-07-07
Publication Date
2024-11-08
Estimated Expiration
2040-07-07

AI Technical Summary

Technical Problem

Traditional text error correction solutions cannot be applied to text carriers such as tables, and cannot effectively handle spelling errors in two-dimensional text.

Method used

By obtaining the original text of the target cell and the text of adjacent cells, using the knowledge base to obtain error correction text, and compute the co-occurrence feature information between the candidate text and the adjacent text to determine the sorting score, thereby accurately correcting the target cell. text.

Benefits of technology

It realizes text error correction in text carriers such as tables, improves the accuracy and efficiency of error correction, and is suitable for various two-dimensional text carriers.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113919327B_ABST
    Figure CN113919327B_ABST
Patent Text Reader

Abstract

The present application provides a text correction method, which is used to correct two-dimensional text in text carriers such as tables. Since the position and content of the text in text carriers such as tables are relatively fixed, the text at the target cell position and the text at the adjacent cell position will show a certain correlation according to the actual application scenario, and the sorting feature information of the candidate text at least includes the co-occurrence feature information between the candidate text and the adjacent text. The sorting score calculated based on this can represent the possibility of the candidate text appearing in the target cell, so the text at the target cell position can be accurately corrected according to the possibility.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of information technology, and in particular to a text error correction method, device and computer-readable medium. Background Art

[0002] When people use various input tools to input text, various input errors may occur, such as spelling, similarity in shape, similarity in pronunciation, etc. Similarly, when recognizing text through OCR (Optical Character Recognition), it is also easy to cause errors in the recognized text due to errors in the recognition process. On the one hand, spelling errors will make the text more easily misunderstood and affect the efficiency of people's text communication; on the other hand, in many rigorous document scenarios, such as judicial and contractual situations, the tolerance for spelling errors is also very low.

[0003] Manual proofreading of text is time-consuming and labor-intensive, which has led to an increasing demand for automatic spell checking and error correction of text. Therefore, a solution that can automatically correct text errors is needed. Traditional text error correction solutions focus on one-dimensional text input for daily use, that is, text written from left to right. However, the text contained in various text carriers such as tables is not a regular one-dimensional text. The relationship between the text content of each part in the table is different from the context relationship in the one-dimensional text. Therefore, traditional text error correction methods cannot be applied to text carriers such as tables. Summary of the invention

[0004] One purpose of the present application is to provide a text correction method, device and computer-readable medium to solve the problem that conventional text correction solutions cannot be applied to text carriers such as various tables.

[0005] An embodiment of the present application provides a text error correction method, the method comprising:

[0006] Obtaining the original text of the target cell and the adjacent text of the adjacent cell, where the adjacent cell is a cell adjacent to the target cell;

[0007] Acquire the error-corrected text corresponding to the original text according to the knowledge base, and determine the original text and the error-corrected text as candidate texts;

[0008] Acquire sorting feature information of the candidate text, wherein the sorting feature information includes co-occurrence feature information between the candidate text and adjacent texts;

[0009] The ranking scores of the candidate texts are calculated according to the ranking feature information, and the candidate text with the highest ranking score is determined as the text of the target cell.

[0010] The present application also provides a text error correction device, which includes:

[0011] An identification and parsing module, used for obtaining the original text of the target cell and the adjacent text of the adjacent cell, wherein the adjacent cell is a cell adjacent to the target cell;

[0012] A candidate generation module, used for obtaining the error correction text corresponding to the original text according to the knowledge base, and determining the original text and the error correction text as candidate texts;

[0013] A feature extraction module, used to obtain the sorting feature information of the candidate text, wherein the sorting feature information includes co-occurrence feature information between the candidate text and adjacent texts;

[0014] A sorting module is used to calculate the sorting scores of the candidate texts according to the sorting feature information, and determine the candidate text with the highest sorting score as the text of the target cell.

[0015] Some embodiments of the present application also provide a computing device, wherein the device includes a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein when the computer program instructions are executed by the processor, the device is triggered to execute the aforementioned text error correction method.

[0016] Some other embodiments of the present application further provide a computer-readable medium having computer program instructions stored thereon, wherein the computer-readable instructions can be executed by a processor to implement the text error correction method.

[0017] The embodiment of the present application provides a text error correction scheme, which can obtain the original text of the target cell and the adjacent text of the adjacent cell, then obtain the error correction text corresponding to the original text according to the knowledge base, and determine the original text and the error correction text as candidate texts. After obtaining the sorting feature information of the candidate text, the sorting score of the candidate text is calculated according to the sorting feature information, and the candidate text with the highest sorting score is determined as the text of the target cell. Since the position and content of the text in the text carrier such as a table are relatively fixed, the text at the target cell position and the text at the adjacent cell position will show a certain correlation according to the actual application scenario, and the sorting feature information of the candidate text at least includes the co-occurrence feature information between the candidate text and the adjacent text. The sorting score calculated based on this can characterize the possibility of the candidate text appearing in the target cell, so the text at the target cell position can be accurately corrected according to the possibility. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Other features, objects and advantages of the present application will become more apparent by reading the detailed description of non-limiting embodiments made with reference to the following drawings:

[0019] Figure 1 A processing flow chart of a text error correction method provided in an embodiment of the present application;

[0020] Figure 2 A schematic diagram of a table for performing text error correction in an embodiment of the present application;

[0021] Figure 3 A structural schematic diagram of a text error correction device provided in an embodiment of the present application;

[0022] Figure 4 A schematic diagram of the structure of a computing device for implementing text error correction provided in an embodiment of the present application;

[0023] The same or similar reference numerals in the drawings represent the same or similar components. DETAILED DESCRIPTION

[0024] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be interpreted as limiting the present invention.

[0025] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present invention refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be intermediate elements. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.

[0026] A text correction method provided in an embodiment of the present application is used to correct two-dimensional text in text carriers such as tables. Since the position and content of the text in text carriers such as tables are relatively fixed, the text at the target cell position and the text at the adjacent cell position will show a certain correlation according to the actual application scenario, and the sorting feature information of the candidate text at least includes the co-occurrence feature information between the candidate text and the adjacent text. The sorting score calculated based on this can represent the possibility of the candidate text appearing in the target cell, so the text at the target cell position can be accurately corrected according to the possibility.

[0027] In actual scenarios, the execution subject of the method can be a user device, a network device, or a device formed by integrating a user device and a network device through a network, and can also be a program running in the above-mentioned device. The user device includes but is not limited to various terminal devices such as computers, mobile phones, and tablet computers; the network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing (Cloud Computing), where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.

[0028] Figure 1 The processing flow of a text error correction method provided by an embodiment of the present application is shown, which at least includes the following processing steps:

[0029] Step S101, obtaining the original text of the target cell and the adjacent text of the adjacent cell.

[0030] Since the text error correction method provided in the embodiment of the present application is applied to two-dimensional text in text carriers such as tables, the difference between two-dimensional text and one-dimensional text is that the text contents of each part in the two-dimensional text have a relatively fixed two-dimensional position relationship. For the same kind of table, the position of the text contained therein is relatively fixed, so cells can be used to represent the position of each text in the two-dimensional text. Among them, the target cell is the cell where the text to be corrected is located, and the adjacent cell is the cell adjacent to the target cell. In actual scenarios, the error correction of different texts can be processed independently, that is, multiple target cells can be defined at the same time, and the texts in these target cells can be corrected separately, and these target cells have their own adjacent cells, and do not interfere with each other during their respective error correction processes.

[0031] by Figure 2Take the table shown as an example, including 6 cells. When correcting the text "rabbit nature" therein, cell cell_3 is the target cell, and its adjacent cells are cells adjacent to the target cell. In some embodiments of the present application, adjacent cells can be defined as cells adjacent to the target cell and located in several directions, such as up, down, left, and right. For the aforementioned target cell cell_3, its adjacent cells may include the upper adjacent cell cell_1, the right adjacent cell cell_4, and the lower adjacent cell cell_5. Since there is no cell on the left, the left adjacent cell in the adjacent cells is empty.

[0032] The specific contents of the original text in the target cell and the adjacent text in the adjacent cell can be obtained through text recognition. Figure 2 In the table, OCR technology can be used to identify the text content in each cell, so as to determine the original text in the target cell and the adjacent text in the adjacent cell. In the actual scene, the error of the text content may occur in the input link, for example, when the user enters the text in the cell cell_3, he mistakenly enters "rabbit nature". In addition, the error of the text content may also occur in the recognition link, for example, the text in the cell cell_3 should actually be "exempt nature", but when recognizing the text, it is mistakenly identified as "rabbit nature". For these errors, the correct text can be determined to be corrected by the text error correction method provided by the embodiment of the present application.

[0033] In some embodiments of the present application, when obtaining the original text of the target cell and the adjacent text of the adjacent cell, the text to be processed can be first identified to obtain the text content and the position information corresponding to the text content. Figure 2 Taking the table shown as an example, the text content and the corresponding position information in the table can be identified by OCR, where the position information can be expressed in the form of coordinates, and the coordinate value of the area where the text content is located is used as the position information to determine the location of the text content. For example, after identifying the table, the following information can be obtained:

[0034] (“rabbit nature”, 10.0, 50.0, 12.0, 60.0);

[0035] (“General Taxation”, 10.0, 61.0, 13.0, 70.0);

[0036] …

[0037] Among them, "Nature of Rabbit Taxation" and "General Taxation" are text contents, and 10.0, 50.0, 12.0, 60.0 and 10.0, 61.0, 13.0, 70.0 are the coordinate values ​​of the area where the text content is located.

[0038] Then, the target cell and the adjacent cell are determined according to the position information, and the text content in the target cell is determined as the original text, and the text content in the adjacent cell is determined as the adjacent text.

[0039] For example, when correcting "Nature of rabbit hunting", the target cell can be determined as cell_3 according to the position information of the text to be processed, and the corresponding adjacent cells are cell_1, cell_4 and cell_5, and then the text content "Nature of rabbit hunting" in the target cell is determined as the original text, and the text content "Import port", "General taxation" and "Country of departure" in the adjacent cells are determined as adjacent texts.

[0040] Since the position of each cell in the table is relatively fixed, the position information can be mapped to the structural information between cells. The structural information is the adjacency relationship between cells, so that the target cell and the adjacent cells can be determined.

[0041] by Figure 2 Take the table shown as an example, which includes 6 cells, each of which can be set as cell_1 to cell_6. Since the areas where these cells are located are known, it can be determined through the coordinate values ​​that "import port" is located in cell_1, "XXX" is located in cell_2, "rabbit nature" is located in cell_3, "general taxation" is located in cell_4, "country of departure" is located in cell_5, and "YYY" is located in cell_6. For the cells, the following data structure can be used to record information:

[0042] (Cell_ID:1,Content:"Import Port",LeftNeighbor:None,UpNeighbor:None,RightNeighbor:2,DownNeighbor:3);

[0043] (Cell_ID:2,Content:“XXX”,LeftNeighbor:1,UpNeighbor:None,RightNeighbor:None,DownNeighbor:4);

[0044] (Cell_ID:3,Content:"Zhengtu Nature",LeftNeighbor:None,UpNeighbor:1,RightNeighbor:4,DownNeighbor:5);

[0045] (Cell_ID: 4, Content: "General taxation", LeftNeighbor: 3, UpNeighbor: 2, RightNeighbor: None, DownNeighbor: 6);

[0046] (Cell_ID:2,Content:"Departure Country",LeftNeighbor:None,UpNeighbor:3,RightNeighbor:6,DownNeighbor:None);

[0047] (Cell_ID:2,Content:“YYY”,LeftNeighbor:5,UpNeighbor:4,RightNeighbor:None,DownNeighbor:None);

[0048] Among them, Cell_ID represents the ID of the current cell, Content represents the text content of the current cell, LeftNeighbor, UpNeighbor, RightNeighbor and DownNeighbor represent the IDs of the left adjacent cell, the upper adjacent cell, the right adjacent cell and the lower adjacent cell respectively, for example, LeftNeighbor:1 represents that the left adjacent cell is cell_1. Based on the above data structure, the target cell, adjacent cells and the original text and adjacent text in these cells can be quickly determined.

[0049] Step S102, obtaining the correction text corresponding to the original text according to the knowledge base, and determining the original text and the correction text as candidate texts. The knowledge base is pre-set with knowledge related to the field to which the application scenario of this solution belongs. For example, when this solution is applied to text correction of customs document forms, a knowledge base related to customs can be used, which includes common vocabulary in customs scenarios.

[0050] In an actual scenario, a set of similar texts corresponding to the original text can be obtained first according to pronunciation similarity and / or glyph similarity, and then, based on the knowledge base, the corrected text corresponding to the original text can be determined from the set of similar texts. For example, the pinyin of "征兔性质" is "[zheng,tu,xing,zhi]". Querying for words with similar pronunciations in the knowledge base, the similar result is an empty set [], indicating that the corrected text determined based on pronunciation similarity is empty. In terms of glyphs, each single character in "征兔性质" can be processed separately to generate a corresponding set of similar texts. For example, those with glyphs similar to the character "兔" include [兔, 免, 菟, …], etc. That is, the set of similar texts can include "征兔性质", "征免性质", and "征菟性质", etc. After querying these words in the knowledge base, the result obtained is [征免性质]. After performing the same processing on the other single characters respectively, the corrected text is "征免性质".

[0051] After obtaining the corrected text, the original text and the corrected text can be determined as candidate texts. In this embodiment, the candidate texts in the target cell cell_3 are "征兔性质" and "征免性质".

[0052] Step S103: Extract features from the candidate texts to obtain the sorting feature information of the candidate texts. Among them, the sorting feature information at least includes the co-occurrence feature information between the candidate text and the adjacent text. The co-occurrence feature information can reflect the situation where the candidate text and the adjacent text co-occur, thereby reflecting the likelihood of the candidate text appearing in the target cell.

[0053] In some embodiments of the present application, the co-occurrence times between the candidate text and the adjacent text, the occurrence times of the candidate text, and the occurrence times of the adjacent text can be statistically analyzed based on a corpus, and then, according to the co-occurrence times between the candidate text and the adjacent text, the occurrence times of the candidate text, and the occurrence times of the adjacent text, the co-occurrence feature information between the candidate text and the adjacent text can be calculated. The calculated co-occurrence feature information can be determined as the sorting feature information. Among them, the corpus included in the corpus corresponds to the application scenario of this solution. For example, when this solution is applied to text correction of customs document forms, a corpus related to customs can be used, which includes common words in the customs scenario and the structural information between these words.

[0054] Taking the candidate texts ("征兔性质", "征免性质") in the target cell cell_3 and the adjacent text ("一般征税") in the adjacent cell to its right as an example, it is necessary to separately count:

[0055] The co-occurrence times of "征兔性质" and "一般征税" n_right(征兔性质,一般征税) = 10;

[0056] The number of co-occurrences of "tax exemption nature" and "general taxation" is n_right(tax exemption nature, general taxation) = 900;

[0057] The number of occurrences of “rabbit-hunting nature” n(rabbit-hunting nature) = 15;

[0058] The number of occurrences of “exempt nature” n(exempt nature) = 1000;

[0059] The number of occurrences of “general taxation” n(general taxation) = 1200;

[0060] When calculating the co-occurrence feature information between the candidate text and the adjacent text, the following method may be used:

[0061] f_right(rabbit taxation) = 2×n(rabbit taxation, general taxation) / (n(rabbit taxation)+n(general taxation)) = 2×10 / (15+1200) = 0.016;

[0062] f_right(exempt nature) = 2×n(exempt nature, general taxation) / (n(exempt nature)+n(general taxation)) = 2×900 / (1000+1200) = 0.818;

[0063] From this, we can see that the co-occurrence feature information of the candidate text "rabbit tax nature" and the adjacent text "general taxation" in the adjacent cell on the right is 0.016, and the co-occurrence feature information of the candidate text "tax exemption nature" and the adjacent text "general taxation" in the adjacent cell on the right is 0.818.

[0064] When the adjacent cells include an upper adjacent cell above the target cell, a lower adjacent cell below the target cell, a left adjacent cell to the left of the target cell, and a right adjacent cell to the right of the target cell, the sorting feature information may also correspond to co-occurrence feature information between the candidate text and the adjacent texts in the upper adjacent cell, the lower adjacent cell, the left adjacent cell, and the right adjacent cell, respectively. Based on a similar approach, the co-occurrence feature information f_left, f_up, and f_down between the candidate text and the adjacent texts in the left adjacent cell, the upper adjacent cell, and the lower adjacent cell may be calculated. Figure 2 In the table shown, since cell cell_3 has no adjacent cell to the left, the adjacent text in the adjacent cell to the left can be determined as f_left = 0. The following sorting feature information is obtained:

[0065] Rabbit properties: [f_right=0.016,f_left=0,f_up=0.026,f_down=0.009]

[0066] Exempt nature: [f_right=0.818,f_left=0,f_up=0.966,f_down=0.882]

[0067] In some other embodiments of the present application, the adjacent cells may also include 8 cells surrounding the target cell, namely, an upper adjacent cell located above the target cell, a lower adjacent cell located below the target cell, a left adjacent cell located to the left of the target cell, a right adjacent cell located to the right of the target cell, an upper left adjacent cell located to the upper left of the target cell, an upper right adjacent cell located to the upper right of the target cell, a lower left adjacent cell located to the lower left of the target cell, and a lower right adjacent cell located to the lower right of the target cell.

[0068] At this time, the sorting feature information corresponds to the co-occurrence feature information between the candidate text and the adjacent texts in the upper adjacent cell, the lower adjacent cell, the left adjacent cell, the right adjacent cell, the upper left adjacent cell, the upper right adjacent cell, the lower left adjacent cell and the lower right adjacent cell.

[0069] Step S104, calculating the ranking scores of the candidate texts according to the ranking feature information, and determining the candidate text with the highest ranking score as the text of the target cell.

[0070] When calculating the ranking score, the ranking feature information can be weighted according to the preset weights to obtain the ranking score of the candidate text. For example, for the two candidate texts mentioned above, weights can be set in advance for f_right, f_left, f_up and f_down, and the ranking scores of each candidate text can be obtained after weighted calculation, and then the candidate text with the highest ranking score can be determined as the text of the target cell. If in this embodiment, the ranking score of "rabbit nature" is calculated to be 0.017, and the ranking score of "exempt nature" is 0.889, wherein the candidate text with the highest ranking score is "exempt nature", so "exempt nature" is determined as the text of the target cell, and text error correction is completed. Here, those skilled in the art should understand that the customs document form is only an application scenario of the scheme implemented in this application, and any type of two-dimensional text other than this can use the scheme provided by the embodiment of this application to realize text error correction. At the same time, the identified erroneous text can be displayed by highlighting and other methods.

[0071] In other embodiments of the present application, in addition to the co-occurrence feature information, the sorting feature information may also include similarity feature information between the candidate text and the original text. In actual scenarios, the more similar the candidate text is to the original text, the higher the possibility of an error. Therefore, the similarity feature information can reflect the possibility that the candidate text is incorrectly input or recognized as the original text. Therefore, using the co-occurrence feature information and the similarity feature information together as the sorting feature information can make the calculated sorting score more reasonable and improve the accuracy of text error correction.

[0072] In this embodiment, when obtaining the sorting feature information of the candidate text, in addition to obtaining the co-occurrence feature information in the aforementioned manner, the similarity feature information between the candidate text and the original text can be determined based on the degree of similarity between the candidate text and the original text, and then the similarity feature information and the co-occurrence feature information can be used together as the sorting feature information.

[0073] Among them, the similar feature information may include at least one of pronunciation similarity, glyph similarity and edit distance. The higher the pronunciation similarity and glyph similarity, and the closer the edit distance, the higher the possibility of confusion between the candidate text and the original text. Depending on the actual application scenario, any one or more of the similar feature information can be selectively used. For example, in this implementation, only the edit distance is used as the similar feature information. For the target cell cell_3, the original text is "Rabbit Recruitment Nature", and one of the candidate texts "Rabbit Recruitment Nature" is the original text, so there is no difference between the two. The other candidate text "Rabbit Recruitment Nature" differs from the original text by one character. After changing "rabbit" to "exempt" through an editing operation, the original text can be modified to the candidate text. Therefore, the edit distances of the two candidate texts are:

[0074] f_editdistance(rabbit property)=0.0,f_editdistance(exempt property)=1.0;

[0075] Combined with the aforementioned co-occurrence feature information, the ranking feature information of “rabbit nature” and “exempt nature” are as follows:

[0076] [f_editdistance=0.0, f_right=0.016, f_left=0, f_up=0.026, f_down=0.009];

[0077] [f_editdistance=1.0, f_right=0.818, f_left=0, f_up=0.966, f_down=0.882];

[0078] When calculating the ranking score of the candidate text according to the ranking feature information, corresponding weights can also be set for similar feature information, and weighted calculation can be performed together with the co-occurrence feature information to obtain the ranking score of the candidate text, and determine the text of the target cell based on the ranking score.

[0079] Based on the same inventive concept, a text correction device is also provided in an embodiment of the present application. The method corresponding to the device is the text correction method in the aforementioned embodiment, and its principle of solving the problem is similar to that of the method.

[0080] A text correction device provided in an embodiment of the present application is used to correct two-dimensional text in text carriers such as tables. Since the position and content of the text in text carriers such as tables are relatively fixed, the text at the target cell position and the text at the adjacent cell position will show a certain correlation according to the actual application scenario, and the sorting feature information of the candidate text at least includes the co-occurrence feature information between the candidate text and the adjacent text. The sorting score calculated based on this can represent the possibility of the candidate text appearing in the target cell, so the text at the target cell position can be accurately corrected according to the possibility.

[0081] In actual scenarios, the device can be a user device, a network device, or a device formed by integrating a user device and a network device through a network, and can also be a program running in the above devices. The user device includes but is not limited to various terminal devices such as computers, mobile phones, and tablet computers; the network device includes but is not limited to network hosts, single network servers, multiple network server sets, or cloud computing-based computer sets. Here, the cloud is composed of a large number of hosts or network servers based on cloud computing (Cloud Computing), where cloud computing is a type of distributed computing, a virtual computer composed of a group of loosely coupled computer sets.

[0082] Figure 3The structure of a text error correction device provided by an embodiment of the present application is shown, including an identification and analysis module 310, a candidate generation module 320, a feature extraction module 330 and a sorting module 340. Among them, the identification and analysis module 310 is used to obtain the original text of the target cell and the adjacent text of the adjacent cell, and the adjacent cell is a cell adjacent to the target cell. The candidate generation module 320 is used to obtain the error correction text corresponding to the original text according to the knowledge base, and determine the original text and the error correction text as candidate texts. The feature extraction module 330 is used to obtain the sorting feature information of the candidate text, and the sorting feature information includes the co-occurrence feature information between the candidate text and the adjacent text. The sorting module 340 is used to calculate the sorting score of the candidate text according to the sorting feature information, and determine the candidate text with the highest sorting score as the text of the target cell.

[0083] Since the text correction device provided by the embodiment of the present application is applied to two-dimensional text in text carriers such as tables, the difference between two-dimensional text and one-dimensional text is that the text contents of each part in the two-dimensional text have a relatively fixed two-dimensional position relationship. For the same kind of table, the position of the text contained therein is relatively fixed, so cells can be used to represent the position of each text in the two-dimensional text. Among them, the target cell is the cell where the text to be corrected is located, and the adjacent cell is the cell adjacent to the target cell. In actual scenarios, the error correction of different texts can be processed independently, that is, multiple target cells can be defined at the same time, and the texts in these target cells can be corrected separately. These target cells have their own adjacent cells and do not interfere with each other during their respective error correction processes.

[0084] by Figure 2 Take the table shown as an example, including 6 cells. When correcting the text "rabbit nature" therein, cell cell_3 is the target cell, and its adjacent cells are cells adjacent to the target cell. In some embodiments of the present application, adjacent cells can be defined as cells adjacent to the target cell and located in several directions, such as up, down, left, and right. For the aforementioned target cell cell_3, its adjacent cells may include the upper adjacent cell cell_1, the right adjacent cell cell_4, and the lower adjacent cell cell_5. Since there is no cell on the left, the left adjacent cell in the adjacent cells is empty.

[0085] The specific contents of the original text in the target cell and the adjacent text in the adjacent cell can be obtained through text recognition. Figure 2In the table, OCR technology can be used to identify the text content in each cell, so as to determine the original text in the target cell and the adjacent text in the adjacent cell. In the actual scene, the error of the text content may occur in the input link, for example, when the user inputs the text in the cell cell_3, he mistakenly enters "rabbit nature". In addition, the error of the text content may also occur in the recognition link, for example, the text in the cell cell_3 should actually be "exempt nature", but when recognizing the text, it is mistakenly identified as "rabbit nature". For these errors, the correct text can be determined by the text error correction device provided by the embodiment of the present application for correction.

[0086] In some embodiments of the present application, when obtaining the original text of the target cell and the adjacent text of the adjacent cell, the recognition and analysis module may first recognize the text to be processed and obtain the text content and the position information corresponding to the text content. Figure 2 Taking the table shown as an example, the text content and the corresponding position information in the table can be identified by OCR, where the position information can be expressed in the form of coordinates, and the coordinate value of the area where the text content is located is used as the position information to determine the location of the text content. For example, after identifying the table, the following information can be obtained:

[0087] (“rabbit nature”, 10.0, 50.0, 12.0, 60.0);

[0088] (“General Taxation”, 10.0, 61.0, 13.0, 70.0);

[0089] …

[0090] Among them, "Nature of Rabbit Taxation" and "General Taxation" are text contents, and 10.0, 50.0, 12.0, 60.0 and 10.0, 61.0, 13.0, 70.0 are the coordinate values ​​of the area where the text content is located.

[0091] Then, the recognition and analysis module determines the target cell and the adjacent cell according to the position information, and determines the text content in the target cell as the original text, and determines the text content in the adjacent cell as the adjacent text.

[0092] For example, when correcting "Nature of rabbit hunting", the target cell can be determined as cell_3 according to the position information of the text to be processed, and the corresponding adjacent cells are cell_1, cell_4 and cell_5, and then the text content "Nature of rabbit hunting" in the target cell is determined as the original text, and the text content "Import port", "General taxation" and "Country of departure" in the adjacent cells are determined as adjacent texts.

[0093] Since the position of each cell in the table is relatively fixed, the position information can be mapped to the structural information between cells. The structural information is the adjacency relationship between cells, so that the target cell and the adjacent cells can be determined.

[0094] by Figure 2 Take the table shown as an example, which includes 6 cells, each of which can be set as cell_1 to cell_6. Since the areas where these cells are located are known, it can be determined through the coordinate values ​​that "import port" is located in cell_1, "XXX" is located in cell_2, "rabbit nature" is located in cell_3, "general taxation" is located in cell_4, "country of departure" is located in cell_5, and "YYY" is located in cell_6. For the cells, the following data structure can be used to record information:

[0095] (Cell_ID:1,Content:"Import Port",LeftNeighbor:None,UpNeighbor:None,RightNeighbor:2,DownNeighbor:3);

[0096] (Cell_ID:2,Content:“XXX”,LeftNeighbor:1,UpNeighbor:None,RightNeighbor:None,DownNeighbor:4);

[0097] (Cell_ID:3,Content:"Zhengtu Nature",LeftNeighbor:None,UpNeighbor:1,RightNeighbor:4,DownNeighbor:5);

[0098] (Cell_ID: 4, Content: "General taxation", LeftNeighbor: 3, UpNeighbor: 2, RightNeighbor: None, DownNeighbor: 6);

[0099] (Cell_ID:2,Content:"Departure Country",LeftNeighbor:None,UpNeighbor:3,RightNeighbor:6,DownNeighbor:None);

[0100] (Cell_ID:2, Content: “YYY”, LeftNeighbor: 5, UpNeighbor: 4, RightNeighbor: None, DownNeighbor: None);

[0101] Among them, Cell_ID represents the identifier of the current cell, Content represents the text content of the current cell, and LeftNeighbor, UpNeighbor, RightNeighbor, and DownNeighbor represent the identifiers of the adjacent cells on the left, above, on the right, and below respectively. Based on the above data structure, the target cell, adjacent cells, and the original text and adjacent text in these cells can be determined quickly.

[0102] Knowledge related to the field to which the application scenario of this solution belongs is preset in the knowledge base. For example, when this solution is applied to text error correction of customs document forms, a knowledge base related to customs can be used, and this knowledge base includes common words in the customs scenario.

[0103] In the actual scenario, the candidate generation module can first obtain a set of similar texts corresponding to the original text according to the pronunciation similarity and / or glyph similarity, and then determine the error correction text corresponding to the original text from the set of similar texts according to the knowledge base. For example, the pinyin of “征兔性质” is “[zheng, tu, xing, zhi]”. Querying for words with similar pronunciations in the knowledge base, the similar result is an empty set []. Thus, it can be seen that the error correction text determined based on pronunciation similarity is empty. In terms of glyphs, each single character of “征兔性质” can be processed separately to generate a corresponding set of similar texts. For example, those with a glyph similar to the character “兔” are [兔, 免, 菟,...], etc. That is, the set of similar texts can include “征兔性质”, “征免性质”, and “征菟性质”, etc. After querying these words in the knowledge base, the result obtained is [征免性质]. After performing the same processing on other single characters respectively, the error correction text is “征免性质”.

[0104] After obtaining the error correction text, the original text and the error correction text can be determined as candidate texts. In this embodiment, the candidate texts in the target cell cell_3 are “征兔性质” and “征免性质”.

[0105] The sorting feature information obtained by the feature extraction module includes at least the co-occurrence feature information between the candidate text and the adjacent text. The co-occurrence feature information can reflect the situation where the candidate text and the adjacent text co-occur, thereby reflecting the likelihood of the candidate text appearing in the target cell.

[0106] In some embodiments of the present application, the feature extraction module can count the number of co-occurrences between the candidate text and the adjacent text, the number of occurrences of the candidate text, and the number of occurrences of the adjacent text based on the corpus, and then calculate the co-occurrence feature information between the candidate text and the adjacent text based on the number of co-occurrences between the candidate text and the adjacent text, the number of occurrences of the candidate text, and the number of occurrences of the adjacent text, and the calculated co-occurrence feature information can be determined as the sorting feature information. The corpus contained in the corpus corresponds to the application scenario of the present solution. For example, when the present solution is applied to text error correction of customs document forms, a corpus related to customs can be used, which includes common words in customs scenarios and structural information between these words.

[0107] Taking the candidate text in the target cell cell_3 ("rabbit tax nature", "tax exemption nature") and the adjacent text in the adjacent cell to its right ("general taxation") as an example, we need to count the following:

[0108] The number of co-occurrences of "rabbit levy nature" and "general taxation" n_right(rabbit levy nature, general taxation) = 10;

[0109] The number of co-occurrences of "tax exemption nature" and "general taxation" is n_right(tax exemption nature, general taxation) = 900;

[0110] The number of occurrences of “rabbit-hunting nature” n(rabbit-hunting nature) = 15;

[0111] The number of occurrences of “exempt nature” n(exempt nature) = 1000;

[0112] The number of occurrences of “general taxation” n(general taxation) = 1200;

[0113] When calculating the co-occurrence feature information between the candidate text and the adjacent text, the following method may be used:

[0114] f_right(rabbit taxation) = 2×n(rabbit taxation, general taxation) / (n(rabbit taxation)+n(general taxation)) = 2×10 / (15+1200) = 0.016;

[0115] f_right(exempt nature) = 2×n(exempt nature, general taxation) / (n(exempt nature)+n(general taxation)) = 2×900 / (1000+1200) = 0.818;

[0116] From this, we can see that the co-occurrence feature information of the candidate text "rabbit tax nature" and the adjacent text "general taxation" in the adjacent cell on the right is 0.016, and the co-occurrence feature information of the candidate text "tax exemption nature" and the adjacent text "general taxation" in the adjacent cell on the right is 0.818.

[0117] When the adjacent cells include an upper adjacent cell above the target cell, a lower adjacent cell below the target cell, a left adjacent cell to the left of the target cell, and a right adjacent cell to the right of the target cell, the sorting feature information may also correspond to co-occurrence feature information between the candidate text and the adjacent texts in the upper adjacent cell, the lower adjacent cell, the left adjacent cell, and the right adjacent cell, respectively. Based on a similar approach, the co-occurrence feature information f_left, f_up, and f_down between the candidate text and the adjacent texts in the left adjacent cell, the upper adjacent cell, and the lower adjacent cell may be calculated. Figure 2 In the table shown, since cell cell_3 has no adjacent cell to the left, the adjacent text in the adjacent cell to the left can be determined as f_left = 0. The following sorting feature information is obtained:

[0118] Rabbit properties: [f_right=0.016,f_left=0,f_up=0.026,f_down=0.009]

[0119] Exempt nature: [f_right=0.818,f_left=0,f_up=0.966,f_down=0.882]

[0120] In some other embodiments of the present application, the adjacent cells may also include 8 cells surrounding the target cell, namely, an upper adjacent cell located above the target cell, a lower adjacent cell located below the target cell, a left adjacent cell located to the left of the target cell, a right adjacent cell located to the right of the target cell, an upper left adjacent cell located to the upper left of the target cell, an upper right adjacent cell located to the upper right of the target cell, a lower left adjacent cell located to the lower left of the target cell, and a lower right adjacent cell located to the lower right of the target cell.

[0121] At this time, the sorting feature information corresponds to the co-occurrence feature information between the candidate text and the adjacent texts in the upper adjacent cell, the lower adjacent cell, the left adjacent cell, the right adjacent cell, the upper left adjacent cell, the upper right adjacent cell, the lower left adjacent cell and the lower right adjacent cell.

[0122] When calculating the ranking score, the sorting module can perform weighted calculation on the ranking feature information according to the preset weights to obtain the ranking score of the candidate text. For example, for the two candidate texts mentioned above, weights can be set in advance for f_right, f_left, f_up and f_down, and the ranking scores of each candidate text can be obtained after weighted calculation, and then the candidate text with the highest ranking score can be determined as the text of the target cell. If in this embodiment, the ranking score of "rabbit nature" is calculated to be 0.017, and the ranking score of "exempt nature" is 0.889, wherein the candidate text with the highest ranking score is "exempt nature", so "exempt nature" is determined as the text of the target cell, and text error correction is completed. Here, those skilled in the art should understand that the customs document form is only an application scenario of the scheme implemented in this application, and any type of two-dimensional text other than this can use the scheme provided by the embodiment of this application to realize text error correction. At the same time, the identified erroneous text can be displayed by highlighting and other methods.

[0123] In other embodiments of the present application, in addition to the co-occurrence feature information, the sorting feature information may also include similarity feature information between the candidate text and the original text. In actual scenarios, the more similar the candidate text is to the original text, the higher the possibility of an error. Therefore, the similarity feature information can reflect the possibility that the candidate text is incorrectly input or recognized as the original text. Therefore, using the co-occurrence feature information and the similarity feature information together as the sorting feature information can make the calculated sorting score more reasonable and improve the accuracy of text error correction.

[0124] In this embodiment, when the feature extraction module obtains the sorting feature information of the candidate text, in addition to obtaining the co-occurrence feature information in the aforementioned manner, it can also determine the similarity feature information between the candidate text and the original text based on the degree of similarity between the candidate text and the original text, and then use the similarity feature information and the co-occurrence feature information together as the sorting feature information.

[0125] Among them, the similar feature information may include at least one of pronunciation similarity, glyph similarity and edit distance. The higher the pronunciation similarity and glyph similarity, and the closer the edit distance, the higher the possibility of confusion between the candidate text and the original text. Depending on the actual application scenario, any one or more of the similar feature information can be selectively used. For example, in this implementation, only the edit distance is used as the similar feature information. For the target cell cell_3, the original text is "Rabbit Recruitment Nature", and one of the candidate texts "Rabbit Recruitment Nature" is the original text, so there is no difference between the two. The other candidate text "Rabbit Recruitment Nature" differs from the original text by one character. After changing "rabbit" to "exempt" through an editing operation, the original text can be modified to the candidate text. Therefore, the edit distances of the two candidate texts are:

[0126] f_editdistance(rabbit property)=0.0,f_editdistance(exempt property)=1.0;

[0127] Combined with the aforementioned co-occurrence feature information, the ranking feature information of “rabbit nature” and “exempt nature” are as follows:

[0128] [f_editdistance=0.0, f_right=0.016, f_left=0, f_up=0.026, f_down=0.009];

[0129] [f_editdistance=1.0, f_right=0.818, f_left=0, f_up=0.966, f_down=0.882];

[0130] When calculating the ranking score of the candidate text according to the ranking feature information, corresponding weights can also be set for similar feature information, and weighted calculation can be performed together with the co-occurrence feature information to obtain the ranking score of the candidate text, and determine the text of the target cell based on the ranking score.

[0131] In addition, a part of the present application may be applied as a computer program product, such as a computer program instruction, which, when executed by a computer, can call or provide the method and / or technical solution according to the present application through the operation of the computer. The program instruction for calling the method of the present application may be stored in a fixed or removable recording medium, and / or transmitted through a data stream in a broadcast or other signal-bearing medium, and / or stored in a working memory of a computer device that runs according to the program instruction. Here, some embodiments of the present application include a Figure 4The computing device shown includes one or more memories 410 storing computer-readable instructions and a processor 420 for executing the computer-readable instructions, wherein when the computer-readable instructions are executed by the processor, the device executes the methods and / or technical solutions based on the aforementioned multiple embodiments of the present application.

[0132] In addition, some embodiments of the present application further provide a computer-readable medium on which computer program instructions are stored. The computer-readable instructions can be executed by a processor to implement the methods and / or technical solutions of the aforementioned multiple embodiments of the present application.

[0133] It should be noted that the present application can be implemented in software and / or a combination of software and hardware, for example, can be implemented using an application specific integrated circuit (ASIC), a general purpose computer or any other similar hardware device. In an embodiment, the software program of the present application can be executed by a processor to implement the above steps or functions. Similarly, the software program of the present application (including related data structures) can be stored in a computer-readable recording medium, for example, a RAM memory, a magnetic or optical drive or a floppy disk and similar devices. In addition, some steps or functions of the present application can be implemented using hardware, for example, as a circuit that cooperates with a processor to perform each step or function.

[0134] Those skilled in the art will appreciate that each block in these structure diagrams and / or block diagrams and / or flow charts and combinations of blocks in these structure diagrams and / or block diagrams and / or flow charts can be implemented using computer program instructions. Those skilled in the art will appreciate that these computer program instructions can be provided to a general-purpose computer, a professional computer, or a processor of other programmable data processing methods to implement, thereby executing the scheme specified in the block or multiple blocks of the structure diagram and / or block diagram and / or flow chart disclosed in the present invention through the processor of the computer or other programmable data processing method.

[0135] Those skilled in the art will appreciate that the various operations, methods, steps, measures, and schemes in the processes discussed in the present invention may be alternated, modified, combined, or deleted. Furthermore, other steps, measures, and schemes in the various operations, methods, and processes discussed in the present invention may also be alternated, modified, rearranged, decomposed, combined, or deleted. Furthermore, the steps, measures, and schemes in the prior art that are similar to those disclosed in the present invention may also be alternated, modified, rearranged, decomposed, combined, or deleted.

[0136] It is obvious to those skilled in the art that the present application is not limited to the details of the exemplary embodiments described above, and that the present application can be implemented in other specific forms without departing from the spirit or essential features of the present application. Therefore, no matter from which point of view, the embodiments should be regarded as exemplary and non-restrictive, and the scope of the present application is defined by the appended claims rather than the above description, and it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present application.

Claims

1. A text error correction method, wherein: The method includes: Obtaining the original text of the target cell and the adjacent text of the adjacent cell, where the adjacent cell is a cell adjacent to the target cell; Acquire the error-corrected text corresponding to the original text according to the knowledge base, and determine the original text and the error-corrected text as candidate texts; Acquire sorting feature information of the candidate text, wherein the sorting feature information includes co-occurrence feature information between the candidate text and adjacent texts; The ranking scores of the candidate texts are calculated according to the ranking feature information, and the candidate text with the highest ranking score is determined as the text of the target cell.

2. The method according to claim 1, wherein: Get the original text of the target cell and the adjacent text of the adjacent cells, including: Identify the text to be processed, and obtain the text content and the position information corresponding to the text content; Determine the target cell and the adjacent cells according to the position information; Determine the text content in the target cell as the original text; The text content in the adjacent cells is determined as adjacent text.

3. The method according to claim 1, wherein: Determining the error correction text corresponding to the original text according to the knowledge base includes: Obtaining a similar text set corresponding to the original text according to pronunciation similarity and / or glyph similarity; Determine the error correction text corresponding to the original text from the similar text set according to the knowledge base.

4. The method according to claim 1, wherein: Obtaining the sorting feature information of the candidate text includes: Based on the corpus, the co-occurrence times between the candidate text and the adjacent text, the occurrence times of the candidate text and the occurrence times of the adjacent text are counted; Calculating co-occurrence feature information between the candidate text and the adjacent text according to the number of co-occurrences between the candidate text and the adjacent text, the number of occurrences of the candidate text and the number of occurrences of the adjacent text; The co-occurrence feature information is determined as sorting feature information.

5. The method according to claim 1, wherein: The sorting feature information also includes similar feature information between the candidate text and the original text; Obtaining the sorting feature information of the candidate text includes: Based on the corpus, the co-occurrence times between the candidate text and the adjacent text, the occurrence times of the candidate text and the occurrence times of the adjacent text are counted; Calculating co-occurrence feature information between the candidate text and the adjacent text according to the number of co-occurrences between the candidate text and the adjacent text, the number of occurrences of the candidate text and the number of occurrences of the adjacent text; Determining similar feature information between the candidate text and the original text according to the degree of similarity between the candidate text and the original text; The similar feature information and the co-occurrence feature information are determined as ranking feature information.

6. The method according to claim 5, wherein: The similar feature information includes at least one of pronunciation similarity, character shape similarity and edit distance.

7. The method according to any one of claims 1 to 6, wherein: The adjacent cells include an upper adjacent cell located above the target cell, a lower adjacent cell located below the target cell, a left adjacent cell located to the left of the target cell, a right adjacent cell located to the right of the target cell, an upper left adjacent cell located to the upper left of the target cell, an upper right adjacent cell located to the upper right of the target cell, a lower left adjacent cell located to the lower left of the target cell, and a lower right adjacent cell located to the lower right of the target cell; The sorting feature information includes co-occurrence feature information between the candidate text and adjacent texts in the upper adjacent cell, the lower adjacent cell, the left adjacent cell, the right adjacent cell, the upper left adjacent cell, the upper right adjacent cell, the lower left adjacent cell and the lower right adjacent cell respectively.

8. The method according to claim 1, wherein: Calculating the ranking score of the candidate text according to the ranking feature information includes: According to the preset weights, the sorting feature information is weightedly calculated to obtain the sorting score of the candidate text.

9. A text error correction device, wherein: The equipment includes: An identification and parsing module, used for obtaining the original text of the target cell and the adjacent text of the adjacent cell, wherein the adjacent cell is a cell adjacent to the target cell; A candidate generation module, used for obtaining the error correction text corresponding to the original text according to the knowledge base, and determining the original text and the error correction text as candidate texts; A feature extraction module, used to obtain the sorting feature information of the candidate text, wherein the sorting feature information includes co-occurrence feature information between the candidate text and adjacent texts; A sorting module is used to calculate the sorting scores of the candidate texts according to the sorting feature information, and determine the candidate text with the highest sorting score as the text of the target cell.

10. The device according to claim 9, wherein: The recognition and analysis module is used to recognize the text to be processed, obtain the text content and the position information corresponding to the text content; determine the target cell and the adjacent cell according to the position information; determine the text content in the target cell as the original text; and determine the text content in the adjacent cell as the adjacent text.

11. The device according to claim 9, wherein: The candidate generation module is used to obtain a similar text set corresponding to the original text according to pronunciation similarity and / or glyph similarity; and determine the error correction text corresponding to the original text from the similar text set according to the knowledge base.

12. The device according to claim 9, wherein: The feature extraction module is used to count the number of co-occurrences between the candidate text and the adjacent text, the number of occurrences of the candidate text and the number of occurrences of the adjacent text based on the corpus; Calculating co-occurrence feature information between the candidate text and the adjacent text according to the number of co-occurrences between the candidate text and the adjacent text, the number of occurrences of the candidate text and the number of occurrences of the adjacent text; And determining the co-occurrence feature information as sorting feature information.

13. The apparatus according to claim 9, wherein: The sorting feature information also includes similar feature information between the candidate text and the original text; The feature extraction module is used to count the number of co-occurrences between the candidate text and the adjacent text, the number of occurrences of the candidate text and the number of occurrences of the adjacent text based on the corpus; Calculating co-occurrence feature information between the candidate text and the adjacent text according to the number of co-occurrences between the candidate text and the adjacent text, the number of occurrences of the candidate text and the number of occurrences of the adjacent text; Determining similar feature information between the candidate text and the original text according to the degree of similarity between the candidate text and the original text; And determining the similar feature information and the co-occurrence feature information as sorting feature information.

14. The device according to claim 13, wherein: The similar feature information includes at least one of pronunciation similarity, character shape similarity and edit distance.

15. The apparatus according to any one of claims 9 to 14, wherein: The adjacent cells include an upper adjacent cell located above the target cell, a lower adjacent cell located below the target cell, a left adjacent cell located to the left of the target cell, a right adjacent cell located to the right of the target cell, an upper left adjacent cell located to the upper left of the target cell, an upper right adjacent cell located to the upper right of the target cell, a lower left adjacent cell located to the lower left of the target cell, and a lower right adjacent cell located to the lower right of the target cell; The sorting feature information includes co-occurrence feature information between the candidate text and adjacent texts in the upper adjacent cell, the lower adjacent cell, the left adjacent cell, the right adjacent cell, the upper left adjacent cell, the upper right adjacent cell, the lower left adjacent cell and the lower right adjacent cell respectively.

16. The apparatus according to claim 9, wherein: The sorting module is used to perform weighted calculation on the sorting feature information according to a preset weight to obtain the sorting score of the candidate text.

17. A computing device, wherein: The device comprises a memory for storing computer program instructions and a processor for executing the computer program instructions, wherein when the computer program instructions are executed by the processor, the device is triggered to execute the method according to any one of claims 1 to 8.

18. A computer readable medium having computer program instructions stored thereon, wherein the computer readable instructions can be executed by a processor to implement the method according to any one of claims 1 to 8.