A fast and batch extraction method for government procurement contract PDF documents

By improving the matching of pdfplumber tool and regular expressions, the problem of many spaces and messy content in the extraction of PDF documents for government procurement contracts is solved, and efficient and accurate contract information extraction and storage is achieved.

CN116775740BActive Publication Date: 2025-08-26QILU UNIVERSITY OF TECHNOLOGY (SHANDONG ACADEMY OF SCIENCES)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202310781766.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-29
Publication Date
2025-08-26
Estimated Expiration
2043-06-29

AI Technical Summary

Technical Problem

The existing PDF document analysis library has the problem of many spaces and disordered content when extracting the content of government procurement contracts, resulting in low extraction efficiency and poor accuracy.

Method used

Improve the pdfplumber tool of Python open source library, add the find_table() method, combine regular expression matching, realize precise positioning of tables and text elements, parse government procurement contracts on pages, and use specific rules to match information for different types of contracts, extract and store them into the database.

Benefits of technology

It improves the efficiency and accuracy of the extraction of PDF documents for government procurement contracts, realizes fast, batch and accurate contract content extraction, and stores the extracted results in the database.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116775740B_ABST
    Figure CN116775740B_ABST
Patent Text Reader

Abstract

This invention relates to a method for rapidly and batch-extracting government procurement contract PDF documents, belonging to the field of information extraction from PDF documents. By improving the pdfplumber library in Python to increase extraction efficiency, and incorporating regular expression matching, a fully automatic extraction and parsing model is implemented to address the issues of large amounts of spaces and disorganized extracted content. This method achieves precise matching and allows for rapid, accurate, and batch extraction of the specific content of government procurement contract PDF documents.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of PDF document information extraction, and in particular to a method for quickly and batch extracting government procurement contract PDF documents. Background Art

[0002] With the continuous development of the past two years, government procurement activities have become increasingly online, requiring transparency and openness. Government procurement contracts are published on information disclosure platforms in PDF format. PDF (Portable Document Format) is a file format that better reproduces the formatting, characters, and colors of documents. Therefore, government procurement contracts are published in PDF format to display the full content of the contract documents. PDF documents have a complex structure, making understanding and extracting useful information a challenging task. To obtain the specific content of contract documents, it is necessary to extract specific content from PDF documents accurately and in batches. While there are many software programs available on the market for extracting PDF text content, their versatility is limited and cannot meet the needs of users in various fields.

[0003] With the continuous development of technology, some open-source PDF document parsing libraries have been continuously updated and iterated. Open-source parsing libraries can be used to parse PDF documents. Existing parsing libraries can extract text content, image objects, table content, and line elements from PDF documents. However, there are problems with the extracted content, such as large spaces and disorganized content. Summary of the Invention

[0004] In order to solve the problems in the existing technology, the patent of this invention designs a method for fast and batch extraction of government procurement contract PDF documents. By improving the pdfplumber tool in the Python open source library, the extraction efficiency is improved, and regular expression matching is incorporated to realize a fully automatic extraction and parsing model to solve the problem that there are a large number of spaces in the extracted content and the extracted content is messy and disordered, and to achieve precise matching, and fast, accurate and batch extraction of the specific content of government procurement contract PDF documents.

[0005] The technical solution adopted by the present invention is: a method for quickly and batch extracting government procurement contract PDF documents, the specific steps of the extraction method are:

[0006] Step S101: read the government procurement contract PDF document, parse the PDF document page number, parse the first page text elements, and obtain the contract procurement type;

[0007] Step S102: Parse the text elements of the second page of the contract PDF according to different contract procurement types, and use different regular expressions to match the specific content of the contract;

[0008] Step S103: If the text element extracted in step S102 does not contain the detailed content of the contract, then the table information of the contract PDF document is extracted, and the detailed content of the contract document is extracted from the table information;

[0009] Step S104: storing the extracted detailed contents of the contract PDF document into a database.

[0010] Furthermore, the PDF document parsing in the extraction method uses the python toolkit pdfplumber tool to obtain all elements of the government procurement contract PDF document.

