Intelligent parsing method and system for quotation based on large language model

Through the intelligent parsing method of quotations based on a large language model, the problems of time-consuming and poor parsing effect in standardizing quotation formats in the building materials industry have been solved, and efficient and accurate quotation parsing and result evaluation have been achieved.

CN118917298BActive Publication Date: 2025-09-05北京瑞达恒建筑咨询有限公司
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410918162.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-10
Publication Date
2025-09-05
Estimated Expiration
2044-07-10

AI Technical Summary

Technical Problem

In the building materials industry, existing technologies such as manual processing of the unified format of building materials product quotations are time-consuming and inaccurate. AI processing has problems with slow parsing speed, poor results, and generation model parameter settings, and it is difficult to evaluate the parsing results.

Method used

An intelligent parsing method for quotations based on a large language model is adopted, including format uniform preprocessing, effective information screening, constructing prompt word input text and parsing using a trained generative model, and correcting the parsing results in combination with evaluation indicators.

Benefits of technology

It achieves efficient and accurate parsing of quotations of various types and formats, with the parsing speed increased by 10 times and the accuracy of the parsing results improved. The parsing effect is evaluated through evaluation indicators.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118917298B_ABST
    Figure CN118917298B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for intelligent parsing of quotations based on a large language model, which relates to the field of artificial intelligence technology. The method comprises: performing format-standardized preprocessing on the quotations to be parsed to obtain the preprocessed quotations to be parsed; screening the preprocessed quotations for effective information based on a trained effective information screening model to obtain screened information; constructing an input parsing text containing prompt words based on the screened information; inputting the input parsing text containing the prompt words into the trained large language generation model to obtain a parsing result of the quotations to be parsed; and comparing and correcting the parsing results based on the screened information to obtain an evaluation index for the parsing results. The present invention alleviates the technical problems of slow parsing speed and poor parsing effect existing in the prior art.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of artificial intelligence technology, and in particular to a method and system for intelligently parsing quotations based on a large language model. Background Art

[0002] Currently, in the building materials industry, due to the diversity of product quotations and their formats, it is often necessary to unify these quotations to facilitate querying. Currently, there are two main approaches: manual processing and AI processing.

[0003] Manually formatting and extracting valid content is time-consuming and inaccurate. Common AI technologies (such as large language models (only generative models based on large language models can be used here due to the content conversion involved in the parsing results) often suffer from slow parsing and poor results due to irrelevant information contained in quotations. Furthermore, due to parameter settings issues within the generative models themselves, redundant product information may occasionally appear. Furthermore, due to the difficulty of evaluating generative models, the parsing results of large language generative models cannot be evaluated. Summary of the Invention

[0004] The purpose of the present invention is to provide a method and system for intelligent parsing of quotations based on a large language model in order to solve at least one of the above technical problems.

[0005] In a first aspect, an embodiment of the present invention provides a method for intelligent parsing of quotations based on a large language model, comprising: performing format-unified preprocessing on the quotation to be parsed to obtain the preprocessed quotation to be parsed; based on a trained effective information screening model, performing effective information screening on the preprocessed quotation to be parsed to obtain screened information; based on the screened information, constructing an input parsing text containing prompt words; inputting the input parsing text containing the prompt words into the trained large language generation model to obtain a parsing result of the quotation to be parsed; comparing and correcting the parsing result based on the screened information to obtain an evaluation index for the parsing result.

[0006] Furthermore, the quotation to be parsed is pre-processed in a unified format, including: determining the file type of the quotation to be parsed based on the file name suffix of the quotation to be parsed; the file type includes any one of the following: Excel table, Word document, image file; if the file type is a Word document, obtaining the table information in the document; if the file type is an image file, obtaining the table information in the file based on an optical character recognition method; and storing the table information in the file type of an Excel table.

[0007] Furthermore, it also includes: training a first preset large language model based on a manually annotated training data set to obtain an effective information screening model after the training; wherein the loss function of the training process includes an adaptive weighted loss function.

[0008] Furthermore, it also includes: training a second preset large language model based on a manually annotated training data set to obtain the trained large language generation model; wherein the manually annotated training data set includes parsed text data, valid data annotation information and parsing results.

[0009] Furthermore, based on the filtered information, an input parsed text containing prompt words is constructed, including: obtaining the number of product information of the filtered information; constructing prompt words based on the number of product information; and constructing the input parsed text containing prompt words based on the prompt words and the filtered information.

[0010] Furthermore, the evaluation index includes a product quantity consistency index and a product information content consistency index.

[0011] Furthermore, the analysis results are compared and corrected based on the information after screening to obtain evaluation indicators of the analysis results, including: segmenting the analysis results to determine the quantity of product information and product content information in the analysis results respectively; the product content information includes product name and market price; obtaining the quantity of product information and product content information in the information after screening; determining the product quantity consistency indicator based on the product quantity information in the analysis results and the product information quantity in the information after screening; determining the product content consistency indicator based on the product content information in the analysis results and the product content information in the information after screening.

[0012] In a second aspect, an embodiment of the present invention further provides an intelligent parsing system for quotations based on a large language model, comprising: a preprocessing module, a screening module, a construction module, a parsing module and an evaluation module; wherein the preprocessing module is used to perform format uniform preprocessing on the quotations to be parsed to obtain the preprocessed quotations to be parsed; the screening module is used to screen the effective information of the preprocessed quotations to be parsed based on the trained effective information screening model to obtain the screened information; the construction module is used to construct an input parsed text containing prompt words based on the screened information; the parsing module is used to input the input parsed text containing prompt words into the trained large language generation model to obtain the parsing result of the quotation to be parsed; the evaluation module is used to compare and correct the parsing result based on the screened information to obtain the evaluation index of the parsing result.

[0013] Furthermore, it also includes a training module, wherein the training module is used to train the first preset large language model and the second preset large language model respectively based on the manually annotated training data set to obtain the effective information screening model after the training and the large language generation model after the training.

[0014] In a third aspect, an embodiment of the present invention further provides an electronic device comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect above when executing the computer program.

[0015] The present invention provides a method and system for intelligent parsing of quotations based on a large language model. The method and system effectively screen out irrelevant information in quotations through an early data screening model, providing valid parsing data for subsequent large language model parsing. The method also relies on the number of valid pieces of information in the data screening model to perform prompt engineering on the large language model to avoid the generation of invalid information. The method also performs indicator evaluation based on the results of large language generation and the results of the screening model, alleviating the technical problems of slow parsing speed and poor parsing effect in the prior art. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the implementation methods of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the specific implementation methods or the description of the prior art. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0017] Figure 1 A flowchart of a method for intelligent parsing of quotations based on a large language model provided by an embodiment of the present invention;

