Invoice fingerprint calculation method and device, storage medium and computer equipment
By acquiring and analyzing the location and distribution information of key text blocks in document documents, a feature sequence is generated, which solves the problem of inaccurate dynamic document fingerprint calculation in the existing technology and achieves more efficient and accurate document fingerprint calculation.
Patent Information
- Application Number
- CN202211330148.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-27
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-10-27
AI Technical Summary
Existing document fingerprinting methods cannot accurately extract key information from dynamic documents, resulting in low accuracy of similarity calculation or clustering results.
By obtaining the text block information of each text block in the document to be calculated, the key text blocks are identified, and the distribution information of the key text blocks in the vertical and horizontal directions is calculated based on the horizontal and vertical coordinate intervals, generating the first feature sequence and the second feature sequence, thereby obtaining the document fingerprint.
It improves the accuracy of similarity calculation and clustering results for dynamic documents, reduces the consumption of computing resources, and enhances the efficiency of document fingerprint calculation.
Smart Images

Figure CN115620318B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computers, and in particular to a bill fingerprint calculation method and device, a storage medium and a computer device. BACKGROUND
[0002] In a business scenario, according to the layout diversity of the same type of bill, the bill can be divided into two categories: static bill and dynamic bill. Among them, the static bill has the characteristics of uniform type of recorded information, uniform position and size of each field, such as ID card and bank card. The dynamic bill refers to the bill with relatively fixed type of recorded information but large layout difference. For example, sea shipping bill, air shipping bill, overseas commercial invoice and commercial receipt.
[0003] Taking the sea shipping bill as an example, the sea shipping bill generally records the information such as sender and receiver, gross weight, departure port, destination port, transportation terms, transportation fee terms, corresponding ship name, voyage and shipping company of the transportation ship. However, the sea shipping bills issued by different companies, different industries and / or different business personnel often have great differences in layout. How to accurately extract the core information of the dynamic bill to obtain the bill fingerprint according to the core information so that the subsequent accurate similarity or clustering result can be obtained is a challenging task.
[0004] At present, the existing bill fingerprint technology can be summarized into two directions: NLP (Natural Language Processing)-based fingerprint calculation method and image-based fingerprint calculation method.
[0005] The NLP-based fingerprint calculation method takes the text content recorded in the bill as the core information and generates the bill fingerprint according to the text content. The NLP-based fingerprint calculation method uses the Simhash algorithm or the SimBERT algorithm to embed the text content recorded in the bill to obtain the corresponding vector, which is the bill fingerprint of the bill. In this implementation, since the bill fingerprint is only obtained based on the text content, the fingerprint cannot reflect the layout information in the bill, ignores the difference caused by the arrangement order of information, and makes it difficult to obtain accurate similarity or clustering result subsequently. For example, it is impossible to determine the sea shipping bills issued by different companies as the same category.
[0006] The image-based fingerprint calculation method uses the image structure features of the bill as the core information to obtain the visual level encoding fingerprint of the bill. However, since this method only considers the format of the bill, it is easy to mistakenly determine the dynamic bills with similar format but different types as similar or the same category when calculating the similarity or clustering subsequently.
[0007] In summary, the existing fingerprint calculation methods cannot accurately extract the key information in dynamic invoices, greatly reducing the accuracy of subsequent similarity calculation results or clustering results. SUMMARY
[0008] The present application aims to at least solve one of the above technical defects, in particular, the technical defect that the prior art cannot accurately extract the key information in dynamic invoices, resulting in low accuracy of subsequent similarity calculation results or clustering results.
[0009] In a first aspect, an embodiment of the present application provides a method for calculating an invoice fingerprint, the method comprising:
[0010] Obtaining text block information of each text block in a to-be-calculated invoice document, wherein the text block information of each text block includes text content in the text block and position information of the text block in the to-be-calculated invoice document, and the position information includes a horizontal coordinate interval and a vertical coordinate interval;
[0011] Determining a text type corresponding to each text block, and taking a text block with a key text type as a key text block;
[0012] Determining vertical distribution information of each key text block in a vertical direction according to a horizontal coordinate interval of each key text block, and obtaining a first feature sequence according to the vertical distribution information and text content of each key text block;
[0013] Determining horizontal distribution information of each key text block in a horizontal direction according to a vertical coordinate interval of each key text block, and obtaining a second feature sequence according to the horizontal distribution information and text content of each key text block;
[0014] Obtaining an invoice fingerprint of the to-be-calculated invoice document according to each first feature sequence and each second feature sequence.
[0015] In one embodiment, the step of determining vertical distribution information of each key text block in a vertical direction according to a horizontal coordinate interval of each key text block, and obtaining a first feature sequence according to the vertical distribution information and text content of each key text block, comprises:
[0016] For each of the key text blocks, a key text block adjacent to the key text block in the longitudinal direction is taken as a first target text block, and whether the key text block and the first target text block are vertically distributed is judged according to the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the first target text block. If yes, a vertical identifier is obtained based on the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block, and a group of the first feature sequences is generated, so that the generated first feature sequences include the text content of the key text block, the text content of the first target text block, and the vertical identifier.
[0017] In one of the embodiments, the step of determining the vertical distribution information of each of the key text blocks in the longitudinal direction according to the horizontal coordinate interval of each of the key text blocks, and obtaining each group of the first feature sequences based on the vertical distribution information and the text content of each of the key text blocks, further includes:
[0018] For each of the key text blocks, if the key text block and the first target text block are not vertically distributed, or the key text block is the key text block corresponding to the maximum or minimum value of the vertical coordinate among the key text blocks, the vertical identifier is obtained according to the vertical coordinate interval of the key text block, and a group of the first feature sequences is generated, so that the generated first feature sequences include the first preset text, the text content of the key text block, and the vertical identifier.
[0019] In one of the embodiments, the step of obtaining the vertical identifier based on the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block includes:
[0020] The vertical interval distance of the key text block and the first target text block in the longitudinal direction is calculated based on the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block.
[0021] Among the preset multiple longitudinal distance intervals, a target longitudinal distance interval into which the vertical interval distance falls is determined, and an identifier corresponding to the target longitudinal distance interval is taken as the vertical identifier; wherein the identifiers corresponding to each of the longitudinal distance intervals are different from each other.
[0022] In one of the embodiments, the step of determining the horizontal distribution information of each of the key text blocks in the horizontal direction according to the vertical coordinate interval of each of the key text blocks, and obtaining each group of the second feature sequences based on the horizontal distribution information and the text content of each of the key text blocks, includes:
[0023] For each of the key text blocks, a key text block adjacent to the key text block in the horizontal direction is taken as a second target text block, and whether the key text block and the first target text block are horizontally distributed is determined according to the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block. If yes, a horizontal identifier is obtained based on the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the second target text block, and a set of the second feature sequences is generated, so that the generated second feature sequences include the text content of the key text block, the text content of the second target text block, and the horizontal identifier.
[0024] In one of the embodiments, the step of determining the horizontal distribution information of each of the key text blocks in the horizontal direction according to the vertical coordinate interval of each of the key text blocks, and obtaining each set of the second feature sequences based on the horizontal distribution information and the text content of each of the key text blocks, further includes:
[0025] For each of the key text blocks, if the key text block and the second target text block are horizontally distributed, or the key text block is the key text block corresponding to the maximum horizontal coordinate in each set of the key text blocks, the horizontal identifier is obtained according to the horizontal coordinate interval of the key text block, and a set of the second feature sequences is generated, so that the generated second feature sequences include the second preset text, the text content of the key text block, and the horizontal identifier.
[0026] In one of the embodiments, the step of obtaining the horizontal identifier based on the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the second target text block includes:
[0027] The horizontal interval distance of the key text block and the second target text block in the horizontal direction is calculated based on the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the second target text block.
[0028] In the preset multiple horizontal distance intervals, a target horizontal distance interval into which the horizontal interval distance falls is determined, and an identifier corresponding to the target horizontal distance interval is taken as the horizontal identifier; wherein the identifiers corresponding to each of the horizontal distance intervals are different from each other.
[0029] In a second aspect, the embodiments of the present application provide a document fingerprint calculation device, which includes:
[0030] A text block information acquisition module is configured to acquire text block information of each text block in a document to be calculated, wherein the text block information of each text block includes text content in the text block and position information of the text block in the document to be calculated, and the position information includes a horizontal coordinate interval and a vertical coordinate interval.
[0031] A key text block determination module is configured to determine a text type corresponding to each of the text blocks respectively, and take the text block with the text type of key text as a key text block;
[0032] A first feature sequence acquisition module is configured to determine vertical distribution information of each of the key text blocks in a vertical direction according to a horizontal coordinate interval of each of the key text blocks, and obtain each group of first feature sequences based on the vertical distribution information and text content of each of the key text blocks;
[0033] A second feature sequence acquisition module is configured to determine horizontal distribution information of each of the key text blocks in a horizontal direction according to a vertical coordinate interval of each of the key text blocks, and obtain each group of second feature sequences based on the horizontal distribution information and text content of each of the key text blocks;
[0034] A fingerprint calculation module is configured to obtain a document fingerprint of the to-be-calculated document based on each group of the first feature sequences and each group of the second feature sequences.
[0035] In a third aspect, an embodiment of the present application provides a storage medium, wherein the storage medium stores computer readable instructions, and the computer readable instructions, when executed by one or more processors, cause the one or more processors to perform the steps of the document fingerprint calculation method in any of the above embodiments.
[0036] In a fourth aspect, an embodiment of the present application provides a computer device, comprising: one or more processors, and a memory;
[0037] The memory stores computer readable instructions, and the computer readable instructions, when executed by the one or more processors, perform the steps of the document fingerprint calculation method in any of the above embodiments.
[0038] In the document fingerprint calculation method, device, storage medium and computer device of the present application, the text block recording the key words in the document to be calculated is taken as the key text block, and the vertical distribution relationship of each key text block in the vertical direction is determined according to the horizontal coordinate interval of each key text block, and the horizontal distribution relationship of each key text block in the horizontal direction is determined according to the vertical coordinate interval of each key text block. According to the vertical distribution relationship and the text content of each key text block, each group of first feature sequence used to represent the vertical layout relationship of each key word is obtained. According to the horizontal distribution relationship and the text content of each key text block, each group of second feature sequence used to represent the horizontal layout relationship of each key word is obtained. The first feature sequence and the second feature sequence can represent the text content of each group of key words and reflect the horizontal and vertical layout relationship between each group of key words. Therefore, the document fingerprint of the document to be calculated is calculated according to the first feature sequence and the second feature sequence, which can accurately extract the key information in the dynamic document, thereby improving the accuracy of the subsequent similarity calculation result or clustering result. BRIEF DESCRIPTION OF DRAWINGS
[0039] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0040] Figure 1 A flowchart of a document fingerprint calculation method in an embodiment;
[0041] Figure 2 A structural diagram of a document fingerprint calculation device in an embodiment;
[0042] Figure 3 A structural diagram of a computer device in an embodiment. DETAILED DESCRIPTION
[0043] The technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0044] The business document usually records a plurality of pairs of key-value information, each pair of key-value information including a key word (key) and a value word (value) corresponding to the key word. For example, in the key-value information "waybill number: HY2022", "waybill number" is the key word in the key-value information, and "HY2022" is the value in the key-value information.
[0045] The inventor found that, because the text content of the business document is generally concise, and the natural semantic correlation between the context is not strong, if the Simhash algorithm or SimBERT algorithm based on semantic information in the prior art is used to calculate the document fingerprint of the dynamic document, the clustering effect and the similarity calculation result are often inaccurate.
[0046] The inventor found that, in the same type of dynamic document of different versions, the key words contained in each version of the business document are relatively fixed, and each version of the business document has certain layout characteristics, such as horizontal arrangement, vertical arrangement, and / or alignment layout, etc. Therefore, the text content of each group of key words and the positional relationship between each group of key words in the business document can be used as characteristic information of the business document to determine the document fingerprint of the business document.
[0047] Further, if the positional relationship between each group of key words is extracted by the image-based method described in the background art, the amount of calculation of image processing is large, so this implementation will consume a large amount of computing resources and reduce the efficiency of document fingerprint calculation.
[0048] To solve the above problems, the embodiments of the present application provide a document fingerprint calculation method and device, a storage medium and a computer device. According to the layout relationship between each group of key words and each group of key words in the to-be-calculated document, each group of first feature sequences and each group of second feature sequences are obtained, so that each group of first feature sequences and each group of second feature sequences can not only represent the text content of each group of key words, but also reflect the horizontal and vertical layout relationship between each group of key words. In this way, according to each group of first feature sequences and each group of second feature sequences, the document fingerprint of the to-be-calculated document is calculated, which can accurately extract the key information in the dynamic document, thereby improving the accuracy of the subsequent similarity calculation result or clustering result.
[0049] In some embodiments, the present application determines the layout relationship between each key word block according to the horizontal coordinate interval and the vertical coordinate interval of each key word block, thereby improving the efficiency of document fingerprint calculation.
[0050] In some embodiments, the present application captures the isolated key words in the edge or row by defining two virtual key words, i.e. the first preset text and the second preset text, so that the first feature sequence and the second feature sequence can more accurately reflect the arrangement relationship between the key words in the business document, thereby further improving the accuracy of the subsequent similarity calculation or clustering result.
[0051] In some embodiments, the present application discretizes the distance between the key word blocks, thereby reducing the complexity of modeling to avoid overfitting as much as possible when performing similarity calculation and clustering later, thereby further improving the accuracy of the subsequent similarity calculation or clustering result.
[0052] In one embodiment, the present application provides a document fingerprint calculation method. The following embodiments are described by taking the application of the method to a computer device as an example. It can be understood that the computer device described herein can be, but is not limited to, various devices with data processing functions, such as servers, personal notebook computers, terminals, etc. The present application does not make specific limitations thereto. As shown in the figure, the method can include the following steps: Figure 1
[0053] S102: Obtain the text block information of each text block in the to-be-calculated document, wherein the text block information of each text block includes the text content in the text block and the position information of the text block in the to-be-calculated document, and the position information includes a horizontal coordinate interval and a vertical coordinate interval.
[0054] In this step, the to-be-calculated document can be divided into text blocks according to the distribution of the texts in the document, and the text block information of each text block can be obtained. The text block information of each text block can include the text content recorded in the text block and the position information of the text block in the to-be-calculated document. In one embodiment, the text block information can also record the text format of the corresponding text content and / or the text block identifier of the adjacent text block. The aforementioned text format includes but is not limited to font color and font format (bold or italic, etc.).
[0055] The position information of each text block includes a horizontal coordinate interval and a vertical coordinate interval, wherein the horizontal coordinate interval includes the value of each horizontal coordinate corresponding to the text block, which can be a continuous interval composed of the minimum horizontal coordinate and the maximum horizontal coordinate of the text block. Similarly, the vertical coordinate interval includes the value of each vertical coordinate corresponding to the text block, which can be a continuous interval composed of the minimum vertical coordinate and the maximum vertical coordinate of the text block.
[0056] In one of the embodiments, before performing the present step, the computer device can identify the document format of the obtained to-be-calculated invoice document, and perform format conversion on the to-be-calculated invoice document in the case that the document format is not a preset format, so that the document format of the converted to-be-calculated invoice document is the preset format, to facilitate subsequent feature extraction. In one example, the preset format can be PDF (Portable Document Format) or any picture format. In the present example, if the obtained to-be-calculated invoice document is a picture format document or a PDF document, S102 to S110 can be directly performed. Otherwise, before performing S102, the computer device needs to convert the original to-be-calculated invoice document into a PDF document, for example, convert the to-be-calculated invoice document in the format of excel / doc / txt / rtf into a PDF document. In this way, the position and visual information of each character in the original to-be-calculated invoice document can be preserved, and the text format and / or layout information of the to-be-calculated invoice document can be prevented from changing before and after the format conversion, to avoid adverse effects of format change on feature extraction, facilitate subsequent feature extraction, and ensure the accuracy of subsequent feature extraction.
[0057] Further, for the to-be-calculated invoice document in the preset format, if the document format of the to-be-calculated invoice document is any picture format, the computer device can perform OCR (Optical Character Recognition) processing on the to-be-calculated invoice document, to divide the to-be-calculated invoice document into a plurality of character blocks and obtain character block information of each character block. If the document format of the to-be-calculated invoice document is PDF, the computer device can perform document analysis processing on the to-be-calculated invoice document, to obtain a plurality of character blocks and character block information of each character block.
[0058] S104: respectively determine the text type corresponding to each character block, and take the character block with the text type of key text as a key character block.
[0059] The text type of each text block is used to reflect whether the text content recorded in the text block is a key word or a value word in a key-value pair. For each text block, if the text type corresponding to the text block is a key word, it can be determined that the text content recorded in the text block is a key word in a key-value pair, for example, the text content in the text block can be "waybill number", "departure port", "destination port", "ship name of the transport ship", or "transport voyage", etc. If the text type corresponding to the text block is a value word, it can be determined that the text content recorded in the text block is a value word in a key-value pair, for example, the text content in the text block can be "HY2022", "Qingdao", or "Guangzhou", etc.
[0060] In this step, the computer device can determine the text type corresponding to each text block respectively, so as to determine whether the text content recorded in each text block is a key word or a value word in a key-value pair, and then filter out the text blocks recording key words from each text block as key word blocks according to the text type corresponding to each text block.
[0061] In one embodiment, the computer device can determine the text type of each text block through a pre-set deep classification model. It can be understood that the deep classification model can be implemented based on any type of classification model in the prior art, and the present application does not limit this. For example, the deep classification model can be implemented based on layoutLM. For each text block, the computer device can respectively input the to-be-calculated single document, the four corner coordinates of the text block, and the text content of the text block into the deep classification model based on layoutLM, so as to obtain the text type corresponding to the text block output by the deep classification model.
[0062] S106: Determine the vertical distribution information of each key word block in the longitudinal direction according to the horizontal coordinate interval of each key word block, and obtain each group of first feature sequences based on the vertical distribution information and the text content of each key word block.
[0063] The vertical distribution information refers to information used to reflect the vertical distribution relationship between the key word blocks. It can be understood that the longitudinal direction described in the embodiments herein can be determined according to actual conditions, and the present application does not make specific limitations thereon. In one example, the longitudinal direction described herein can be the Y-axis direction.
[0064] In this step, the computer device can determine the vertical distribution relationship between the key text blocks according to the horizontal coordinate intervals of the key text blocks, and obtain the vertical distribution information according to the vertical distribution relationship. Then, according to the vertical distribution information and the text content of each key text block, a first feature sequence of each group is obtained, so that the text content and the longitudinal layout relationship of each group of key texts can be reflected through the first feature sequence of each group.
[0065] In one of the embodiments, in order to ensure that each group of first feature sequences can completely depict the core information in the longitudinal direction of the to-be-calculated document, and to reduce the total number of first feature sequences as much as possible, so as to reduce the redundant information and the amount of feature data as much as possible, and to further improve the efficiency of the document fingerprint calculation and the accuracy of the subsequent similarity calculation result and clustering result, S106 can include: for each key text block, taking a key text block adjacent to the key text block in the longitudinal direction as a first target text block, and determining whether the key text block and the first target text block are vertically distributed according to the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the first target text block. If yes, a vertical identifier is obtained based on the longitudinal coordinate interval of the key text block and the longitudinal coordinate interval of the first target text block, and a first feature sequence of a group is generated, so that the generated first feature sequence includes the text content of the key text block, the text content of the first target text block, and the vertical identifier.
[0066] Specifically, the computer device can determine the adjacent situation of each key text block in the longitudinal direction, which can reflect the arrangement order of each key text block in the longitudinal direction. For example, the computer device can determine the adjacent situation in the longitudinal direction according to the longitudinal coordinate interval of each key text block, or according to the text block identifier of the adjacent text block in the text block information, which is not limited in the present application.
[0067] For each key text block, the computer device can determine a key text block adjacent to the key text block in the longitudinal direction, and take the adjacent key text block as a first target text block. Further, the computer device can take a key text block adjacent to the key text block in the positive direction of the Y-axis (or the negative direction of the Y-axis) as the first target text block.
[0068] It should be noted that the "key text block adjacent to the key text block in the longitudinal direction" in the step refers to the key text block adjacent to the key text block in the longitudinal direction in the longitudinal coordinate interval of the key text block. That is, if there is no other key text block between the first key text block and the second key text block in the longitudinal direction, it can be determined that the first key text block and the second key text block are adjacent in the longitudinal direction. For example, the first key text block, the non-key text block and the second key text block are arranged adjacent in the longitudinal direction, and since there is no other key text block between the first key text block and the second key text block in the longitudinal direction, it can be determined that the first key text block and the second key text block are adjacent in the longitudinal direction.
[0069] For each key text block, after determining the first target text block corresponding to the key text block, the computer device can determine whether the key text block and the first target text block are vertically distributed in the longitudinal direction according to the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the first target text block. It can be understood that the present application can use any way to realize the judgment of vertical distribution, and the present application does not make specific limitation. In one example, the computer device can respectively obtain the first union interval and the first intersection interval between the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the first target text block, and calculate the first ratio between the interval length of the first intersection interval and the interval length of the first union interval. If the first ratio exceeds the first preset threshold, it is determined that the key text block and the first target text block are vertically distributed in the longitudinal direction, that is, the key text block and the first target text block are vertically arranged. Otherwise, it is determined that the key text block and the first target text block are not vertically distributed in the longitudinal direction.
[0070] For each key text block, if it is determined that the key text block and the first target text block are vertically distributed in the longitudinal direction, the computer device can obtain a vertical identifier according to the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block. The vertical identifier can be used to reflect the vertical spacing of the key text block and the first target text block. For example, the vertical identifier can be the vertical spacing distance of the key text block and the first target text block in the longitudinal direction.
[0071] For each key text block, the computer device can generate a first feature sequence set according to the text content of the key text block, the text content of the first target text block, and the vertical identifier, so that the generated first feature sequence set at least includes the text content of the key text block, the text content of the first target text block, and the vertical identifier. In this way, the visual features are not directly used as the document features, but the position relationship features after vertical alignment are considered according to the characteristics of the business document, and the text content and position relationship features of each group of key texts are represented by the first feature sequence set, so that the complexity of the feature sequence set can be greatly reduced, and the computing resources consumed when calculating the document fingerprint can be reduced. At the same time, it also conforms to the characteristics of the layout design of the business document itself.
[0072] It can be understood that in addition to the text content of the key text block, the text content of the first target text block, and the vertical identifier, the first feature sequence set can also include more information, which is not limited in the present application. In one example, the first feature sequence set can only include the above three kinds of information, so that the constitution of the first feature sequence set can be simplified, and the core information of the document to be calculated can be described more completely.
[0073] In one of the embodiments, S106 can further include the following steps: for each key text block, if the key text block is not vertically distributed with the first target text block, or the key text block is the key text block corresponding to the maximum value of the vertical coordinate in the group of key texts, the vertical identifier is obtained according to the vertical coordinate interval of the key text block, and a first feature sequence set is generated, so that the generated first feature sequence set includes the first preset text, the text content of the key text block, and the vertical identifier.
[0074] Specifically, for each key text block, if the key text block is not vertically distributed with the first target text block, the vertical identifier corresponding to the key text block can be determined according to the vertical coordinate interval of the key text block, and the vertical identifier is used to reflect the vertical distance between the key text block and the upper and lower edges of the page (which can be the upper edge and / or the lower edge of the page). A first feature sequence set is generated according to the vertical identifier, the first preset text, and the text content of the key text block, so as to express the isolated key texts in the column through the first feature sequence set.
[0075] In which, the text content of the first preset text can be pre-configured according to the actual situation, which is not limited in the present application, as long as it is not repeated with the key texts recorded in the document to be calculated. In one example, the first preset text can be "Top", and the computer device can determine the corresponding vertical identifier according to the vertical distance between the isolated key text block and the upper end of the page.
[0076] For each key text block, if the key text block is the text block corresponding to the maximum vertical coordinate in the group of key text blocks or the key text block corresponding to the minimum vertical coordinate in the group of key text blocks, it can be determined that the key text block is located at the edge in the vertical direction. In this case, the computer device can generate a group of first feature sequences by referring to the above process to make the key text of the large page edge through the group of first feature sequences.
[0077] In this way, the edge or isolated key text in the column can be captured by the first preset text, which is a virtual key text, so that each group of first feature sequences can more accurately reflect the vertical layout relationship between each group of key texts in the business document, thereby further improving the accuracy of subsequent similarity calculation or clustering results.
[0078] In one embodiment, to achieve data dimension reduction to further improve the calculation efficiency of the document fingerprint and avoid overfitting in the clustering and similarity calculation processes, to further improve the accuracy of subsequent clustering results and similarity calculation results, based on the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block, the step of obtaining a vertical identifier can include:
[0079] Based on the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block, the vertical interval distance of the key text block and the first target text block in the vertical direction is calculated.
[0080] Among the plurality of preset vertical distance intervals, the target vertical distance interval into which the vertical interval distance falls is determined, and the identifier corresponding to the target vertical distance interval is taken as the vertical identifier; wherein the identifiers corresponding to each of the vertical distance intervals are different from each other.
[0081] Specifically, the computer device can determine at least two vertical distance intervals and determine the interval value of each vertical distance interval and the identifier corresponding to each vertical distance interval, respectively, wherein the identifiers corresponding to each two vertical distance intervals are different. It can be understood that the specific number of vertical distance intervals can be determined according to actual needs, and the present application does not make specific limitations thereon. For ease of description, some embodiments are described by taking three vertical distance intervals as an example. Similarly, the boundary value of each vertical distance interval can be determined according to the number of vertical distance intervals and the total height of the document to be calculated in the vertical direction, and the present application does not make specific limitations thereon.
[0082] For each key text block, when it is necessary to calculate the vertical identifier between the key text block and the corresponding first target text block, the computer device can calculate a vertical interval distance between the key text block and the first target text block, which can reflect the vertical interval between the key text block and the first target text block. After determining the vertical interval distance, the computer device can take the vertical interval distance interval including the vertical interval distance as a target vertical distance interval among a plurality of vertical distance intervals, take the identifier corresponding to the target vertical distance interval as the vertical identifier, and generate a first feature sequence according to the text content of the key text block, the text content of the first target text block, and the vertical identifier.
[0083] For example, if the computer device determines 3 vertical distance intervals in advance, when the vertical interval distance falls into the first vertical distance interval, it indicates that the vertical interval between the key text block and the corresponding first target text block is within 1 / 3 of a page, in which case a first feature sequence of "text content of the key text block - text content of the first target text block - V1" can be generated. Similarly, when the vertical interval distance falls into the second vertical distance interval, it indicates that the vertical interval between the key text block and the corresponding first target text block is within the range of 1 / 3 of a page to 2 / 3 of a page, in which case a first feature sequence of "text content of the key text block - text content of the first target text block - V2" can be generated. When the vertical interval distance falls into the third vertical distance interval, it indicates that the vertical interval between the key text block and the corresponding first target text block exceeds 2 / 3 of a page, in which case a first feature sequence of "text content of the key text block - text content of the first target text block - V3" can be generated.
[0084] In this way, on the one hand, the vertical interval between the key text blocks can be discretized, thereby reducing the complexity of modeling to avoid overfitting as much as possible when performing similarity calculation and clustering later, thereby further improving the accuracy of the subsequent similarity calculation or clustering results.
[0085] S108: Determine horizontal distribution information of each key text block in the horizontal direction according to the vertical coordinate interval of each key text block, and obtain a second feature sequence according to the horizontal distribution information and the text content of each key text block.
[0086] The horizontal distribution information refers to information reflecting the horizontal distribution relationship between the key text blocks. It can be understood that the specific direction of the horizontal direction described in the embodiments herein can be determined according to actual conditions, and the present application does not make specific limitations thereon. In one example, the horizontal direction described herein can be the X-axis direction.
[0087] In this step, the computer device can determine the horizontal distribution relationship between the key text blocks according to the vertical coordinate intervals of the key text blocks, and obtain the horizontal distribution information according to the horizontal distribution information and the text content of each key text block, and obtain each group of second feature sequences according to the horizontal distribution information and the text content of each key text block, so that the text content and the transverse layout relationship of each group of key texts can be expressed through each group of second feature sequences.
[0088] In one of the embodiments, in order to ensure that each group of second feature sequences can completely depict the core information in the transverse direction of the to-be-calculated document, and to reduce the total number of second feature sequences as much as possible, so as to reduce the redundant information and the amount of feature data as much as possible, and to further improve the efficiency of the document fingerprint calculation and the accuracy of the subsequent similarity calculation result and clustering result, S108 can include: for each key text block, taking the key text block adjacent to the key text block in the transverse direction as a second target text block, and determining whether the key text block and the first target text block are horizontally distributed according to the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block, if yes, obtaining a horizontal identifier based on the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the second target text block, and generating a group of second feature sequences, so that the generated second feature sequences include the text content of the key text block, the text content of the second target text block, and the horizontal identifier.
[0089] Specifically, the computer device can determine the adjacent situation of each key text block in the transverse direction, which can reflect the arrangement order of each key text block in the transverse direction. For example, the computer device can determine the adjacent situation in the transverse direction according to the horizontal coordinate interval of each key text block, or can determine the adjacent situation according to the text block identifier of the adjacent text block in the text block information, and the present application does not make a specific limitation in this regard.
[0090] For each key text block, the computer device can determine the key text block adjacent to the key text block in the transverse direction, and take the adjacent key text block as a second target text block. Further, the computer device can take the key text block adjacent to the key text block in the positive direction of the X-axis (or the negative direction of the X-axis) as the second target text block.
[0091] It should be noted that the specific definition of the "key text block adjacent to the key text block in the transverse direction" in this step is similar to the "key text block adjacent to the key text block in the vertical direction" described above, which refers to the key text block in each key text block, the horizontal coordinate interval of which is adjacent to the horizontal coordinate interval of the key text block.
[0092] For each key text block, after determining the second target text block corresponding to the key text block, the computer device can determine whether the key text block and the second target text block are horizontally distributed in the horizontal direction according to the vertical coordinate interval of the key text block and the vertical coordinate interval of the second target text block. In one example, the computer device can respectively obtain a second union interval and a second intersection interval between the vertical coordinate interval of the key text block and the vertical coordinate interval of the second target text block, and calculate a second ratio between the interval length of the second intersection interval and the interval length of the second union interval. If the second ratio exceeds a second preset threshold, it is determined that the key text block and the second target text block are horizontally distributed in the horizontal direction. Otherwise, it is determined that the key text block and the second target text block are not horizontally distributed in the horizontal direction.
[0093] For each key text block, the computer device can obtain a horizontal identifier according to the vertical coordinate interval of the key text block and the vertical coordinate interval of the second target text block in the case that the key text block and the second target text block are horizontally distributed in the horizontal direction. The horizontal identifier can be used to reflect the horizontal distance between the key text block and the second target text block. For example, the horizontal identifier can be the horizontal interval distance between the key text block and the second target text block in the horizontal direction.
[0094] For each key text block, the computer device can generate a second feature sequence set according to the text content of the key text block, the text content of the second target text block, and the horizontal identifier, so that the generated second feature sequence set at least includes the text content of the key text block, the text content of the second target text block, and the horizontal identifier. In this way, the complexity of the feature sequence is greatly reduced, and the computing resources consumed in calculating the document fingerprint are also reduced. At the same time, it is also in line with the characteristics of the layout design of the business document itself.
[0095] It can be understood that in addition to the text content of the key text block, the text content of the second target text block, and the horizontal identifier, the second feature sequence can also include more information, which is not limited in the present application. In one example, the second feature sequence can only include the aforementioned three kinds of information, so that the composition of the second feature sequence can be simplified, and the core information of the to-be-calculated document can be described more completely.
[0096] In one of the embodiments, S108 can further include the following steps: for each of the key text blocks, if the key text block is horizontally distributed with the second target text block, or the key text block is the key text block corresponding to the maximum horizontal coordinate in each group of key text blocks, a horizontal identifier is obtained according to the horizontal coordinate interval of the key text block, and a set of the second feature sequences is generated, so that the generated set of the second feature sequences includes the second preset text, the text content of the key text block, and the horizontal identifier.
[0097] Specifically, for each of the key text blocks, if the key text block is not horizontally distributed with the second target text block, a horizontal identifier corresponding to the key text block can be determined according to the horizontal coordinate interval of the key text block, and the horizontal identifier is used to reflect the horizontal distance between the key text block and the left and right edges of the page (which can be the left edge of the page and / or the right edge of the page). A set of the second feature sequences is generated according to the horizontal identifier, the second preset text, and the text content of the key text block, so as to express the isolated key text in a line through the set of the second feature sequences. In one example, the second preset text can be “Left”, and the computer device can determine the corresponding horizontal identifier according to the horizontal distance between the isolated key text block and the left end of the page.
[0098] For each of the key text blocks, if the key text block is the key text block corresponding to the maximum horizontal coordinate in each group of key text blocks, or the key text block corresponding to the minimum horizontal coordinate in each group of key text blocks, it can be determined that the key text block is located at the edge in the horizontal direction. In this case, the computer device can generate a set of the second feature sequences to capture the key text of the page edge through the set of the second feature sequences according to the above process.
[0099] In this way, the edge or the isolated key text in a line can be captured through the virtual key text of the second preset text, so that each set of the second feature sequences can more accurately reflect the horizontal layout relationship between each group of key texts in the business document, thereby further improving the accuracy of the subsequent similarity calculation or clustering results.
[0100] In one of the embodiments, in order to realize data dimension reduction to further improve the calculation efficiency of the document fingerprint, and to avoid overfitting in the clustering and similarity calculation process in the later stage, to further improve the accuracy of the subsequent clustering results and similarity calculation results, in the present application, based on the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the second target text block, the step of obtaining the horizontal identifier includes:
[0101] Based on the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the second target text block, the horizontal interval distance of the key text block and the second target text block in the horizontal direction is calculated.
[0102] In the preset plurality of lateral distance intervals, a target lateral distance interval in which the lateral interval distance falls is determined, and an identifier corresponding to the target lateral distance interval is taken as the horizontal identifier; wherein the identifiers corresponding to the respective lateral distance intervals are different from each other.
[0103] Specifically, the computer device can determine at least two lateral distance intervals in advance, and determine an interval value of each lateral distance interval and an identifier corresponding to each lateral distance interval, respectively, wherein the identifiers corresponding to each two lateral distance intervals are different from each other. Further, the identifier corresponding to each lateral distance interval is also different from the identifier corresponding to each longitudinal distance interval.
[0104] It can be understood that the specific number of lateral distance intervals can be determined according to actual needs, and the present application does not make specific limitations thereon, for example, three lateral distance intervals can be divided. Similarly, the boundary values of the respective lateral distance intervals can be determined according to the number of divided lateral distance intervals and the total length of the document to be calculated in the lateral direction, and the present application does not make specific limitations thereon.
[0105] For each key text block, when the horizontal identifier between the key text block and the corresponding second target text block needs to be calculated, the computer device can calculate the lateral interval distance between the key text block and the second target text block, which can reflect the horizontal distance between the key text block and the second target text block. After determining the lateral interval distance, the computer device can take the lateral distance interval including the lateral interval distance in the plurality of lateral distance intervals as the target lateral distance interval, and take the identifier corresponding to the target lateral distance interval as the horizontal identifier, and generate a second feature sequence according to the text content of the key text block, the text content of the second target text block and the horizontal identifier.
[0106] In this way, the horizontal distance between the key text blocks can be discretized, so as to reduce the complexity of modeling, so as to avoid overfitting as much as possible when performing similarity calculation and clustering later, so as to further improve the accuracy of the subsequent similarity calculation or clustering results.
[0107] S110: Obtain a document fingerprint of the document to be calculated according to the respective groups of first feature sequences and second feature sequences.
[0108] Specifically, by the above steps, the to-be-calculated invoice document can be expressed by the first feature sequences and the second feature sequences, which not only includes the text semantic information of the key texts in the to-be-calculated invoice document, but also includes the layout topological relationship between the key texts. The computer device can process the first feature sequences and the second feature sequences by using any type of fingerprint calculation algorithm in the prior art to obtain the invoice fingerprint of the to-be-calculated invoice document. In an example, the computer device can obtain the invoice fingerprint by using a graph embedding algorithm or a node embedding algorithm.
[0109] In one of the embodiments, after S110, the computer device can perform similarity calculation of invoices or invoice clustering according to the calculated invoice fingerprint. According to the inventor's test, when the invoice fingerprint calculation method provided in the present application is applied in the most similar document retrieval process, the retrieval time can be controlled within the millisecond level, which greatly improves the response rate and saves the computing resources.
[0110] In the present application, the text block recording the key texts in the to-be-calculated invoice document is regarded as a key text block, and the vertical distribution relationship of each key text block in the vertical direction is determined according to the horizontal coordinate interval of each key text block, and the horizontal distribution relationship of each key text block in the horizontal direction is determined according to the vertical coordinate interval of each key text block. According to the vertical distribution relationship and the text content of each key text block, the first feature sequences for representing the vertical layout relationship of each key text are obtained. According to the horizontal distribution relationship and the text content of each key text block, the second feature sequences for representing the horizontal layout relationship of each key text are obtained. The first feature sequences and the second feature sequences can not only represent the text content of each group of key texts, but also reflect the horizontal and vertical layout relationship between each group of key texts. In this way, the invoice fingerprint of the to-be-calculated invoice document is calculated according to the first feature sequences and the second feature sequences, which can accurately extract the key information in the dynamic invoice, thereby improving the accuracy of the subsequent similarity calculation result or clustering result.
[0111] The invoice fingerprint calculation device provided in the embodiments of the present application is described below. The invoice fingerprint calculation device described below can be referred to in correspondence with the invoice fingerprint calculation method described above.
[0112] In one of the embodiments, the present application provides an invoice fingerprint calculation device 200. As shown in FIG. 2, the invoice fingerprint calculation device 200 includes a first feature sequence calculation unit 210, a second feature sequence calculation unit 220, an invoice fingerprint calculation unit 230, and an invoice similarity calculation unit 240. Figure 2As shown, the apparatus 200 specifically comprises a text block information obtaining module 210, a key text block determining module 220, a first feature sequence obtaining module 230, a second feature sequence obtaining module 240 and a fingerprint calculating module 250. Among them:
[0113] The text block information obtaining module 210 is configured to obtain text block information of each text block in the to-be-calculated document respectively, wherein the text block information of each text block comprises text content in the text block and position information of the text block in the to-be-calculated document, and the position information comprises a horizontal coordinate interval and a vertical coordinate interval.
[0114] The key text block determining module 220 is configured to determine a text type corresponding to each text block respectively, and take the text block with a key text type as a key text block.
[0115] The first feature sequence obtaining module 230 is configured to determine vertical distribution information of each key text block in a vertical direction according to a horizontal coordinate interval of each key text block, and obtain each group of first feature sequences based on the vertical distribution information and text content of each key text block.
[0116] The second feature sequence obtaining module 240 is configured to determine horizontal distribution information of each key text block in a horizontal direction according to a vertical coordinate interval of each key text block, and obtain each group of second feature sequences based on the horizontal distribution information and text content of each key text block.
[0117] The fingerprint calculating module 250 is configured to obtain a document fingerprint of the to-be-calculated document according to each group of first feature sequences and each group of second feature sequences.
[0118] In an embodiment, the first feature sequence obtaining module 230 comprises a first feature sequence generating unit. The first feature sequence generating unit is configured to, for each key text block, take a key text block adjacent to the key text block in the vertical direction as a first target text block, and determine whether the key text block and the first target text block are vertically distributed according to a horizontal coordinate interval of the key text block and a horizontal coordinate interval of the first target text block. If yes, a vertical identifier is obtained based on a vertical coordinate interval of the key text block and a vertical coordinate interval of the first target text block, and one group of first feature sequences is generated, so that the generated first feature sequences comprise text content of the key text block, text content of the first target text block and the vertical identifier.
[0119] In one embodiment, the first feature sequence acquisition module 230 further comprises a second feature sequence generation unit. The second feature sequence generation unit is configured to, for each of the key text blocks, if the key text block is not vertically distributed with the first target text block or the key text block is the key text block corresponding to the maximum value of the vertical coordinate in each group of key text blocks, obtain the vertical identifier according to the vertical coordinate interval of the key text block, and generate a group of the first feature sequences, so that the generated first feature sequences comprise a first preset text, the text content of the key text block, and the vertical identifier.
[0120] In one embodiment, the first feature sequence acquisition module 230 further comprises a vertical interval distance unit and a vertical identifier determination unit. The vertical interval distance unit is configured to calculate the vertical interval distance of the key text block and the first target text block in the vertical direction based on the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block. The vertical identifier determination unit is configured to determine the target vertical distance interval into which the vertical interval distance falls in a plurality of preset vertical distance intervals, and take the identifier corresponding to the target vertical distance interval as the vertical identifier; wherein the identifiers corresponding to each of the vertical distance intervals are different from each other.
[0121] In one embodiment, the second feature sequence acquisition module 240 comprises a third feature sequence generation unit. The third feature sequence generation unit is configured to, for each of the key text blocks, take the key text block adjacent to the key text block in the horizontal direction as a second target text block, and determine whether the key text block and the first target text block are horizontally distributed according to the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block. If so, obtain a horizontal identifier based on the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the second target text block, and generate a group of the second feature sequences, so that the generated second feature sequences comprise the text content of the key text block, the text content of the second target text block, and the horizontal identifier.
[0122] In one embodiment, the second feature sequence acquisition module 240 further comprises a fourth feature sequence generation unit. The fourth feature sequence generation unit is configured to, for each of the key text blocks, if the key text block is horizontally distributed with the second target text block or the key text block is the key text block corresponding to the maximum value of the horizontal coordinate in each group of key text blocks, obtain the horizontal identifier according to the horizontal coordinate interval of the key text block, and generate a group of the second feature sequences, so that the generated second feature sequences comprise a second preset text, the text content of the key text block, and the horizontal identifier.
[0123] In one embodiment, the second feature sequence acquisition module 240 further comprises a horizontal interval distance unit and a horizontal label determination unit. The horizontal interval distance unit is configured to calculate a horizontal interval distance between the key text block and the second target text block in a horizontal direction based on the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the second target text block. The horizontal label determination unit is configured to determine a target horizontal distance interval into which the horizontal interval distance falls in a plurality of preset horizontal distance intervals, and take a label corresponding to the target horizontal distance interval as the horizontal label; wherein the labels corresponding to each of the horizontal distance intervals are different from each other.
[0124] In one embodiment, the present application further provides a storage medium having computer readable instructions stored therein, which, when executed by one or more processors, cause the one or more processors to perform the steps of the invoice fingerprint calculation method of any of the above embodiments.
[0125] In one embodiment, the present application further provides a computer device. The computer device has computer readable instructions stored therein, which, when executed by one or more processors, cause the one or more processors to perform the steps of the invoice fingerprint calculation method of any of the above embodiments.
[0126] Schematically, Figure 3 An internal structure schematic diagram of a computer device provided by an embodiment of the present application is shown in the figure. In one example, the computer device can be a server. Referring to Figure 3 The computer device 900 includes a processing component 902, which further includes one or more processors, and a memory resource represented by the memory 901, for storing instructions executable by the processing component 902, such as an application program. The application program stored in the memory 901 can include one or more than one module each corresponding to a set of instructions. In addition, the processing component 902 is configured to execute the instructions to perform the steps of the invoice fingerprint calculation method of any of the above embodiments.
[0127] The computer device 900 can further include a power supply component 903 configured to perform power management of the computer device 900, a wired or wireless network interface 904 configured to connect the computer device 900 to a network, and an input / output (I / O) interface 905. The computer device 900 can operate based on an operating system stored in the memory 901, such as Windows Server TM, Mac OS X TM, Unix TM, Linux TM, Free BSD TM, or the like.
[0128] Those skilled in the art can understand that the internal structure of the computer device shown in the present application is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. A specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0129] Finally, it should be noted that in the present document, the terms such as first and second, etc. are merely used to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Also, the terms "include", "contain" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such a process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element. In the present document, "a", "an", "said", "the" and "it" can also include plural forms, unless the context clearly indicates otherwise. A plurality means at least two, such as 2, 3, 5 or 8, etc. "And / or" includes any and all combinations of the related listed items.
[0130] The various embodiments in the specification are described in a progressive manner, each embodiment focusing on the differences from other embodiments, and the various embodiments can be combined as needed, and the same and similar parts refer to each other.
[0131] The above description of the disclosed embodiments enables a person skilled in the art to implement or use the present application. Various modifications to the embodiments will be apparent to those skilled in the art, and the general principles defined herein can be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application will not be limited to the embodiments shown herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A method of bill fingerprinting, characterized by, The method comprises: respectively obtaining text block information of each text block in a to-be-calculated invoice document, wherein the text block information of each text block comprises text content in the text block and position information of the text block in the to-be-calculated invoice document, and the position information comprises a horizontal coordinate interval and a vertical coordinate interval; respectively determining a text type corresponding to each text block, and taking a text block with a text type of key text as a key text block; determining vertical distribution information of each key text block in a vertical direction according to a horizontal coordinate interval of each key text block, and obtaining each group of first feature sequences based on the vertical distribution information and the text content of each key text block; determining horizontal distribution information of each key text block in a horizontal direction according to a vertical coordinate interval of each key text block, and obtaining each group of second feature sequences based on the horizontal distribution information and the text content of each key text block; obtaining an invoice fingerprint of the to-be-calculated invoice document according to each group of first feature sequences and each group of second feature sequences.
2. The method of claim 1, wherein, The step of determining the vertical distribution information of each key text block in the vertical direction according to the horizontal coordinate interval of each key text block, and obtaining each group of first feature sequences based on the vertical distribution information and the text content of each key text block, comprises: for each key text block, taking a key text block adjacent to the key text block in the vertical direction as a first target text block, and judging whether the key text block and the first target text block are vertically distributed according to the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the first target text block, if yes, obtaining a vertical identifier based on the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block, and generating one group of first feature sequences, so that the generated first feature sequences comprise the text content of the key text block, the text content of the first target text block and the vertical identifier.
3. The method of claim 2, wherein, The step of determining the vertical distribution information of each key text block in the vertical direction according to the horizontal coordinate interval of each key text block, and obtaining each group of first feature sequences based on the vertical distribution information and the text content of each key text block, further comprises: for each key text block, if the key text block and the first target text block are not vertically distributed, or the key text block is a key text block corresponding to a vertical coordinate extreme value in each group of key text blocks, obtaining the vertical identifier according to the vertical coordinate interval of the key text block, and generating one group of first feature sequences, so that the generated first feature sequences comprise a first preset text, the text content of the key text block and the vertical identifier.
4. The method according to claim 2 or 3, characterized in that, The step of obtaining the vertical identifier based on the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block, comprises: calculating a vertical interval distance of the key text block and the first target text block in the vertical direction based on the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block. The target longitudinal distance interval corresponding to the target longitudinal interval distance is determined, and an identifier corresponding to the target longitudinal distance interval is taken as the vertical identifier.
5. The method according to claim 2 or 3, characterized in that, The step of determining horizontal distribution information of each key text block in the horizontal direction according to the vertical coordinate interval of each key text block, and obtaining each group of second feature sequences based on the horizontal distribution information and the text content of each key text block, comprises: For each key text block, a key text block adjacent to the key text block in the horizontal direction is taken as a second target text block, and whether the key text block and the first target text block are horizontally distributed is judged according to the vertical coordinate interval of the key text block and the vertical coordinate interval of the first target text block. If yes, a horizontal identifier is obtained based on the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the second target text block, and a group of the second feature sequences is generated, so that the generated second feature sequence comprises the text content of the key text block, the text content of the second target text block and the horizontal identifier.
6. The method of claim 5, wherein, The step of determining horizontal distribution information of each key text block in the horizontal direction according to the vertical coordinate interval of each key text block, and obtaining each group of second feature sequences based on the horizontal distribution information and the text content of each key text block, further comprises: For each key text block, if the key text block and the second target text block are horizontally distributed, or the key text block is a key text block corresponding to a horizontal coordinate extreme value in each group of key text blocks, the horizontal identifier is obtained according to the horizontal coordinate interval of the key text block, and a group of the second feature sequences is generated, so that the generated second feature sequence comprises a second preset text, the text content of the key text block and the horizontal identifier.
7. The method of claim 5, wherein, The step of obtaining a horizontal identifier based on the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the second target text block, comprises: The horizontal interval distance between the key text block and the second target text block in the horizontal direction is calculated based on the horizontal coordinate interval of the key text block and the horizontal coordinate interval of the second target text block. The target horizontal distance interval corresponding to the target horizontal interval distance is determined, and an identifier corresponding to the target horizontal distance interval is taken as the horizontal identifier; wherein the identifiers corresponding to each horizontal distance interval are different.
8. A slip fingerprinting computing device, comprising: The device comprises: A text block information acquisition module is configured to acquire text block information of each text block in a to-be-calculated document respectively, wherein the text block information of each text block comprises text content in the text block and position information of the text block in the to-be-calculated document, and the position information comprises a horizontal coordinate interval and a vertical coordinate interval. A key text block determination module is configured to determine a text type corresponding to each text block respectively, and take a text block with a key text type as a key text block. The first feature sequence acquisition module is configured to determine vertical distribution information of each key text block in the vertical direction according to a horizontal coordinate interval of each key text block, and obtain each group of first feature sequences based on the vertical distribution information and text content of each key text block. The second feature sequence acquisition module is configured to determine horizontal distribution information of each key text block in the horizontal direction according to a vertical coordinate interval of each key text block, and obtain each group of second feature sequences based on the horizontal distribution information and text content of each key text block. The fingerprint calculation module is configured to obtain a document fingerprint of the to-be-calculated document according to each group of first feature sequences and each group of second feature sequences.
9. A storage medium, characterized by The storage medium has computer readable instructions stored therein, and the computer readable instructions, when executed by one or more processors, cause the one or more processors to perform the steps of the document fingerprint calculation method according to any one of claims 1 to 7.
10. A computer device, comprising: The storage medium has computer readable instructions stored therein, and the computer readable instructions, when executed by one or more processors, cause the one or more processors to perform the steps of the document fingerprint calculation method according to any one of claims 1 to 7. The storage medium has computer readable instructions stored therein, and the computer readable instructions, when executed by one or more processors, cause the one or more processors to perform the steps of the document fingerprint calculation method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Character block sorting method and device, storage medium and electronic equipment
CN111027304A
Information retrieval method in document, electronic equipment and storage medium
CN115114412A