[0011] Furthermore, the extraction method improves the pdfplumber tool of the python toolkit and adds a find_table() method. After importing the PDF file, the table is searched and the page where the table is located is accurately located by retrieving the number of line segments on each page.

[0012] Furthermore, the step S101 is specifically as follows:

[0013] Step S1011, read the government procurement contract PDF document through the open() method to obtain the total number of pages of the PDF document; obtain the text elements of the first page content of the PDF document through the extract_text() method, and store the text content in the text first page list;

[0014] Step S1012: Since the text elements obtained by the extract_text() method may contain a large number of null values, it is necessary to remove the null values ​​from the text elements of the home page content to obtain the complete text content of the PDF document home page, and replace the text content in the home page list;

[0015] Step S1013, using the findall() method of regular expression matching on the home page list, accurately matching the procurement type of the government procurement contract and storing it in the database.

[0016] Furthermore, if the government procurement contract type obtained in step S101 is a service contract, the specific process of step S102 is as follows:

[0017] Parse the second page of the government procurement contract PDF document, parse the text elements therein, and store the parsed text elements in the list on the second page;

[0018] For the text elements in the list on the second page, use regular expressions according to specific rules to match the full name of the purchaser of the government procurement contract;

[0019] Use regular expressions to match the full names of suppliers in government procurement contracts through specific rules;

[0020] Use regular expressions to match the project names of government procurement contracts through specific rules;

[0021] Use regular expressions to match the service locations of government procurement contracts through specific rules;

[0022] Use regular expressions to match the service content and scope of government procurement contracts through specific rules;

[0023] The matched procurement type, purchaser, supplier, project name, service location, service content and scope data are stored in the service category information table in the database.

[0024] Furthermore, if the government procurement contract type obtained in step S101 is equipment, the specific process of step S102 is:

[0025] Parse the second page of the government procurement contract PDF document, parse the text elements therein, and store the parsed text elements in the list on the second page;

[0026] For the text elements in the list on the second page, use regular expressions according to specific rules to match the full name of the purchaser of the government procurement contract;

[0027] Use regular expressions to match the full names of suppliers in government procurement contracts through specific rules;

[0028] Use regular expressions to match the project names of government procurement contracts through specific rules;

[0029] Use regular expressions to match the supply locations of government procurement contracts through specific rules;

[0030] Use regular expressions based on specific rules to match the supply name and scope of government procurement contracts;

[0031] The matched purchase type, purchaser, supplier, project name, supply location, supply name and scope data are stored in the equipment category information table in the database.

[0032] Furthermore, if the government procurement contract type obtained in step S101 is engineering, the specific process of step S102 is:

[0033] Parse the second page of the government procurement contract PDF document, parse the text elements therein, and store the parsed text elements in the list on the second page;

[0034] For the text elements in the list on the second page, use regular expressions according to specific rules to match the full name of the purchaser of the government procurement contract;

[0035] Use regular expressions to match the full names of suppliers in government procurement contracts through specific rules;

[0036] Use regular expressions to match the project names of government procurement contracts through specific rules;

[0037] Use regular expressions to match the project locations of government procurement contracts through specific rules;

[0038] Use regular expressions based on specific rules to match the engineering content of government procurement contracts;

[0039] The matched procurement type, purchaser, supplier, project name, project location, and project content data are stored in the engineering information table in the database.

[0040] Furthermore, if the service content and scope are not included in the service-related government procurement contract document in step S102, the detailed content exists in the quotation form, and step S103 needs to be initiated to extract the form data;

[0041] First, by improving the pdfplumber library, we added the find_table() method, which can accurately locate the page where the table is located;

[0042] Parse the table elements on the page where the located table is located and extract the data content in the table;

[0043] Store the above extracted table data content into the table list;

[0044] Remove the blanks from the data stored in the table list to obtain the correct list data;

[0045] Extract the correct list data items and service contents above;

[0046] The matched purchase type, purchaser, supplier and the extracted list data items and service contents are stored in the table information table of the database.

[0047] Furthermore, if the supply name and scope do not appear in the equipment-related government procurement contract document in step S102, the detailed content exists in the quotation form, and step S103 needs to be initiated to extract the form data;

[0048] First, by improving the pdfplumber library, we added the find_table() method, which can accurately locate the page where the table is located;