[0018] Figure 2 A flowchart of another method for intelligent parsing of quotations based on a large language model provided by an embodiment of the present invention;

[0019] Figure 3 A schematic diagram of a quotation to be parsed provided in an embodiment of the present invention;

[0020] Figure 4 A schematic diagram of an intelligent quotation parsing system based on a large language model provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0021] The following will provide a clear and complete description of the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. All other embodiments obtained by ordinary technicians in this field based on the embodiments of the present invention without making any creative efforts shall fall within the scope of protection of the present invention.

[0022] Example 1

[0023] Figure 1 This is a flow chart of a method for intelligent parsing of quotations based on a large language model according to an embodiment of the present invention. Figure 1 As shown, the method specifically includes the following steps:

[0024] Step S102 , performing format uniform preprocessing on the quotation to be parsed to obtain the preprocessed quotation to be parsed.

[0025] Step S104 , based on the trained effective information screening model, the pre-processed quotation to be parsed is screened for effective information to obtain the screened information.

[0026] Step S106: constructing an input parsed text containing the prompt word based on the filtered information.

[0027] In step S108 , the input parsed text containing the prompt word is input into the trained large language generation model to obtain the parsed result of the quotation to be parsed.

[0028] Step S110 , comparing and correcting the analysis results based on the filtered information to obtain evaluation indicators of the analysis results.

[0029] Figure 2 FIG. 1 is a flow chart of another method for intelligent parsing of quotations based on a large language model according to an embodiment of the present invention. Figure 2 As shown, specifically, step S102 further includes the following steps:

[0030] Step S1021: Determine the file type of the quotation to be parsed based on the file name suffix of the quotation to be parsed; the file type includes any of the following: Excel spreadsheet, Word document, image file;

[0031] Step S1022: If the file type is a word document, obtain the table information in the document;

[0032] Step S1023: If the file type is an image file, obtain the table information in the file based on an optical character recognition method;

[0033] Step S1024: Store the table information in the file type of an Excel table.

[0034] Specifically, the embodiment of the present invention performs a unified conversion on various quotation file types and converts them into Excel files (useful product information in the quotation is in the form of a table). There are three types of files currently processed, namely Excel files, whose file suffixes are: xlsx, xls, csv; docx files, whose file suffixes are docx; and image files, whose suffixes are jpg, png. By distinguishing the file types based on the suffixes of the file names, Excel files do not need to be processed. For docx files, the existing python-docx third-party dependency is used to obtain the table information therein and save it as an Excel file. For image files, the existing optical character recognition (OCR) technology is used to extract the table information therein and save it as an Excel file.

