WO2022142627A1 - 地址信息的提取方法、装置、设备及介质 - Google Patents

地址信息的提取方法、装置、设备及介质 Download PDF

Info

Publication number
WO2022142627A1
WO2022142627A1 PCT/CN2021/125502 CN2021125502W WO2022142627A1 WO 2022142627 A1 WO2022142627 A1 WO 2022142627A1 CN 2021125502 W CN2021125502 W CN 2021125502W WO 2022142627 A1 WO2022142627 A1 WO 2022142627A1
Authority
WO
WIPO (PCT)
Prior art keywords
text
address
list
line
information
Prior art date
Application number
PCT/CN2021/125502
Other languages
English (en)
French (fr)
Inventor
李超
徐国强
Original Assignee
深圳壹账通智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2022142627A1 publication Critical patent/WO2022142627A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/40Document-oriented image-based pattern recognition
    • G06V30/41Analysis of document content
    • G06V30/416Extracting the logical structure, e.g. chapters, sections or page numbers; Identifying elements of the document, e.g. authors
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V20/00Scenes; Scene-specific elements
    • G06V20/60Type of objects
    • G06V20/62Text, e.g. of license plates, overlay texts or captions on TV images
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/153Segmentation of character regions using recognition of characters or words
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition
    • G06V30/14Image acquisition
    • G06V30/148Segmentation of character regions
    • G06V30/158Segmentation of character regions using character size, text spacings or pitch estimation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V30/00Character recognition; Recognising digital ink; Document-oriented image-based pattern recognition
    • G06V30/10Character recognition