[0049] Parse the table elements on the page where the located table is located and extract the data content in the table;

[0050] Store the above extracted table data content into the table list;

[0051] Remove the blanks from the data stored in the table list to obtain the correct list data;

[0052] Extract the product name, brand, and model from the correct list data above;

[0053] The matched purchase type, purchaser, supplier, project name and the extracted list data commodity name, brand, and model are stored in the table information table of the database.

[0054] Furthermore, the method for extracting the table data in step S103 is:

[0055] Step S1031, accurately locate the page where the table is located by adding the find_table() method in pdfplumber;

[0056] Step S1032: parsing the file information, parsing the locked page, and saving the parsed line segments, wireframes, and other information;

[0057] Step S1033: Process the line segments, filter out abnormal line segments using the filter_edges() method, and then merge the line segments using the merge_edges() method.

[0058] Step S1034: Find the intersection point, determine the endpoint coordinates of each line segment using the edges_to_intersections() method, return the intersection point of the line, and save it in a dictionary data type;

[0059] Step S1035: Find a table. First, use the intersections_to_cells() method to sort the intersections from left to right and from top to bottom, and find the smallest cell with each intersection as the top left vertex to generate the cells contained in the current table. Then, use the cells_to_tables() method to sort and combine the connected cells to generate a table object.

[0060] Step S1036, extract the table text. The extract() method in the Table class can determine the text in the cell by the cell position and character position, and extract the text in the cell in the form of rows into a nested list according to the arrangement of the cells, and save the purchase item details in the table into the database.

[0061] Compared with the existing technology, the invention provides a method for quickly and batch extracting government procurement contract PDF documents. The advantages are:

[0062] First, this method improves the pdfplumber tool in the Python open source library and adds a find_table() method, which can accurately locate the page where the table is located, greatly improving extraction efficiency;

[0063] Second, this method parses government procurement contracts by page. Since the format of government procurement contract PDF files is fixed, only the text content of the first two pages needs to be extracted, and the entire document does not need to be extracted, which can greatly reduce the extraction time. The contract type is obtained from the first page, and the contract related information is obtained from the second page. Different rules are used for different types of contracts to match contract information using regular expressions, which has a high accuracy rate.

[0064] Third, for equipment contracts that do not include the supply name and scope in the procurement contract documents, and service contracts that do not include the service content and scope, we use table extraction to accurately locate the page where the table is located, and design a suitable method to parse it and match the required contract information.

[0065] The method for rapid and batch extraction of PDF content of government procurement contracts proposed in the patent of this invention improves the existing open source parsing tools, can parse out text content and table content at the same time, and cooperate with corresponding technical methods to realize information extraction of specific content. It has high operating efficiency, and can realize rapid, batch and accurate extraction of contract document content, and store the extracted structured data into the database. BRIEF DESCRIPTION OF THE DRAWINGS

[0066] Figure 1 This is a flow chart of the method for quickly and batch extracting government procurement contract PDF documents provided by the present invention.

[0067] Figure 2 It is a detailed flow chart of the method for batch extraction of government procurement contract PDF content provided by the present invention.

[0068] Figure 3 A schematic diagram of an extraction module of the method for batch extracting PDF content of government procurement contracts provided by the present invention.

[0069] Figure 4 The present invention provides a flowchart of a table extraction method in an improved PDFplumber library. DETAILED DESCRIPTION

[0070] The present invention will be further described below with reference to the accompanying drawings and specific embodiments. The technical solutions in the embodiments of the present invention are clearly and completely described. The embodiments described are only embodiments of a part of the present invention, not all of it. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0071] like Figure 1 、 2 As shown, the present invention patent designs an embodiment of a method for fast and batch extraction of government procurement contract PDF documents. The method disclosed in this embodiment improves the pdfplumber tool in the Python open source library to improve the extraction efficiency and incorporates regular expression matching to implement a fully automatic extraction and parsing model to solve the problem of large spaces and disordered extracted content, achieve precise matching, and quickly and accurately extract the specific content of government procurement contract PDF documents in batches. The specific steps are:

