Image processing device, method, and program
The image processing device uses regular expressions with space management parameters to enhance the precision of character string extraction for file naming, addressing the issue of unwanted characters in character recognition results.
Patent Information
- Application Number
- JP2020123283
- Authority / Receiving Office
- JP · JP
- Patent Type
- Patents
- Current Assignee / Owner
- Filing Date
- 2020-07-17
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2040-07-17
AI Technical Summary
Existing character recognition systems fail to accurately separate relevant information from unwanted characters when converting to file names, leading to undesired inclusion of blank spaces or unnecessary text, requiring manual editing.
An image processing device that utilizes regular expressions with predefined parameters to insert or delete spaces based on character distance, allowing precise extraction and division of character strings for file naming.
Enables automatic and accurate extraction of desired character strings without extra characters, improving the efficiency of file naming by reducing manual intervention.
Smart Images

Figure 0007566520000001 
Figure 0007566520000002 
Figure 0007566520000003
Abstract
Description
[Technical field]
[0001] The present invention relates to an image processing device, method, and program. [Background technology]
[0002] There is a business that scans paper documents, digitizes them, and stores them. Conventionally, there has been a system that performs character recognition when digitizing documents and uses the results as a file name. For example, there is a system in which a user selects the character recognition results from a document image and saves the character recognition results as a file name in an arbitrary storage device. However, since the character recognition results are used, there is a tendency for the character recognition results to fluctuate. For example, when an extra blank character is present in a character string to be set as a file name, the file name also contains blank characters, which is not preferable. Therefore, Patent Document 1 discloses a method of converting the character recognition results into a character string suitable for a file name, such as by removing leading blank characters, when using the character recognition results as a file name. [Prior art documents] [Patent documents]
[0003] [Patent Document 1] JP 2013-74609 A Summary of the Invention [Problem to be solved by the invention]
[0004] In the method of Patent Document 1, when a selected character recognition result contains a space, it can be converted into a character string suitable for a file name, but the range of the character string selected as a file name may not be suitable in the first place. For example, even if you want to select a date as a file name, the date and the characters on either side of it form a single character string, and the entire character string may be selected. For example, if "payment due date" is written as the item name of the date, and the item name and the date cannot be separated, they will be selected as a single character string. In this case, the user must manually select and delete the unnecessary parts from the character recognition result of the selected character string. [Means for solving the problem]
[0005] The image processing device of the present invention comprises: Positive The system comprises a storage means for storing a regular expression definition that associates a regular expression with parameters related to a space character that is predefined for each regular expression; a character recognition means for executing a character recognition process on a document image; a generation means for generating a search string by inserting a space character into a character string resulting from character recognition by the character recognition means based on the parameters related to the space character; a search means for searching the search string generated by the generation means for a portion that matches the regular expression; and a division means for dividing the character string resulting from character recognition based on the portion searched for by the search means. Effect of the Invention
[0006] According to the present invention, a character string resulting from character recognition can be divided and extracted at appropriate positions. [Brief description of the drawings]
[0007] [Figure 1] FIG. 1 is a diagram illustrating a system configuration of an image processing system. [Diagram 2] FIG. 2 is a diagram illustrating a hardware configuration of an image forming apparatus 101. [Diagram 3]2 is a diagram illustrating the hardware configuration of an image processing server 102 and a user terminal 103. FIG. [Figure 4] FIG. 4 is a diagram showing an example of a form image 400 and its character recognition result. [Diagram 5] FIG. 2 is a diagram illustrating a processing flow according to the first embodiment. [Figure 6] FIG. 4 is a diagram showing a list of regular expression definitions in the first embodiment. [Figure 7] 11 is a table showing an example of a character recognition result. [Figure 8] 13 is an example of a result after a division process in the first embodiment. [Figure 9] FIG. 11 is a diagram showing a list of regular expression definitions in the second embodiment. [Figure 10] 13 is an example of a character recognition result in the second embodiment. [Figure 11] FIG. 13 is a diagram showing a list of regular expression definitions in the third embodiment. [Figure 12] 13 is an example of a character recognition result in the third embodiment. DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENTS
[0008] Hereinafter, an embodiment of the present invention will be described with reference to the drawings. Note that the embodiment does not limit the present invention, and all of the configurations described in the embodiment are not necessarily essential means for solving the problems of the present invention.
[0009] <First embodiment> 1 is a diagram showing an example of the configuration of an image processing system 100 according to the first embodiment. This image processing system 100 includes an image forming apparatus 101, an image processing server 102, and a user terminal 103. The image forming apparatus 101, the image processing server 102, and the user terminal 103 are interconnected via a network 104 and are capable of communicating with each other.
[0010] The image forming apparatus 101 is a multifunction machine capable of receiving a print request (print data) of image data from the user terminal 103 and printing the image data, reading the image data with a scanner provided in the image forming apparatus 101, and printing the image data read with the scanner. The image processing server 102 is an image processing apparatus capable of executing image processing, which will be described later, on the image data read with the scanner of the image forming apparatus 101 and transmitting the image processing result to the user terminal 103. The image processing server 102 may be a cloud, that is, a virtual server disposed on the Internet. The user terminal 103 is capable of performing additional processing of the image processing result received from the image processing server 102 interactively with a user using an application having a user interface. In this embodiment, the user terminal 103 is assumed to be a general PC equipped with a display, a keyboard, and a mouse, but may be, for example, a mobile terminal equipped with a touch panel.
[0011] In this embodiment, a series of data input support processes will be described, in which an image forming device 101 scans paper documents such as invoices, an image processing server 102 extracts the necessary information from the documents and stores it electronically, and a user terminal 103 provides a user interface that allows the user to check and correct the extracted results.
[0012] 2 is a diagram showing an example of the configuration of the image forming apparatus 101. The image forming apparatus 101 has a controller 201, a printer 202, a scanner 203, and an operation unit 204. The controller 201 has a CPU 211, a RAM 212, a HDD 213, a network I / F 214, a printer I / F 215, a scanner I / F 216, an operation unit I / F 217, and an expansion I / F 218.
[0013] The CPU 211 controls the entire image forming apparatus 101. The CPU 211 can control data transmission and reception with the RAM 212, the HDD 213, the network I / F 214, the printer I / F 215, the scanner I / F 216, the operation unit I / F 217, and the expansion I / F 218. The CPU 211 also loads a control program (instruction) read from the HDD 213 in the RAM 212 and executes the instruction loaded in the RAM 212. The HDD 213 stores a control program executable by the CPU 211, setting values used in the image forming apparatus 101, data related to processing requested by a user, and the like. The RAM 212 has an area for temporarily storing instructions read by the CPU 211 from the HDD 213. The RAM 212 can also store various data required for executing instructions. For example, in image processing, the CPU 211 can perform processing by loading input data in the RAM 212.
[0014] The network I / F 214 is an interface for performing network communication with devices in the image processing system 100. The network I / F 214 can notify the CPU 211 of data reception and can transmit data on the RAM 212 to the network 104. The printer I / F 215 can transmit print data transmitted from the CPU 211 to the printer 202 and can transmit the printer status received from the printer 202 to the CPU 211. The scanner I / F 216 can transmit an image reading instruction transmitted from the CPU 211 to the scanner 203, transmit image data received from the scanner 203 to the CPU 211, and can transmit the status received from the scanner 203 to the CPU 211. The operation unit I / F 217 can transmit an instruction from a user input from the operation unit 204 to the CPU 211 and can transmit screen information for the user to operate to the operation unit 204. The expansion I / F 218 is an interface that enables an external device to be connected to the image forming apparatus 101. The expansion I / F 218 includes, for example, a USB (Universal Serial Bus) type interface. When an external storage device such as a USB memory is connected to the expansion I / F 218, the image forming apparatus 101 can read data stored in the external storage device and write data to the external storage device.
[0015] The printer 202 is capable of printing image data received from the printer I / F 215 on paper, and of transmitting the status of the printer 202 to the printer I / F 215 .
[0016] The scanner 203 can read information displayed on a paper sheet placed on a reading unit, digitize the information, and transmit the digitalized information to the scanner I / F 216 in accordance with an image reading instruction received from the scanner I / F 216. The scanner 203 can also transmit its own status to the scanner I / F 216.
[0017] The operation unit 204 is an interface that allows a user to perform operations for issuing various instructions to the image forming apparatus 101. For example, the operation unit 204 includes a liquid crystal display having a touch panel, and provides an operation screen to the user of the image forming apparatus 101 and accepts operations from the user.
[0018] 3(a) is a diagram showing an example of the configuration of the image processing server 102. The image processing server 102 has a CPU 301, a RAM 302, a HDD 303, and a network I / F 304. The CPU 301 controls the entire image processing server 102. The CPU 301 can control the exchange of data with the RAM 302, the HDD 303, and the network I / F 304. The CPU 301 also loads a control program (instructions) read from the HDD 303 into the RAM 302, and executes the instructions loaded into the RAM 302.
[0019] FIG. 3B is a diagram showing an example of the configuration of the user terminal 103. The user terminal 103 includes a CPU 311, a RAM 312, a HDD 313, a network I / F 314, and an input / output I / F 315. The CPU 311 controls the entire user terminal 103. The CPU 311 can control data transmission and reception between the RAM 312, the HDD 313, the network I / F 314, and the input / output I / F 315. The display 320 is configured with a display device such as a liquid crystal display, and displays display information received from the input / output I / F 315. The input device 330 is configured with a pointing device such as a mouse or a touch panel, and a keyboard, and receives an operation from a user and transmits operation information to the input / output I / F 315. The HDD 313 can store image processing results received from the image processing server 102 via the network I / F 314. In this embodiment, the CPU 311 loads an application program read from the HDD 313 into the RAM 312, and causes the operation unit I / F 315 to display display information and accept user operations.
[0020] Fig. 4(a) is a diagram showing an example of a form image 400 assumed in this embodiment. The form image 400 is an image acquired by reading a paper document (e.g., an invoice) with the scanner of the image forming apparatus 101. Item values 401 to 403 are examples of item character strings to be extracted by the image processing system 100. The item value 401 in Fig. 4(a) is the value of the title indicating the contents of this document, the item value 402 is the value of the date indicating the issue date, and the item value 403 is the value of the billing amount. For the sake of explanation, the positions of the item values 401 to 403 are shown by rectangular frames, but it is assumed that no rectangular frames are drawn on the actual form image.
[0021] FIG. 4(b) is an example of a character string (OCR character string) that is a result of character recognition obtained when a general-purpose region analysis process and an optical character recognition (OCR) process are performed on a form image 400. Eight character regions, character strings 410 to 417, are identified, and an OCR character string is extracted from each character region. The position of each character region extracted based on the results of the region analysis process and the OCR process is indicated by a rectangular frame. Character string 410 is obtained as a character string corresponding to one character region that includes the character string of item value 401 and the character string to the left of it. Character string 411 is extracted as a character string corresponding to one character region that includes item value 402 and the character string to the left of it. Character string 413 is also extracted as a character string corresponding to an area that includes item value 403 and the character string to the left of it.
[0022] A use case will be described in which this character string is used in a UI for a user to create a file name. For example, a UI (user interface) will be described in which, when a user clicks a desired position on a form image, the character area corresponding to the clicked position and based on the area analysis result in FIG. 4(b) is selected. In such a UI, when a user clicks on the character string "invoice", the character string in the character area based on the area analysis result (i.e., the character string "Invoice for ABC Co., Ltd." in character area 410) will be selected. Therefore, if a user wants to select only the document title portion of "invoice" as the file name, the redundant character string "ABC Co., Ltd." must be deleted from the selected character string.
[0023] In this embodiment, therefore, image processing will be described that appropriately extracts character strings such as item values 401 to 403 from an OCR character string such as that shown in FIG. 4(b) when a user selects a character string to be used as a file name.
[0024] In this embodiment, the extraction of an item value refers to a state in which the target value is an independent character string without any extra characters. For example, in the form image 400, the item value 401 is an independent character string, "invoice."
[0025] The regular expression definition list 600 in FIG. 6 is an example showing a plurality of regular expression definitions in a table format. The regular expression definitions in this embodiment are defined by associating a combination of a regular expression and a regular expression parameter with each definition ID. These predefined multiple regular expression definitions are stored in the HDD 303 of the image processing server 102. The regular expression is a description of a string to be extracted, such as items to be extracted (e.g., date, phone number, amount, characters included in the document title, etc.), in a single regular expression. The regular expression parameter is a parameter that defines how to interpret the OCR character string to be targeted when performing a regular expression search for each regular expression. For example, it describes with parameters how far apart adjacent characters should be for them to be treated as space characters (blank characters).
[0026] In the example of the regular expression definition list 600 in FIG. 6, three regular expression definitions 610, 620, and 630 are defined.
[0027] The regular expression definition ID 610 consists of the regular expression pattern of "¥S*書" and the regular expression parameter of "space = 2h". The regular expression pattern of "¥S*書" represents a pattern combining a plurality of characters other than space characters (¥S) and the character "書". For example, it can be searched as a pattern corresponding to character strings such as "請求書" (invoice) and "見積書" (estimate). The regular expression parameter "space = 2h" indicates that when converting the OCR character string into a search string, if the distance between adjacent characters is more than twice the character height (h), a space character is inserted and treated. In this embodiment, the character height is used to define the threshold for treating as a space character as a regular expression parameter. However, for example, the pixel size of the image, the physical distance on the paper surface, the average character width, etc. may also be used as a reference.
[0028] Regular expression definition ID 620 is a regular expression definition related to dates, and is composed of a regular expression of "d{2,4} year, d{1,2} month, d{1,2} day" and a regular expression parameter of "delete spaces". The regular expression of "d{2,4} year, d{1,2} month, d{1,2} day" represents a pattern that combines a 2- to 4-digit number, a "year", a 1- to 2-digit number, a "month", a 1- to 2-digit number, and a "day", and it is possible to search for date strings that match this pattern. The regular expression parameter "delete spaces" indicates that when converting an OCR string into a search string, no space characters are inserted regardless of the distance between adjacent characters.
[0029] Regular expression definition ID 630 consists of a regular expression of "[1-9][¥d,]*yen" and a regular expression parameter of "space=1h". The regular expression of "[1-9][¥d,]*yen" represents a pattern that combines a number starting with any of the digits 1 to 9 and including one or more commas with "yen", and it is possible to search for a character string that represents an amount of money that matches this pattern. The regular expression parameter "space=1h" indicates that when converting an OCR string into a search string, if the distance between adjacent characters is equal to or greater than one character height, based on the character height (h), a space character is inserted.
[0030] The image processing of this embodiment will be described with reference to the flowchart of FIG. 5, using the form image 400 of FIG. 4 and the regular expression definition list 600 of FIG. 6 as examples.
[0031] First, in S501, the CPU 211 of the image forming apparatus 101 transmits the form image 400 read by the scanner 203 to the image processing server 102. The image processing server 102 acquires the form image 400 transmitted from the image forming apparatus 101.
[0032] Next, in S502, the CPU 301 of the image processing server 102 performs region analysis processing on the form image 400 to identify character regions, and executes character recognition processing on the character regions. As a result of the character recognition processing, the CPU 301 obtains the coordinates of the character region (character block), the coordinates of each character in the character region, and the character code of the character recognition result. The array of character codes obtained here for each character region is called an OCR character string. It is assumed that character strings 410 to 417 are obtained as OCR character strings as a result of performing character recognition processing on the form image 400.
[0033] Next, in S503, the CPU 301 of the image processing server 102 selects one of the regular expression definitions (for example, the regular expression definition 610) from the regular expression definition list 600 stored in the HDD 303 as the processing target.
[0034] Next, in S504, the CPU 301 of the image processing server 102 interprets the recognition result of the character string obtained in S502 based on the regular expression parameters of the regular expression definition targeted for processing in S503, and normalizes it as a search character string.
[0035] 7 shows an example of a character recognition result. Character recognition result 701 is the character recognition result of character string 410. Character recognition result 702 is the character recognition result of OCR character string 411 including item value 402. Character recognition result 703 is the character recognition result of OCR character string 413 including item value 403. The character rows in the table of character recognition results 701 to 703 represent each recognized character, and the distance rows represent the distance to the next character, with the character height as the relative criterion. The regular expression parameter of regular expression definition 610 is "space=2h", which indicates that if the distance between characters is two character heights or more with the character height as the relative criterion, it is regarded as a space character.
[0036] The CPU 301 scans the distance between each character and the adjacent character for the character recognition result 701 of the character string 410, and detects the characters that meet the space insertion condition. As a result of the detection, since the character "様" is separated from the adjacent character "請" by a distance corresponding to 2.1 character heights, a space character is inserted here to generate the search string "ABC(株)様 請求書".
[0037] Note that for each regular expression parameter, the search string changes. For example, when "space = 1h" is defined, space characters are further inserted between "請" and "求", and between "求" and "書", resulting in "ABC(株) 様 請 求 書". When "space deletion" is defined, it becomes "ABC(株)様請求書".
[0038] Next, the CPU 301 scans the distance between each character and the adjacent character for the character recognition result 702 of the character string 411, and detects the characters that meet the space insertion condition. As a result of the detection, since the characters "年" and "月" are separated from the adjacent characters by more than 2 character heights, a space character is inserted here to form the search string "発行日:2020年 5月 15日".
[0039] The same process is executed for the remaining character strings 412 to 417 to form search strings for all character strings.
[0040] Next, in S505, the CPU 301 of the image processing server 102 performs a regular expression search process to determine whether each of the search strings obtained in S504 matches the regular expression of the regular expression definition to be processed in S503.
[0041] When the regular expression definition 610 is searched for the search string "ABC Co., Ltd. Invoice" in string 410, the "invoice" portion matches. Subsequently, when the regular expression definition 610 is searched for the search string "Issue date: May 15, 2020" in string 411, no match is obtained. Similarly, the same process is performed on the remaining search strings 412 to 417 using the regular expression definition 610, and as a result, the regular expression does not match the other strings.
[0042] In S506, the CPU 301 of the image processing server 102 stores in the RAM 302 the matching information for “invoice” obtained in the search result in S505.
[0043] Next, in S507, the CPU 301 of the image processing server 102 determines whether any unprocessed regular expression definitions remain, and if any unprocessed regular expression definitions remain, the process returns to S503 and similarly performs the processes of S504 to S507 on one of the unprocessed regular expression definitions as the next processing target.
[0044] For example, if regular expression definition 610 was the first processing target, regular expression definition 620 is the next processing target. In this case, in S504, a search string is generated for character recognition result 702 based on the parameters of regular expression definition 620. Since the parameter of regular expression definition 620 is "delete spaces", no space characters are inserted regardless of the distance between characters, and therefore "Publication date: May 15, 2020" is obtained as a search string from character recognition result 702. Then, the search result of "May 15, 2020" is obtained as a portion that matches the regular expression of regular expression definition 620.
[0045] Similarly, when the regular expression definition 630 is the processing target, in S504, a search character string of "Total amount: 11,286 yen" is formed for the character recognition result 703 based on the parameter "space=1h" of the regular expression definition 630. Then, in S505, "11,286 yen" is searched for as a portion that matches the regular expression of the regular expression definition 630.
[0046] If it is determined in S507 that all of the regular expression definitions have been processed, the process proceeds to S508.
[0047] In S508, the CPU 301 of the image processing server 102 performs character string division processing based on the search results stored in the RAM in the processing of S506. The division processing is processing for dividing the OCR character string at both ends of the range that matches the regular expression in the OCR character string. For example, in the OCR character string 410, "Invoice for ABC Co., Ltd.", the left and right of "Invoice" are used as character string separators to divide the string. However, the right side of "Invoice" is the right end of the OCR character string, so division does not occur, and the OCR character string 410 is divided at the left side of "Invoice" (i.e., between "Mr." and "Request") to divide the OCR character string 410 into two OCR character strings. Similarly, processing is performed for "May 15, 2020" and "11,286 yen," and the processing of the flowchart is terminated.
[0048] Fig. 8 is a diagram showing, with rectangular frames, the positions of OCR character strings after the flowchart of Fig. 5 has been applied to the form image 400. The OCR character string 410 is divided into OCR character strings 800 and 801, the OCR character string 411 is divided into OCR character strings 802 and 803, and the OCR character string 413 is divided into OCR character strings 804 and 805. Note that the OCR character strings 412, 414 to 417 remain unchanged.
[0049] As a result of applying this image processing, when the user names a file for the form image 400 and clicks at a position above the document title "Bill" (claim form), instead of the character string 410 in FIG. 4, the OCR character string 801 in FIG. 8 will be selected. That is, it becomes possible to extract and select character strings that match the regular expression definition.
[0050] If the search character string based on the regular expression definition parameters described in this embodiment is not used, the following processing will occur. For example, when the OCR character string "ABC Co., Ltd. Bill" is obtained by the character recognition processing in S502, in the regular expression of the regular expression definition 610, since there is a space character before "Bill", it does not match, that is, the character string "Bill" cannot be extracted. In this way, in general character recognition processing, the process of inserting space characters based on the distance between characters is uniformly applied to the entire document image, so in the recognition result, it does not always match the intention of the original document creator. Therefore, it is difficult to express how to represent spaces in a regular expression.
[0051] On the other hand, in this embodiment, for each regular expression definition, as a parameter of the regular expression, how to handle spaces is defined, so that appropriate space characters can be handled for each regular expression. For example, for a document title such as "Bill", after using the character string where non-space characters are consecutive as a clue for item value extraction, considering that there is a certain distance between the characters of the title, the space condition can be defined as "space = 2h". Also, for example, when it can be clearly extracted in a format such as a date, the space can be ignored as "space deletion".
[0052] In this way, in this embodiment, character strings often used in file names and the like are predefined with regular expressions, and for each character string, it can be defined how the characters of each character string are spaced (whether to insert space characters). Thereby, the position of the character string to be split can be specified more accurately.
[0053] If the space characters output by the character recognition process are reliable, the parameters may be set to use the recognition results as they are. For example, in character recognition process of English sentences in an English document, words are recognized using a word dictionary, and space characters written in a rut style are inserted between the words.
[0054] Additionally, in the present embodiment, the extraction of item values has been described using an example of file naming, but it may also be used for metadata for saving forms, automatic input of values into a document transcription system, and the like.
[0055] As described above, by applying this embodiment, the user can divide item values into OCR character strings suitable for file naming and the like.
[0056] <Second embodiment> In the first embodiment, one regular expression definition is used for each item value, but this is not limited thereto, and multiple regular expression definitions may be used.
[0057] Regular expression definition list 800 in Fig. 9 is an example of a regular expression definition for a telephone number. Regular expression definition 910 is the regular expression "d{2,4}[\-\(]\d{2,4}[\-\)]\d{4}" without any regular expression parameters, and regular expression definition 911 is the same regular expression as 910, but with a regular expression parameter of "delete spaces". The regular expression expressions of regular expression definitions 910 and 911 are capable of searching for Japanese telephone numbers consisting of 2 to 4 digits, "-" or "(", 2 to 4 digits, "-" or ")", and 4 digits.
[0058] Regular expression definition 920 consists of only the regular expression "d{2,4}\s\d{2,4}\s\d{4}" without any regular expression parameters, and regular expression definition 921 consists of the same regular expression as 920 and a regular expression parameter of "space=1h". Regular expression definitions 920 and 921 are capable of searching for Japanese telephone numbers consisting of 2 to 4 digits, a space character, 2 to 4 digits, a space character, and a 4 digit number.
[0059] 10 is an example of the character recognition result of a telephone number in a document. In OCR character string 1010, the space before and after the character "1" is large, so as a result of the character recognition in S502, spaces are inserted before and after the 1, resulting in the character string "TEL: 0 1 23-456-7890". Since regular expression definition 910 does not have a regular expression parameter, this OCR character string is treated as it is as a search string, and a search using the regular expression "¥d{2,4}[¥-¥(]¥d{2,4}[¥-¥)]¥d{4}" does not produce a match. Since regular expression definition 911 has a parameter for "delete spaces", the search string becomes "TEL:0123-456-7890", and the telephone number portion can be extracted.
[0060] OCR character string 1020 is an example where there is no hyphen but a space character as a delimiter of a telephone number. Since the space between the characters before and after the character "1" in OCR character string 1020 is large, the result of character recognition in S502 is that spaces are inserted before and after the 1, resulting in the character string "TEL: 0 1 23 456 7890". Since regular expression definition 920 does not have a regular expression parameter, this OCR character string is treated as it is as a search character string, and a search using the regular expression "¥d{2,4}¥s¥d{2,4}¥s¥d{4}" does not produce a match. Since regular expression definition 921 has a parameter "space=1h", the search character string becomes "TEL:0123-456-7890", and the telephone number portion can be extracted.
[0061] If you try to match such space characters output by character recognition results using only regular expressions, you will have no choice but to write "[\d\s]{2,7}" for the regular expression "\d{2,4}" which is a 2-4 digit number at the beginning. In other words, because the number of spaces is indefinite, the number of digits is defined as 2-7 digits assuming the maximum space, but with such a regular expression, many character strings will match, increasing noise other than the item value you are actually trying to extract.
[0062] As described above, by applying this embodiment, it is possible to reduce the influence of space characters in the output of the character recognition result and to define a regular expression in a simple manner.
[0063] <Third embodiment> In the first embodiment, the pattern to be extracted is defined by a regular expression definition and is divided at the matching left and right ends, but operations other than division may be specified by regular expression parameters.
[0064] Regular expression definition list 1100 in Fig. 11 specifies the action to be taken when a regular expression matches as regular expression parameter 2. Regular expression definition 1111 specifies the regular expression as ".*no", which represents, for example, a combination of any sequence of characters and "no", with a regular expression parameter of "delete space" and an action definition of "split". Split is the action of splitting the search results at the left and right ends, as explained in the first embodiment. Regular expression definition 1112 specifies the character string "nov", with a regular expression parameter of "delete space", and an action definition of "protect". Protect is an action definition that does not split the range that matches the search results.
[0065] A character string 1201 "Invoice No 10123" in Fig. 12 represents an invoice number, and when only the regular expression definition 1111 is used as the regular expression definition list, it matches "Invoice No" as a result of the processing in the flowchart in Fig. 5. As a result, it is split into "Invoice No" and "10123".
[0066] The character string 1202 "12 Nov 2019" in FIG. 12 represents a date, and when only the regular expression definition 1111 is used in the regular expression definition list, the search results match "12 No." As a result, it is split into "12 No" and "v 2019," which is undesirable for a user who wants to extract a date. By adding the regular expression definition 1112 to the regular expression definition list and searching, the search result matches "Nov" in the character string 1202, and no splitting is performed within that range, and is stored in S506. In S508, the split information is protected, splitting is not performed, and unintended splitting can be prevented.
[0067] Other operations may also be specified. In the regular expression definition 1120, it is possible to define sub-match splitting by using grouping of regular expressions to split on both sides of a match by a sub-match. As a result of regular expression search of the regular expression "(.*no)(¥d*)" of the regular expression definition 1120 against the character string 1201, "Invoice No" matches with sub-match 1 and "10123" matches with sub-match 2, and splitting is performed between them.
[0068] As described above, by applying this embodiment, unintended division can be prevented or more complicated division can be implemented.
[0069] <Fourth embodiment> In the first embodiment, the item value is extracted by dividing the OCR character string, but it may be combined. For example, in a case where the OCR character string 411 of the form image 400 is divided into three OCR character strings, "Issuance date: 2020", "May", and "15th", as a result of character recognition, in the search character string generation process of S503, OCR character strings in the vicinity of the same character height are combined, and then a search is performed using a regular expression in S504, and if there is a match, the matching range is combined.
[0070] As described above, by applying this embodiment, it is possible to extract using a regular expression without being affected by the granularity of the OCR character string output as a result of character recognition.
[0071] <Other embodiments> The present invention can also be realized by supplying a program for implementing one or more of the functions of the above-described embodiments to a system or device via a network or a storage medium, and having one or more processors in the computer of the system or device read and execute the program. It can also be realized by a circuit (e.g., ASIC) that implements one or more of the functions.
[0072] Although the preferred embodiments of the present invention have been described above, the present invention is not limited to these embodiments, and various modifications and changes are possible within the scope of the gist of the present invention. [Explanation of symbols]
[0073] 100 Image Processing System 101 Image forming device 102 Image processing server (image processing device) 103 User terminal 104 Network
Claims
1. A storage means for storing regular expression definitions that associate regular expressions with parameters related to space characters that are predefined for each regular expression; character recognition means for executing character recognition processing on a document image; a generating means for generating a search string by inserting a space character into a character string resulting from character recognition by the character recognition means based on the parameter relating to the space character; a search means for searching the search string generated by the generation means for a portion that matches the regular expression; a division means for dividing the character string of the character recognition result based on the portion searched by the search means; 13. An image processing device comprising:
2. 2. The image processing device according to claim 1, wherein the generating means generates the search character string by inserting the space character into a location where a distance between adjacent characters in the character string resulting from the character recognition is greater than an interval defined as a parameter related to the space character.
3. 3. The image processing device according to claim 2, wherein, for a regular expression definition in which a parameter specified using a character height is defined as the parameter related to the space character, the generating means generates the search character string by inserting the space character at a location where a distance between adjacent characters in the character string resulting from the character recognition relative to the character height in the character string resulting from the character recognition is greater than the parameter related to the space character.
4. 4. The image processing device according to claim 1, wherein, for a regular expression definition in which deletion of spaces is defined as a parameter related to the space character, the generating means generates the search character string without inserting a space character into the character string resulting from the character recognition.
5. 5. The image processing device according to claim 1, further comprising a selection unit that selects the character string after division when a position specified by a user in the document image corresponds to a character string divided by the division unit.
6. An image processing method for dividing a character string resulting from character recognition based on a regular expression definition that associates a regular expression with a parameter related to a space character that is predefined for each regular expression, comprising: a character recognition step of performing character recognition processing on the document image; a generating step of generating a search string by inserting a space character into the character string resulting from the character recognition step based on the parameter related to the space character; a search step of searching the search string generated in the generation step for a portion that matches the regular expression; a division step of dividing the character string of the character recognition result based on the portion searched for in the search step; 13. An image processing method comprising:
7. A program for causing a computer to function as each of the means of the image processing apparatus according to any one of claims 1 to 5.
Citation Information
Patent Citations
Document recognition device and mail divider
JP2000148906A
File name creation apparatus and file name creation program
JP2013074609A
Formatting module, system, and method for formatting electronic strings.
JP2015534171A
Member information registration support system
JP2017228170A
