Contract information extraction method and device, equipment and medium
By acquiring and judging the contract terms text, and using a combination of large models and prompt word templates, the problem of low efficiency and poor accuracy in new home contract information recognition has been solved, achieving fast and accurate contract information extraction and recognition.
Patent Information
- Application Number
- CN202510677452.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-23
- Publication Date
- 2025-10-28
AI Technical Summary
In the real estate business, existing technologies are inefficient at identifying key information in new home contracts, and manual identification is inaccurate, leading to increased transaction time and errors in transaction information.
By obtaining the text of the unprocessed clauses in the contract text to be processed, determining whether it is the target clause text, obtaining the corresponding prompt word template and setting the prompt identifier, and using the large model to extract information based on the target prompt word template, the target format text information is obtained to determine the contract information.
It enables the rapid and accurate extraction of key information from contract texts, improving the efficiency of contract information recognition and reducing the risk of business errors.
Smart Images

Figure CN120849530A_ABST
Abstract
Description
Technical Field
[0001] This disclosure relates to the field of data processing technology, and in particular to a method, apparatus, device and medium for extracting contract information. Background Technology
[0002] Currently, in real estate transactions, such as new home sales, it is necessary to sign a new home contract with the developer. The new home contract will stipulate key information such as customer ownership, settlement time, commission terms, and commission calculation. The new home contract also needs to be uploaded to the service system to assist in the real estate transaction.
[0003] In related technologies, the process involves manually uploading contract text files and manually identifying key information in the contract to manually enter it into the service system. This results in problems such as low processing efficiency, inaccurate identification of contract terms, increased real estate transaction time, and errors in transaction information. Summary of the Invention
[0004] In order to solve the above-mentioned technical problems, or at least partially solve the above-mentioned technical problems, this disclosure provides a method, apparatus, equipment and medium for extracting contract information.
[0005] This disclosure provides a method for extracting contract information, the method comprising:
[0006] Retrieve the text of pending clauses from the pending contract text;
[0007] Determine whether the text of the clause to be processed is the target clause text;
[0008] In response to the fact that the text to be processed is the target text, the prompt word template corresponding to the text to be processed is obtained, and a corresponding prompt identifier is set for the prompt word template corresponding to the text to be processed, so as to obtain the target prompt word template;
[0009] The text of the clause to be processed is extracted by a pre-set large model based on the target prompt word template to obtain target format text information, and the contract information corresponding to the contract text to be processed is determined based on the target format text information.
[0010] This disclosure also provides a contract information extraction device, the device comprising:
[0011] The first acquisition module is used to acquire the text of the clauses to be processed in the contract text to be processed.
[0012] The judgment module is used to determine whether the text to be processed is the target text.
[0013] The first response acquisition module is used to acquire the prompt word template corresponding to the text to be processed in response to the text to be processed being the target text.
[0014] The setting module is used to set the corresponding prompt identifier for the prompt word template corresponding to the text to be processed, so as to obtain the target prompt word template;
[0015] The processing module is used to extract information from the text of the clause to be processed based on the target prompt word template using a preset large model to obtain target format text information, and to determine the contract information corresponding to the contract text to be processed based on the target format text information.
[0016] This disclosure also provides an electronic device, the electronic device comprising: a processor; a memory for storing executable instructions of the processor; the processor being configured to read the executable instructions from the memory and execute the instructions to implement the contract information extraction method provided in this disclosure.
[0017] This disclosure also provides a computer-readable storage medium storing a computer program for executing the contract information extraction method provided in this disclosure.
[0018] This disclosure also provides a computer program product, including a computer program, wherein the computer program is executed by a processor using the contract information extraction method provided in this disclosure.
[0019] Compared with the prior art, the technical solution provided in this disclosure has the following advantages: The contract information extraction scheme provided in this disclosure obtains the text of the clauses to be processed in the contract text to be processed; determines whether the text of the clauses to be processed is the target clause text; in response to the text of the clauses to be processed being the target clause text, obtains the prompt word template corresponding to the text of the clauses to be processed, and sets a corresponding prompt identifier for the prompt word template corresponding to the text of the clauses to be processed, thereby obtaining the target prompt word template; and extracts information from the text of the clauses to be processed based on the target prompt word template using a preset large model, thereby obtaining target format text information, and determining the contract information corresponding to the contract text to be processed based on the target format text information. Therefore, the large model can quickly and accurately extract the key information of each clause text, thereby obtaining the accurate information of the entire contract text, and adding prompt identifiers for specific clauses to improve recognition accuracy, further improving the efficiency and effectiveness of contract information recognition, thereby improving the efficiency of contract-related business processing and reducing the risk of business errors. Attached Figure Description
[0020] The above and other features, advantages, and aspects of the embodiments of this disclosure will become more apparent from the accompanying drawings and the following detailed description. Throughout the drawings, the same or similar reference numerals denote the same or similar elements. It should be understood that the drawings are schematic, and the originals and elements are not necessarily drawn to scale.
[0021] Figure 1 A flowchart illustrating a contract information extraction method provided in this embodiment of the disclosure;
[0022] Figure 2 A flowchart illustrating another contract information extraction method provided in this embodiment of the disclosure;
[0023] Figure 3 This is a schematic diagram illustrating a prompt word template processing method provided in an embodiment of this disclosure;
[0024] Figure 4 A schematic diagram illustrating a large model adjustment provided in an embodiment of this disclosure;
[0025] Figure 5 This is a schematic diagram of the structure of a contract information extraction device provided in an embodiment of the present disclosure;
[0026] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. Detailed Implementation
[0027] Embodiments of this disclosure will now be described in more detail with reference to the accompanying drawings. While some embodiments of this disclosure are shown in the drawings, it should be understood that this disclosure can be implemented in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided to provide a more thorough and complete understanding of this disclosure. It should be understood that the accompanying drawings and embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of protection of this disclosure.
[0028] It should be understood that the steps described in the method embodiments of this disclosure may be performed in different orders and / or in parallel. Furthermore, the method embodiments may include additional steps and / or omit the steps shown. The scope of this disclosure is not limited in this respect.
[0029] The term "comprising" and its variations as used herein are open-ended inclusions, meaning "including but not limited to". The term "based on" means "at least partially based on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Definitions of other terms will be given in the description below.
[0030] It should be noted that the concepts of "first" and "second" mentioned in this disclosure are used only to distinguish different devices, modules or units, and are not used to limit the order of functions performed by these devices, modules or units or their interdependencies.
[0031] It should be noted that the terms "a" and "a plurality of" used in this disclosure are illustrative rather than restrictive, and those skilled in the art should understand that, unless otherwise expressly indicated in the context, they should be understood as "one or more".
[0032] The names of messages or information exchanged between multiple devices in the embodiments of this disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
[0033] In practical applications, such as real estate business scenarios, like new home sales, it is necessary to sign a new home contract with the developer and upload it to the service system to assist in the real estate transaction. The new home contract will stipulate key information such as settlement time and commission terms. Uploading the contract manually requires manually identifying key information and manually entering it into the system, which is inefficient and may result in the inability to accurately and completely identify various clauses in the contract. This leads to increased costs such as real estate transaction time and also technical problems such as errors in transaction information.
[0034] To address the technical problems of slow manual contract parsing and the susceptibility of human error in clause identification, this disclosure proposes a contract information extraction method. The method involves: acquiring the text of clauses to be processed from the contract text; determining whether the text of clauses to be processed is the target text; in response to the text of clauses to be processed being the target text, acquiring the corresponding prompt word template for the text of clauses to be processed, and setting a corresponding prompt identifier for the prompt word template to obtain the target prompt word template; and using a pre-set large model to extract information from the text of clauses to be processed based on the target prompt word template to obtain target format text information, which is then used to determine the contract information corresponding to the contract text to be processed. Therefore, the large model can quickly and accurately extract key information from each clause text, thereby obtaining accurate information from the entire contract text. Furthermore, adding prompt identifiers for specific clauses improves recognition accuracy, further enhancing the efficiency and effectiveness of contract information recognition, thereby improving the efficiency of contract-related business processing and reducing the risk of business errors.
[0035] Figure 1 This is a flowchart illustrating a contract information extraction method provided in an embodiment of this disclosure. The method can be executed by a contract information extraction device, which can be implemented using software and / or hardware, and is generally integrated into an electronic device. Figure 1 As shown, the method includes:
[0036] Step 101: Obtain the text of the clauses to be processed from the contract text to be processed.
[0037] The contract text to be processed can be any contract text. In this embodiment of the disclosure, the contract text to be processed can be any contract text involved in the real estate business. For example, the contract text to be processed can be a new house contract in the new house business, or a house rental contract in the rental business.
[0038] Among them, the pending clause text can be any clause text in the pending contract text. It is understood that the pending contract text includes at least one clause text. Different pending contract texts usually contain different clause texts. For example, in a new house contract, one or more texts corresponding to the settlement conditions clause, one or more texts corresponding to the customer confirmation rules, one or more texts corresponding to the commission rules, etc. can all be used as clause texts. Similarly, in a house rental contract, one or more texts corresponding to the rental period, one or more texts corresponding to the rental purpose, and one or more texts corresponding to the settlement method, etc., can all be used as clause texts.
[0039] In this embodiment of the disclosure, there are many ways to obtain the text of the clauses to be processed in the contract text to be processed. As one example, an image or file of the contract to be processed is obtained, and text recognition is performed on the image or file to obtain the text of the contract to be processed. Then, the text of the contract to be processed is segmented according to the text of each clause to obtain at least one text of the clauses to be processed. As another example, the text of the contract to be processed is directly obtained, and the text of the contract to be processed is segmented according to the text of each clause to obtain at least one text of the clauses to be processed. The above two methods are only examples, and this embodiment of the disclosure does not impose specific limitations on the methods of obtaining the text of the clauses to be processed in the contract text to be processed.
[0040] Specifically, during the contract information extraction process, one or more clause texts from the contract text to be processed are obtained as the clause texts to be processed.
[0041] Step 102: Determine whether the text of the clause to be processed is the target text of the clause.
[0042] The target clause text refers to the test clause text whose information extraction rate is less than or equal to a preset test extraction rate threshold. The information extraction rate refers to the accuracy rate of information extraction from the test clause text. The test extraction rate threshold is selected and set according to the actual application scenario. Specifically, the contract text test sample and the extracted text information corresponding to each test clause text in the contract text test sample are obtained. Based on the extracted text information and the pre-annotated labeled text information, the string similarity is calculated to obtain the information extraction rate corresponding to each test clause text. The test clause texts with information extraction rates less than or equal to the preset test extraction rate threshold are used as the target clause texts.
[0043] In this embodiment of the disclosure, there are many ways to determine whether the text to be processed is the target text. As one example, a clause identifier is used to identify a unique text. The clause identifier of the text to be processed is compared with the clause identifier of the target text to determine whether the text to be processed is the target text. As another example, the text similarity between the text to be processed and the target text is calculated directly, and the text to be processed is determined as the target text based on the calculation result.
[0044] In this embodiment of the disclosure, after obtaining the text of the clause to be processed in the contract text to be processed, it can be determined whether the text of the clause to be processed is the target clause text.
[0045] Step 103: In response to the fact that the text to be processed is the target text, obtain the prompt word template corresponding to the text to be processed, and set the corresponding prompt icon for the prompt word template corresponding to the text to be processed to obtain the target prompt word template.
[0046] In this embodiment of the disclosure, the term "to be processed" and "target term text" indicate that the term to be processed is a term text with a relatively low accuracy rate in information extraction based on test samples. Therefore, it is necessary to adjust the prompt word template corresponding to the term text to be processed in order to improve the accuracy of subsequent information extraction.
[0047] In this embodiment of the disclosure, the prompt word template corresponding to the text to be processed refers to one or more prompt words used to guide the large model to perform the recognition of the text to be processed. As an example, a prompt word template example can be set in advance, and the prompt word template example can be adjusted according to the text to be processed to obtain the prompt word template corresponding to the text to be processed. As another example, the prompt word template corresponding to the text to be processed can be generated directly.
[0048] In this embodiment of the disclosure, when the text to be processed is the target text, it is necessary to set a corresponding prompt identifier for the prompt word template corresponding to the text to be processed. That is, it is necessary to update the prompt word template corresponding to the text to be processed to obtain the target prompt word template. As one example, based on the prompt word template, the prompt words corresponding to the text to be processed are obtained, and the prompt words corresponding to the text to be processed are split to obtain the key items and the corresponding sub-items of the key items; the corresponding prompt identifiers are set for the key items and / or the corresponding sub-items of the key items to obtain the target prompt word template. As another example, based on the prompt word template, the prompt words corresponding to the text to be processed are obtained, and the corresponding prompt identifiers are set for the prompt words to obtain the target prompt word template.
[0049] It should be noted that when the text to be processed is not the target text, the target format text information can be obtained directly by extracting information from the text to be processed based on the prompt word template through the preset large model.
[0050] Specifically, when it is determined that the text to be processed is the target text, the prompt word template corresponding to the text to be processed is obtained, and the corresponding prompt identifier is set on the prompt word template corresponding to the text to be processed to obtain the target prompt word template.
[0051] Step 104: Extract information from the text of the clause to be processed based on the target prompt word template using the preset large model to obtain the target format text information, and determine the contract information corresponding to the contract text to be processed based on the target format text information.
[0052] Among them, pre-setting large models refers to large-parameter models trained using large-scale data and powerful computing capabilities, such as large language models (LLM).
[0053] In this embodiment of the disclosure, the text of the clause to be processed is input into a large model, and the large model is guided by the target prompt word template to extract information from the text of the clause to be processed, thereby obtaining target format text information such as structured text information. In this way, the target format text information corresponding to all the text of the clause to be processed in the contract text can be combined to obtain the contract information corresponding to the contract text to be processed.
[0054] Specifically, the target prompt word template is obtained, and the large model extracts information from the text of the clause to be processed based on the specific prompt words in the prompt word template to obtain the target format text information. Based on all the target format text information, the contract information corresponding to the contract text to be processed is determined.
[0055] The contract information extraction scheme provided in this disclosure involves: acquiring the text of clauses to be processed from the contract text to be processed; determining whether the text of clauses to be processed is the target text of clauses; in response to the text of clauses to be processed being the target text of clauses, acquiring the prompt word template corresponding to the text of clauses to be processed, and setting a corresponding prompt identifier for the prompt word template corresponding to the text of clauses to be processed to obtain the target prompt word template; and extracting information from the text of clauses to be processed based on the target prompt word template using a preset large model to obtain target format text information, thereby determining the contract information corresponding to the contract text to be processed based on the target format text information. Thus, the large model can quickly and accurately extract key information from each clause text, thereby obtaining accurate information from the entire contract text. Furthermore, adding prompt identifiers for specific clauses improves recognition accuracy, further improving the efficiency and effectiveness of contract information recognition, thereby improving the efficiency of contract-related business processing and reducing the risk of business errors.
[0056] In some embodiments, setting a corresponding prompt identifier for the prompt word template corresponding to the text to be processed to obtain a target prompt word template includes: obtaining the prompt word corresponding to the text to be processed based on the prompt word template; splitting the prompt word corresponding to the text to be processed to obtain key items and corresponding sub-items; setting corresponding prompt identifiers for the key items and / or corresponding sub-items to obtain a target prompt word template.
[0057] In this embodiment, the prompt words corresponding to the text to be processed refer to the information extraction prompt words corresponding to the text to be processed. The key item refers to the different category items corresponding to a prompt word. The subordinate item refers to the category item to which the key item is attached. In this embodiment, the prompt word template includes one or more prompt words for the text to be processed. When the text to be processed is the target text, the prompt word template needs to be further adjusted. Specifically, the prompt words can be split to obtain at least one key item, and each key item can be analyzed to determine the subordinate item corresponding to each key item. Finally, corresponding prompt identifiers are set for the key item and / or the subordinate item corresponding to the key item to obtain the target prompt word template.
[0058] In some embodiments, obtaining the prompt word template corresponding to the text of the terms to be processed includes: obtaining a preset prompt word template example; processing the text of the terms to be processed and the prompt word template example to obtain the prompt word template corresponding to the text of the terms to be processed.
[0059] In this embodiment of the disclosure, prompt word template examples can be preset. For example, common prompt word template examples can be set for some clause texts. After obtaining the clause text to be processed, the corresponding prompt word template examples can be adjusted according to the prompt word template examples to obtain the prompt word templates corresponding to the clause text to be processed, thereby further improving the efficiency of obtaining the prompt word templates corresponding to the clause text to be processed.
[0060] For example, taking the pending terms as settlement conditions, the prompt words for the settlement conditions are customer types. These customer types are then broken down into key items such as full-payment customers, loan customers, and installment payment customers. For each key item, corresponding sub-items are determined. For example, for full-payment customers, the sub-items are signing the contract and payment for the property. Finally, corresponding prompt icons are set for the key items and / or their corresponding sub-items. For example, the prompt icon for signing the contract is "First locate the signing conditions for full-payment customers in the contract text," "Sign," and "Draft," etc. Multiple prompt icons can be used. Similarly, the prompt icon for payment for the property is "First locate the payment conditions for full-payment customers in the contract text" and "Payment," etc. This yields an updated prompt word template, i.e., the target prompt word template.
[0061] In the above solution, during the process of setting corresponding prompt icons for the prompt word template corresponding to the clause text to be processed, the prompt words are split to obtain key items and their corresponding sub-items, and corresponding prompt icons are set for the key items and / or their corresponding sub-items. This allows for segmented prediction of the clause text to be processed, that is, first outputting some key items, then locating specific text positions based on the key items, and extracting sub-items. In other words, the prompt word template optimization introduces the thinking chain approach. Through the thinking chain, the powerful reasoning ability of the large model can be stimulated. The segmented prompt words combined with the thinking chain model can greatly improve the accuracy of clause structuring, thereby further improving the efficiency and effectiveness of contract information extraction.
[0062] In some embodiments, the contract information extraction method may further include: obtaining a contract text test sample and extracted text information corresponding to each test clause text in the contract text test sample; calculating string similarity based on the extracted text information and pre-annotated labeled text information to obtain the information test extraction rate corresponding to each test clause text; and taking the test clause text corresponding to an information test extraction rate less than or equal to a preset test extraction rate threshold as the target clause text.
[0063] In this embodiment, one or more contract texts can be obtained as test samples, i.e., contract text test samples. The corresponding test clause texts are then obtained. Information is extracted using a large model combined with the prompt word templates corresponding to the test clause texts, resulting in extracted text information for each test clause text. Furthermore, each test clause text is pre-annotated with corresponding annotation text information. The annotation text information refers to the correct extraction result corresponding to the test clause text. Based on the extracted text information and the pre-annotated annotation text information, string similarity calculation is performed to obtain the information test extraction rate for each test clause text.
[0064] The information test extraction rate refers to the accuracy of information extraction from the test clause text. For example, if the similarity is 100%, the information test extraction rate is determined to be 100%. If the similarity is 50%, the information test extraction rate is determined to be 50%. Generally, the higher the information extraction rate, the higher the accuracy of information extraction.
[0065] Specifically, a test extraction rate threshold is pre-set according to the actual application scenario. The information test extraction rate is then compared with the test extraction rate threshold. Test clause texts with an information test extraction rate less than or equal to the preset test extraction rate threshold are used as target clause texts. This indicates that the accuracy of information extraction from the target clause text is relatively low, and the feedback prompt word template needs to be further processed to improve the information extraction rate in order to meet user needs.
[0066] In the above scheme, the target clause text can be determined by the extraction accuracy of the test. Then, during the contract text processing, when the clause text to be processed is the target clause text, the corresponding prompt icon is set according to the prompt word template of the clause text to be processed for information extraction by the large model, thereby further improving the accuracy of contract information extraction.
[0067] In some embodiments, the contract information extraction method may further include: calculating the processing vector corresponding to the text of the clause to be processed, obtaining multiple candidate vectors from a preset knowledge database, calculating the similarity between the processing vector and each candidate vector, taking the candidate vector with a similarity greater than or equal to a preset similarity threshold as the target vector, and adding the prompt words corresponding to the target vector to the target prompt word template.
[0068] The knowledge database refers to a database that stores multiple clause text vectors as candidate vectors. In this embodiment of the disclosure, a knowledge database is set up in advance. Specifically, for the contract text to be processed, the information extraction rate of each clause text in the contract text to be processed is obtained. Clause texts with information extraction rates less than or equal to a preset extraction rate threshold are used as candidate clause texts. The candidate clause texts are labeled with the corresponding extraction results, and the candidate clause texts and the corresponding extraction results are stored in the knowledge database.
[0069] Specifically, after extracting information from each clause in the contract text to be processed, the accuracy of the extracted information can be analyzed, and the information extraction rate corresponding to each clause can be determined to represent the accuracy of the information extraction. Generally, the higher the information extraction rate, the higher the accuracy of the information extraction. An extraction rate threshold is set in advance according to the application needs. When the information extraction rate corresponding to each clause is less than or equal to the extraction rate threshold, it indicates that the accuracy of the extracted information for that clause is relatively low. Therefore, this clause is regarded as a candidate clause, and the candidate clause is labeled with the corresponding extraction results. The candidate clause and the corresponding extraction results are stored in the knowledge database. Here, the labeling results refer to the correctly extracted text information of the candidate clause.
[0070] In this embodiment, each clause text in the knowledge database can be encoded to obtain text vectors as candidate vectors. After obtaining the clause text to be processed, the corresponding processing vector can be calculated, and the similarity between the processing vector and each candidate vector can be calculated. The higher the similarity, the more similar the clause text to be processed is to the clause text in the knowledge database, which means that the information extraction from the clause text to be processed may be more difficult. Therefore, the candidate vectors with a similarity greater than or equal to a preset similarity threshold are used as target vectors, and the prompt words corresponding to the target vectors are added to the target prompt word template. The similarity threshold can be selected and set according to the actual application needs. Thus, by adding the correct prompt words from the knowledge database to the target prompt word template, the information extraction from the clause text to be processed can be assisted, further improving the accuracy of information extraction.
[0071] In the above solution, by collecting inaccurate clause texts from online feedback and marking the correct answers, a knowledge database dedicated to clause texts is established. When dealing with clause texts to be processed for new contracts, the clause texts to be processed are automatically matched with the clause texts in the knowledge database. Those that reach the similarity threshold are added to the prompt word template as clause texts, thereby improving the model's prediction accuracy.
[0072] In some embodiments, the contract information extraction method may further include: in response to an adjustment instruction for target format text information, obtaining a feedback prompt word template, extracting information from the text of the clause to be processed based on the feedback prompt word template and the target format text information, and obtaining updated text information.
[0073] In this embodiment of the disclosure, the feedback prompt word template refers to one or more prompt words used to guide the model to adjust the output result; wherein, the output result refers to the target format text information, thereby inputting the target format text information into the large model, and the large model extracts information based on the feedback prompt word template and the target format text information during the information extraction process of the text to be processed, and obtains updated text information.
[0074] In the above scheme, the output of the large model is adjusted by using feedback prompt word templates, and the output is then input into the large model for modification. This process can be iterated until the correct answer is output, thereby extending the thinking process of the large model and improving the accuracy of information extraction.
[0075] Figure 2 This is a flowchart illustrating another contract information extraction method provided in this embodiment of the present disclosure. This embodiment further optimizes the above-described contract information extraction method based on the previous embodiment. Figure 2 As shown, the method includes:
[0076] Step 201: Obtain the text of the pending clauses in the contract text to be processed, and determine whether the text of the pending clauses is the target clause text.
[0077] It should be noted that step 201 is the same as steps 101-102. Please refer to the description of steps 101-102 for details. It will not be described in detail here.
[0078] Step 202: In response to the fact that the text to be processed is the target text, obtain the preset prompt word template example, process the text to be processed and the prompt word template example to obtain the prompt word template corresponding to the text to be processed.
[0079] Specifically, the term "to be processed" indicates that the term to be processed is a term with a relatively low accuracy rate in information extraction based on test samples. Therefore, the prompt word template corresponding to the term to be processed needs to be adjusted to improve the accuracy of subsequent information extraction.
[0080] Specifically, by pre-setting a prompt word template example and adjusting the prompt word template example according to the text of the clause to be processed, the prompt word template corresponding to the text of the clause to be processed can be obtained.
[0081] After step 202, steps 203 and / or 204 can be executed. The execution order of steps 202-204 can be determined according to the actual situation. Figure 2 This is just an example.
[0082] Step 203: Obtain the prompt words corresponding to the text of the clause to be processed based on the prompt word template, split the prompt words corresponding to the text of the clause to be processed to obtain the key items and the corresponding sub-items of the key items, set the corresponding prompt labels for the key items and / or the corresponding sub-items of the key items, and obtain the target prompt word template.
[0083] Specifically, for some difficult-to-judge clause texts, that is, the clause text to be processed is the target clause text, such as commission rules, jump commission, etc., the prompt words can be broken down and output in multiple steps. That is, the key item is output first, and the other items are attached to the key item. Then, the information of the subordinate items is predicted based on the key item, which can avoid information confusion in the large model.
[0084] Specifically, the text to be processed is the target text. It can be understood that the text to be processed may have a low extraction accuracy. Therefore, it is necessary to set corresponding prompts for key items and / or the corresponding sub-items to obtain the target prompt word template. Based on the target prompt word template, the large model is guided to extract text information. The prompts are added to improve the accuracy of the large model's prediction.
[0085] For example, the key item is "Protection Period for Viewing by Party B," and the sub-items are "Duration of Protection for Viewing by Party B," "Start Date of Protection for Viewing by Party B," "Whether the Number of Times the Protection Period Can Be Extended After a Follow-up Visit is Restricted," and "Protection Period for Party B's Clients After Contract Termination." The sub-item "Start Date of Protection for Viewing by Party B" is indicated by the prompt: "When determining the start date of protection for viewing by Party B, consider the following step by step: First, the text specifically describes the ownership of clients of both Party A and Party B, and clearly states that the protection periods for both parties are the same. Then, the text clearly states that..." If a customer visits again during the protection period, or if the customer is invited to visit again by Party B more than 30 days after the protection period, the customer protection period will be recalculated from the date of the second visit. Therefore, it is inferred that there is a customer revisit situation, and the protection period will be automatically extended. According to the judgment of the third constraint, the output should be "5". Thus, the output "Protection duration of Party B's viewing" is "30", "Starting point of Party B's viewing protection period" is "5", "Whether the number of times the protection period is extended after the revisit is limited" is "agreement" and "Party B's customer protection period after contract termination" is "agreement".
[0086] Step 204: Calculate the processing vector corresponding to the text to be processed, and obtain multiple candidate vectors from the preset knowledge database. Calculate the similarity between the processing vector and each candidate vector, and take the candidate vector with a similarity greater than or equal to the preset similarity threshold as the target vector. Add the prompt words corresponding to the target vector to the prompt word template or the target prompt word template.
[0087] Specifically, for clause texts that consistently perform poorly in online processing, user feedback on clause texts can be automatically collected, and correct answers can be manually annotated to build a knowledge database. Then, the newly input clause text is vectorized and its similarity to the text vectors in the knowledge database is calculated. When the similarity is greater than a similarity threshold, such as 80%, the clause text in the knowledge database and the correct answer are added as prompt words to the prompt word template. The large model then outputs the prediction result, which is the target format text information corresponding to the newly input clause text.
[0088] For example, such as Figure 3 As shown, the text of the clause to be processed and the candidate text of the knowledge database are input into the encoding model for encoding to obtain the vector to be processed and the candidate vector. The vector to be processed is used to determine the candidate vector by nearest neighbor search and the similarity between the vector to be processed and the candidate vector is calculated. The candidate vector with a similarity greater than a preset similarity threshold is used as the target vector. There can be multiple candidate vectors, so the correct label corresponding to the target vector is obtained and a small number of samples are generated as dynamic prompt words and added to the target prompt word template.
[0089] Step 205: Extract information from the text of the clause to be processed based on the target prompt word template using the preset large model to obtain the target format text information, and determine the contract information corresponding to the contract text to be processed based on the target format text information.
[0090] In this embodiment of the disclosure, the text of the clause to be processed is input into a large model, and the large model is guided by the target prompt word template to extract information from the text of the clause to be processed, thereby obtaining target format text information such as structured text information. In this way, the target format text information corresponding to all the text of the clause to be processed in the contract text can be combined to obtain the contract information corresponding to the contract text to be processed.
[0091] Step 206: In response to the adjustment instruction for the target format text information, obtain the feedback prompt word template, extract information from the text of the clause to be processed based on the feedback prompt word template and the target format text information, and obtain the updated text information.
[0092] For example, such as Figure 4 As shown, for the inaccurate pending terms text reported by online users, the large model is asked to re-predict and extend the model's thinking process. The Self-Refine method (which optimizes the initial output of the large model through iterative feedback and improvement, using the same large model to generate the initial output, then having the large model provide feedback on its output, and iterating and improving based on the feedback until a satisfactory output is achieved) is adopted. In other words, the large model's first output is fed back, and the feedback content is passed to the large model to correct the output. This process is repeated until the large model determines that the output is correct.
[0093] Specifically, a target format text message is generated using a large model. The same large model self-evaluates the target format text message and provides feedback prompt word templates. The target format text message is improved based on the feedback prompt word templates, and this process is repeated until the stopping condition is met.
[0094] Therefore, by leveraging the powerful text information extraction capabilities of the large model, key information required for business operations can be extracted from various clause texts, such as customer confirmation rules, settlement rules, and commission rules in new home contracts. This key information is then fed back to the user as prompts, improving business efficiency, reducing the risk of business errors, further meeting user needs, and enhancing the user experience.
[0095] The contract information extraction scheme provided in this embodiment obtains the text of the clause to be processed from the contract text to be processed, determines whether the text of the clause to be processed is the target clause text, and in response to the text of the clause to be processed being the target clause text, obtains a preset prompt word template example, processes the text of the clause to be processed and the prompt word template example to obtain the prompt word template corresponding to the text of the clause to be processed, obtains the prompt words corresponding to the text of the clause to be processed based on the prompt word template, splits the prompt words corresponding to the text of the clause to be processed to obtain key items and the corresponding sub-items of the key items, sets corresponding prompt icons for the key items and / or the corresponding sub-items of the key items to obtain the target prompt word template, and calculates the text of the clause to be processed corresponding to the clause to be processed. The system extracts vectors and retrieves multiple candidate vectors from a pre-set knowledge database. It calculates the similarity between the vector to be processed and each candidate vector, and selects candidate vectors with similarity greater than or equal to a pre-set similarity threshold as target vectors. The system adds prompt words corresponding to the target vectors to a target prompt word template. A pre-set large model extracts information from the text of the clause to be processed based on the target prompt word template, obtaining target format text information. Based on the target format text information, it determines the contract information corresponding to the contract text to be processed. In response to an adjustment instruction for the target format text information, it obtains a feedback prompt word template. Based on the feedback prompt word template and the target format text information, it extracts information from the text of the clause to be processed, obtaining updated text information. Therefore, unlike the method of directly inputting the entire contract text for a large model to predict, this embodiment proposes a segmented prompt word plus thought chain method for information extraction from complex contract texts. Furthermore, it can update the prompt word template according to the knowledge database and continuously adjust the output results of the large model to output correct results, improving the efficiency and effectiveness of contract text extraction.
[0096] Figure 5 This is a schematic diagram of a contract information extraction device provided in an embodiment of this disclosure. The device can be implemented by software and / or hardware, and is generally integrated into an electronic device. Figure 5 As shown, the device includes:
[0097] The first acquisition module 301 is used to acquire the text of the clauses to be processed in the contract text to be processed.
[0098] The judgment module 302 is used to determine whether the text to be processed is the target text.
[0099] The first response acquisition module 303 is used to acquire the prompt word template corresponding to the text to be processed in response to the text to be processed being the target text.
[0100] Setting module 304 is used to set a corresponding prompt identifier for the prompt word template corresponding to the text to be processed, so as to obtain the target prompt word template;
[0101] The processing module 305 is used to extract information from the text of the clause to be processed based on the target prompt word template using a preset large model to obtain target format text information, so as to determine the contract information corresponding to the contract text to be processed based on the target format text information.
[0102] Optionally, the setting module 304 is specifically used for:
[0103] Based on the prompt word template, obtain the prompt word corresponding to the text of the clause to be processed;
[0104] The prompt words corresponding to the text of the clause to be processed are broken down to obtain the key items and the corresponding sub-items;
[0105] Set corresponding prompt icons for the key item and / or the corresponding sub-items to obtain the target prompt word template.
[0106] Optionally, the device further includes:
[0107] The second acquisition module is used to acquire a contract text test sample and the extracted text information corresponding to each test clause text in the contract text test sample;
[0108] The calculation module is used to calculate the string similarity based on the extracted text information and the pre-annotated labeled text information, so as to obtain the information test extraction rate corresponding to each test clause text.
[0109] The first determining module is used to select the test clause text corresponding to an information test extraction rate less than or equal to a preset test extraction rate threshold as the target clause text.
[0110] Optionally, the first response acquisition module 303 is specifically used for:
[0111] In response to the fact that the text to be processed is the target text, a preset prompt template is obtained;
[0112] The text of the terms to be processed and the example of the prompt word template are processed to obtain the prompt word template corresponding to the text of the terms to be processed.
[0113] Optionally, the device further includes:
[0114] The calculation and acquisition module is used to calculate the vector to be processed corresponding to the text of the clause to be processed, and to obtain multiple candidate vectors from a preset knowledge database.
[0115] The calculation and determination module is used to calculate the similarity between the vector to be processed and each of the candidate vectors, and to take the candidate vectors whose similarity is greater than or equal to a preset similarity threshold as the target vectors;
[0116] An add module is used to add the prompt words corresponding to the target vector to the target prompt word template.
[0117] Optionally, the device further includes:
[0118] The third acquisition module is used to acquire the information extraction rate of each clause text in the contract text to be processed.
[0119] The second determining module is used to select clause texts with an information extraction rate less than or equal to a preset extraction rate threshold as candidate clause texts.
[0120] The storage module is used to annotate the candidate clause text with the corresponding extraction results and store the candidate clause text and the corresponding extraction results in the knowledge database.
[0121] Optionally, the device further includes:
[0122] The second response acquisition module is used to acquire a feedback prompt word template in response to the adjustment instruction for the target format text information;
[0123] The adjustment module is used to extract information from the text of the clause to be processed based on the feedback prompt template and the target format text information to obtain updated text information.
[0124] The contract information extraction device provided in this disclosure can execute the contract information extraction method provided in any embodiment of this disclosure, and has the corresponding functional modules and beneficial effects of the execution method.
[0125] This disclosure also provides a computer program product, including a computer program / instruction that, when executed by a processor, implements the contract information extraction method provided in any embodiment of this disclosure.
[0126] Figure 6 This is a schematic diagram of an electronic device provided in an embodiment of the present disclosure. See below for details. Figure 6 The diagram illustrates a structural schematic suitable for implementing the electronic device 400 in the embodiments of this disclosure. The electronic device 400 in the embodiments of this disclosure may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 6 The electronic device shown is merely an example and should not be construed as limiting the functionality and scope of the embodiments disclosed herein.
[0127] like Figure 6 As shown, electronic device 400 may include a processing device (e.g., a central processing unit, a graphics processor, etc.) 401, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 402 or a program loaded from storage device 408 into random access memory (RAM) 403. RAM 403 also stores various programs and data required for the operation of electronic device 400. Processing device 401, ROM 402, and RAM 403 are interconnected via bus 404. Input / output (I / O) interface 405 is also connected to bus 404.
[0128] Typically, the following devices can be connected to I / O interface 405: input devices 406 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 407 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; storage devices 408 including, for example, magnetic tapes, hard disks, etc.; and communication devices 409. Communication device 409 allows electronic device 400 to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 An electronic device 400 with various devices is shown; however, it should be understood that it is not required to implement or possess all of the devices shown. More or fewer devices may be implemented or possessed alternatively.
[0129] In particular, according to embodiments of this disclosure, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this disclosure include a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 409, or installed from a storage device 408, or installed from a ROM 402. When the computer program is executed by the processing device 401, it performs the functions defined in the contract information extraction method of embodiments of this disclosure.
[0130] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example,—but not limited to—an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in connection with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0131] In some implementations, clients and servers can communicate using any currently known or future-developed network protocol such as HTTP (Hypertext Transfer Protocol) and can interconnect with digital data communication (e.g., communication networks) of any form or medium. Examples of communication networks include local area networks (“LANs”), wide area networks (“WANs”), the Internet (e.g., the Internet of Things), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future-developed networks.
[0132] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0133] The aforementioned computer-readable medium carries one or more programs. When the aforementioned one or more programs are executed by the electronic device, the electronic device causes the following to occur: it acquires the text of a clause to be processed from the contract text to be processed; determines whether the text of a clause to be processed is the target clause text; in response to the text of a clause to be processed being the target clause text, it acquires the prompt word template corresponding to the text of a clause to be processed and sets a corresponding prompt identifier on the prompt word template corresponding to the text of a clause to be processed, thereby obtaining the target prompt word template; and extracts information from the text of a clause to be processed based on the target prompt word template using a preset large model, thereby obtaining target format text information, and determining the contract information corresponding to the contract text to be processed based on the target format text information.
[0134] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including but not limited to object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0135] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0136] The units described in the embodiments of this disclosure can be implemented in software or hardware. The names of the units are not, in some cases, intended to limit the specific unit.
[0137] The functions described above in this document can be performed, at least in part, by one or more hardware logic components. For example, exemplary types of hardware logic components that can be used, without limitation, include: Field Programmable Gate Arrays (FPGAs), Application-Specific Integrated Circuits (ASICs), Application Standard Products (ASSPs), System-on-Chip (SoCs), Complex Programmable Logic Devices (CPLDs), and so on.
[0138] In the context of this disclosure, a machine-readable medium can be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device. A machine-readable medium can be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium can be, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.
[0139] According to one or more embodiments of this disclosure, this disclosure provides an electronic device, including:
[0140] processor;
[0141] Memory used to store the processor's executable instructions;
[0142] The processor is configured to read the executable instructions from the memory and execute the instructions to implement the contract information extraction method as described in any of the present disclosure.
[0143] According to one or more embodiments of the present disclosure, the present disclosure provides a computer-readable storage medium storing a computer program for performing a contract information extraction method as described in any of the present disclosure.
[0144] The above description is merely a preferred embodiment of this disclosure and an explanation of the technical principles employed. Those skilled in the art should understand that the scope of this disclosure is not limited to technical solutions formed by specific combinations of the above-described technical features, but should also cover other technical solutions formed by arbitrary combinations of the above-described technical features or their equivalents without departing from the above-described concept. For example, technical solutions formed by substituting the above features with (but not limited to) technical features disclosed in this disclosure that have similar functions.
[0145] Furthermore, while the operations are described in a specific order, this should not be construed as requiring these operations to be performed in the specific order shown or in a sequential order. In certain environments, multitasking and parallel processing may be advantageous. Similarly, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of this disclosure. Certain features described in the context of individual embodiments may also be implemented in combination in a single embodiment. Conversely, various features described in the context of a single embodiment may also be implemented individually or in any suitable sub-combination in multiple embodiments.
[0146] Although the subject matter has been described using language specific to structural features and / or methodological logic, it should be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or actions described above. Rather, the specific features and actions described above are merely illustrative examples of implementing the claims.
Claims
1. A method for extracting contract information, characterized in that, include: Retrieve the text of pending clauses from the pending contract text; Determine whether the text of the clause to be processed is the target clause text; In response to the fact that the text to be processed is the target text, the prompt word template corresponding to the text to be processed is obtained, and a corresponding prompt identifier is set for the prompt word template corresponding to the text to be processed, so as to obtain the target prompt word template; The text of the clause to be processed is extracted by a pre-set large model based on the target prompt word template to obtain target format text information, and the contract information corresponding to the contract text to be processed is determined based on the target format text information.
2. The method according to claim 1, characterized in that, The step of setting a corresponding prompt identifier for the prompt word template corresponding to the text to be processed, to obtain the target prompt word template, includes: Based on the prompt word template, obtain the prompt word corresponding to the text of the clause to be processed; The prompt words corresponding to the text of the clause to be processed are broken down to obtain the key items and the corresponding sub-items; Set corresponding prompt icons for the key item and / or the corresponding sub-items to obtain the target prompt word template.
3. The method according to claim 1, characterized in that, The method further comprises: Obtain a test sample of the contract text, and the extracted text information corresponding to each test clause text in the test sample of the contract text; Based on the extracted text information and the pre-annotated labeled text information, the string similarity is calculated to obtain the information test extraction rate corresponding to each test clause text; The test clause text corresponding to an information test extraction rate less than or equal to a preset test extraction rate threshold is taken as the target clause text.
4. The method according to claim 1, characterized in that, The step of obtaining the prompt word template corresponding to the text of the clause to be processed includes: Get preset prompt word template examples; The text of the terms to be processed and the example of the prompt word template are processed to obtain the prompt word template corresponding to the text of the terms to be processed.
5. The method according to claim 1, characterized in that, The method further comprises: Calculate the processing vector corresponding to the text of the clause to be processed, and obtain multiple candidate vectors from a preset knowledge database; Calculate the similarity between the vector to be processed and each of the candidate vectors, and take the candidate vectors whose similarity is greater than or equal to a preset similarity threshold as the target vector; Add the prompt word corresponding to the target vector to the target prompt word template.
6. The method according to claim 5, characterized in that, The method further comprises: Obtain the information extraction rate of each clause in the contract text to be processed; Clause texts with an information extraction rate less than or equal to a preset extraction rate threshold are selected as candidate clause texts. The candidate clause texts are labeled with the corresponding extraction results, and the candidate clause texts and their corresponding extraction results are stored in the knowledge database.
7. The method according to claim 1, characterized in that, The method also includes In response to an adjustment instruction for the target format text information, a feedback prompt word template is obtained; Based on the feedback prompt template and the target format text information, information is extracted from the text of the clause to be processed to obtain updated text information.
8. An electronic device, characterized in that, The electronic device includes: processor; Memory used to store the processor's executable instructions; The processor is configured to read the executable instructions from the memory and execute the instructions to implement the contract information extraction method according to any one of claims 1-7.
9. A computer-readable storage medium, characterized in that, The storage medium stores a computer program for executing the contract information extraction method according to any one of claims 1-7.
10. A computer program product, characterized in that, The method includes a computer program, wherein the computer program is executed by a processor using the contract information extraction method according to any one of claims 1-7.
Citation Information
Cited By
Data processing method and product
CN121636719A