[0072] Step S101: Read the government procurement contract PDF document, parse the PDF document page number, parse the first page text elements, and obtain the contract procurement type. Since the government procurement contract PDF file format is fixed, only the text content of the first two pages needs to be extracted, and the entire document content does not need to be extracted, which can greatly reduce the extraction time. The specific steps include:

[0073] Step S1011, read the government procurement contract PDF document through the open() method to obtain the total number of pages of the PDF document; obtain the text elements of the first page content of the PDF document through the extract_text() method, and store the text content in the text first page list;

[0074] Step S1012: Since the text elements obtained by the extract_text() method may contain a large number of null values, it is necessary to remove the null values ​​from the text elements of the home page content. The replace() method is used to replace all spaces to achieve the purpose of removing null values, obtain the complete text content of the PDF document home page, and replace the text content in the home page list;

[0075] Step S1013, using the findall() method of regular expression matching on the home page list, accurately matching the procurement type of the government procurement contract and storing it in the database.

[0076] Through step S101, the government procurement contracts are matched into three types, namely equipment type, service type and engineering type.

[0077] Step S102: Parse the text elements of the second page of the contract PDF according to different contract procurement types, and use different regular expressions to match the specific content of the contract. For three different contract types, the specific steps are as follows:

[0078] (1) If the government procurement contract type obtained in step S101 is equipment, the specific process of step S102 is as follows:

[0079] Parse the second page of the government procurement contract PDF document, parse the text elements therein, and store the parsed text elements in the list on the second page;

[0080] For the text elements in the list on the second page, use regular expressions according to specific rules to match the full name of the purchaser of the government procurement contract;

[0081] Use regular expressions to match the full names of suppliers in government procurement contracts through specific rules;

[0082] Use regular expressions to match the project names of government procurement contracts through specific rules;

[0083] Use regular expressions to match the supply locations of government procurement contracts through specific rules;

[0084] Use regular expressions based on specific rules to match the supply name and scope of government procurement contracts;

[0085] The matched purchase type, purchaser, supplier, project name, supply location, supply name and scope data are stored in the equipment category information table in the database.

[0086] (2) If the government procurement contract type obtained in step S101 is a service contract, the specific process of step S102 is as follows:

[0087] Parse the second page of the government procurement contract PDF document, parse the text elements therein, and store the parsed text elements in the list on the second page;

[0088] For the text elements in the list on the second page, use regular expressions according to specific rules to match the full name of the purchaser of the government procurement contract;

[0089] Use regular expressions to match the full names of suppliers in government procurement contracts through specific rules;

[0090] Use regular expressions to match the project names of government procurement contracts through specific rules;

[0091] Use regular expressions to match the service locations of government procurement contracts through specific rules;

[0092] Use regular expressions to match the service content and scope of government procurement contracts through specific rules;

[0093] The matched procurement type, purchaser (full name), supplier (full name), project name, service location, service content and scope data are stored in the service information table in the database.

[0094] (3) If the government procurement contract type obtained in step S101 is engineering, the specific process of step S102 is as follows:

[0095] Parse the second page of the government procurement contract PDF document, parse the text elements therein, and store the parsed text elements in the list on the second page;

[0096] For the text elements in the list on the second page, use regular expressions according to specific rules to match the full name of the purchaser of the government procurement contract;

[0097] Use regular expressions to match the full names of suppliers in government procurement contracts through specific rules;

[0098] Use regular expressions to match the project names of government procurement contracts through specific rules;

[0099] Use regular expressions to match the project locations of government procurement contracts through specific rules;

[0100] Use regular expressions based on specific rules to match the engineering content of government procurement contracts;

[0101] The matched procurement type, purchaser, supplier, project name, project location, and project content data are stored in the engineering information table in the database.

[0102] Step S103: If the text elements extracted in step S102 do not contain the detailed contents of the contract, the table information of the contract PDF document is extracted, and the detailed contents of the contract document are extracted from the table information. This step is mainly applicable to equipment contracts and service contracts. The specific steps are as follows:

[0103] (1) If the supply name and scope do not appear in the equipment-related government procurement contract document in step S102, the detailed information exists in the quotation form, and step S103 needs to be initiated to extract the form data;

