Data extraction method, device, equipment and storage medium
By determining the character position information and row-rank relationship in the image, combined with the preset format, automatic word segmentation and attribute determination of image characters are realized, which solves the problem of character recognition in the existing technology that cannot segment words and determine meaning, and improves processing efficiency and accuracy. .
Patent Information
- Application Number
- CN202210769050.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-06-30
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2042-06-30
AI Technical Summary
Existing image character recognition technology can only recognize characters, but cannot segment words and determine the meaning of characters. This results in manual participation in business processing, which is inefficient.
By obtaining the image to be recognized, character position information is determined, word segmentation and attribute judgment are performed based on row-column relationships and preset formats, and word segmentation results and attribute results are integrated to achieve automatic word segmentation and attribute determination.
Word segmentation with actual meaning can be extracted from images without manual intervention, improving processing efficiency and improving the accuracy of word segmentation and attribute determination.
Smart Images

Figure CN115019320B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer application technology, and in particular to a data extraction method, device, equipment and storage medium. Background Art
[0002] With the development of digital information technology, in order to facilitate user operations, it is often necessary to recognize characters from images for business processing. For example, for paper medical records, the information in them needs to be entered into the computer for storage, but the medical record information may be large, and the cost of manual input is high and the efficiency is low. Therefore, image character recognition technology can be directly used to extract characters from medical record images for storage.
[0003] However, current image character recognition technology can only recognize characters, but cannot perform word segmentation or determine the meaning of characters. During business processing, manual word segmentation and meaning determination of recognized characters are still required, which is inefficient. Summary of the invention
[0004] The present invention provides a data extraction method, device, equipment and storage medium to solve the deficiencies in the related art.
[0005] According to a first aspect of an embodiment of the present invention, there is provided a data extraction method, comprising:
[0006] Obtain an image to be recognized;
[0007] Based on character recognition, determining the characters and character position information in the image to be recognized;
[0008] Determine the row and column relationship between characters according to the determined character position information;
[0009] Determining a corresponding preset format based on the preset format keyword included in the determined characters;
[0010] For each line of characters, the characters in the same line are concatenated in order, and based on the word segmentation model, the first segmentation phrase and the corresponding first attribute in the concatenation result are determined;
[0011] For each row of characters, characters belonging to different columns are respectively determined as second segmentation phrases, and a second attribute corresponding to each second segmentation phrase is determined according to the determined preset format; and for each second segmentation phrase, based on the segmentation model, whether the corresponding second attribute is correct;
[0012] The first segmented word group and the corresponding first attribute, as well as the second segmented word group and the correct second attribute, are comprehensively considered to determine a segmentation result and a corresponding attribute result.
[0013] Optionally, determining the row and column relationship between characters according to the determined character position information includes:
[0014] Determine the line spacing distribution between characters according to the determined character position information;
[0015] Determine the standard line spacing according to the determined line spacing distribution;
[0016] Based on the standard line spacing, determining characters belonging to the same line;
[0017] And according to the determined character position information, characters belonging to the same column are determined.
[0018] Optionally, determining the row and column relationship between characters according to the determined character position information includes:
[0019] Determining characters belonging to the same row according to the determined character position information;
[0020] For each row of characters, multiple character blocks are divided based on the horizontal distance between the characters;
[0021] For each character block, the character block with the highest degree of overlap with the character block in horizontal position or horizontal coordinate is determined among the character blocks in other rows, and the determined character block and the character block are determined as characters belonging to the same column.
[0022] Optionally, the method further comprises:
[0023] Pre-acquire a set of corresponding relationships between a preset format and a preset format keyword; the preset format includes a plurality of attributes arranged in sequence;
[0024] The determining of the corresponding preset format based on the preset format keyword included in the determined characters includes:
[0025] Based on the preset format keyword included in the determined character, determining a corresponding preset format from the corresponding relationship set;
[0026] Determining the second attribute corresponding to each segmentation phrase according to the determined preset format includes:
[0027] Matching the order of the attributes included in the determined preset format with the order of the second participle phrases;
[0028] The matching attribute corresponding to each second participle phrase is determined as the second attribute corresponding to the second participle phrase.
[0029] Optionally, the method further comprises:
[0030] When it is determined that the second attribute corresponding to any second segmentation phrase is correct, the second segmentation phrase and the corresponding second attribute are added to the training sample set of the segmentation model;
[0031] The added training sample set is used to update and train the word segmentation model.
[0032] Optionally, the step of comprehensively determining a segmentation result and a corresponding attribute result by combining the first segmentation phrase and the corresponding first attribute, and the second segmentation phrase and the correct second attribute, includes:
[0033] For the correct second attribute, add the corresponding second segmentation phrase to the segmentation result, and add the corresponding correct second attribute to the corresponding attribute result;
[0034] For the wrong second attribute, the same attribute is determined from the first attribute, and the first segmentation phrase corresponding to the determined attribute is added to the segmentation result, and the corresponding first attribute is added to the corresponding attribute result.
[0035] Optionally, for each row of characters, determining characters belonging to different columns as second segmentation phrases respectively includes:
[0036] According to the determined preset format, determining the starting row of the concerned character and the ending row of the concerned character from the determined characters; the preset format includes the keyword of the starting row of the concerned character and the keyword of the ending row of the concerned character;
[0037] For each row of characters between the focus character start row and the focus character end row, characters belonging to different columns are respectively determined as second segmentation phrases.
[0038] According to a second aspect of an embodiment of the present invention, there is provided a data extraction device, comprising:
[0039] A recognition unit, used for acquiring an image to be recognized; based on character recognition, determining characters and character position information in the image to be recognized;
[0040] A pre-analysis unit, used to determine the row and column relationship between characters according to the determined character position information; and determine the corresponding preset format based on the preset format keywords included in the determined characters;
[0041] A first extraction unit is used to sequentially concatenate the characters in each line of characters, and determine a first segmentation phrase and a corresponding first attribute in the concatenation result based on the segmentation model;
[0042] The second extraction unit is used to determine, for each row of characters, characters belonging to different columns as second segmentation phrases, and determine, according to the determined preset format, a second attribute corresponding to each second segmentation phrase; and for each second segmentation phrase, based on the segmentation model, determine whether the corresponding second attribute is correct;
[0043] The synthesis unit is used to synthesize the first segmentation phrase and the corresponding first attribute, and the second segmentation phrase and the correct second attribute to determine the segmentation result and the corresponding attribute result.
[0044] Optionally, the pre-analysis unit is used to:
[0045] Determine the line spacing distribution between characters according to the determined character position information;
[0046] Determine the standard line spacing according to the determined line spacing distribution;
[0047] Based on the standard line spacing, determining characters belonging to the same line;
[0048] And according to the determined character position information, characters belonging to the same column are determined.
[0049] Optionally, the pre-analysis unit is used to:
[0050] Determining characters belonging to the same row according to the determined character position information;
[0051] For each row of characters, multiple character blocks are divided based on the horizontal distance between the characters;
[0052] For each character block, the character block with the highest degree of overlap with the character block in horizontal position or horizontal coordinate is determined among the character blocks in other rows, and the determined character block and the character block are determined as characters belonging to the same column.
[0053] Optionally, the device further comprises:
[0054] A preset unit, used to pre-acquire a set of corresponding relationships between preset formats and preset format keywords; the preset format includes a plurality of attributes arranged in sequence;
[0055] The pre-analysis unit is used for:
[0056] Based on the preset format keyword included in the determined character, determining a corresponding preset format from the corresponding relationship set;
[0057] The second extraction unit is used for:
[0058] Matching the order of the attributes included in the determined preset format with the order of the second participle phrases;
[0059] The matching attribute corresponding to each second participle phrase is determined as the second attribute corresponding to the second participle phrase.
[0060] Optionally, the device further comprises:
[0061] The feedback unit is used to add the second segmentation phrase and the corresponding second attribute to the training sample set of the segmentation model when it is determined that the second attribute corresponding to any second segmentation phrase is correct; the added training sample set is used to update and train the segmentation model.
[0062] Optionally, the integration unit is used to:
[0063] For the correct second attribute, add the corresponding second segmentation phrase to the segmentation result, and add the corresponding correct second attribute to the corresponding attribute result;
[0064] For the wrong second attribute, the same attribute is determined from the first attribute, and the first segmentation phrase corresponding to the determined attribute is added to the segmentation result, and the corresponding first attribute is added to the corresponding attribute result.
[0065] Optionally, the second extraction unit is used to:
[0066] According to the determined preset format, determining the starting row of the concerned character and the ending row of the concerned character from the determined characters; the preset format includes the keyword of the starting row of the concerned character and the keyword of the ending row of the concerned character;
[0067] For each row of characters between the focus character start row and the focus character end row, characters belonging to different columns are respectively determined as second segmentation phrases.
[0068] According to a third aspect of an embodiment of the present invention, there is provided an electronic device, including:
[0069] at least one processor; and,
[0070] a memory communicatively connected to the at least one processor; wherein,
[0071] The memory stores instructions that can be executed by the one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the above-mentioned data extraction method.
[0072] According to a fourth aspect of an embodiment of the present invention, there is provided a computer-readable storage medium storing a computer program, wherein the computer program implements the above-mentioned data extraction method when executed by a processor.
[0073] According to the above embodiments, the row and column relationship between characters is determined by character position information, and then the word segmentation and word segmentation attributes can be determined in two different ways for integration to obtain the final word segmentation result and the corresponding attribute result without human intervention, thereby improving processing efficiency.
[0074] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0076] Figure 1 is a flow chart of a data extraction method according to an embodiment of the present invention;
[0077] Figure 2 is a schematic diagram of an image to be recognized according to an embodiment of the present invention;
[0078] Figure 3 is a structural schematic diagram of a data extraction device according to an embodiment of the present invention;
[0079] Figure 4 The figure is a schematic diagram of the hardware structure of a computer device configured with the method of the embodiment of the present invention according to the embodiment of the present invention. DETAILED DESCRIPTION
[0080] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Instead, they are merely examples of devices and methods consistent with some aspects of the present invention as detailed in the appended claims.
[0081] With the development of digital information technology, in order to facilitate user operations, it is often necessary to recognize characters from images for business processing. For example, for paper medical records, the information in them needs to be entered into the computer for storage, but the medical record information may be large, and the cost of manual input is high and the efficiency is low. Therefore, image character recognition technology can be directly used to extract characters from medical record images for storage.
[0082] However, current image character recognition technology can only recognize characters, but cannot perform word segmentation or determine the meaning of characters. During business processing, manual word segmentation and meaning determination of recognized characters are still required, which is inefficient.
[0083] The present invention provides a data extraction method. For the recognized characters, the position information of the characters needs to be determined, so as to facilitate the determination of the row and column relationship between the characters.
[0084] The relationship between rows and columns can help determine the specific meaning of characters.
[0085] For example, characters belonging to the same row often correspond to different attributes of the same entity, and characters belonging to the same column often correspond to the same attribute values of different entities.
[0086] Furthermore, for characters in the same row, word segmentation can be performed in one or more ways, and attributes of the word segmentation can be determined.
[0087] The attribute of the word segmentation may specifically be the actual meaning of the character. For example, for a medical record, there may be attributes such as the name of the disease, the name of the medicine, and the frequency of taking the medicine.
[0088] Determining the attributes of word segmentation can make it easier for the machine to automatically determine structured data, thereby automatically performing business processing without human intervention, thereby improving processing efficiency.
[0089] For example, for the characters recognized in the medical record image, after determining the row and column relationship and the word segmentation attributes, the results such as popular trauma cream (drug name), 5 tubes (quantity), 3 times / day (frequency), 1 appropriate amount / time (dosage) and external use (route of administration) can be determined. Therefore, according to the word segmentation attributes, the corresponding word segmentation information can be processed for business purposes. Specifically, it can be filled in the medical record data structure of the computer, so as to quickly generate a digital medical record without human intervention.
[0090] The present invention does not specifically limit the method of word segmentation and determining word segmentation attributes. Word segmentation and word segmentation attributes can be determined by a word segmentation model, or by a preset format, which can specifically include several attributes, so that the corresponding preset format can be directly applied according to the row and column relationship between characters to determine the corresponding attribute.
[0091] After determining word segmentation and word segmentation attributes through multiple methods, the word segmentation results and attribute results of the multiple methods can be integrated to improve the accuracy of word segmentation and the accuracy of word segmentation attributes.
[0092] like Figure 1 As shown, Figure 1 It is a flowchart of a data extraction method according to an embodiment of the present invention.
[0093] The following steps may be included.
[0094] S101: Acquire an image to be recognized; based on character recognition, determine the characters and character position information in the image to be recognized.
[0095] S102: Determine the row and column relationship between characters according to the determined character position information; and determine the corresponding preset format based on the preset format keywords included in the determined characters.
[0096] S103: For each line of characters, concatenate the characters in the line in order, and determine a first segmentation phrase and a corresponding first attribute in the concatenation result based on the segmentation model.
[0097] S104: For each row of characters, the characters belonging to different columns are respectively determined as second segmentation phrases, and the second attribute corresponding to each second segmentation phrase is determined according to the determined preset format; and for each second segmentation phrase, based on the segmentation model, it is determined whether the corresponding second attribute is correct.
[0098] S105: Determine a segmentation result and a corresponding attribute result by combining the first segmentation phrase and the corresponding first attribute, and the second segmentation phrase and the correct second attribute.
[0099] The above method process can determine the row and column relationship between characters through character position information, and then can determine the word segmentation and word segmentation attributes respectively in two different ways, and finally combine the results determined by the two different methods to obtain the final word segmentation result and the corresponding attribute result, so that the word segmentation with actual meaning can be extracted from the image to be recognized.
[0100] Since no human intervention is required, the characters recognized in the image to be recognized can be segmented and the segmentation attributes can be determined, thereby improving processing efficiency. In addition, the segmentation and segmentation attributes can be determined in a variety of ways, which can improve the accuracy of the segmentation and segmentation attributes.
[0101] The following is a detailed explanation of each step.
[0102] S101: Acquire an image to be recognized; based on character recognition, determine the characters and character position information in the image to be recognized.
[0103] Regarding the image to be recognized, the present invention does not limit the specific source of the image, as long as the image contains recognizable characters.
[0104] In a specific example, the image to be identified can be a photographed image of a paper report. For example, the examination report set of osteoporosis patients basically includes bone densitometer examination reports, prescription records, medical records, liver and kidney function blood component examination reports, consultation reports and X-ray reports. After the images are taken, these examination reports can be used as images to be identified, and the corresponding structured data, that is, the segmentation results with corresponding attributes, can be extracted.
[0105] Regarding character recognition, the present invention does not limit a specific character recognition method. In an optional embodiment, optical character recognition (OCR) can be used to recognize the characters and character position information in the image to be recognized.
[0106] Optionally, the characters in the image to be recognized can be integrated into a character set. It should be emphasized that when specifically recognizing characters, a character string can be recognized, or a single character can be recognized, and the present invention is not limited thereto.
[0107] The present invention does not limit the specific form of the character position information, as long as it can represent the position of the character and be used for subsequently determining the row and column relationship between the characters.
[0108] Optionally, the character position information may specifically include the position of the center point of the character in the image to be recognized, or may include the horizontal and vertical positions of the character in the image to be recognized, and may specifically be a position range.
[0109] For example, the position information of the recognized character string “1000000” may include a position range of 1 to 5 in the horizontal direction of the image to be recognized, or may include a position range of 1 to 2 in the vertical direction of the image to be recognized.
[0110] For ease of understanding, Figure 2 As shown, Figure 2 FIG. 4 is a schematic diagram of an image to be recognized according to an embodiment of the present invention.
[0111] The image to be identified is a photograph of a paper report of a laboratory test sheet.
[0112] Through character recognition, the characters and the position information of the characters in the image to be recognized can be identified.
[0113] For example, the character strings "project name", "English abbreviation", "reference value", "total protein", etc. in the image to be identified can be identified, and the single characters "result" and "result" can also be identified.
[0114] It can be determined that the position information of the string "project name" includes the position coordinates of the center point (1, 10), the position information of "English abbreviation" includes the position coordinates of the center point (3, 10), and the position information of "total protein" includes the position coordinates of the center point (1, 7).
[0115] S102: Determine the row and column relationship between characters according to the determined character position information; and determine the corresponding preset format based on the preset format keywords included in the determined characters.
[0116] The present invention does not limit the specific method of determining the row and column relationship between characters.
[0117] In an optional embodiment, the row-column relationship between characters may include characters belonging to the same row and characters belonging to the same column.
[0118] From a practical point of view, compared with characters belonging to the same row, it is often difficult to directly determine the characters belonging to the same column because characters in the same column are more likely to have different lengths. Therefore, you can first determine the characters belonging to the same row, and then determine the characters belonging to the same column based on the characters belonging to the same row.
[0119] This embodiment does not limit the specific method of determining characters belonging to the same row.
[0120] Optionally, the characters may be distinguished by line spacing. When the upper and lower spacing between two characters is greater than a certain threshold, it can be determined that the two characters do not belong to the same line.
[0121] The upper and lower intervals between characters can be determined based on the position information of the characters, and specifically can be determined based on the center point position of the characters.
[0122] Optionally, determining the row and column relationship between characters based on the determined character position information may include: determining the line spacing distribution between characters based on the determined character position information; determining the standard line spacing based on the determined line spacing distribution; determining characters belonging to the same row based on the standard line spacing; and determining characters belonging to the same column based on the determined character position information.
[0123] Optionally, the distribution of line spacing between characters may include line spacing between a plurality of characters, and may specifically include a plurality of line spacings between a plurality of characters determined according to character position information.
[0124] This embodiment does not specifically limit the method for determining the standard line spacing.
[0125] Optionally, the mode, median, mean, etc. may be calculated based on the distribution of the line spacing as the standard line spacing.
[0126] Optionally, determining the standard line spacing according to the determined line spacing distribution may include selecting a middle value of a most densely distributed interval in the line spacing distribution as the standard line spacing.
[0127] Optionally, based on the standard line spacing, determining characters belonging to the same row may include: determining different characters whose upper and lower spacing is less than the standard line spacing as characters in the same row; specifically, it may include, for each character, determining, among other determined characters, a character whose upper and lower spacing with the character is less than the standard line spacing, and determining the determined character and the character as characters belonging to the same row.
[0128] This embodiment can determine the characters belonging to the same row in the image to be recognized based on the standard line spacing, which can be determined by traversal.
[0129] This embodiment does not limit the specific method of determining characters belonging to the same column.
[0130] Optionally, since characters in the same column are usually the characters with the most overlap in horizontal position or horizontal coordinates between different rows, the characters belonging to the same column can be determined based on the degree of overlap in horizontal position or horizontal coordinates between different rows.
[0131] In an optional embodiment, determining the row and column relationship between characters based on the determined character position information may include: determining characters belonging to the same row based on the determined character position information; for each row of characters, dividing into multiple character blocks based on the horizontal distance between the characters; for each character block, determining the character block with the highest degree of overlap with the character block in horizontal position or horizontal coordinate among the character blocks in other rows, and determining the determined character block and the character block as characters belonging to the same column.
[0132] Optionally, if there is no character block in other rows that overlaps with the character block in terms of horizontal position or horizontal coordinate, the character block can be determined as a character belonging to a single column.
[0133] Optionally, for each row of characters, a plurality of character blocks may be divided according to position information to facilitate preliminary distinction of characters in different columns.
[0134] Specifically, for each row of characters, if the horizontal distance between two adjacent characters is less than the preset horizontal distance, the two adjacent characters are determined to be in the same character block; if the horizontal distance between two adjacent characters is greater than or equal to the preset horizontal distance, the two adjacent characters are determined to be in different character blocks.
[0135] Therefore, optionally, for each row of characters, multiple character blocks are divided based on the horizontal distance between characters, which may include: for each row of characters, traversing each character therein, and when it is determined that the horizontal distance between the character and the adjacent character is less than a preset horizontal distance, determining that the two adjacent characters are in the same character block; when it is determined that the horizontal distance between the character and the adjacent character is greater than or equal to the preset horizontal distance, determining that the two adjacent characters are in different character blocks.
[0136] In an optional embodiment, specifically determining the row and column relationship between characters may include: in terms of line spacing, first arranging the characters in sequence according to their center positions, then performing differential processing on the upper and lower spacing of each character to extract the line spacing between different rows, then analyzing the distribution of the line spacing, selecting the middle value of the most densely distributed interval of these line spacings as the preset standard line spacing, then looping through each character to determine whether each character belongs to the same row, that is, whether the upper and lower spacing between two characters is less than the preset standard line spacing, and finally obtaining a line text sequence.
[0137] In terms of column spacing, each character block separated by spaces in each row is analyzed, and the overlap relationship between character blocks in different rows in horizontal position or horizontal coordinates is analyzed. The group of character blocks with the most overlap in horizontal position or horizontal coordinates can be determined as character blocks belonging to the same column.
[0138] S103: For each line of characters, concatenate the characters in the line in order, and determine a first segmentation phrase and a corresponding first attribute in the concatenation result based on the segmentation model.
[0139] In an optional embodiment, a word segmentation model may be used to segment each line of characters and determine the word segmentation attributes.
[0140] Optionally, the word segmentation model can be used to segment the character string and can be used to determine the word segmentation attributes.
[0141] This embodiment does not limit the training method of the word segmentation model, nor does it limit the specific model structure of the word segmentation model.
[0142] Among them, optionally, in order to improve the accuracy of word segmentation, each line of characters can be first spliced in order from left to right to obtain a spliced string, so that the word segmentation model can be used to perform word segmentation and determine the word segmentation attributes. Specifically, the spliced string can be input into the word segmentation model to obtain the word segmentation and corresponding word segmentation attributes.
[0143] By concatenating characters, word segmentation can be performed on each line of characters, thereby improving the accuracy of word segmentation.
[0144] For example, for a single line of characters: Danghong Trauma Cream 5 tubes 3 times / day 1 appropriate amount / time for external use, you can input the word segmentation model and get the results: Danghong Trauma Cream (drug name), 5 tubes (quantity), 3 times / day (frequency), 1 appropriate amount / time (dosage) and external use (route of administration).
[0145] For the sake of easy distinction, the segmented words determined in S103 are referred to as first segmented word phrases, and the corresponding segmented word attributes are referred to as first attributes.
[0146] Optionally, the word segmentation model may determine possible output attributes for the input characters based on the determined preset format.
[0147] For example, for the preset format “medication report form” determined in S102 , it can be determined that the attributes that may be output by the word segmentation model include five attributes: drug name, quantity, frequency, dosage, and route of administration.
[0148] S104: For each row of characters, the characters belonging to different columns are respectively determined as second segmentation phrases, and the second attribute corresponding to each second segmentation phrase is determined according to the determined preset format; and for each second segmentation phrase, based on the segmentation model, it is determined whether the corresponding second attribute is correct.
[0149] In an optional embodiment, word segmentation may be performed directly based on the determined row-column relationship, and then a preset format may be used to match the determined row-column relationship, so that the word segmentation attributes may be determined using the attributes in the preset format.
[0150] Optionally, since the row-column relationship between characters has been determined, the characters belonging to different columns in each row of characters can be respectively determined as segmentation phrases.
[0151] Optionally, the preset format may specifically be a specific table format, which may include attributes, so that it can be used to determine the segmentation attributes.
[0152] For example, the preset format can be a table format of a medical record, which may include attributes such as patient name, disease name, drug name, chief complaint and current medical history, symptoms, examination results, prescription, test results, and instructions. The test report includes examination items, results, reference values, units, and abnormalities. The bone densitometer report includes T value, SOS value, measured value / peak value ratio (V / M), and relative fracture risk rate.
[0153] In an optional embodiment, a set of correspondence relationships between preset formats and preset format keywords may be acquired in advance.
[0154] The preset format keyword may be a keyword used to distinguish different preset formats. For example, for the preset format of a medical record, the corresponding preset format keyword may include "medical record" or "medical record", and for the preset format of a test report, the corresponding preset format keyword may include "test report" or "test", etc.
[0155] Specifically, different contents in preset formats may be collected, keywords may be extracted therefrom as preset format keywords, and then a set of corresponding relationships between preset formats and preset format keywords may be set.
[0156] By using the preset format keywords, the preset formats that the characters in the image to be recognized may correspond to can be determined, and then the segmentation attributes can be determined.
[0157] Optionally, determining the corresponding preset format based on the preset format keyword included in the determined character may include: determining the corresponding preset format from a corresponding relationship set based on the preset format keyword included in the determined character.
[0158] Optionally, the preset format may include several attributes arranged in order. For example, in the case where the preset format is a medication report, it may include five attributes, namely, drug name, quantity, frequency, dosage, and route of administration, arranged from left to right.
[0159] Correspondingly, when the preset format is determined, the segmentation attributes of the segmentation phrases obtained in each line of characters can be determined in order from left to right.
[0160] Optionally, determining the second attribute corresponding to each participle phrase according to the determined preset format may include: matching the order of the attributes included in the determined preset format with the order between the second participle phrases; and determining the matching attribute corresponding to each second participle phrase as the second attribute corresponding to the second participle phrase.
[0161] Among them, matching the order of the attributes included in the determined preset format with the order of the second participle phrases can specifically include matching the Nth attribute from left to right included in the determined preset format with the Nth second participle phrase from left to right in each line of characters, N≥1.
[0162] For example, when the preset format is a medication report, the five attributes of drug name, quantity, frequency, dosage, and route of administration can be included in order from left to right. For the single-line character segmentation phrase, Danghong trauma cream, 5 tubes, 3 times / day, 1 appropriate amount / time, external use, directly match in order, and get the result: Danghong trauma cream (drug name), 5 tubes (quantity), 3 times / day (frequency), 1 appropriate amount / time (dosage), and external use (route of administration).
[0163] Optionally, there is redundant information or invalid information for the characters recognized in the image to be recognized. For example, for medical records, the characters of concern are usually specific medical record information, while the header information of some medical records may specifically include xx hospital, xx department, precautions, etc., so there is no need to pay attention to it and extract the characters of concern in the medical record.
[0164] Usually, the characters of interest are displayed in a table format, while invalid information, such as header information, is usually not displayed in the table. Therefore, the start row character and the end row character of interest can be determined from the recognized characters.
[0165] For example, the start line characters may generally include attribute information, which may specifically include the drug name, quantity, frequency, dosage, and route of administration. The end line characters may generally include the last line characters of the table.
[0166] Optionally, the start row and the end row can be determined by keywords.
[0167] For example, for a medical record, usually behind the patient information form, there is doctor information, specifically the doctor's signature. Therefore, the start line can be a single line of characters including attribute information, and the end line can be a single line of characters including doctor information.
[0168] Optionally, for each row of characters, the characters belonging to different columns therein are respectively determined as second participle phrases, which may include: determining a focus character starting row and a focus character ending row from the determined characters according to a determined preset format; for each row of characters between the focus character starting row and the focus character ending row, the characters belonging to different columns therein are respectively determined as second participle phrases.
[0169] Optionally, the preset format may include a keyword of a starting row of the concerned character and a keyword of an ending row of the concerned character, so that the starting row of the concerned character and the ending row of the concerned character may be determined according to the keyword.
[0170] In this embodiment, the processing efficiency can be improved by extracting the characters between the focus character start line and the focus character end line.
[0171] In an optional embodiment, after the second segmentation phrase and the corresponding second attribute are determined based on the preset format, it is further possible to determine whether the corresponding second attribute is correct based on the segmentation model.
[0172] Optionally, for each second segmentation phrase, it may be determined based on the segmentation model whether the corresponding second attribute is correct.
[0173] Optionally, the second segmentation phrases determined for each line of characters may be directly determined using a segmentation model for each second segmentation phrase without concatenation, and the segmentation model does not need to perform further segmentation.
[0174] For any second participle phrase, when the participle attribute determined by the participle model is the same as the corresponding second attribute, it can be determined that the second attribute is correct; when the participle attribute determined by the participle model is different from the corresponding second attribute, it can be determined that the second attribute is wrong.
[0175] For example, for "5 sticks", the preset format "medication report" is used to determine that the corresponding second attribute is "quantity", and the word segmentation model is used to determine that the corresponding word segmentation attribute of "5 sticks" is "quantity". Therefore, it can be determined that the second attribute corresponding to "5 sticks" is correct.
[0176] For "external use", the preset format "medication report form" is used to determine that the corresponding second attribute is "frequency", and the word segmentation model is used to determine that the corresponding word segmentation attribute of "external use" is "route of administration". Therefore, it can be determined that the second attribute corresponding to "external use" is wrong.
[0177] Optionally, the word segmentation model used here can be the same model as the word segmentation model in S103, or can be a different model. The word segmentation model used in S104 can be used only to determine word segmentation attributes, or can be used for word segmentation and determining word segmentation attributes.
[0178] After determining whether the second attribute is correct or incorrect through the word segmentation model, the word segmentation and the corresponding attribute may be determined based on step S104.
[0179] It should be noted that the execution order between S103 and S104 is not specifically limited, and they can be executed in sequence or in parallel.
[0180] Through S103 and S104, the word segmentation and the corresponding attributes can be determined for the recognized characters in different ways, so as to facilitate the subsequent steps to be integrated and determine the final word segmentation result and the corresponding attribute result.
[0181] S105: Determine a segmentation result and a corresponding attribute result by combining the first segmentation phrase and the corresponding first attribute, and the second segmentation phrase and the correct second attribute.
[0182] In an optional embodiment, S104 may determine whether the second attribute is correct. For an incorrect second attribute, the corresponding second participle phrase may not be used in the subsequent integration step, and only the correct second attribute and the corresponding second participle phrase are used for integration.
[0183] The present invention is not limited to a specific synthesis method.
[0184] In an optional embodiment, the first segmentation phrase and the corresponding first attribute are determined using a segmentation model for the concatenation result of each row of characters, while the second segmentation phrase is determined according to a preset format, and the corresponding correct second attribute is determined using the segmentation model for different columns of characters in each row of characters.
[0185] Correspondingly, since the wrong second attribute cannot be integrated, some attributes in the preset format may not have corresponding participle phrases, so they can be supplemented from the first participle phrases.
[0186] Optionally, comprehensively combining the first participle phrase and the corresponding first attribute, as well as the second participle phrase and the correct second attribute, to determine the participle result and the corresponding attribute result may include: for the correct second attribute, adding the corresponding second participle phrase to the participle result, and adding the corresponding correct second attribute to the corresponding attribute result; for the incorrect second attribute, determining the same attribute from the first attribute, and adding the first participle phrase corresponding to the determined attribute to the participle result, and adding the corresponding first attribute to the corresponding attribute result.
[0187] Optionally, the integration method may also include, for the same attribute in the first attribute and the correct second attribute, determining whether the first participle phrase group and the second participle phrase group respectively corresponding to the first attribute and the correct second attribute are the same.
[0188] In the case that the determined first segmentation phrase and the second segmentation phrase are identical, the identical first segmentation phrase may be directly added to the segmentation result, and the corresponding first attribute may be determined as the corresponding attribute result.
[0189] In the case where the determined first segmentation phrase and the second segmentation phrase are different, the first segmentation phrase may be added to the segmentation result, and the corresponding first attribute may be determined as the corresponding attribute result, or the second segmentation phrase may be added to the segmentation result, and the corresponding second attribute may be determined as the corresponding attribute result.
[0190] In an optional embodiment, since the second attribute is determined according to a preset format, the correct second attribute can be further fed back to the word segmentation model. Specifically, the correct second attribute and the corresponding second word segmentation phrase can be added to the training sample set of the word segmentation model for subsequent updating of the training model, thereby improving the accuracy of the word segmentation model.
[0191] Optionally, when it is determined that the second attribute corresponding to any second segmentation phrase is correct, the second segmentation phrase and the corresponding second attribute can be added to the training sample set of the segmentation model; the added training sample set can be used to update the training segmentation model.
[0192] For ease of understanding, the present invention also provides a specific application embodiment.
[0193] At present, the overall awareness and treatment rates of elderly bone degenerative diseases represented by osteoporosis are low, especially the long-term follow-up treatment rate as a chronic disease is low. There is an urgent need for an effective prevention and control management model for the disease that suits my country's national conditions.
[0194] It is necessary to optimize existing solutions and technical intervention measures, provide accurate and personalized prevention and treatment plans such as exercise, nutrition, and medication for high-risk patients through early warning screening, demonstrate a personal osteoporosis prevention and treatment plan system, and establish evaluation standards for technologies and plans.
[0195] Artificial intelligence technology can be used throughout the entire process to form application technology support platforms and systems for comprehensive disease diagnosis and treatment, evidence-based medication, health trends, chronic disease management, and medical behavior. Forming an integrated osteoporosis chronic disease management demonstration system of "prevention-healthcare-diagnosis-treatment-rehabilitation" is a key part. Under this requirement, it is necessary to establish a set of structured data extraction solutions for osteoporosis patient examination report collections, which will be used to digitally and uniformly manage the electronic structured processing of paper reports of osteoporosis patients undergoing tests, examinations, and diagnoses in the hospital.
[0196] This embodiment performs digital structuring of medical records (medical records, prescription records, blood test sheets, etc.) involved in the in-hospital examination of osteoporosis patients.
[0197] The solution first establishes a metadata database of patient test data, and then builds a structured extraction network that can identify different reports and perform targeted identification and structured data extraction for various reports. Two methods will be used in the extraction network to extract structured data.
[0198] The first is a word segmentation system based on machine learning, and the second is structured data extraction based on the report layout structure.
[0199] The two strategies are used to jointly output results to generate high-confidence structured data results, and finally form a set of structured data archives for osteoporosis patients.
[0200] 1. Establish a metadata database for the test data of osteoporosis patients.
[0201] First, we collected the examination categories and subjects involved in the clinical treatment and examination of osteoporosis patients. Through analysis, collection, comparison and data discussion with clinical doctors, we found that the examination report set of osteoporosis patients basically includes bone densitometer examination report, prescription record, medical history, liver and kidney function blood component examination form, consultation report and X-ray report.
[0202] By integrating the medical examination items involved in the overall report set, a metadata database of the test data of osteoporosis patients is formed.
[0203] During this stage, data collection and format features, keyword features and other unique information of the report documents of the inspection categories and inspection subjects involved will also be carried out simultaneously.
[0204] In terms of data collection and keyword features, a certain number of relevant report documents can be collected in advance and separated according to types, and then the data therein can be entered into a relevant database, and the relevant fields therein can be extracted to form a set of prefabricated phrase libraries containing data such as test item names (such as the total protein item field in a routine blood test), test item data names (such as the English abbreviations in the total protein item field in a routine blood test, results, reference values, etc.), and other data.
[0205] The format features are mainly extracted based on the characteristics of the row and column items of the report. For example, a blood routine report has an obvious row structure. For example, under the Chinese characters: project name, English abbreviation, result, reference value, unit are the inspection data of each item.
[0206] Each row of inspection data is divided into five columns, namely project name, English abbreviation, result, reference value, unit, etc., and also records keyword information unique to various reports. For example, the total protein field in a routine blood test is equivalent to a unique field of the report.
[0207] 2. Pre-analysis of OCR text in report documents.
[0208] Before recognizing the report, OCR technology can be used to perform OCR text recognition on the inspection report uploaded by taking a photo, and the report image can be parsed into unit blocks of characters and spatial positions.
[0209] In terms of line spacing, the characters are first arranged in sequence according to their center positions, and then the upper and lower spacing of each character is differentially processed to extract the line spacing between different lines. Then the distribution of the line spacing is analyzed, and the middle value of the most densely distributed interval among these line spacings is selected as the preset standard line spacing. Then, each character is looped through to determine whether each character belongs to the same line, that is, whether the upper and lower spacing between two characters is less than the preset standard line spacing. Finally, a line text sequence is obtained.
[0210] In terms of column spacing, each character block separated by spaces in each row is analyzed, and the overlap relationship between character blocks in different rows in horizontal position or horizontal coordinates is analyzed. The group of character blocks with the most horizontal overlap is determined to belong to the same column.
[0211] 3. Identify the report document style and type.
[0212] For the pre-parsed text line data, use the keyword information pre-parsed in the first step to perform keyword matching and key information extraction in the line data, identify specific inspection subjects and categories, and determine the type of inspection document, which is the preset format.
[0213] At the same time, the categories and fields required to be extracted from the report, that is, the word segmentation attributes, can be obtained.
[0214] For example, in a medication report form, it is necessary to identify the drug name, quantity, frequency, dosage, route of administration and other word segmentation attributes.
[0215] 4. Extraction of structured data from documents
[0216] Through the document type parsed in the previous step, you can get the report structure information and report inspection category of this type.
[0217] And the structured information in the document is parsed through two ways.
[0218] First, a machine learning word segmentation system can be based on specific pre-made phrases.
[0219] Input the keywords of the inspection categories involved in this report into the word segmentation network, use the word segmentation network to segment each line of characters, and determine the word segmentation attributes.
[0220] For example, for the original row data: Danghong Trauma Cream 5 tubes 3 times / day 1 appropriate amount / time for external use, the data after word segmentation can be determined: Danghong Trauma Cream (drug name), 5 tubes (quantity), 3 times / day (frequency), 1 appropriate amount / time (dosage) and external use (route of administration).
[0221] After determining the segmentation properties for these segmentation phrases, the five fields required for the document can be extracted to complete the extraction of the line of characters.
[0222] Secondly, structured data extraction can be performed based on the report layout structure. The relatively fixed layout structure of the report is used to parse the relationship between rows and extract specific report start and end rows for structured data extraction.
[0223] Take this medication report data as an example to explain. As mentioned above, when using this method to parse each line of data, we will retain the space characters as follows:
[0224] Danghong trauma cream 5 tubes 3 times / day 1 appropriate amount / time for external use
[0225] We split this data by spaces to form five separate fields, namely
[0226] 1. Danghong trauma cream 2.5 tubes 3.3 times / day 4.1 appropriate amount / time 5. For external use
[0227] It can be directly filled into the five positions of drug name, quantity, frequency, dosage, and route of administration in this order to determine the corresponding word segmentation attributes.
[0228] The word segmentation model is used to determine whether the determined word segmentation attributes are correct, so that the correct word segmentation attributes can be retained and the incorrect word segmentation attributes can be deleted.
[0229] After data extraction using two parallel strategies, a solution can be provided to integrate and verify the results of the two strategies.
[0230] The results of the above two strategies are merged, the same results are merged, the missing items are supplemented, and the final result is output.
[0231] 5. Automatic picking and optimization mechanism based on pre-made phrase library of medical vocabulary.
[0232] Aiming at the problem of system optimization, a specific word library of pre-made phrases is designed to be fed back in the data extracted from the structured data based on the report layout structure.
[0233] For example, if the system obtains a phrase describing the dosage of a drug, "1 tablet / day", through the report structure, the system will automatically pick up the field and merge it into the specific vocabulary in the pre-made phrase. The specific vocabulary can be used to train the word segmentation model, so that when the system analyzes the dosage phrase "tablets / day" again, it can directly identify and extract the word-part meaning of the dosage, which helps to optimize the accuracy of the system.
[0234] Corresponding to the above method embodiment, the embodiment of the present invention also provides a device embodiment.
[0235] like Figure 3 As shown, Figure 3 It is a structural schematic diagram of a data extraction device according to an embodiment of the present invention.
[0236] The apparatus may include the following units.
[0237] The recognition unit 301 is used to obtain an image to be recognized; based on character recognition, determine the characters and character position information in the image to be recognized;
[0238] The pre-analysis unit 302 is used to determine the row and column relationship between characters according to the determined character position information; and determine the corresponding preset format based on the preset format keywords included in the determined characters;
[0239] The first extraction unit 303 is used to sequentially concatenate characters in each line of characters, and determine a first segmentation phrase and a corresponding first attribute in the concatenation result based on the segmentation model;
[0240] The second extraction unit 304 is used to determine, for each row of characters, characters belonging to different columns as second segmentation phrases, and determine, according to the determined preset format, a second attribute corresponding to each second segmentation phrase; and for each second segmentation phrase, based on the segmentation model, determine whether the corresponding second attribute is correct;
[0241] The integration unit 305 is used to integrate the first segmentation phrase and the corresponding first attribute, and the second segmentation phrase and the correct second attribute to determine the segmentation result and the corresponding attribute result.
[0242] Optionally, the pre-parsing unit 302 is used to: determine the line spacing distribution between characters based on the determined character position information; determine the standard line spacing based on the determined line spacing distribution; determine the characters belonging to the same row based on the standard line spacing; and determine the characters belonging to the same column based on the determined character position information.
[0243] Optionally, the pre-parsing unit 302 is used to: determine the characters belonging to the same row based on the determined character position information; for each row of characters, divide it into multiple character blocks based on the horizontal distance between the characters; for each character block, determine the character block that has the highest degree of overlap with the character block in the horizontal position or horizontal coordinate among the character blocks in other rows, and determine the determined character block and the character block as characters belonging to the same column.
[0244] Optionally, the device further includes: a preset unit 306, configured to pre-acquire a set of corresponding relationships between preset formats and preset format keywords; the preset format includes a plurality of attributes arranged in sequence.
[0245] Correspondingly, the pre-analysis unit 302 is used to: determine the corresponding preset format from the corresponding relationship set based on the preset format keyword included in the determined character;
[0246] The second extraction unit 304 is used to: match the order of the attributes included in the determined preset format with the order of the second participle phrases; and determine the matched attribute corresponding to each second participle phrase as the second attribute corresponding to the second participle phrase.
[0247] Optionally, the device also includes: a feedback unit 307, which is used to add the second segmentation phrase and the corresponding second attribute to the training sample set of the segmentation model when it is determined that the second attribute corresponding to any second segmentation phrase is correct; the added training sample set is used to update the training segmentation model.
[0248] Optionally, the integration unit 305 is used to: for a correct second attribute, add the corresponding second segmentation phrase to the segmentation result, and add the corresponding correct second attribute to the corresponding attribute result; for an incorrect second attribute, determine the same attribute from the first attribute, and add the first segmentation phrase corresponding to the determined attribute to the segmentation result, and add the corresponding first attribute to the corresponding attribute result.
[0249] Optionally, the second extraction unit 304 is used to: determine the starting row of the focus character and the ending row of the focus character from the determined characters according to the determined preset format; the preset format includes the keyword of the starting row of the focus character and the keyword of the ending row of the focus character; for each row of characters between the starting row of the focus character and the ending row of the focus character, the characters belonging to different columns therein are respectively determined as second word segmentation phrases.
[0250] An embodiment of the present invention further provides a computer device, which at least includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein any of the above method embodiments is implemented when the processor executes the program.
[0251] An embodiment of the present invention also provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any of the above-mentioned method embodiments.
[0252] Figure 4 1 is a schematic diagram of the hardware structure of a computer device configured with a method according to an embodiment of the present invention, and the device may include: a processor 1010, a memory 1020, an input / output interface 1030, a communication interface 1040, and a bus 1050. The processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040 are connected to each other in communication within the device through the bus 1050.
[0253] The processor 1010 can be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of the present invention.
[0254] The memory 1020 may be implemented in the form of ROM (Read Only Memory), RAM (Random Access Memory), static storage device, dynamic storage device, etc. The memory 1020 may store an operating system and other application programs. When the technical solution provided by the embodiment of the present invention is implemented by software or firmware, the relevant program code is stored in the memory 1020 and is called and executed by the processor 1010.
[0255] The input / output interface 1030 is used to connect the input / output module to realize information input and output. The input / output module can be configured in the device as a component (not shown in the figure), or it can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, a mouse, a touch screen, a microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, etc.
[0256] The communication interface 1040 is used to connect a communication module (not shown) to realize communication interaction between the device and other devices. The communication module can realize communication through a wired mode (such as USB, network cable, etc.) or a wireless mode (such as mobile network, WIFI, Bluetooth, etc.).
[0257] The bus 1050 includes a path that transmits information between the various components of the device (eg, the processor 1010, the memory 1020, the input / output interface 1030, and the communication interface 1040).
[0258] It should be noted that, although the above device only shows the processor 1010, the memory 1020, the input / output interface 1030, the communication interface 1040 and the bus 1050, in the specific implementation process, the device may also include other components necessary for normal operation. In addition, it can be understood by those skilled in the art that the above device may also only include the components necessary for implementing the embodiments of the present invention, and does not necessarily include all the components shown in the figure.
[0259] An embodiment of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, any of the above method embodiments is implemented.
[0260] An embodiment of the present invention further provides a computer-readable storage medium storing a computer program, wherein the computer program implements any of the above method embodiments when executed by a processor.
[0261] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0262] It can be known from the description of the above implementation mode that a person skilled in the art can clearly understand that the embodiment of the present invention can be implemented by means of software plus a necessary general hardware platform. Based on such an understanding, the technical solution of the embodiment of the present invention can be essentially or in other words, the part that makes the contribution can be embodied in the form of a software product, and the computer software product can be stored in a storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiment of the present invention.
[0263] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer, which may be in the form of a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email transceiver, a game console, a tablet computer, a wearable device or a combination of any of these devices.
[0264] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. The device embodiment described above is only schematic, wherein the modules described as separate components may or may not be physically separated, and the functions of each module can be implemented in the same one or more software and / or hardware when implementing the embodiment of the present invention. It is also possible to select some or all of the modules according to actual needs to achieve the purpose of the embodiment. Ordinary technicians in this field can understand and implement it without paying creative work.
[0265] The above is only a specific implementation of the embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the embodiment of the present invention. These improvements and modifications should also be regarded as protection for the embodiment of the present invention.
[0266] In the present invention, the terms "first" and "second" are used for descriptive purposes only and cannot be understood as indicating or implying relative importance. The term "plurality" refers to two or more than two, unless otherwise clearly defined.
[0267] Those skilled in the art will readily appreciate other embodiments of the present invention after considering the specification and practicing the disclosure disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention that follow the general principles of the present invention and include common knowledge or customary techniques in the art that are not disclosed by the present invention. The description and examples are to be considered exemplary only, and the true scope and spirit of the present invention are indicated by the following claims.
[0268] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A data extraction method, characterized in that: The method comprises: Obtain an image to be recognized; Based on character recognition, determining the characters and character position information in the image to be recognized; Determine the row and column relationship between characters according to the determined character position information; Determining a corresponding preset format based on the preset format keyword included in the determined characters; For each line of characters, the characters in the line are concatenated in order, and based on the word segmentation model, a first segmentation phrase and a corresponding first attribute in the concatenation result are determined; For each row of characters, characters belonging to different columns are respectively determined as second segmentation phrases, and a second attribute corresponding to each second segmentation phrase is determined according to the determined preset format; and for each second segmentation phrase, based on the segmentation model, whether the corresponding second attribute is correct; The first segmented word group and the corresponding first attribute, as well as the second segmented word group and the correct second attribute, are comprehensively considered to determine a segmentation result and a corresponding attribute result.
2. The method according to claim 1, characterized in that: Determining the row and column relationship between characters according to the determined character position information includes: Determine the line spacing distribution between characters according to the determined character position information; Determine the standard line spacing according to the determined line spacing distribution; Based on the standard line spacing, determining characters belonging to the same line; And according to the determined character position information, characters belonging to the same column are determined.
3. The method according to claim 1, characterized in that Determining the row and column relationship between characters according to the determined character position information includes: Determining characters belonging to the same row according to the determined character position information; For each row of characters, multiple character blocks are divided based on the horizontal distance between the characters; For each character block, the character block with the highest degree of overlap with the character block in horizontal position or horizontal coordinate is determined among the character blocks in other rows, and the determined character block and the character block are determined as characters belonging to the same column.
4. The method according to claim 1, characterized in that Also includes: Pre-acquire a set of correspondences between preset formats and preset format keywords; The preset format includes a number of attributes arranged in order; The determining of the corresponding preset format based on the preset format keyword included in the determined characters includes: Based on the preset format keyword included in the determined character, determining a corresponding preset format from the corresponding relationship set; Determining the second attribute corresponding to each segmentation phrase according to the determined preset format includes: Matching the order of the attributes included in the determined preset format with the order of the second participle phrases; The matching attribute corresponding to each second participle phrase is determined as the second attribute corresponding to the second participle phrase.
5. The method according to claim 1, characterized in that Also includes: When it is determined that the second attribute corresponding to any second segmentation phrase is correct, the second segmentation phrase and the corresponding second attribute are added to the training sample set of the segmentation model; The added training sample set is used to update and train the word segmentation model.
6. The method according to claim 1, characterized in that The step of comprehensively determining a segmentation result and a corresponding attribute result by combining the first segmentation phrase and the corresponding first attribute, and the second segmentation phrase and the correct second attribute, includes: For the correct second attribute, add the corresponding second segmentation phrase to the segmentation result, and add the corresponding correct second attribute to the corresponding attribute result; For the wrong second attribute, the same attribute is determined from the first attribute, and the first segmentation phrase corresponding to the determined attribute is added to the segmentation result, and the corresponding first attribute is added to the corresponding attribute result.
7. The method according to claim 1, characterized in that The step of determining, for each row of characters, characters belonging to different columns as second segmentation phrases respectively includes: According to the determined preset format, determining the starting row of the concerned character and the ending row of the concerned character from the determined characters; the preset format includes the keyword of the starting row of the concerned character and the keyword of the ending row of the concerned character; For each row of characters between the focus character start row and the focus character end row, characters belonging to different columns are respectively determined as second segmentation phrases.
8. A data extraction device, characterized in that: The device comprises: A recognition unit, used for acquiring an image to be recognized; based on character recognition, determining characters and character position information in the image to be recognized; A pre-analysis unit, used to determine the row and column relationship between characters according to the determined character position information; and determine the corresponding preset format based on the preset format keywords included in the determined characters; A first extraction unit is used to sequentially concatenate the characters in each line of characters, and determine a first segmentation phrase and a corresponding first attribute in the concatenation result based on the segmentation model; The second extraction unit is used to determine, for each row of characters, characters belonging to different columns as second segmentation phrases, and determine, according to the determined preset format, a second attribute corresponding to each second segmentation phrase; and for each second segmentation phrase, based on the segmentation model, determine whether the corresponding second attribute is correct; The synthesis unit is used to synthesize the first segmentation phrase and the corresponding first attribute, and the second segmentation phrase and the correct second attribute to determine the segmentation result and the corresponding attribute result.
9. An electronic device, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the one processor, and the instructions are executed by the at least one processor so that the at least one processor can perform the method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that: The computer program implements the method according to any one of claims 1 to 7 when executed by a processor.
Citation Information
Patent Citations
Method and device for identifying table content in image file and memory medium
CN108734089A
Method and device for automatically auditing business receipts of ERP financial system
CN112364645A