[0035] Specifically, such as Figure 2 As shown, it also includes: training a first preset large language model based on a manually annotated training data set to obtain an effective information screening model after training; wherein the loss function of the training process includes an adaptive weighted loss function.

[0036] In the embodiment of the present invention, the training data of the effective information screening model are all obtained through manual annotation, which mainly includes parsed text data and effective data annotation information.

[0037] Figure 3 Schematic diagram of a quotation to be parsed according to an embodiment of the present invention. Figure 3 Taking the file shown as an example, the parsed text data is the Appendix 1 Excel file, and its valid data annotation information is: {"Appendix 1":"Invalid information, invalid information, index row, product invalid information, product invalid information, valid information, invalid information"}, indicating that the contents of rows 1, 2, and 7 of the Appendix 1 Excel quotation are invalid information, the 3rd row is the index row of valid information, the 4th and 5th rows are invalid product information (although it is product information, it lacks price), and the 6th row is valid product information.

[0038] The training data format of the effective information screening model is:

[0039] [{"content":"row content (different columns in the same row are separated by separators) string concatenation)","label":"**"}]

[0040] by Figure 3 The training data constructed by the file shown is:

[0041] [{“content”:”Purchase Order”, “label”:”Invalid Information”},...

[0042] {"content":"Serial number name Model / Specifications / Parameters Preliminary quantity unit price Notes","label":"Index Row"},...]

[0043] The training dataset, consisting of all Excel files, has an uneven data distribution. An adaptive weighted loss function is used here. The loss weight for each category is obtained by taking the number of categories in the training data.

[0044] Count={c1,c2,...,c n} represents the number of times n categories appear in the training data, and c1 represents the number of times category 1 appears in the training data. The corresponding loss weight W for each category is:

[0045] Where N is the total number of training data.

[0046] During model training, the model's loss function in represents the probability that training data j belongs to class i, Indicates that sample j belongs to category i, Indicates that sample j does not belong to category i. The loss of the category is then multiplied by the weight of the corresponding category, and then superimposed twice to obtain the weighted loss of all samples in each category, which is used as the model loss for this training to guide model optimization.

[0047] The input parsing text of the effective information screening model is a string composed of the information of each row in the Excel file, such as the content in the above content.

[0048] The output result of the valid information screening model is a row category (one of the four: invalid information, index row, invalid product information, and valid information).

[0049] The training data of the effective information screening model consists of the row contents of all Excel files and their corresponding label categories.

[0050] When applied, the input parsing text of the effective information screening model is the content of each row of the Excel file, and the output result is the row category.

[0051] Specifically, such as Figure 2 As shown, the method also includes: training a second preset large language model based on a manually annotated training data set to obtain a trained large language generation model; wherein the manually annotated training data set includes parsed text data, valid data annotation information and parsing results.

[0052] Specifically, step S106 further includes the following steps:

[0053] Step S1061, obtaining the number of product information after filtering;

[0054] Step S1062, constructing prompt words based on the quantity of product information;

[0055] Step S1063: construct an input parsed text containing the prompt word based on the prompt word and the filtered information.

[0056] In the embodiment of the present invention, the training data of the Excel parsing model (i.e., the large language generation model) is obtained by manual annotation, which mainly includes parsed text data, valid data annotation information, and parsing results.

[0057] Excel parsing model input content:

[0058] By parsing text data (such as Figure 3 The Excel file shown in Appendix 1) and valid data annotation information can be used to obtain the valid information string of the Excel quotation (only the Excel rows labeled as index rows and valid information are retained and the rows are concatenated). To improve the reliability of the large language generation model and avoid generating additional product information, the number of valid product information is obtained based on the valid annotation information and added to the prompt.

[0059] Prompt="Analyze the subsequent Excel string information to obtain the product information. The string contains ** (the specific number of valid information is obtained from the statistics of valid data annotation information) product information. Do not generate redundant product information. The Excel string to be parsed is as follows:\n"

[0060] The final input parsing statement format of the large language model is: Prompt+Excel valid information string.

[0061] Excel parsing model output results:

[0062] The valid information in the parsing result (Appendix 4) (except the blue index row) is spliced ​​in the above way (with columns separated by separators). Concatenate strings, with delimiters between lines Perform row string concatenation), empty cell information is marked with the character "-1" (some fields in some parsed files have values, while some are empty. For the unified type, all fields are set to have values, and -1 represents a meaningless placeholder value).