[0104] First, by improving the pdfplumber library, a new find_table() method is added, which can accurately locate the page where the table is located;

[0105] Parse the table elements on the page where the located table is located and extract the data content in the table;

[0106] Store the above extracted table data content into the table list;

[0107] Remove the blanks from the data stored in the table list to obtain the correct list data;

[0108] Extract the product name, brand, and model from the correct list data above;

[0109] The matched purchase type, purchaser, supplier, project name and the extracted list data commodity name, brand, and model are stored in the table information table of the database.

[0110] (2) If the service content and scope are not included in the service-related government procurement contract document in step S102, the detailed information is in the quotation form, and step S103 needs to be initiated to extract the form data;

[0111] First, by improving the pdfplumber library, a new find_table() method is added, which can accurately locate the page where the table is located;

[0112] Parse the table elements on the page where the located table is located and extract the data content in the table;

[0113] Store the above extracted table data content into the table list;

[0114] Remove the blanks from the data stored in the table list to obtain the correct list data;

[0115] Extract the correct list data items and service contents above;

[0116] The matched purchase type, purchaser, supplier and the extracted list data items and service contents are stored in the table information table of the database.

[0117] Here, this embodiment takes the equipment contract as an example to further explain step S102 and step S103 in detail, as follows:

[0118] The extract_text() method of pdfplumber is used to obtain the text elements on the second page of the government procurement contract PDF document, and the text elements are de-emptied and stored in the second page list.

[0119] Apply the findall() method of regular expression matching to the second page list to extract the purchaser (full name) of the government procurement contract and store it in the equipment information table in the database;

[0120] The regular expression for extracting device information can be expressed as follows:

[0121] Type=re.findall(r'[(].*?[)]',content)[0].replace("(","").replace(")","")

[0122] Purchaser=re.findall(r'.*Purchaser (full name): (.+)\n',content)[0].replace("\n","")

[0123] suppliers = re.findall(r'.*Supplier (full name): (.*)\n', content)[0].replace("\n","")

[0124] ProjectName=re.findall(r'.*Project Name:(.*).',content)[0].replace("\n","")

[0125] Place=re.findall(r'.*Delivery location:(.*).',content)[0].replace("\n","")

[0126] Content=re.findall(r'.*Supply content and scope:([\d\D]*?).',content)[0].replace("\n","")

[0127] The above code is the main code part of the regular expression, which extracts the detailed content in the contract information. The extraction module is as follows: Figure 3 As shown, the specific steps of information extraction are as follows:

[0128] Step 1: The receiving module accepts the second page text content extracted by the extract_text() method and passes the text content to the transfer module;

[0129] Step 2: The transfer module receives the data from the receiving module and temporarily stores it;

[0130] Step 3: The matching module receives the text information from the transfer module and uses the specified regular expression to match and extract the information, extracting the purchaser (full name), supplier (full name), project name, supply location, and supply name and scope;

[0131] Step 4: temporarily store the information extracted by the matching module;

[0132] Step 5: The storage module stores the formatted information temporarily stored by the acquisition module into the database.

[0133] If there is no supply name and scope in the equipment-related government procurement contract document, the detailed content exists in the quotation form, and step S103 needs to be started to extract the table data. The original pdfplumber open source library needs to parse the entire page for table extraction, parse the data of all pages, and then combine the table data. This method is time-consuming. The present invention improves the pdfplumber open source library, adds the find_table() method therein, and accurately locates the page where the table is located by retrieving the number of line segments on each page. It only needs to extract the page where the table is located, and there is no need to parse all interfaces, which greatly speeds up the parsing speed and improves the efficiency of extraction. The operation flow chart is as follows Figure 4 As shown, the specific steps are as follows;

[0134] (1) Accurately locate the page where the table is located by adding the find_table() method in pdfplumber;

[0135] (2) Parse the file information, parse the locked page, and save the parsed line segments, wireframes and other information;

[0136] (3) Processing line segments: filter out abnormal line segments through the filter_edges() method, and then merge the line segments through the merge_edges() method;

[0137] (4) Find the intersection point, use the edges_to_intersections() method to determine the coordinates of the endpoints of each line segment, return the intersection point between the lines, and save it in the dictionary data type.