Definitions

  • the present application relates to the field of information technology, and in particular, to a method, apparatus, device and medium for extracting address information.
  • the prior art mainly uses deep learning models or regular expressions to extract address information from bill images. If a deep learning model is used, model training needs to be performed on large-scale data in advance, resulting in high development, deployment and operation costs and low efficiency. If regular expressions are used, a large number of regular expressions need to be written in advance, and samples that are not covered by regular expressions cannot be extracted; and with the diversification of address information on bill images, the regular expressions written will also become more and more More and more complex, not easy to maintain and update.
  • the embodiments of the present application provide an address information extraction method, apparatus, device and medium, so as to solve the problems of low operation efficiency, difficult maintenance and update existing in the existing address information extraction technology.
  • a method for extracting address information comprising:
  • a device for extracting address information comprising:
  • the identification module is used to obtain the bill image to be identified, and carries out OCR identification to the bill image to obtain the text information in the bill image and its corresponding coordinate information;
  • a merging module configured to merge the text information according to the coordinate information to obtain one or more small text lists, and combine the small text lists to obtain a large text list corresponding to the bill image;
  • the acquisition module is used to acquire the address level and its corresponding keyword list
  • an extraction module configured to perform address extraction on the text mini-list according to the address hierarchy and its corresponding keyword list, to obtain address information corresponding to the text mini-list;
  • the combination module is used for traversing all the small text lists in the large text list, obtaining the address information corresponding to each text small list, and combining the address information to obtain the address information list on the bill image.
  • a computer device comprising a memory, a processor, and a readable storage medium stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the readable storage medium:
  • One or more readable storage media having computer-readable instructions stored thereon, the computer-readable storage media having computer-readable instructions stored thereon, wherein the computer-readable instructions, when executed by one or more processors, cause all The one or more processors perform the following steps:
  • the present application reduces the cost, improves the operation efficiency, and has better fault tolerance.
  • FIG. 1 is a flowchart of a method for extracting address information provided in an embodiment of the present application
  • step S102 is a flowchart of step S102 in the method for extracting address information provided in an embodiment of the present application
  • FIG. 3 is a schematic diagram of a bill image provided in an embodiment of the present application.
  • step S104 is a flowchart of step S104 in the method for extracting address information provided in an embodiment of the present application
  • step S1041 is a flowchart of step S1041 in the method for extracting address information provided in an embodiment of the present application
  • step S1042 is a flowchart of step S1042 in the method for extracting address information provided in an embodiment of the present application
  • step S1043 is a flowchart of step S1043 in the method for extracting address information provided in an embodiment of the present application.
  • step S1044 is a flowchart of step S1044 in the method for extracting address information provided in an embodiment of the present application
  • FIG. 9 is a schematic block diagram of an apparatus for extracting address information in an embodiment of the present application.
  • FIG. 10 is a schematic diagram of a computer device in an embodiment of the present application.
  • This embodiment provides a method for extracting address information.
  • the method for extracting address information provided by this embodiment will be described in detail below.
  • the method for extracting address information includes:
  • step S101 the bill image to be recognized is acquired, and OCR is performed on the bill image to obtain text information in the bill image and its corresponding coordinate information.
  • the image is cut according to the text distribution to obtain several text regions.
  • Each text area is composed of characters on the same line and within a predetermined distance from each other.
  • Character recognition is performed on the text area to obtain text information corresponding to each text area.
  • Position calibration is performed on the text area to obtain coordinate information corresponding to each text area.
  • the coordinate information consists of the upper left corner coordinate information (x1, y1) and the lower right corner coordinate information (x2, y2) of the text area, that is, the coordinate information corresponding to each text area is (x1, y1, x2, y2).
  • the text information is stored in a dictionary with "text" as a key
  • the coordinate information is stored in a dictionary with "rect” as a key.
  • the OCR technology recognizes text information from the bill image in the order from top to bottom and from left to right, and the obtained text information is arranged and numbered according to the recognition sequence.
  • step S102 the text information is combined according to the coordinate information to obtain one or more small text lists, and the small text lists are combined to obtain a large text list corresponding to the receipt image.
  • the text information obtained in step S101 is divided into text areas for each line, and the address information in some bills is divided into lines or broken in the same line.
  • the text information obtained in each text area is It may only be part of the address information and is not complete. Therefore, in the embodiment of the present application, the text information is merged, so that the text information that is close in position is classified into the same small text list, so as to realize the merging of the text information.
  • step S102 the text information is merged according to the coordinate information to obtain one or more small text lists including:
  • step S1021 the coordinate information corresponding to the paired text information is compared to obtain the vertical distance and the horizontal distance corresponding to the paired text information.
  • the vertical distance refers to the distance between two pieces of text information in the vertical direction.
  • the difference between the ordinates of the upper left corner or the difference between the ordinates of the upper right corner corresponding to the two pieces of text information is used as the vertical distance between the two pieces of text information.
  • the horizontal distance refers to the distance between two pieces of text information in the horizontal direction.
  • the difference between the abscissa of the upper left corner of the next text information and the abscissa of the upper left corner of the previous text information is used as the horizontal distance between the two text information.
  • step S1022 when the vertical distance of the two pieces of text information is less than or equal to the first threshold and the horizontal distance is less than or equal to the second threshold, the two pieces of text information are regarded as the text information adjacent to the top and bottom, and added to the same text small List.
  • This embodiment of the present application presets a first threshold and a second threshold.
  • the first threshold and the second threshold are jointly used as a criterion for judging whether two pieces of text information are vertically adjacent.
  • the first threshold and the second threshold may be set according to the text line height on the bill image, for example, the first threshold corresponds to 1.5 times the line height, and the second threshold corresponds to 1 times the line height.
  • step S1023 the text information in the same text small list is sorted in ascending order according to the coordinate information corresponding to the text information.
  • the text information in the same small text list is the text information that is adjacent to each other up and down.
  • the embodiment of the present application calculates the average value between the ordinate y1 of the upper left corner of the text information and the ordinate y2 of the lower right corner for each text information, as Sorting coordinates of the text information, and sorting all text information in the same text small list in ascending order according to the sorting coordinates.
  • the pair of text information is not vertically adjacent text information.
  • step S1024 when a piece of text information does not have text information adjacent to the top and bottom, the text information is added to a small text list separately.
  • an independent small text list is established for the text information, and the text information is added to the small text list separately.
  • Each text information that does not have upper and lower adjacent text information is added to a separate small text list.
  • each small text list whether it includes one or more pieces of text information, is used as the minimum unit for address extraction in this embodiment of the present application.
  • the row height of the bill image is 10, the text information identified in the text area on the left side of the first row is marked as text 0, the corresponding upper left corner coordinate information is (0, 0), and the lower right corner coordinate information is (40, 10); The text information recognized by the text area on the right side of the first line is recorded as text 1, the corresponding upper left corner coordinate information is (110, 0), and the lower right corner coordinate information is (160, 10); the text area on the left side of the second row is recognized The text information of is denoted as text 2, the corresponding upper left corner coordinate information is (0, 10), and the lower right corner coordinate information is (60, 20). Since the row height is 10, then the first threshold is 15 and the second threshold is 10.
  • the vertical distance between text 0 and text 2 is 10, which is less than the first threshold, and the horizontal distance is 0, which is less than the second threshold, then text 0 and text 2 are adjacent text information; text 1 and text 0, text 2 are not adjacent.
  • the recognition order of OCR itself no matter whether it is sorted from top to bottom, the order of text information cannot be used directly.
  • the upper and lower adjacent text information is merged and reordered to prepare for subsequent address extraction, and address lines without address keywords can be located in advance by merging, with good fault tolerance.
  • step S103 the address hierarchy and its corresponding keyword list are obtained.
  • the address level and its corresponding keyword list include several pre-divided levels, at least one keyword corresponding to each level, and also record the address level as the first line of the address and the address as the last line of the address. level.
  • an address hierarchy and its corresponding keywords are constructed in advance according to the ticket sample.
  • the level of address information is preset according to experience. For example, address information includes but is not limited to eight "region”, “district”, “street”, “estate”, “building”, “block”, “floor”, “unit”, etc. level.
  • address information on the bill samples is manually marked according to the above divided address levels. According to the labeling results, clustering analysis is performed on the address information on the same address level to obtain keywords corresponding to the address level, as well as the address level as the first line of the address and the address level as the last line of the address.
  • keywords at the "unit” level include, but are not limited to: “FLAT”, “FLT”, “RM”, “ROOM”, “SHOP”, “UNIT”. Keywords at the "street” level include, but are not limited to: “AVENUE”, “LANE”, “RD”, “ROAD”, “ST”, “STREET”, “TERRACE”. Keywords at the "region” level include, but are not limited to, “KOWLOON”, “KLN”, “NEW TERRITORIES”, and “NT”. In practical applications, it is generally considered that the three address levels of "block”, “floor” and “unit” belong to the first line of addresses, and the two address levels of "region” and “district” belong to the last line of addresses.
  • step S104 address extraction is performed on the text small list according to the address hierarchy and its corresponding keyword list, to obtain address information corresponding to the text small list.
  • the list of address levels and their corresponding keywords includes each address level and its corresponding keywords, and which address levels are the first line of addresses and which address levels are the last line of addresses.
  • addresses are extracted using a small text list as a minimum unit, and address information corresponding to the small text list is obtained by querying the address hierarchy and its corresponding keyword list.
  • the step S104 further includes:
  • step S1041 for a small text list in the large text list, according to the address hierarchy and its corresponding keyword list, the address line, the first address line, and the last address line in the small text list are obtained.
  • each small text list includes at least one piece of text information
  • this embodiment of the present application traverses each piece of text information in the small text list, and queries the address hierarchy and its corresponding keyword list to determine whether each piece of text information is It is the address line, the first line of the address, or the last line of the address.
  • the step S1041 further includes:
  • step S501 the text information in the text small list is traversed, and it is determined whether at least one keyword in the keyword list exists in the text information.
  • step S502 If yes, go to step S502; otherwise, go to step S501 to judge the next text information in the text small list.
  • step S502 using the text information as an address line, the address level of the keywords in the address line is acquired.
  • the text information hits the address keywords, the text information is an address line, and then according to the hit keywords address level, and determine whether the text information is the first line of the address or the last line of the address.
  • step S503 if the address level is the first line of the address, the address line is used as the first line of the address, and if the address level is the last line of the address, the address line is used as the last line of the address.
  • the keyword list of the address hierarchy can be traversed in descending order of the address hierarchy to check whether the keyword exists in the text information.
  • the above example can be in the order from "unit” to "region".
  • the text information "FLT 11 22/F BLK 33" first traverse the keyword list corresponding to the "unit” level, including "FLAT”, “FLT”, “RM”, “ROOM”, “SHOP” ", "UNIT”, it can be found that "FLT” exists in the text information "FLT 11 22/F BLK 33", then the text information "FLT 11 22/F BLK 33" is considered to be the address line, marked as True, and the synchronization record is hit
  • the level is "unit”. Since the three levels of "block”, "floor” and "unit” belong to the first line of the address, the text information "FLT 11 22/F BLK 33" is also the first line of the address.
  • step S1042 according to the first line of the address and the last line of the address, the spanning address line in the small text list is acquired.
  • the address information when the address information is too long or limited by typesetting requirements, it will be divided into two or more lines and presented on the ticket image.
  • the cross-row address row refers to each row in the address information that is divided into multiple rows.
  • step S601 two pieces of text information differing by a preset number of lines in the small text list are acquired.
  • the preset number of rows may be 3.
  • the above step S601 respectively acquires two pieces of text information that differ by one line, two pieces of text information that differ by two lines, and two pieces of text information that differ by three lines.
  • step S602 it is judged whether the two text information satisfy that the former text information is an address line and is not an address end line, and the latter text information is an address line and is not an address first line.
  • the text information in the same small text list is sorted in ascending order according to the coordinate information, so the sequence of the two text information obtained in step S602 can be determined.
  • the embodiment of the present application further determines whether the two pieces of text information satisfy the following conditions: the former text information is an address line and not an address tail line based on the results obtained in step S1041, and the latter text information is The address line is not the first line of the address.
  • steps S601 and S602 will first determine whether two text information with a difference of 1 line constitute a cross-line address line, which are the first line and the second line, the second line and the third line respectively. line, ..., line 7 and line 8. Then judge whether the two text information differing by 2 lines constitute a cross-line address line, which are the 1st line and the 3rd line, the 2nd line and the 4th line, ..., the 6th line and the 8th line respectively. Finally, it is judged whether the two text information differing by 3 lines constitute a cross-line address line, which are the 1st line and the 4th line, the 2nd line and the 4th line, ..., the 6th line and the 8th line respectively.
  • step S603 If the two text information satisfy that the former text information is the address line and is not the end line of the address, and the latter text information is the address line and is not the first line of the address, step S603 is executed. Otherwise, step S604 is executed.
  • step S603 the two pieces of text information and all the text information therebetween are acquired as a cross-line address line.
  • the two text information and all the text information between them constitute a cross-line address line.
  • step S604 continue to acquire two pieces of text information in the small text list that differ by a preset number of lines to perform the determination of the address line across lines.
  • the previous text information is the address line and not the end line of the address
  • the next text information is the address line and not the first line of the address, that is, the previous text information does not satisfy the "address line and not the address line” and/or, the latter text information does not meet the requirements of "address line and not the first line of the address", then the two text information and the text information between them do not constitute a cross-line address line.
  • step S1043 a two-dimensional matrix of inter-line relationships corresponding to the text small list is constructed according to the cross-line address line.
  • a small text list corresponds to a two-dimensional matrix of inter-line relationships
  • the two-dimensional matrix of inter-line relationships is a mathematical model of the text small list, used to record whether each text information in the text small list is an address line, whether it constitutes a Spanning address lines.
  • the step S1043 further includes:
  • step S701 an N-order square matrix A is constructed according to the number N of text information in the text small list, and the elements on the main diagonal of the N-order square matrix A are assigned as 1, and the rest are assigned as 0.
  • the initial two-dimensional matrix of inter-row relationship is an N-order unit matrix, and the elements on the main diagonal of the unit matrix are all 1s. Each element 1 on the main diagonal represents a text message in the text minilist.
  • step S702 for the m-th text information and the n-th text information in the text small list, it is judged whether the m-th text information and the n-th text information are both cross-line address lines, where 1 ⁇ n ⁇ N, 1 ⁇ m ⁇ N, and n>m.
  • step S703 the element A[m][n] in the N-order square matrix A is assigned a value of 1.
  • the embodiment of the present application determines whether each pair of text information, such as the m-th text information and the n-th text information, constitutes a cross-line address line based on the cross-line address line obtained in step S1042. If both the m-th text information and the n-th text information constitute a cross-line address line, A[m][n] is assigned the value of 1, and when m is equal to M, n takes M+1 to N respectively. Conversely, if the m-th text information and the n-th text information do not constitute a cross-line address line, A[i][j] is both assigned a value of 0, where i ranges from 0 to m respectively, and j is equal to n. Traverse all the text information in the small text list to obtain a two-dimensional matrix of inter-line relationships.
  • the N-order square matrix A obtained through step S701 is as follows:
  • step S1044 at least one address sequence number set corresponding to the text small list is generated according to the two-dimensional matrix of inter-line relationships.
  • step S1044 further includes:
  • step S801 traverse each row of the two-dimensional matrix of inter-row relationship, obtain the column serial number of the element whose value is 1 in the row, and combine the column serial numbers to obtain a row serial number set corresponding to each row.
  • step S1043 For the two-dimensional matrix of inter-row relationships obtained in step S1043, start from the first row A[0][y0] to save all the column numbers y0 equal to 1 to the row number set S1 corresponding to the first row. Save all the column numbers y1 equal to 1 in the second row A[1][y1] to the row number set S2 corresponding to the second row, and so on until all rows in the two-dimensional matrix A of the relationship between rows are traversed.
  • step S802 inclusion screening is performed on the row sequence number set to obtain at least one maximum row sequence number set, and each maximum row sequence number set is used as an address sequence number set.
  • the obtained set of address serial numbers is used as the address for searching address information from the text small list.
  • a small list of texts is converted into a mathematical model, which is convenient for searching the text information that constitutes the address information. Improve the fault tolerance rate of address information extraction.
  • step S1045 a target address sequence number set is filtered out from the address sequence number set, corresponding text information is obtained from the text mini-list according to the target address sequence number set, and the text information is combined to obtain the text information in the text mini-list. an address information.
  • the number of address lines on a ticket is usually between 2-6 lines. Therefore, in this embodiment of the present application, a filtering range [2, 6] is set, and then an address sequence number set whose number of elements is within the filtering range is selected from the address sequence number set as the target address sequence number set.
  • each element in the target address sequence number set corresponds to the sequence number of each text information in the small text list sorted in ascending order.
  • an address sequence number set with too few elements can be filtered out, and some non-address information including address keywords can be filtered out by using a regular address length.
  • step S105 traverse all the small text lists in the large text list, obtain address information corresponding to each small text list, and combine the address information to obtain an address information list on the bill image.
  • multiple text lists can be identified from the bill image, and addresses are extracted from the multiple text lists to obtain multiple address information. Save to a list, so as to obtain a list of address information corresponding to the bill image.
  • a ticket image contains "FLT 11 22/F BLK 33 ⁇ n KLN ⁇ n KLN", "2557 0210 1234 5421 ⁇ n ENJOY VISA PLATINUM ⁇ n MISS HUNG XXXX KUEN ⁇ n RM 123 ⁇ n HOI XXX HSE XXX LAI EST ⁇ n LAI CHI KOK ⁇ n KOWLOON ⁇ n Tel-12345678", "Date 2020-10-19", "XXX Bank”.
  • the address numbers corresponding to the four text lists are [ ⁇ 0,1 ⁇ , ⁇ 2 ⁇ ], [ ⁇ 0 ⁇ , ⁇ 1 ⁇ , ⁇ 2 ⁇ , ⁇ 3,4,5,6 ⁇ , ⁇ 7 ⁇ ], [ ⁇ 0 ⁇ ], [ ⁇ 0 ⁇ ].
  • the target address sequence number set is filtered out, and respectively obtained: ⁇ 0, 1 ⁇ of the first text small list, ⁇ 3, 4, 5, 6 ⁇ of the second text small list.
  • the address information corresponding to the second small text list can be obtained as "RM 123 ⁇ n HOI XXX HSE XXX LAI EST ⁇ n LAI CHI KOK ⁇ n KOWLOON ⁇ n".
  • the list of address information extracted from the ticket image is ["FLT 11 22/F BLK 33 ⁇ n KLN", "RM 123 ⁇ n HOI XXX HSE XXX LAI EST ⁇ n LAI CHI KOK ⁇ n KOWLOON”].
  • an apparatus for extracting address information corresponds one-to-one with the method for extracting address information in the above-mentioned embodiment.
  • the address information extraction device includes an identification module 91 , a merge module 92 , an acquisition module 93 , an extraction module 94 , and a combination module 95 .
  • the detailed description of each functional module is as follows:
  • the identification module 91 is used to obtain the bill image to be identified, perform OCR identification on the bill image, and obtain the text information in the bill image and its corresponding coordinate information;
  • the merging module 92 is configured to merge the text information according to the coordinate information to obtain one or more small text lists, and combine the small text lists to obtain a large text list corresponding to the bill image;
  • Obtaining module 93 for obtaining the address level and its corresponding keyword list
  • An extraction module 94 configured to perform address extraction on the text small list according to the address hierarchy and its corresponding keyword list, to obtain address information corresponding to the text small list;
  • the combination module 95 is configured to traverse all the small text lists in the large text list, obtain the address information corresponding to each small text list, and combine the address information to obtain the address information list on the bill image.
  • the merging module 92 includes:
  • the distance acquisition unit is used to compare the coordinate information corresponding to the two-by-two text information, and obtains the vertical distance and the horizontal distance corresponding to the two-by-two text information;
  • the combining unit is used to add the two pairs of text information as vertically adjacent text information to the same text subsection when the vertical distance of each pair of text information is less than or equal to the first threshold value and the horizontal distance is less than or equal to the second threshold value.
  • a sorting unit configured to sort the text information in the same text small list in ascending order according to the coordinate information corresponding to the text information
  • the adding unit is used for separately adding the text information to a small text list when there is no text information adjacent to the top and bottom of a text information.
  • the extraction module 94 includes:
  • the address line obtaining unit is configured to, for a small text list in the large text list, obtain the address line, the first line of addresses, and the last line of addresses in the small text list according to the address level and its corresponding keyword list ;
  • a cross-line address line obtaining unit configured to obtain the cross-line address line in the small text list according to the first line of the address and the last line of the address;
  • a matrix constructing unit configured to construct a two-dimensional matrix of inter-row relationships corresponding to the text small list according to the cross-row address row;
  • a generating unit configured to generate at least one address sequence number set corresponding to the text small list according to the two-dimensional matrix of inter-line relationships
  • the address extraction unit is configured to filter out a target address sequence number set from the address sequence number set, obtain corresponding text information from the text mini-list according to the target address sequence number set, and combine the text information to obtain the text mini-list an address information.
  • the address line obtaining unit includes:
  • a keyword judgment subunit used to traverse the text information in the text small list, and judge whether there is at least one keyword in the keyword list in the text information
  • the level acquisition subunit is used to obtain the address level of the keyword in the address line by taking the text information as an address line when the judgment result of the keyword judgment subunit is yes;
  • the end-to-end determination subunit is used to use the address line as the address first line if the address level is the address first line, and use the address line as the address end line if the address level is the address end line.
  • the cross-line address line obtaining unit includes:
  • a text acquisition subunit used for acquiring two text information that differs by a preset number of lines in the small text list
  • Conditional judgment subunit used for judging whether the two text information satisfy that the previous text information is an address line and is not an address tail line, and the latter text information is an address line and is not an address first line;
  • Cross-row acquisition subunit for when the judgment result of the conditional judgment subunit is yes, to acquire the two text information and all the text information therebetween, as the row-crossing address row;
  • the condition judging subunit is configured to continue to acquire two pieces of text information in the small text list that differ by a preset number of lines to perform cross-line address line judgment when the judgment result is no.
  • the matrix building unit includes:
  • the initialization subunit is used to construct an N-order square matrix A according to the number N of text information in the text small list, and assign the elements on the main diagonal of the N-order square matrix A to 1, and the rest are assigned to 0 ;
  • a judging subunit configured to judge whether the m th text information and the n th text information are both cross-line address lines for the m th text information and the n th text information in the text small list, wherein 1 ⁇ n ⁇ N, 1 ⁇ m ⁇ N, and n>m;
  • the first assignment subunit is used to assign the element A[m][n] in the N-order square matrix A to 1 when the judgment result of the judgment subunit is yes;
  • the generating unit includes:
  • the row sequence number set generation subunit is used to traverse each row of the two-dimensional matrix of the inter-row relationship, obtain the column sequence number of the element whose value is 1 in the row, and combine the column sequence numbers to obtain the row sequence number set corresponding to each row;
  • the inclusion screening subunit is used to perform inclusion screening on the row sequence number set to obtain at least one maximum row sequence number set, and each maximum row sequence number set is used as an address sequence number set.
  • Each module in the apparatus for extracting the address information can be implemented in whole or in part by software, hardware and combinations thereof.
  • the above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
  • a computer device is provided, and the computer device may be a server, and its internal structure diagram may be as shown in FIG. 10 .
  • the computer device includes a processor, memory, a network interface, and a database connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a storage medium and an internal memory.
  • the storage medium stores an operating system, a computer program and a database.
  • the internal memory provides an environment for the operation of the operating system and computer programs in the storage medium.
  • the network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a method for extracting address information is implemented.
  • a computer device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, and the processor implements the following steps when executing the computer program:
  • one or more readable storage media storing computer readable instructions are provided, the computer readable storage media having computer readable instructions stored thereon, wherein the computer readable instructions are stored by one or more When each processor is executed, the one or more processors are caused to perform the following steps:
  • the readable storage medium in this embodiment includes a non-volatile readable storage medium and a volatile readable storage medium.
  • any reference to memory, storage, database or other medium used in the various embodiments provided in this application may include non-volatile and/or volatile memory.
  • Memory may include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory, and may also include random access memory (RAM) or external cache memory.
  • RAM is available in various forms such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous chain Road (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
  • SRAM static RAM
  • DRAM dynamic RAM
  • SDRAM synchronous DRAM
  • DDRSDRAM double data rate SDRAM
  • ESDRAM enhanced SDRAM
  • SLDRAM synchronous chain Road (Synchlink) DRAM
  • SLDRAM synchronous chain Road (Synchlink) DRAM
  • Rambus direct RAM
  • DRAM direct memory bus dynamic RAM
  • RDRAM memory bus dynamic RAM

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Theoretical Computer Science (AREA)
  • Artificial Intelligence (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种地址信息的提取方法,包括:获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据图像中的文本信息及其对应的坐标信息(S101);根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表(S102);获取地址层级及其对应的关键词列表(S103);按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息(S104);遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表(S105)。解决了现有地址信息提取技术存在的运行效率低、不易维护和更新的问题。

Description

地址信息的提取方法、装置、设备及介质
本申请以2020年12月28日提交的申请号为202011584201.2,名称为“地址信息的提取方法、装置、设备及介质”的中国发明申请为基础,并要求其优先权。
技术领域
本申请涉及信息技术领域,尤其涉及一种地址信息的提取方法、装置、设备及介质。
背景技术
现有技术主要采用深度学习模型或者正则表达式来从票据图像中提取地址信息。若采用深度学习模型,需要预先对大规模的数据进行模型训练,开发、部署以及运营成本高,效率低。若采用正则表达式,则需要预先编写大量的正则表达式,对于正则表达式没有覆盖的样本则无法提取;且随着票据图像上地址信息的多样化发展,所编写的正则表达式也会越来越复杂,不易维护和更新。
发明内容
本申请实施例提供了一种地址信息的提取方法、装置、设备及介质,以解决现有地址信息提取技术存在的运行效率低、不易维护和更新的问题。
一种地址信息的提取方法,包括:
获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据图像中的文本信息及其对应的坐标信息;
根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表;
获取地址层级及其对应的关键词列表;
按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息;
遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表。
一种地址信息的提取装置,其中,所述装置包括:
识别模块,用于获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据 图像中的文本信息及其对应的坐标信息;
合并模块,用于根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表;
获取模块,用于获取地址层级及其对应的关键词列表;
提取模块,用于按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息;
组合模块,用于遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表。
一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的可读存储介质,其中,所述处理器执行所述可读存储介质时实现如下步骤:
获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据图像中的文本信息及其对应的坐标信息;
根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表;
获取地址层级及其对应的关键词列表;
按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息;
遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表。
一个或多个存储有计算机可读指令的可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其中,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:
获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据图像中的文本信息及其对应的坐标信息;
根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表;
获取地址层级及其对应的关键词列表;
按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息;
遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表。
本申请降低了成本,提高了运行效率,容错性较好。
附图说明
为了更清楚地说明本申请实施例的技术方案,下面将对本申请实施例的描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。
图1是本申请一实施例中提供的地址信息的提取方法的流程图;
图2是本申请一实施例中提供的地址信息的提取方法中步骤S102的流程图;
图3是本申请一实施例中提供的票据图像的示意图;
图4是本申请一实施例中提供的地址信息的提取方法中步骤S104的流程图;
图5是本申请一实施例中提供的地址信息的提取方法中步骤S1041的流程图;
图6是本申请一实施例中提供的地址信息的提取方法中步骤S1042的流程图;
图7是本申请一实施例中提供的地址信息的提取方法中步骤S1043的流程图;
图8是本申请一实施例中提供的地址信息的提取方法中步骤S1044的流程图;
图9是本申请一实施例中地址信息的提取装置的一原理框图;
图10是本申请一实施例中计算机设备的一示意图。
具体实施方式
下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。
本实施例提供了一种地址信息的提取方法。以下将对本实施例提供的地址信息的提取方法进行详细的描述,如图1所示,所述地址信息的提取方法包括:
在步骤S101中,获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据图像中的文本信息及其对应的坐标信息。
现有的OCR技术在对图像进行识别时,按照文字分布对图像进行切割,得到若干个文本区域。每一文本区域由处于同一行且相互距离在预设范围内的文字构成。对所述文本区域进行文字识别,得到每一文本区域对应的文本信息。对所述文本区域进行位置标定,得到每一文本区域对应的坐标信息。所述坐标信息由文本区域的左上角坐标信息(x1,y1)和右下角坐标信息(x2,y2)组成,即每个文本区域对应的坐标信息为(x1,y1,x2,y2)。可选地,所述文本信息保存在以“text”为键的字典里,所述坐标信息保存在以“rect”为键的字典里。
组合每一个文本信息及其对应的坐标信息。为了便于理解,以下给出本申请实施例提供的一个文本信息及其对应的坐标信息示例,[{‘text’:‘FLT 11 22/F BLK 33’, ‘rect’:(100,120,200,220)}]。其中,文本信息为FLT 11 22/F BLK 33,坐标信息为(100,120,200,220)。
在这里,OCR技术按照从上到下、从左到右的顺序从票据图像中识别文本信息,所得到的文本信息按照识别顺序排列以及编号。
在步骤S102中,根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表。
在这里,通过步骤S101中得到的文本信息是以每一行进行文本区域划分的,而有些票据中的地址信息是分行的或者在同一行是断开的,此时每一个文本区域得到的文本信息可能仅仅是地址信息的一部分,是不完整的。因此本申请实施例对所述文本信息进行合并,以将位置上相近的文本信息归入同一个文本小列表中,实现文本信息的合并。
可选地,作为本申请的一个优选示例,如图2所示,步骤S102中所述的根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表包括:
在步骤S1021中,将两两文本信息对应的坐标信息进行比较,得到所述两两文本信息对应的垂直距离和水平距离。
在这里,所述垂直距离是指两两文本信息在垂直方向上的距离。本申请实施例以两两文本信息对应的左上角的纵坐标之差或者右上角的纵坐标之差,作为所述两个文本信息之间的垂直距离。
所述水平距离是指两两文本信息在水平方向上的距离。本申请实施例以后一文本信息的左上角的横坐标与前一文本信息的左上角的横坐标之间的差值,作为所述两个文本信息之间的水平距离。
在步骤S1022中,当两两文本信息的垂直距离小于或等于第一阈值且水平距离小于或等于第二阈值时,将所述两两文本信息作为上下相邻的文本信息,添加到同一文本小列表中。
本申请实施例预先设置第一阈值和第二阈值。其中,所述第一阈值和所述第二阈值共同用作判断两个文本信息是否上下相邻的标准。可以根据票据图像上的文本行高,设置所述第一阈值和第二阈值,比如第一阈值对应1.5倍行高,第二阈值对应1倍行高。
分别将所述两两文本信息的垂直距离与所述第一阈值比较,将所述水平距离与所述第二阈值比较,当且仅当所述两两文本信息的垂直距离小于或等于第一阈值且水平距离小于或等于第二阈值时,认为所述两两文本信息是上下相邻的文本信息,将所述两两文本信息添加到同一文本小列表中。
在步骤S1023中,按照所述文本信息对应的坐标信息对同一文本小列表中的文本信息进行升序排序。
在本申请实施例中,处于同一文本小列表中的文本信息,均为上下相邻的文本信息。在对同一文本小列表中的文本信息进行排序时,本申请实施例对每一文本信息,计算所述文本信息的左上角的纵坐标y1与右下角的纵坐标y2之间的平均值,作为所述文本信息的 排序坐标,按照所述排序坐标对同一文本小列表中的所有文本信息进行升序排序。
进一步地,当两两文本信息的垂直距离大于第一阈值或者水平距离大于第二阈值时,则所述两两文本信息不是上下相邻的文本信息。
在步骤S1024中,当一个文本信息不存在上下相邻的文本信息时,将所述文本信息单独添加到一个文本小列表中。
当一个文本信息不存在上下相邻的文本信息时,本申请实施例为所述文本信息建立一个独立的文本小列表,将所述文本信息单独添加至所述文本小列表中。每一个不存在上下相邻文本信息的文本信息,各自添加到一个独立的文本小列表中。
在这里,每一个文本小列表,不管包括一个还是多个文本信息,均作为本申请实施例进行地址提取的最小单元。
为了便于理解,假设存在如图3所示的票据图像。票据图像的行高为10,将第一行左边的文本区域识别出来的文本信息记为文本0,对应的左上角坐标信息为(0,0),右下角坐标信息为(40,10);第一行右边的文本区域识别出来的文本信息记为文本1,对应的左上角坐标信息为(110,0),右下角坐标信息为(160,10);第二行左边的文本区域识别出来的文本信息记为文本2,对应的左上角坐标信息为(0,10),右下角坐标信息为(60,20)。由于行高为10,那么第一阈值为15,第二阈值为10。
经过计算,文本0和文本2的垂直距离为10,小于第一阈值,水平距离为0,小于第二阈值,则文本0和文本2是相邻的文本信息;文本1与文本0、文本2均不相邻。
将文本0和文本2添加到同一个文本小列表中,得到文本小列表1:[{'text':'文本0的内容','rect':'(0,0),(40,10)',},{'text':'文本2的内容','rect':'(0,10),(60,20)',}]。
将文本1添加到一个独立的文本小列表中,得到文本小列表2:[{'text':'文本1的内容','rect':'(110,0),(160,10)',}]。
如果按照OCR本身的识别顺序,不论是否从上到下排序过,文本信息的顺序都是无法直接使用的。本申请实施例通过合并上下相邻文本信息并重新排序,为后续进行地址提取做准备,并且通过合并可提前对不存在地址关键词的地址行进行定位,容错性较好。
在步骤S103中,获取地址层级及其对应的关键词列表。
在这里,所述地址层级及其对应的关键词列表中包括预先划分的若干个层级、每一个层级对应的至少一个关键词,同时还记录了作为地址首行的地址层级和作为地址尾行的地址层级。
本申请实施例预先根据票据样本构建地址层级及其对应的关键词。根据经验预先设置地址信息的层级,比如地址信息包括但不限于“region”、“district”、“street”、“estate”、“building”、“block”、“floor”、“unit”等八个层级。对于收集到的票据样本,按照上述划分的地址层级对票据样本上的地址信息通过人工方式进行标注。根据标注结果,对同一地址层级上的地址信息进行聚类分析,得到地址层级对应的关键词, 以及作为地址首行的的地址层级和作为地址尾行的地址层级。
示例性地,“unit”层级的关键词包括但不限于:“FLAT”、“FLT”、“RM”、“ROOM”、“SHOP”、“UNIT”。“street”层级的关键词包括但不限于:“AVENUE”、“LANE”、“RD”、“ROAD”、“ST”、“STREET”、“TERRACE”。“region”层级的关键词包括但不限于“KOWLOON”、“KLN”、“NEW TERRITORIES”、“NT”。在实际应用中,一般认为“block”、“floor”、“unit”三个地址层级属于地址首行,“region”、“district”两个地址层级属于地址尾行。
在步骤S104中,按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息。
如前所述,所述地址层级及其对应的关键词列表中包括各地址层级及其对应的关键词,以及哪些地址层级为地址首行,哪些地址层级为地址尾行。本申请实施例以文本小列表作为最小单位进行地址提取,通过查询所述地址层级及其对应的关键词列表,得到所述文本小列表对应的地址信息。
可选地,作为本申请的一个优选示例,如图4所示,所述步骤S104还包括:
在步骤S1041中,对于所述文本大列表中的一个文本小列表,根据所述地址层级及其对应的关键词列表,获取所述文本小列表中的地址行以及地址首行、地址尾行。
在这里,每一文本小列表中包括至少一个文本信息,本申请实施例遍历文本小列表中的每一个文本信息,查询所述地址层级及其对应的关键词列表,以判断每一个文本信息是否为地址行、地址首行或者地址尾行。可选地,如图5所示,所述步骤S1041还包括:
在步骤S501中,遍历所述文本小列表中的文本信息,判断所述文本信息中是否存在所述关键词列表中的至少一个关键词。
在这里,本申请实施例通过判断所述地址层级及其对应的关键词列表中的关键词是否出现在所述文本信息中,来确定所述文本信息是否为地址行。
若是,则执行步骤S502;否则,继续执行步骤S501,对所述文本小列表中的下一个文本信息进行判断。
在步骤S502中,以所述文本信息作为一个地址行,获取所述地址行中的关键词的地址层级。
若所述地址层级及其对应的关键词列表中的关键词出现在所述文本信息时,则认为所述文本信息命中地址关键词,所述文本信息为地址行,然后根据所命中的关键词的地址层级,确定所述文本信息是地址首行还是地址尾行。
在步骤S503中,若所述地址层级为地址首行时,以所述地址行作为地址首行,若所述地址层级为地址尾行时,以所述地址行作为地址尾行。
可以按地址层级从大到小的顺序依次遍历地址层级的关键词列表来检查关键词是否存在于文本信息,比如前文示例可按从“unit”到“region”的顺序。示例性地,以文本信息“FLT 11 22/F BLK 33”为例,首先遍历“unit”层级对应的关键词列表,包含“FLAT”、 “FLT”、“RM”、“ROOM”、“SHOP”、“UNIT”,可以发现“FLT”在文本信息“FLT 11 22/F BLK 33”中存在,那么认为文本信息“FLT 11 22/F BLK 33”是地址行,标记为True,同步记录命中的层级为“unit”。由于“block”、“floor”、“unit”三个层级属于地址首行,因此,文本信息“FLT 11 22/F BLK 33”也为地址首行。
再以文本信息“NGAU TAU KOK”为例,前文示例中的8个地址层级中任一关键词均未出现在文本信息“NGAU TAU KOK”中,那么认为文本信息“NGAU TAU KOK”不是地址行,则标记为False。
在步骤S1042中,根据所述地址首行和地址尾行,获取所述文本小列表中的跨行地址行。
在这里,当地址信息太长或者受限于排版需求时,会分成两行或者多行呈现在票据图像上。所述跨行地址行是指划分为多行表示的地址信息中的每一行。在得到地址首行和地址尾行后,本申请实施例按照预设的逻辑对所述文本小列表中的每一个文本信息进行判断,得到所述文本小列表中的跨行地址行。可选地,如图6所示,所述步骤S1042还包括:
在步骤S601中,获取所述文本小列表中相差预设行数的两个文本信息。
可选地,所述预设行数可以为3。此时,上述步骤S601分别获取相差一行的两个文本信息、相差两行的两个文本信息、相差三行的两个文本信息。
在步骤S602中,判断所述两个文本信息是否满足前一文本信息为地址行且不为地址尾行、后一文本信息为地址行且不为地址首行。
如前所述,同一文本小列表中的文本信息按照坐标信息进行升序排序,因此可以确定步骤S602中获取到的两个文本信息的先后顺序。对于所述两个文本信息,本申请实施例进一步根按照步骤S1041获取到的结果,判断所述两个文本信息是否满足:前一文本信息为地址行且不为地址尾行,后一文本信息为地址行且不为地址首行。
示例性地,以8个文本信息为例,步骤S601和步骤S602会先判断相差1行的两个文本信息是否构成跨行地址行,分别是第1行和第2行、第2行和第3行、……、第7行和第8行。再判断相差2行的两个文本信息是否构成跨行地址行,分别是第1行和第3行、第2行和第4行、……、第6行和第8行。最后判断相差3行的两个文本信息是否构成跨行地址行,分别是第1行和第4行、第2行和第4行、……、第6行和第8行。
若两个文本信息满足前一文本信息为地址行且不为地址尾行、后一文本信息为地址行且不为地址首行,则执行步骤S603。否则,执行步骤S604。
在步骤S603中,获取所述两个文本信息及其之间的所有文本信息,作为跨行地址行。
当且仅当前一文本信息为地址行且不为地址尾行、后一文本信息为地址行且不为地址首行时,所述两个文本信息及其之间的所有文本信息构成跨行地址行。
在步骤S604中,继续获取所述文本小列表中相差预设行数的两个文本信息进行跨行地址行判断。
当两个文本信息不满足:前一文本信息为地址行且不为地址尾行、后一文本信息为地 址行且不为地址首行时,即前一文本信息不满足“地址行且不为地址尾行”的要求,和/或,后一文本信息不满足“地址行且不为地址首行”的要求,则所述两个文本信息及其之间的文本信息均不构成跨行地址行。
通过判别跨行地址行,可以找到可能会地址行但是又不存在地址关键词的文本信息。
在步骤S1043中,根据所述跨行地址行构建所述文本小列表对应的行间关系二维矩阵。
在这里,一个文本小列表对应一个行间关系二维矩阵,所述行间关系二维矩阵是文本小列表的数学模型,用于记录文本小列表中的各文本信息是否为地址行、是否构成跨行地址行。可选地,作为本申请的一个优选示例,如图7所示,所述步骤S1043还包括:
在步骤S701中,按照所述文本小列表中的文本信息的个数N构建N阶方阵A,并将N阶方阵A的主对角线上的元素赋值为1,其余赋值为0。
在本实施例中,初始的行间关系二维矩阵为一个N阶的单位矩阵,单位矩阵的主对角线上的元素均为1。主对角线上的每一个元素1代表文本小列表中的一个文本信息。
在步骤S702中,对于所述文本小列表中的第m个文本信息和第n个文本信息,判断所述第m个文本信息和第n个文本信息是否均为跨行地址行,其中,1≤n≤N,1≤m≤N,且n>m。
若是,则执行步骤S703,否则,执行步骤S704。
在步骤S703中,将所述N阶方阵A中的元素A[m][n]赋值为1。
在步骤S704中,将所述N阶方阵A中的元素A[i][j]均赋值0,其中i分别取0到m,j=n。
在这里,本申请实施例基于步骤S1042得到的跨行地址行,判断两两文本信息,比如第m个文本信息和第n个文本信息,是否均构成跨行地址行。若第m个文本信息和第n个文本信息均构成跨行地址行,则将A[m][n]赋值为1,其中m等于M时,n分别取M+1到N。反之,若第m个文本信息和第n个文本信息不构成跨行地址行,则将A[i][j]均赋值0,其中i分别取0到m,j等于n。遍历所述文本小列表中的所有文本信息,得到行间关系二维矩阵。
为了便于理解,以文本小列表“FLT 11 22/F BLK 33\n KLN\n KLN”为例,\n表示分行符号,FLT 11 22/F BLK 33\n记为文本0,是地址行和地址首行,KLN\n记为文本1,是地址行和地址尾行,KLN记为文本2,是地址行和地址尾行。
经过步骤S701得到的N阶方阵A如下:
Figure PCTCN2021125502-appb-000001
比较文本0和文本1,构成跨行地址行,则A[0][1]=1,N阶方阵A更新为:
Figure PCTCN2021125502-appb-000002
比较文本0和文本2,构成跨行地址行,则A[0][2]=1,N阶方阵A更新为:
Figure PCTCN2021125502-appb-000003
比较文本1和文本2,不构成跨行地址行,A[0][2]=0,A[1][2]=0),N阶方阵A更新为:
Figure PCTCN2021125502-appb-000004
在步骤S1044中,根据所述行间关系二维矩阵生成所述文本小列表对应的至少一个地址序号集。
在这里,经过步骤S1043之后得到的所述行间关系二维矩阵,元素1代表地址行,元素0代表非地址行。本申请实施例先对每一行中值为1的元素的列序号进行统计,得到若干个序号集,然后按照预设规则从中筛选出地址序号集。所述地址序号集是指地址信息在所述行间关系二维矩阵对应的文本小列表中的查询表示式,即地址信息在所述文本小列表中的地址。可选地,如图8所示,所述步骤S1044还包括:
在步骤S801中,遍历所述行间关系二维矩阵的每一行,获取该行中值为1的元素的列序号,组合所述列序号得到每一行对应的行序号集。
示例性地,对于步骤S1043得到的行间关系二维矩阵,从第一行A[0][y0]开始保存所有等于1的列序号y0到第一行对应的行序号集S1,同理往下保存第二行A[1][y1]中所有等于1的列序号y1到第二行对应的行序号集S2,如此循环直至遍历行间关系二维矩阵A中的所有行。
在步骤S802中,对所述行序号集进行包含筛选,得到至少一个最大行序号集,以每一所述最大行序号集作为一个地址序号集。
对所述行序号集进行包含筛选,即比较两两行序号集,将具有包含关系的两两行序号集进行合并,仅保留范围最大的行序号集,最终得到至少一个范围最大的序号集,这些最大行序号集互相之间不存在隶属关系。以每一最大行序号集作为一个地址序号集,则经过包含筛选后可以得到至少一个地址序号集。
示例性地,同样以“FLT 11 22/F BLK 33\n KLN\n KLN”为例,行间关系二维矩阵A为
Figure PCTCN2021125502-appb-000005
对于第一行A[0][y0],保存所有等于1的列序号y0到集合S0:A[0][0]=1,A[0][1]=1,则S0={0,1}
对于第二行A[1][y1],保存所有等于1的列序号y1到集合S1:A[1][1]=1,则S1={1};
对于第三行A[1][y2],保存所有等于1的列序号y2到集合S2:A[2][2]=1,则S2={2}。
此时行间关系二维矩阵所有的3个序号都在S系列的集合里面,S0与S1存在包含关系,合并之后保留S0,最终得到两个最大序号集[{0,1},{2}],分别作为地址序号集。
至此,所得到的地址序号集作为从所述文本小列表中查找地址信息的地址。本实施例通过构建行间关系二维矩阵,将文本小列表转化为数学模型,便于查找构成地址信息的文本信息,通过整理地址序号集,可以将不存在地址关键词的文本信息也合并进来,提高地址信息提取的容错率。
在步骤S1045中,从所述地址序号集中筛选出目标地址序号集,根据所述目标地址序号集从所述文本小列表中获取对应的文本信息,组合所述文本信息得到所述文本小列表的一个地址信息。
一般而言,票据上的地址行数通常在2-6行之间。因此,本申请实施例设置筛选范围[2,6],然后从地址序号集中筛选出元素个数在所述筛选范围内的地址序号集,作为目标地址序号集。其中,目标地址序号集中的每一个元素对应文本小列表中的每一个文本信息按升序排序后的序号。本实施例过滤掉元素太少的地址序号集,可实现通过常规地址长度过滤掉一些包含地址关键词的非地址信息。
可选地,为了便于理解,承接前文示例,对于“FLT 11 22/F BLK 33\n KLN\n KLN”,按照筛选范围[2,6]筛选出目标最大序号集为{0,1},根据{0,1}从文本小列表中获取到的序号为0的文本信息是“FLT 11 22/F BLK 33\n”,获取到的序号为1的文本信息是“KLN\n”,组合“FLT 11 22/F BLK 33\n”和“KLN\n”,所得到地址信息,即为从所述文本小列表中提取出来的地址信息。
在步骤S105中,遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表。
由于一张票据图像上可能存在多个地址,那么从票据图像中可以识别出多个文本小列表,对所述多个文本小列表分别提取地址,则可得到多个地址信息,将这些地址信息保存至一个列表,从而得到所述票据图像对应的地址信息列表。
示例性地,例如一张票据图像包含“FLT 11 22/F BLK 33\n KLN\n KLN”,“2557 0210 1234 5421\n ENJOY VISA PLATINUM\n MISS HUNG XXXX KUEN\n RM 123\n HOI XXX HSE XXX LAI EST\n LAI CHI KOK\n KOWLOON\n Tel-12345678”,“日期2020-10-19”,“XXX银行”。
经过OCR识别及合并后,得到一个包含4个文本小列表的文本大列表。4个文本小列表分别对应的地址序号集为[{0,1},{2}],[{0},{1},{2},{3,4,5,6},{7}],[{0}],[{0}]。
按照筛选范围[2,6]筛选出目标地址序号集,分别得到:第1个文本小列表的{0,1},第2个文本小列表的{3,4,5,6}。
以第1个文本小列表的{0,1}为例,从第一个文本小列表取回序号为0、1的文本信息,得到第一个文本小列表对应的地址信息为”FLT 11 22/F BLK 33\n KLN”。
同理可以得到第二个文本小列表对应的地址信息为“RM 123\n HOI XXX HSE XXX LAI EST\n LAI CHI KOK\n KOWLOON\n”。
该票据图像提取到的地址信息列表为[“FLT 11 22/F BLK 33\n KLN”,“RM 123\n HOI XXX HSE XXX LAI EST\n LAI CHI KOK\n KOWLOON”]。
本申请实施例通过获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据图像中的文本信息及其对应的坐标信息;根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表;获取地址层级及其对应的关键词列表;按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息;遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表;从而提供了一种新的票据图像的地址提取方式,极少采用正则表达式,代码便于维护和更新;也无需训练模型,降低了开发、部署、运维成本,提高了运行效率;且通过合并的方式可对不存在地址关键词的地址行进行定位,容错性较好。
应理解,上述实施例中各步骤的序号的大小并不意味着执行顺序的先后,各过程的执行顺序应以其功能和内在逻辑确定,而不应对本申请实施例的实施过程构成任何限定。
在一实施例中,提供一种地址信息的提取装置,该地址信息的提取装置与上述实施例中地址信息的提取方法一一对应。如图9所示,该地址信息的提取装置包括识别模块91、合并模块92、获取模块93、提取模块94、组合模块95。各功能模块详细说明如下:
识别模块91,用于获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据图像中的文本信息及其对应的坐标信息;
合并模块92,用于根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表;
获取模块93,用于获取地址层级及其对应的关键词列表;
提取模块94,用于按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息;
组合模块95,用于遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表。
可选的,所述合并模块92包括:
距离获取单元,用于将两两文本信息对应的坐标信息进行比较,得到所述两两文本信 息对应的垂直距离和水平距离;
组合单元,用于当两两文本信息的垂直距离小于或等于第一阈值且水平距离小于或等于第二阈值时,将所述两两文本信息作为上下相邻的文本信息,添加到同一文本小列表中;
排序单元,用于按照所述文本信息对应的坐标信息对同一文本小列表中的文本信息进行升序排序;
添加单元,用于当一个文本信息不存在上下相邻的文本信息时,将所述文本信息单独添加到一个文本小列表中。
可选的,所述提取模块94包括:
地址行获取单元,用于对于所述文本大列表中的一个文本小列表,根据所述地址层级及其对应的关键词列表,获取所述文本小列表中的地址行以及地址首行、地址尾行;
跨行地址行获取单元,用于根据所述地址首行和地址尾行,获取所述文本小列表中的跨行地址行;
矩阵构建单元,用于根据所述跨行地址行构建所述文本小列表对应的行间关系二维矩阵;
生成单元,用于根据所述行间关系二维矩阵生成所述文本小列表对应的至少一个地址序号集;
地址提取单元,用于从所述地址序号集中筛选出目标地址序号集,根据所述目标地址序号集从所述文本小列表中获取对应的文本信息,组合所述文本信息得到所述文本小列表的一个地址信息。
可选的,所述地址行获取单元包括:
关键词判断子单元,用于遍历所述文本小列表中的文本信息,判断所述文本信息中是否存在所述关键词列表中的至少一个关键词;
层级获取子单元,用于在关键词判断子单元的判断结果为是时,以所述文本信息作为一个地址行,获取所述地址行中的关键词的地址层级;
首尾确定子单元,用于若所述地址层级为地址首行时,以所述地址行作为地址首行,若所述地址层级为地址尾行时,以所述地址行作为地址尾行。
可选的,所述跨行地址行获取单元包括:
文本获取子单元,用于获取所述文本小列表中相差预设行数的两个文本信息;
条件判断子单元,用于判断所述两个文本信息是否满足前一文本信息为地址行且不为地址尾行、后一文本信息为地址行且不为地址首行;
跨行获取子单元,用于在条件判断子单元的判断结果为是时,获取所述两个文本信息及其之间的所有文本信息,作为跨行地址行;
所述条件判断子单元,用于在判断结果为否时,继续获取所述文本小列表中相差预设行数的两个文本信息进行跨行地址行判断。
可选的,所述矩阵构建单元包括:
初始化子单元,用于按照所述文本小列表中的文本信息的个数N构建N阶方阵A,并将N阶方阵A的主对角线上的元素赋值为1,其余赋值为0;
判断子单元,用于对于所述文本小列表中的第m个文本信息和第n个文本信息,判断所述第m个文本信息和第n个文本信息是否均为跨行地址行,其中,1≤n≤N,1≤m≤N,且n>m;
第一赋值子单元,用于在判断子单元的判断结果为是时,将所述N阶方阵A中的元素A[m][n]赋值为1;
第二赋值子单元,用于在判断子单元的判断结果为否时,将所述N阶方阵A中的元素A[i][j]均赋值0,其中i分别取0到m,j=n。
可选的,所述生成单元包括:
行序号集生成子单元,用于遍历所述行间关系二维矩阵的每一行,获取该行中值为1的元素的列序号,组合所述列序号得到每一行对应的行序号集;
包含筛选子单元,用于对所述行序号集进行包含筛选,得到至少一个最大行序号集,以每一所述最大行序号集作为一个地址序号集。
关于地址信息的提取装置的具体限定可以参见上文中对于地址信息的提取方法的限定,在此不再赘述。上述地址信息的提取装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图10所示。该计算机设备包括通过***总线连接的处理器、存储器、网络接口和数据库。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括存储介质、内存储器。该存储介质存储有操作***、计算机程序和数据库。该内存储器为存储介质中的操作***和计算机程序的运行提供环境。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种地址信息的提取方法。
在一个实施例中,提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行计算机程序时实现以下步骤:
获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据图像中的文本信息及其对应的坐标信息;
根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表;
获取地址层级及其对应的关键词列表;
按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息;
遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表。
在一个实施例中,提供了一个或多个存储有计算机可读指令的可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其中,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:
获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据图像中的文本信息及其对应的坐标信息;
根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表;
获取地址层级及其对应的关键词列表;
按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息;
遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表。本实施例中的可读存储介质包括非易失性可读存储介质和易失性可读存储介质。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、存储、数据库或其它介质的任何引用,均可包括非易失性和/或易失性存储器。存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存,还可包括随机存取存储器(RAM)或者外部高速缓冲存储器。作为说明而非局限,RAM以多种形式可得,诸如静态RAM(SRAM)、动态RAM(DRAM)、同步DRAM(SDRAM)、双数据率SDRAM(DDRSDRAM)、增强型SDRAM(ESDRAM)、同步链路(Synchlink)DRAM(SLDRAM)、存储器总线(Rambus)直接RAM(RDRAM)、直接存储器总线动态RAM(DRDRAM)、以及存储器总线动态RAM(RDRAM)等。
所属领域的技术人员可以清楚地了解到,为了描述的方便和简洁,仅以上述各功能单元、模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能单元、模块完成,即将所述装置的内部结构划分成不同的功能单元或模块,以完成以上描述的全部或者部分功能。
以上所述实施例仅用以说明本申请的技术方案,而非对其限制;尽管参照前述实施例对本申请进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本申请各实施例技术方案的精神和范围,均应包含在本申请的保护范围之内。

Claims (20)

  1. 一种地址信息的提取方法,其中,包括:
    获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据图像中的文本信息及其对应的坐标信息;
    根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表;
    获取地址层级及其对应的关键词列表;
    按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息;
    遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表。
  2. 如权利要求1所述的地址信息的提取方法,其中,所述根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表包括:
    将两两文本信息对应的坐标信息进行比较,得到所述两两文本信息对应的垂直距离和水平距离;
    当两两文本信息的垂直距离小于或等于第一阈值且水平距离小于或等于第二阈值时,将所述两两文本信息作为上下相邻的文本信息,添加到同一文本小列表中;
    按照所述文本信息对应的坐标信息对同一文本小列表中的文本信息进行升序排序;
    当一个文本信息不存在上下相邻的文本信息时,将所述文本信息单独添加到一个文本小列表中。
  3. 如权利要求1或2所述的地址信息的提取方法,其中,所述按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息包括:
    对于所述文本大列表中的一个文本小列表,根据所述地址层级及其对应的关键词列表,获取所述文本小列表中的地址行以及地址首行、地址尾行;
    根据所述地址首行和地址尾行,获取所述文本小列表中的跨行地址行;
    根据所述跨行地址行构建所述文本小列表对应的行间关系二维矩阵;
    根据所述行间关系二维矩阵生成所述文本小列表对应的至少一个地址序号集;
    从所述地址序号集中筛选出目标地址序号集,根据所述目标地址序号集从所述文本小列表中获取对应的文本信息,组合所述文本信息得到所述文本小列表的一个地址信息。
  4. 如权利要求3所述的地址信息的提取方法,其中,所述对于所述文本大列表中的一个文本小列表,根据所述地址层级及其对应的关键词列表,获取所述文本小列表中的地址行以及地址首行、地址尾行包括:
    遍历所述文本小列表中的文本信息,判断所述文本信息中是否存在所述关键词列表中 的至少一个关键词;
    若是,则以所述文本信息作为一个地址行,获取所述地址行中的关键词的地址层级;
    若所述地址层级为地址首行时,以所述地址行作为地址首行,若所述地址层级为地址尾行时,以所述地址行作为地址尾行。
  5. 如权利要求4所述的地址信息的提取方法,其中,所述根据所述地址首行和地址尾行,获取所述文本小列表中的跨行地址行包括:
    获取所述文本小列表中相差预设行数的两个文本信息;
    判断所述两个文本信息是否满足前一文本信息为地址行且不为地址尾行、后一文本信息为地址行且不为地址首行;
    若是,则获取所述两个文本信息及其之间的所有文本信息,作为跨行地址行;
    若否,则继续获取所述文本小列表中相差预设行数的两个文本信息进行跨行地址行判断。
  6. 如权利要求5所述的地址信息的提取方法,其中,所述根据所述跨行地址行构建所述文本小列表对应的行间关系二维矩阵,包括:
    按照所述文本小列表中的文本信息的个数N构建N阶方阵,并将N阶方阵的主对角线上的元素赋值为1,其余赋值为0;
    对于所述文本小列表中的第m个文本信息和第n个文本信息,判断所述第m个文本信息和第n个文本信息是否均为跨行地址行,其中,1≤n≤N,1≤m≤N,且n>m;
    若是,则将所述N阶方阵中的元素[m][n]赋值为1;
    若否,则将所述N阶方阵A中的元素[i][j]均赋值0,其中i分别取0到m,j=n。
  7. 如权利要求6所述的地址信息的提取方法,其中,所述根据所述行间关系二维矩阵生成所述文本小列表对应的至少一个地址序号集包括:
    遍历所述行间关系二维矩阵的每一行,获取该行中值为1的元素的列序号,组合所述列序号得到每一行对应的行序号集;
    对所述行序号集进行包含筛选,得到至少一个最大行序号集,以每一所述最大行序号集作为一个地址序号集。
  8. 一种地址信息的提取装置,其中,所述装置包括:
    识别模块,用于获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据图像中的文本信息及其对应的坐标信息;
    合并模块,用于根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表;
    获取模块,用于获取地址层级及其对应的关键词列表;
    提取模块,用于按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息;
    组合模块,用于遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表 对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表。
  9. 一种计算机设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的可读存储介质,其中,所述处理器执行所述可读存储介质时实现如下步骤:
    获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据图像中的文本信息及其对应的坐标信息;
    根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表;
    获取地址层级及其对应的关键词列表;
    按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息;
    遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表。
  10. 如权利要求9所述的计算机设备,其中,所述根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表包括:
    将两两文本信息对应的坐标信息进行比较,得到所述两两文本信息对应的垂直距离和水平距离;
    当两两文本信息的垂直距离小于或等于第一阈值且水平距离小于或等于第二阈值时,将所述两两文本信息作为上下相邻的文本信息,添加到同一文本小列表中;
    按照所述文本信息对应的坐标信息对同一文本小列表中的文本信息进行升序排序;
    当一个文本信息不存在上下相邻的文本信息时,将所述文本信息单独添加到一个文本小列表中。
  11. 如权利要求9或10所述的计算机设备,其中,所述按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息包括:
    对于所述文本大列表中的一个文本小列表,根据所述地址层级及其对应的关键词列表,获取所述文本小列表中的地址行以及地址首行、地址尾行;
    根据所述地址首行和地址尾行,获取所述文本小列表中的跨行地址行;
    根据所述跨行地址行构建所述文本小列表对应的行间关系二维矩阵;
    根据所述行间关系二维矩阵生成所述文本小列表对应的至少一个地址序号集;
    从所述地址序号集中筛选出目标地址序号集,根据所述目标地址序号集从所述文本小列表中获取对应的文本信息,组合所述文本信息得到所述文本小列表的一个地址信息。
  12. 如权利要求11所述的计算机设备,其中,所述对于所述文本大列表中的一个文本小列表,根据所述地址层级及其对应的关键词列表,获取所述文本小列表中的地址行以及地址首行、地址尾行包括:
    遍历所述文本小列表中的文本信息,判断所述文本信息中是否存在所述关键词列表中的至少一个关键词;
    若是,则以所述文本信息作为一个地址行,获取所述地址行中的关键词的地址层级;
    若所述地址层级为地址首行时,以所述地址行作为地址首行,若所述地址层级为地址尾行时,以所述地址行作为地址尾行。
  13. 如权利要求12所述的计算机设备,其中,所述根据所述地址首行和地址尾行,获取所述文本小列表中的跨行地址行包括:
    获取所述文本小列表中相差预设行数的两个文本信息;
    判断所述两个文本信息是否满足前一文本信息为地址行且不为地址尾行、后一文本信息为地址行且不为地址首行;
    若是,则获取所述两个文本信息及其之间的所有文本信息,作为跨行地址行;
    若否,则继续获取所述文本小列表中相差预设行数的两个文本信息进行跨行地址行判断。
  14. 如权利要求13所述的计算机设备,其中,所述根据所述跨行地址行构建所述文本小列表对应的行间关系二维矩阵包括:
    按照所述文本小列表中的文本信息的个数N构建N阶方阵,并将N阶方阵的主对角线上的元素赋值为1,其余赋值为0;
    对于所述文本小列表中的第m个文本信息和第n个文本信息,判断所述第m个文本信息和第n个文本信息是否均为跨行地址行,其中,1≤n≤N,1≤m≤N,且n>m;
    若是,则将所述N阶方阵中的元素[m][n]赋值为1;
    若否,则将所述N阶方阵A中的元素[i][j]均赋值0,其中i分别取0到m,j=n。
  15. 一个或多个存储有计算机可读指令的可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其中,所述计算机可读指令被一个或多个处理器执行时,使得所述一个或多个处理器执行如下步骤:
    获取待识别的票据图像,对所述票据图像进行OCR识别,得到票据图像中的文本信息及其对应的坐标信息;
    根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表,组合所述文本小列表,得到所述票据图像对应的文本大列表;
    获取地址层级及其对应的关键词列表;
    按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息;
    遍历所述文本大列表中的所有的文本小列表,得到每一个文本小列表对应的地址信息,组合所述地址信息得到所述票据图像上的地址信息列表。
  16. 如权力要求15所述的可读存储介质,其中,所述根据所述坐标信息对所述文本信息进行合并,得到一个或多个文本小列表包括:
    将两两文本信息对应的坐标信息进行比较,得到所述两两文本信息对应的垂直距离和水平距离;
    当两两文本信息的垂直距离小于或等于第一阈值且水平距离小于或等于第二阈值时,将所述两两文本信息作为上下相邻的文本信息,添加到同一文本小列表中;
    按照所述文本信息对应的坐标信息对同一文本小列表中的文本信息进行升序排序;
    当一个文本信息不存在上下相邻的文本信息时,将所述文本信息单独添加到一个文本小列表中。
  17. 如权利要求15或16所述的可读存储介质,其中,所述按照所述地址层级及其对应的关键词列表对所述文本小列表进行地址提取,得到所述文本小列表对应的地址信息包括:
    对于所述文本大列表中的一个文本小列表,根据所述地址层级及其对应的关键词列表,获取所述文本小列表中的地址行以及地址首行、地址尾行;
    根据所述地址首行和地址尾行,获取所述文本小列表中的跨行地址行;
    根据所述跨行地址行构建所述文本小列表对应的行间关系二维矩阵;
    根据所述行间关系二维矩阵生成所述文本小列表对应的至少一个地址序号集;
    从所述地址序号集中筛选出目标地址序号集,根据所述目标地址序号集从所述文本小列表中获取对应的文本信息,组合所述文本信息得到所述文本小列表的一个地址信息。
  18. 如权利要求17所述的可读存储介质,其中,所述对于所述文本大列表中的一个文本小列表,根据所述地址层级及其对应的关键词列表,获取所述文本小列表中的地址行以及地址首行、地址尾行包括:
    遍历所述文本小列表中的文本信息,判断所述文本信息中是否存在所述关键词列表中的至少一个关键词;
    若是,则以所述文本信息作为一个地址行,获取所述地址行中的关键词的地址层级;
    若所述地址层级为地址首行时,以所述地址行作为地址首行,若所述地址层级为地址尾行时,以所述地址行作为地址尾行。
  19. 如权利要求18所述的可读存储介质,其中,所述根据所述地址首行和地址尾行,获取所述文本小列表中的跨行地址行包括:
    获取所述文本小列表中相差预设行数的两个文本信息;
    判断所述两个文本信息是否满足前一文本信息为地址行且不为地址尾行、后一文本信息为地址行且不为地址首行;
    若是,则获取所述两个文本信息及其之间的所有文本信息,作为跨行地址行;
    若否,则继续获取所述文本小列表中相差预设行数的两个文本信息进行跨行地址行判断。
  20. 如权利要求19所述的可读存储介质,其中,所述根据所述跨行地址行构建所述文本小列表对应的行间关系二维矩阵包括:
    按照所述文本小列表中的文本信息的个数N构建N阶方阵,并将N阶方阵的主对角线上的元素赋值为1,其余赋值为0;
    对于所述文本小列表中的第m个文本信息和第n个文本信息,判断所述第m个文本 信息和第n个文本信息是否均为跨行地址行,其中,1≤n≤N,1≤m≤N,且n>m;
    若是,则将所述N阶方阵中的元素[m][n]赋值为1;
    若否,则将所述N阶方阵A中的元素[i][j]均赋值0,其中i分别取0到m,j=n。
PCT/CN2021/125502 2020-12-28 2021-10-22 地址信息的提取方法、装置、设备及介质 WO2022142627A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011584201.2A CN112633193A (zh) 2020-12-28 2020-12-28 地址信息的提取方法、装置、设备及介质
CN202011584201.2 2020-12-28

Publications (1)

Publication Number Publication Date
WO2022142627A1 true WO2022142627A1 (zh) 2022-07-07

Family

ID=75285741

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/125502 WO2022142627A1 (zh) 2020-12-28 2021-10-22 地址信息的提取方法、装置、设备及介质

Country Status (2)

Country Link
CN (1) CN112633193A (zh)
WO (1) WO2022142627A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116824594A (zh) * 2023-07-10 2023-09-29 广州市西克传感器有限公司 一种用于图像中定位关键词的文本排序方法

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112633193A (zh) * 2020-12-28 2021-04-09 深圳壹账通智能科技有限公司 地址信息的提取方法、装置、设备及介质
CN115082919B (zh) * 2022-07-22 2022-11-29 平安银行股份有限公司 一种地址识别方法、电子设备及存储介质

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630817A (zh) * 2014-11-03 2016-06-01 航天信息股份有限公司 一种电子***内容解析的方法及***
US20170124718A1 (en) * 2015-10-30 2017-05-04 Xiaomi Inc. Method, device, and computer-readable storage medium for area extraction
CN107832756A (zh) * 2017-10-24 2018-03-23 讯飞智元信息科技有限公司 快递单信息提取方法及装置、存储介质、电子设备
CN109635627A (zh) * 2018-10-23 2019-04-16 中国平安财产保险股份有限公司 图片信息提取方法、装置、计算机设备及存储介质
CN111652176A (zh) * 2020-06-11 2020-09-11 商汤国际私人有限公司 信息提取方法、装置、设备及存储介质
CN112052672A (zh) * 2020-08-28 2020-12-08 丰图科技(深圳)有限公司 基于地址文本的单元区域识别方法、装置和计算机设备
CN112633193A (zh) * 2020-12-28 2021-04-09 深圳壹账通智能科技有限公司 地址信息的提取方法、装置、设备及介质

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105630817A (zh) * 2014-11-03 2016-06-01 航天信息股份有限公司 一种电子***内容解析的方法及***
US20170124718A1 (en) * 2015-10-30 2017-05-04 Xiaomi Inc. Method, device, and computer-readable storage medium for area extraction
CN107832756A (zh) * 2017-10-24 2018-03-23 讯飞智元信息科技有限公司 快递单信息提取方法及装置、存储介质、电子设备
CN109635627A (zh) * 2018-10-23 2019-04-16 中国平安财产保险股份有限公司 图片信息提取方法、装置、计算机设备及存储介质
CN111652176A (zh) * 2020-06-11 2020-09-11 商汤国际私人有限公司 信息提取方法、装置、设备及存储介质
CN112052672A (zh) * 2020-08-28 2020-12-08 丰图科技(深圳)有限公司 基于地址文本的单元区域识别方法、装置和计算机设备
CN112633193A (zh) * 2020-12-28 2021-04-09 深圳壹账通智能科技有限公司 地址信息的提取方法、装置、设备及介质

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116824594A (zh) * 2023-07-10 2023-09-29 广州市西克传感器有限公司 一种用于图像中定位关键词的文本排序方法
CN116824594B (zh) * 2023-07-10 2024-04-26 广东西克智能科技有限公司 一种用于图像中定位关键词的文本排序方法

Also Published As

Publication number Publication date
CN112633193A (zh) 2021-04-09

Similar Documents

Publication Publication Date Title
WO2022142627A1 (zh) 地址信息的提取方法、装置、设备及介质
KR102056822B1 (ko) 학습 서비스 제공 방법 및 그 장치
US9785830B2 (en) Methods for automatic structured extraction of data in OCR documents having tabular data
US11348330B2 (en) Key value extraction from documents
WO2020000688A1 (zh) 财务风险验证处理方法、装置、计算机设备及存储介质
CN112446351B (zh) 医疗票据智能识别方法
CN112861648A (zh) 文字识别方法、装置、电子设备及存储介质
CN109299233B (zh) 文本数据处理方法、装置、计算机设备及存储介质
CN114708133B (zh) 一种通用的文本水印方法和装置
US9002842B2 (en) System and method for computerized batching of huge populations of electronic documents
EP2804115A1 (en) Index scanning apparatus and index scanning method
AU2021315432B2 (en) Generating machine renderable representations of forms using machine learning
CN108446702B (zh) 一种图像字符分割方法、装置、设备及存储介质
CN106855862A (zh) 一种快速比较方法及装置
CN110377559B (zh) 一种pdf文件数据提取方法、装置及存储介质
WO2002099737A1 (de) Verfahren und vorrichtung zum automatischen lesen von adressen in mehr als einer sprache
CN112948429B (zh) 一种数据报送方法、装置和设备
CN117171650A (zh) 基于网络爬虫技术的文献数据处理方法、***及介质
CN111611883A (zh) 基于最小单元格聚类的表格版面分析方法、***及设备
CN111092879A (zh) 日志关联方法及装置、电子设备、存储介质
WO2018100700A1 (ja) データ変換装置とデータ変換方法
CN114003784A (zh) 请求录制方法、装置、设备及存储介质
CN113536951A (zh) 表格识别方法及相关装置和电子设备、存储介质
JP6325472B2 (ja) データ構造抽出装置、データ構造抽出方法およびデータ構造抽出プログラム
CN112035486B (zh) 分区表的分区建立方法、装置和设备

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21913372

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 05.10.2023)

122 Ep: pct application non-entry in european phase

Ref document number: 21913372

Country of ref document: EP

Kind code of ref document: A1