[0063] The training data of the Excel parsing model consists of the valid information string of Excel and the valid information string of the corresponding parsing file content.

[0064] When applied, after the Excel file passes through the valid information model, the Excel row strings labeled as index rows and valid information are retained and spliced ​​into a parsing string; and the Prompt is supplemented and improved according to the number of valid information categories; then the Prompt+parsing string is used as the input of the Excel parsing model, and the output result is a string based on the corresponding formatted parsing result.

[0065] Preferably, the evaluation index includes a product quantity consistency index and a product information content consistency index.

[0066] Specifically, step S110 further includes the following steps:

[0067] Step S1101 : segment the parsing result to determine the number of product information and product content information in the parsing result; the product content information includes the product name and market price.

[0068] Step S1102: Acquire the quantity of product information and product content information in the filtered information.

[0069] Step S1103: determining a product quantity consistency index based on the product quantity information in the parsing result and the product information quantity in the filtered information.

[0070] Step S1104: determining a product content consistency index based on the product content information in the parsing result and the product content information in the filtered information.

[0071] Specifically, the Excel parsing model parses a quote string containing only valid information and obtains the corresponding quote parsing result. However, there is no evaluation or verification of the parsing results at this time.

[0072] The result string is By segmenting, the number of product information in the parsing results can be determined. This number should be consistent with the number of valid information categories in the valid information screening model, so as to obtain the product quantity consistency index (consistent or inconsistent);

[0073] by After splitting, each parsed product information is an independent string, and then After string segmentation, the specific product name, market price, etc. of each product can be obtained according to the order. Since all this information comes from the parsed text, it is necessary to determine whether the product name and market price belong to the string composed of the original Excel file.

[0074] This provides two indicators: whether the product quantity is consistent, and whether the product name and market price of each row of product information in the analysis results are consistent. This provides a preliminary assessment of the analysis results and reduces the inspection work.

[0075] As can be seen from the above description, an embodiment of the present invention provides an intelligent parsing method for quotations based on a large language model. This method can efficiently and accurately parse quotation files of various types and formats. Compared to existing AI processing methods, the method provided by an embodiment of the present invention reduces the length of the parsed text of the large language model through an Excel effective information classification model with millisecond response, and the parsing speed is about 10 times the original parsing speed. Through prompt construction, the number of product information items in the model parsing results and the actual number of product information items in the parsed text are significantly improved, effectively improving the accuracy of the parsing results.

[0076] Example 2

[0077] Figure 4 Schematic diagram of a quotation intelligent parsing system based on a large language model according to an embodiment of the present invention. Figure 4 As shown, the system includes: a preprocessing module 10, a screening module 20, a construction module 30, a parsing module 40 and an evaluation module 50.

[0078] Specifically, the preprocessing module 10 is used to perform format unification preprocessing on the quotation to be parsed to obtain the preprocessed quotation to be parsed.

[0079] The screening module 20 is used to screen the valid information of the pre-processed quotation to be parsed based on the trained valid information screening model to obtain the screened information.

[0080] The construction module 30 is used to construct an input parsed text containing prompt words based on the filtered information.

[0081] The parsing module 40 is used to input the input parsing text containing the prompt word into the trained large language generation model to obtain the parsing result of the quotation to be parsed.

[0082] The evaluation module 50 is used to compare and correct the analysis results based on the filtered information to obtain evaluation indicators of the analysis results.

[0083] Specifically, the preprocessing module 10 is further used to:

[0084] Determine the file type of the quotation to be parsed based on the file name suffix of the quotation to be parsed; the file type includes any of the following: Excel spreadsheet, Word document, image file;

[0085] If the file type is a word document, get the table information in the document;

[0086] If the file type is an image file, the table information in the file is obtained based on the optical character recognition method;

[0087] Store the table information in the file type of Excel table.

[0088] Specifically, such as Figure 4 As shown, the system further includes a training module 60 for:

[0089] Based on the manually annotated training data set, the first preset large language model and the second preset large language model are trained respectively to obtain a trained effective information screening model and a trained large language generation model.

[0090] The specific building block 30 is further used for:

[0091] Get the number of product information after filtering;

[0092] Construct prompt words based on the amount of product information;

[0093] Based on the prompt word and the filtered information, construct the input parsed text containing the prompt word.

[0094] Preferably, the evaluation index includes a product quantity consistency index and a product information content consistency index.

[0095] Specifically, the evaluation module 50 is further configured to:

[0096] Segment the parsing results to determine the number of product information and product content information in the parsing results; the product content information includes the product name and market price;