[0138] (5) To find a table, first use the intersections_to_cells() method to sort the intersections from left to right and from top to bottom, and find the smallest cell with each intersection as the upper left vertex to generate the cells contained in the current table; then use the cells_to_tables() method to sort and combine the connected cells to generate a table object.

[0139] (6) Extract table text. The extract() method in the Table class can determine the text in the cell by the cell position and character position, and extract the text in the cell in the form of rows into a nested list according to the arrangement of the cells, and save the detailed information of the purchased items in the table into the database.

[0140] The data in the table list above contains a lot of spaces. First, remove the spaces to make the table header and the table content correspond, and then replace them in the table list;

[0141] Perform data extraction on the above table list to obtain the name, brand, and model of the goods, and store the extracted content in the equipment information table of the database to complete the extraction of the specific content of the contract PDF.

[0142] Step S104: The detailed contents of the extracted contract PDF document are stored in a database. Batch and accurate extraction is achieved through a combination of looping and regular expression matching.

[0143] By cyclically inputting government procurement contract PDF documents, batch extraction of contract PDF details can be achieved;

[0144] The input document is parsed by pdfplumber and regular expression matching method to accurately extract the detailed content of the contract PDF document;

[0145] Finally, through the complete steps, we can realize the batch and accurate extraction of detailed content of government procurement contract PDF documents, convert unstructured data into structured data, and store the extracted data in the database. The detailed flow chart of the three types of government procurement contract PDF extraction is as follows: Figure 2 shown.

[0146] The above contents are merely preferred embodiments of the present invention and are not intended to limit the scope of implementation of the present invention. That is, any simple equivalent changes and modifications made in accordance with the claims and description of the present invention are still within the scope of the present invention.

Claims

1. A method for fast and batch extraction of government procurement contract PDF documents, characterized by: The specific steps of the extraction method are: Step S101: read the government procurement contract PDF document, parse the PDF document page number, parse the first page text elements, and obtain the contract procurement type; Step S102: Parse the text elements of the second page of the contract PDF according to different contract procurement types, and use different regular expressions to match the specific content of the contract; Step S103: If the text element extracted in step S102 does not contain the detailed content of the contract, then the table information of the contract PDF document is extracted, and the detailed content of the contract document is extracted from the table information; Step S104, storing the extracted detailed contents of the contract PDF document into a database; In the extraction method, the PDF document is parsed using the Python toolkit pdfplumber to obtain all elements of the government procurement contract PDF document; The extraction method improves the pdfplumber of the Python toolkit and adds a find_table() method. After importing a PDF file, the method searches for the table and accurately locates the page where the table is located by retrieving the number of line segments on each page. The method for extracting the table data in step S103 is: Step S1031, accurately locate the page where the table is located by adding the find_table() method in pdfplumber; Step S1032: parsing the file information, parsing the locked page, and saving the parsed line segments, wireframes, and other information; Step S1033, processing the line segments, filtering out abnormal line segments through the filter_edges() method, and then merging the line segments through the merge_edges() method; Step S1034: Find the intersection point, determine the endpoint coordinates of each line segment through the edges_to_intersections() method, return the intersection point of the line and save it in the dictionary data type; Step S1035: Find the table. First, use the intersections_to_cells() method to sort the intersections from left to right and from top to bottom, and find the smallest cell with each intersection as the upper left vertex to generate the cells contained in the current table. Then, use the cells_to_tables() method to sort and combine the connected cells to generate a table object. Step S1036: Extract the table text. The extract() method in the Table class can determine the text in the cell by the cell position and character position, and extract the text in the cell in the form of rows into a nested list according to the arrangement of the cells, and save the purchase item details in the table to the database.

2. A method for fast and batch extraction of government procurement contract PDF documents according to claim 1, characterized in that: The step S101 is specifically as follows: Step S1011, using the open() method to read the government procurement contract PDF document and obtain the total number of pages of the PDF document; using the extract_text() method to obtain the text elements of the first page content of the PDF document, and storing the text content in a text first page list; Step S1012: Since the text elements obtained by the extract_text() method may contain a large number of null values, it is necessary to remove the null values ​​from the text elements of the home page content to obtain the complete text content of the PDF document home page, and replace the text content in the home page list; Step S1013, using the findall() method of regular expression matching on the homepage list, accurately matching the procurement type of the government procurement contract and storing it in the database.

3. A method for rapid and batch extraction of government procurement contract PDF documents according to claim 2, characterized in that: If the government procurement contract type obtained in step S101 is a service contract, the specific process of step S102 is as follows: Parse the second page of the government procurement contract PDF document, parse the text elements therein, and store the parsed text elements in the list on the second page; For the text elements in the list on the second page, use regular expressions according to specific rules to match the full name of the purchaser of the government procurement contract; Use regular expressions to match the full names of suppliers in government procurement contracts through specific rules; Use regular expressions to match the project names of government procurement contracts through specific rules; Use regular expressions to match the service locations of government procurement contracts through specific rules; Use regular expressions to match the service content and scope of government procurement contracts through specific rules; The matched procurement type, purchaser, supplier, project name, service location, service content and scope data are stored in the service category information table in the database.

4. A method for rapid and batch extraction of government procurement contract PDF documents according to claim 2, characterized in that: If the government procurement contract type obtained in step S101 is equipment, the specific process of step S102 is as follows: Parse the second page of the government procurement contract PDF document, parse the text elements therein, and store the parsed text elements in the list on the second page; For the text elements in the list on the second page, use regular expressions according to specific rules to match the full name of the purchaser of the government procurement contract; Use regular expressions to match the full names of suppliers in government procurement contracts through specific rules; Use regular expressions to match the project names of government procurement contracts through specific rules; Use regular expressions to match the supply locations of government procurement contracts through specific rules; Use regular expressions based on specific rules to match the supply name and scope of government procurement contracts; The matched purchase type, purchaser, supplier, project name, supply location, supply name and scope data are stored in the equipment category information table in the database.

5. A method for rapid and batch extraction of government procurement contract PDF documents according to claim 2, characterized in that: If the government procurement contract type obtained in step S101 is engineering, the specific process of step S102 is as follows: Parse the second page of the government procurement contract PDF document, parse the text elements therein, and store the parsed text elements in the list on the second page; For the text elements in the list on the second page, use regular expressions according to specific rules to match the full name of the purchaser of the government procurement contract; Use regular expressions to match the full names of suppliers in government procurement contracts through specific rules; Use regular expressions to match the project names of government procurement contracts through specific rules; Use regular expressions to match the project locations of government procurement contracts through specific rules; Use regular expressions to match the engineering content of government procurement contracts through specific rules; The matched procurement type, purchaser, supplier, project name, project location, and project content data are stored in the engineering information table in the database.

6. A method for rapid and batch extraction of government procurement contract PDF documents according to claim 3, characterized in that: If the service content and scope are not included in the service-related government procurement contract document in step S102, the detailed information is in the quotation form, and step S103 needs to be initiated to extract the form data; First, by improving the pdfplumber library, we added the find_table() method, which can accurately locate the page where the table is located; Parse the table elements on the page where the located table is located and extract the data content in the table; Store the above extracted table data content into the table list; Remove the blanks from the data stored in the table list to obtain the correct list data; Extract the correct list data items and service contents above; The matched purchase type, purchaser, supplier and the extracted list data items and service contents are stored in the table information table of the database.

7. A method for rapid and batch extraction of government procurement contract PDF documents according to claim 4, characterized in that: If the supply name and scope do not appear in the equipment government procurement contract document in step S102, the detailed content exists in the quotation form, and step S103 needs to be initiated to extract the form data; First, by improving the pdfplumber library, we added the find_table() method, which can accurately locate the page where the table is located; Parse the table elements on the page where the located table is located and extract the data content in the table; Store the above extracted table data content into the table list; Remove the blanks from the data stored in the table list to obtain the correct list data; Extract the product name, brand, and model from the correct list data above; The matched purchase type, purchaser, supplier, project name and the extracted list data commodity name, brand, and model are stored in the table information table of the database.

Citation Information

Patent Citations

  • Intelligent extraction system and method for financial document information

    CN110889310A

  • Method and device for positioning table in PDF document

    US20190294663A1