[0097] Obtain the number of product information and product content information in the filtered information;

[0098] Determine the product quantity consistency index based on the product quantity information in the parsing results and the product information quantity in the filtered information;

[0099] A product content consistency index is determined based on the product content information in the parsed results and the product content information in the filtered information.

[0100] An embodiment of the present invention further provides an electronic device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method in the first embodiment described above when executing the computer program.

[0101] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above and that the invention can be embodied in other specific forms without departing from the spirit or essential characteristics of the invention. Therefore, the embodiments should be considered in all respects as illustrative and non-restrictive, and the scope of the invention is defined by the appended claims, not the foregoing description, and all variations within the meaning and range of equivalents of the claims are intended to be included therein. Any reference sign in a claim should not be construed as limiting the claim to which it relates.

[0102] In addition, it should be understood that although this specification is described in terms of implementation methods, not every implementation method contains only one independent technical solution. This narrative method of the specification is only for the sake of clarity. Those skilled in the art should regard the specification as a whole. The technical solutions in each embodiment can also be appropriately combined to form other implementation methods that can be understood by those skilled in the art.

Claims

1. A method for intelligent parsing of quotations based on a large language model, characterized in that: include: Perform format-unified preprocessing on the quotations to be parsed to obtain the preprocessed quotations to be parsed; Based on the trained effective information screening model, the effective information of the pre-processed quotation to be parsed is screened to obtain the screened information; Based on the filtered information, construct an input parsed text containing the prompt word; Inputting the input parsed text containing the prompt word into the trained large language generation model to obtain the parsed result of the quotation to be parsed; The analysis results are compared and corrected based on the filtered information to obtain evaluation indicators of the analysis results.

2. The method according to claim 1, wherein: Perform unified format preprocessing on the quotations to be parsed, including: Determine the file type of the quotation to be parsed based on the file name suffix of the quotation to be parsed; the file type includes any one of the following: Excel spreadsheet, Word document, image file; If the file type is a word document, then obtain the table information in the document; If the file type is an image file, obtaining table information in the file based on an optical character recognition method; The table information is stored in an Excel file format.

3. The method according to claim 1, wherein: Also includes: Based on a manually annotated training data set, a first preset large language model is trained to obtain an effective information screening model after the training; wherein the loss function of the training process includes an adaptive weighted loss function.

4. The method according to claim 1, wherein: Also includes: Based on a manually annotated training data set, a second preset large language model is trained to obtain the trained large language generation model; wherein the manually annotated training data set includes parsed text data, valid data annotation information and parsing results.

5. The method according to claim 1, wherein: Based on the filtered information, construct an input parsed text containing prompt words, including: Obtain the number of product information after filtering the information; Constructing a prompt word based on the quantity of product information; Based on the prompt word and the filtered information, the input parsed text containing the prompt word is constructed.

6. The method according to claim 1, wherein: The evaluation indicators include product quantity consistency indicators and product content consistency indicators.

7. The method according to claim 6, characterized in that: The analysis results are compared and corrected based on the filtered information to obtain evaluation indicators of the analysis results, including: Segmenting the parsing results to determine the number of product information and product content information in the parsing results; the product content information includes product name and market price; Obtaining the quantity and content of product information in the filtered information; Determining the product quantity consistency index based on the product quantity information in the parsing result and the product information quantity in the filtered information; The product content consistency index is determined based on the product content information in the parsing result and the product content information in the filtered information.

8. An intelligent quotation parsing system based on a large language model, characterized in that: include: Preprocessing module, screening module, construction module, parsing module and evaluation module; among them, The preprocessing module is used to preprocess the quotation to be parsed in a unified format to obtain the preprocessed quotation to be parsed; The screening module is used to screen the valid information of the pre-processed quotation to be parsed based on the trained valid information screening model to obtain the screened information; The construction module is used to construct an input parsed text containing prompt words based on the filtered information; The parsing module is configured to input the input parsing text containing the prompt word into the trained large language generation model to obtain a parsing result of the quotation to be parsed; The evaluation module is used to compare and correct the analysis results based on the filtered information to obtain evaluation indicators of the analysis results.

9. The system according to claim 8, characterized in that: Also included is a training module, where The training module is used to train the first preset large language model and the second preset large language model based on the manually annotated training data set, respectively, to obtain the trained effective information screening model and the trained large language generation model.

10. An electronic device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method according to any one of claims 1 to 7 when executing the computer program.

Citation Information

Patent Citations

  • Intelligent dialogue method and device, computer equipment and storage medium

    CN117591649A

  • Instruction analysis method, device and equipment based on large language model

    CN117910454A