Information processing method and apparatus, electronic device, medium, and computer program product
By combining large models with prompts and keyword examples, audit documents are segmented and processed, solving the problems of low efficiency and poor accuracy in traditional methods. This achieves efficient and accurate extraction of keywords from institutional documents and enriches the tag library, thereby improving document management and retrieval efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA MOBILE COMM GRP CO LTD
- Filing Date
- 2024-11-27
- Publication Date
- 2026-05-29
AI Technical Summary
Existing technologies are inefficient and inaccurate in audit document processing. Traditional methods rely on manual labor or text recognition and comparison technology, which cannot effectively extract keywords, resulting in limited keyword extraction, semantic incoherence, and incomplete coverage.
By combining a large model with prompts and keyword examples, long files are split into sub-files and further processed based on the large model. Combined with a pre-set tag library and user review, this achieves efficient and accurate keyword extraction.
It improves the accuracy and efficiency of keyword retrieval in institutional documents, can handle extremely long documents, enriches the preset tag library, and improves document management and retrieval efficiency.
Smart Images

Figure CN122111958A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of artificial intelligence, and specifically relates to an information processing method, apparatus, electronic device, medium, and computer program product. Background Technology
[0002] Currently, in the process of handling institutional documents, especially in the field of audit document processing, there is a large number of audit documents that need to be managed and analyzed. However, the current methods for processing audit documents tend to rely on traditional document management systems, using manual methods or text recognition and comparison technologies to extract keywords from audit documents. Therefore, the current processing of audit documents suffers from low efficiency and poor accuracy. Summary of the Invention
[0003] This application provides an information processing method, apparatus, electronic device, medium, and computer program product.
[0004] This application provides an information processing method, the method comprising:
[0005] Identify the prompt words corresponding to the documents to be processed, as well as examples of keywords; wherein, the documents to be processed include policy documents;
[0006] Based on the prompt words and the keyword examples, the file to be processed is processed using a large model;
[0007] In response to processing failure, the file to be processed is split into multiple sub-files according to the terms information of the file to be processed; wherein the length of each sub-file is less than the input threshold of the large model.
[0008] Based on the prompt words and the keyword examples, the keywords of each sub-file are obtained by processing each sub-file through the large model.
[0009] In some embodiments, after obtaining the keywords of each sub-file, the method further includes: summarizing the keywords of each sub-file to obtain summarized keywords; and processing the summarized keywords using the large model based on the prompt words and the keyword examples to obtain a keyword list of the file to be processed.
[0010] As can be seen, the method given in this embodiment can process extremely long files, such as files whose length exceeds the input threshold of a large model, and obtain the keywords of the extremely long files.
[0011] In some embodiments, after obtaining the keyword list of the file to be processed, the method further includes: determining the matching degree of each keyword in the keyword list with each tag in the preset tag library to obtain multiple matching degrees; if there is a matching degree greater than a matching degree threshold among the multiple matching degrees, determining the target keyword corresponding to the maximum matching degree and the target tag in the preset tag library; using the target tag as the tag of the file to be processed; wherein, the tag of the file to be processed is used to identify or search the file to be processed.
[0012] It can be seen that determining the tags of the files to be processed by matching degree helps to improve the accuracy of the tags of the files to be processed. By adding tags to the files to be processed, it is easier to achieve accurate identification and search of the files.
[0013] In some embodiments, after obtaining the keyword list of the file to be processed, the method further includes: sending the keyword list and the file to be processed to a user device when all of the multiple matching degrees are less than a matching degree threshold; obtaining an addition instruction through the user device when the keyword list and the file to be processed have passed user review; and adding the keyword list as a new tag to a preset tag library based on the addition instruction.
[0014] It can be seen that adding new tags to the preset tag library after approval can improve the accuracy of keyword extraction from institutional documents and enrich the types of tags in the preset tag library.
[0015] In some embodiments, after obtaining the keyword list of the file to be processed, the method further includes: filtering the keyword list for stop words to obtain a filtered keyword list.
[0016] It can be seen that filtering the keyword list with stop words can improve the accuracy of the keywords in the keyword list.
[0017] In some embodiments, before processing the file to be processed using the large model, the method further includes: dividing the file to be processed according to the terms of the file to be processed to obtain the divided file to be processed; the processing of the file to be processed using the large model includes: processing the divided file to be processed using the large model, and if the processing is successful, obtaining the keywords of the divided file to be processed; wherein the keywords of the divided file to be processed correspond to the terms of the file to be processed.
[0018] It can be seen that by dividing the documents to be processed into clauses before extracting keywords, it is beneficial to directly obtain the corresponding clauses through keywords or tags, thereby improving the efficiency of finding policy documents.
[0019] In some embodiments, determining the prompt words and keyword examples corresponding to the file to be processed includes: obtaining the prompt words and keyword examples corresponding to the file to be processed based on a large model application framework; processing the file to be processed using the large model based on the prompt words and keyword examples includes: obtaining an instantiated large model using the large model application framework; concatenating the prompt words, keyword examples, and the main text content of the file to be processed based on the large model application framework to obtain input information; inputting the input information into the instantiated large model, and processing the file to be processed using the instantiated large model.
[0020] It can be seen that by using the large model application framework and combining prompt words with the large model to extract keywords from institutional documents, the accuracy of keyword extraction from institutional documents can be improved.
[0021] This application embodiment also provides an information processing apparatus, the apparatus comprising:
[0022] The determination module is used to determine the prompt words corresponding to the file to be processed, as well as keyword examples; wherein, the file to be processed includes policy documents;
[0023] The processing module is used to process the file to be processed using a large model based on the prompt words and the keyword examples; in response to processing failure, the file to be processed is split into multiple sub-files according to the terms information of the file to be processed; wherein the length of each sub-file is less than the input threshold of the large model; and the keywords of each sub-file are obtained by processing each sub-file using the large model based on the prompt words and the keyword examples.
[0024] This application provides an electronic device, which includes a processor and a memory for storing computer programs capable of running on the processor; wherein,
[0025] The processor is used to run the computer program to perform any of the above information processing methods.
[0026] This application provides a non-transient computer storage medium storing a computer program thereon, which, when executed by a processor, implements any of the above-described information processing methods.
[0027] This application provides a computer program product, including a computer program that, when executed by a processor, implements any of the above-described information processing methods.
[0028] This application provides an information processing method, apparatus, electronic device, medium, and computer program product. By designing prompt words and keyword examples for institutional documents and combining them with a large model to extract keywords from institutional documents, it solves the problems of limited keyword extraction, semantic incoherence, and incomplete coverage in traditional institutional document keyword extraction methods, thereby improving the accuracy and efficiency of keyword acquisition. Especially for cases where the length of the document to be processed exceeds the input threshold of the large model, the method provided in this application can achieve keyword extraction from extremely long documents. Attached Figure Description
[0029] Figure 1 A flowchart of keyword extraction in a related technology provided in this application embodiment;
[0030] Figure 2 A flowchart of an information processing method provided in an embodiment of this application;
[0031] Figure 3 A flowchart of a keyword extraction method provided in this application embodiment;
[0032] Figure 4 This is a schematic diagram of the structure of an information processing device provided in an embodiment of this application;
[0033] Figure 5 This is a schematic diagram of the composition structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0034] Currently, there are a large number of policy documents that need to be managed and analyzed. However, the commonly used technical solutions tend to rely on traditional document management systems, using manual methods or text recognition comparison techniques for keyword extraction. This results in low efficiency and poor accuracy in keyword extraction. Since a large number of policy documents are stored in a typical policy document management system, the ability to extract keywords from these documents is crucial.
[0035] Extracting keywords from institutional documents offers several advantages: First, keywords allow for the identification of hierarchical relationships among documents, facilitating the construction of a knowledge graph. For instance, documents sharing the same tags or keywords can be defined as siblings. Once the knowledge graph is formed, the relationships between documents can be determined using tags or keywords, and further, the hierarchical and causal relationships can be established based on their publication order. Second, keyword extraction significantly improves retrieval efficiency. Users can quickly find relevant institutional documents using keywords, saving time and increasing work efficiency. Furthermore, the search page visually presents the domain to which an institutional document belongs, providing users with a clear understanding of its content and classification. These advantages collectively enhance the intelligence level and user experience of the institutional document system.
[0036] In related technologies, the key extraction scheme for institutional documents involves extracting keywords from the current institutional document and assigning tags to the document using these keywords. This process mainly consists of the following steps:
[0037] 1. For unstructured data, such as Portable Document Format (PDF) files, use Optical Character Recognition (OCR) technology to parse policy documents.
[0038] 2. Perform word segmentation on structured and unstructured parsed data, and extract words from the name and body of the policy documents according to their weight.
[0039] 3. Pre-set keywords are provided manually by auditors and stored in the tag library.
[0040] 4. Search for keywords in the keyword list in the preset tag library, count the frequency of the found keywords, and take the top 5 as the keywords of the policy document.
[0041] Figure 1 A flowchart of keyword extraction in a related technology is shown. Before extracting keywords, the policy documents to be processed are first divided into policy document name 101 and policy document body 103.
[0042] Natural language processing technology is used to process the name 101 of the institutional document and the body 103 of the institutional document to obtain the word segmentation library 102 of the institutional document name 101 after processing and the word segmentation library 104 of the institutional document body 103 after processing.
[0043] Search the terminology database 102 for the name of the policy document and the terminology database 104 for the body of the policy document in the keyword database 105, and then proceed to step 106.
[0044] Step 106: Determine if the search was successful.
[0045] If the system document name is successfully searched in the keyword database 105 in the system document name word segmentation database 102, or if the system document body word segmentation database 104 is successfully searched in the keyword database 105, proceed to steps 107 to 109.
[0046] If the search for the name of the policy document in the terminology library 102 fails in the keyword library 105, or if the search for the name of the policy document in the terminology library 104 fails in the keyword library 105, proceed to step 110.
[0047] Step 107: Output the keyword list.
[0048] Step 108: Count word frequencies.
[0049] Calculate the frequency of each keyword in the keyword list.
[0050] Step 109: Output the top 5 keywords with the highest word frequency.
[0051] Step 110: Determine if it is a non-keyword.
[0052] If the search for the name of the policy document in the terminology database 102 fails in the keyword database 105, it is determined that the name of the policy document in the terminology database 102 is not a keyword; or, if the search for the body text of the policy document in the terminology database 104 fails in the keyword database 105, it is determined that the body text of the policy document in the terminology database 104 is not a keyword.
[0053] In a related technology, a multi-label classification method for text content is presented: the text to be classified and its corresponding candidate label set are input into a label recall model to obtain multiple target candidate labels corresponding to the text to be classified; a target input text is constructed based on the text to be classified and the target candidate labels, and the target input text is input into a label generation model to obtain the classification result label corresponding to the text to be classified; the label recall model is obtained after training based on the text sample to be classified and a pre-determined candidate label set, and the label generation model is obtained after training based on the input text sample and the pre-determined classification result label.
[0054] In another related technology, a fast-applied multi-label text classification method is presented: high-quality pre-labeling of unlabeled text is achieved by combining multiple methods to obtain positive and negative samples; based on the obtained positive and negative samples, a multi-label text classification task model is trained, and the trained multi-label text classification task model is used for prediction to obtain the text classification result.
[0055] It can be seen that the use of high-frequency words in policy documents often deviates from the document's semantic main idea, which reduces the accuracy of tags. Furthermore, due to the limitations of existing tag or keyword libraries, the number of extracted keywords is limited and cannot cover the diversity of policy documents, thus restricting the role of tags in policy document classification and content extraction. Finally, the incompleteness of tag or keyword libraries means that the keywords in policy documents may not accurately reflect the core content of the documents. Insufficient tag or keyword libraries will directly affect the diversity and accuracy of keywords.
[0056] Unlike the methods described in related technologies, this application's embodiments, based on generating a large model, use only a small number of positive samples and keywords. Through the semantic search capabilities of the large model, a large amount of high-quality supervised corpus can be obtained. In text classification scenarios without labeled samples, training samples are constructed by combining multiple methods, reducing manual costs and accelerating the implementation efficiency of multi-label text classification tasks. Furthermore, this application's embodiments use multi-model cross-validation to achieve mutual verification and improve the reliability of prediction results.
[0057] The embodiments of this application will be further described in detail below with reference to the accompanying drawings and examples. It should be understood that the embodiments provided herein are merely illustrative of the embodiments of this application and are not intended to limit the embodiments of this application. Furthermore, the embodiments provided below are some embodiments for implementing this application, and not all embodiments for implementing this application. Unless otherwise specified, the technical solutions described in the embodiments of this application can be implemented in any combination.
[0058] It should be noted that, in the embodiments of this application, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a method or apparatus that includes a list of elements includes not only the elements expressly described, but also other elements not expressly listed, or elements inherent to implementing the method or apparatus. Without further limitations, an element defined by the phrase "comprising..." does not exclude the presence of other related elements in the method or apparatus that includes that element (e.g., steps in the method or units in the apparatus; for example, a unit in the apparatus may be a portion of circuitry, a portion of a processor, a portion of a program or software, etc.).
[0059] The information processing method provided in this application includes a series of steps, but the information processing method provided in this application is not limited to the steps described. Similarly, the information processing apparatus provided in this application includes a series of modules, but the apparatus provided in this application is not limited to the modules explicitly described, and may also include modules that need to be set up for obtaining relevant information or processing based on information.
[0060] This application provides an information processing method, such as... Figure 2 As shown, Figure 2 A flowchart of an information processing method is shown. Figure 2 The information processing methods shown include:
[0061] Step 201: Determine the prompt for the document to be processed, and provide examples of the prompts; the document to be processed includes policy documents.
[0062] Institutional documents typically refer to a series of rules, regulations, and ordinances formulated and implemented by organizations, enterprises, and institutions to standardize and guide various tasks and activities. Generally, institutional documents are composed of a uniform format and include different clauses. In this application's embodiments, the documents to be processed include institutional documents and other documents with a specific format, consisting of clauses or chapters. For example, the documents to be processed could be audit documents.
[0063] After obtaining the file to be processed, based on the file and the expected processing result, determine the corresponding prompt and keyword examples for the file to be processed.
[0064] When batch processing of files is required, such as exporting a collection of policy documents from a policy file system for which keywords need to be obtained, Python code can be written using the programming software VS Code (Visual Studio Code). First, define a variable named `files`, read the policy documents, obtain the text of all policy documents, and assign the text of all policy documents to the `files` variable. Then, write a for loop to process each file in the policy document collection one by one.
[0065] Before this step, the document to be processed can be preprocessed. A new project for extracting keywords can be created from the policy file system, the policy document to be processed can be identified and downloaded locally. The policy document to be processed is a text file (txt), and a single policy document contains all its clauses and contents. This embodiment of the application illustrates the processing of a single policy document as an example.
[0066] Before determining the prompt and keyword examples for the file to be processed, you can also determine the type of file, such as a text file or a database file, and the specific task to be processed, such as information extraction, data filtering, or content analysis. Then, set the goal and clarify the objective of processing the file, such as obtaining specific information from the file or generating a report.
[0067] When designing a prompt, it is necessary to construct clear instructions based on the task and objectives. These instructions will guide the model to process the file. For example, "Please extract all entries related to 'high profit' from the provided data report and return them to me in the form of a list. The relevant entries should include information such as sales date, salesperson, products sold, and sales amount."
[0068] Keyword examples are used to guide the identification of key task-related information from the document content. By providing keyword examples in the prompt, the model can be guided to search for and extract relevant information from the document. For example, keyword examples could be "high sales," "sales growth," "sales champion," etc.
[0069] In some embodiments, a large model application framework can be used to obtain the prompt and keyword examples corresponding to the file to be processed.
[0070] Taking LangChain, a large-model application framework, as an example, LangChain is an open-source framework specifically designed for building applications based on Large Language Models (LLMs), or simply large models. This framework provides a suite of tools aimed at improving the customization, accuracy, and relevance of the information generated by the model. LangChain allows developers to improve the response quality of large models by building new prompt chains or customizing existing templates. LangChain operates based on the concept of "chains," a method of organizing different AI components to provide context-aware responses. A chain is a sequence of multiple "links," each representing an operation, such as formatting user input, sending a query to the model, or retrieving data from cloud storage. Developers can flexibly adapt the model to specific business environments by specifying the steps required to produce the expected results. LangChain provides a rich set of prompt templates, allowing developers to choose the appropriate template based on their needs. By adjusting the parameters and settings in the templates, diverse prompts can be generated.
[0071] LangChain's Few-shot technique is a cue engineering approach that guides the LLM model to generate text by providing it with a set of example inputs and outputs, which can significantly improve model performance in certain situations. Through Few-shot cue templates, LangChain enables developers to leverage examples to guide the model in generating more accurate and expected outputs, thereby improving application performance and user experience.
[0072] In the example of obtaining the prompt and keyword corresponding to the file to be processed based on the LangChain framework, you can first import the LangChain package, introduce the relevant functions of the prompt template PromptTemplate and the FewShotPromptTemplate class, etc., use the LangChain framework to design the prompt and keyword examples, and send the prompt, keyword examples and policy documents to PromptTemplate to complete the assignment and complete the definition of the prompt.
[0073] Step 202: Based on prompt words and keyword examples, process the file to be processed using a large model.
[0074] After obtaining the prompt and keyword examples corresponding to the file to be processed, the designed prompt, keyword examples, and file to be processed are input into the selected large model. The large model then processes the input file according to the instructions of the prompt and the keyword examples, and outputs the results that meet the requirements, such as the keywords of the file to be processed.
[0075] In some embodiments, an instantiated large model can be obtained through the LangChain framework; based on the LangChain framework, the prompt, keyword examples, and the main text of the file to be processed are concatenated to obtain input information; the input information is input into the instantiated large model, and the file to be processed is processed through the instantiated large model.
[0076] Specifically, you can first import the LangChain package, introduce the development framework LLMChain, Xinference and other related functions, then determine the Uniform Resource Locator (url) address and model ID of the large model to be called, and obtain the instantiated large model.
[0077] In the process of implementing large model instantiation, Temperature and Top_p are two important hyperparameters used to control the output style and diversity of the model. Temperature adjusts the smoothness of the probabilities of the output layer of the normalized exponential function softmax. Top_p is a sampling strategy used to select which tokens to output; a higher Top_p value allows the model to output more diverse results, while a lower Top_p value makes the model output more stable. By determining the values of parameters such as temperature and top_p, the quality of large model instantiation can be determined. After configuring the large model based on the Temperature and Top_p parameters, the configured large model data is passed to the Xinference platform for inference.
[0078] Xinference is an inference platform designed specifically for large language models. It provides various flexible interfaces and application programming interfaces (APIs) and supports private deployment. Through the Xinference platform, large models can be easily instantiated and efficient inference services can be provided. The large model variables are defined by passing the configured large model data to the Xinference function. Then, the prompt and large model variables from the aforementioned example are passed to LLMChain to complete the instantiation of the large model. In practical applications, it is also possible to invoke a large model with hundreds of billions of parameters to obtain keywords from the file to be processed.
[0079] Based on the LangChain framework, a large instantiated model is obtained through LLMChain, Prompt, and keyword examples, and the file to be processed is processed through the instantiated large model.
[0080] Step 203: In response to processing failure, the file to be processed is split into multiple sub-files according to the terms information of the file to be processed; wherein the length of each sub-file is less than the input threshold of the large model.
[0081] If the large model call is successful, meaning the large model successfully processes the document, it outputs a list of keywords for that document. If processing fails, in response, a long text segmentation algorithm is invoked to segment the document according to its clauses. Since a document typically consists of N clauses, to ensure the integrity of the clauses in the segmented sub-files, the document is segmented according to its clauses. During the segmentation process, a total length can be set so that the sum of the lengths of the segmented clauses does not exceed the specified length.
[0082] Since policy documents sometimes consist of hundreds of clauses, a single policy document may have excessive word count, exceeding the input threshold of the large model and causing the model to fail to return the correct result. When the document to be processed is too long, i.e., when the large model fails to process it, the policy document is split according to clauses or paragraphs, specifying that the total word count of the split clauses does not exceed a set value, ensuring that the length of each sub-document does not exceed the input threshold of the large model.
[0083] Step 204: Based on prompts and keyword examples, process each sub-file using the large model to obtain the keywords for each sub-file.
[0084] In practical applications, you can set the process to extract a specified number of keywords.
[0085] In practical applications, steps 201 to 204 can be implemented based on a processor, which can be at least one of the following: Application Specific Integrated Circuit (ASIC), Digital Signal Processor (DSP), Digital Signal Processing Device (DSPD), Programmable Logic Device (PLD), Field Programmable Gate Array (FPGA), Central Processing Unit (CPU), Controller, Microcontroller, and Microprocessor.
[0086] In some embodiments, after obtaining the keywords of each sub-file, the method further includes: summarizing the keywords of each sub-file to obtain summarized keywords; and processing the summarized keywords using a large model based on prompt words and keyword examples to obtain a keyword list for the file to be processed.
[0087] After dividing the policy document into several sub-files, for each sub-file, based on the prompt and keyword examples, queries are posed to the larger model to extract a specified number of keywords. The keywords from all sub-files are then aggregated to obtain the aggregated keywords. Finally, based on the prompt and keyword examples, queries are posed to the larger model to obtain the final keyword list for the document to be processed.
[0088] In some embodiments, after obtaining the keyword list of the file to be processed, the method further includes: determining the matching degree of each keyword in the keyword list with each tag in the preset tag library to obtain multiple matching degrees; if there is a matching degree greater than the matching degree threshold among the multiple matching degrees, determining the target keyword corresponding to the maximum matching degree and the target tag in the preset tag library; using the target tag as the tag of the file to be processed; wherein the tag of the file to be processed is used to identify or search the file to be processed.
[0089] Since the keyword list may contain multiple keywords and the preset tag library may also contain multiple tags, when calculating the matching degree, each keyword in the keyword list can be traversed to calculate the matching degree between each keyword and each tag in the preset tag library.
[0090] In practical applications, a secondary label similarity collision algorithm suitable for matching policy documents can be performed by comparing keywords in the keyword list with a pre-defined label library. This involves defining a function to execute the secondary label similarity collision algorithm. The algorithm takes as input a keyword list generated by a large model and a pre-defined label library corresponding to the policy documents, and iteratively checks whether keywords in the keyword list are in the pre-defined label library.
[0091] By calculating the matching degree, the matching degree between different keywords and different tags can be obtained. If the matching degree is greater than the matching degree threshold, the keyword is considered to exist in the preset tag library. The target keyword corresponding to the maximum matching degree and the target tag in the preset tag library are found, and the target tag is used as the tag for the document to be processed, thus effectively forming a standardized keyword extraction process for institutional documents. Depending on different application scenarios, the matching degree threshold can be set to 90%, 95%, etc.
[0092] In some embodiments, after obtaining the keyword list of the file to be processed, the method further includes: sending the keyword list and the file to be processed to a user device when multiple matching degrees are less than the matching degree threshold; obtaining an addition instruction through the user device when the keyword list and the file to be processed have passed user review; and adding the keyword list as a new tag to a preset tag library based on the addition instruction.
[0093] Similar to the method given in the above embodiments, by calculating the matching degree, the matching degrees between different keywords and different tags can be obtained. If all the matching degrees are less than the matching degree threshold, it is considered that none of the keywords obtained after the large model processing match any tag in the preset tag library. In this case, the keyword list obtained by the large model processing and the corresponding file to be processed are sent to the user device, so that relevant reviewers can review the keyword list received by the user device and the corresponding file to be processed. Here, the file to be processed may include the name of the file to be processed and the original text of the file to be processed. When the reviewer reviews the keyword list and the corresponding file to be processed according to the actual situation, and when the review is passed and it is considered that the keywords obtained by the large model can be used as the tags of the file to be processed, the reviewer sends an addition instruction to the user device.
[0094] After the user device receives the addition instruction, it sends the addition instruction to the information processing device. The information processing device sorts out the keywords in the keyword list and incorporates the keywords into the tag library as new tags in the tag library.
[0095] Based on the method given in this embodiment, not only can the core keywords of the file to be processed be efficiently and accurately extracted, but the keywords can also be updated to the tag library in a standardized manner, significantly improving the management and retrieval efficiency of the file to be processed.
[0096] In some embodiments, after obtaining the keyword list of the file to be processed, the above method further includes: filtering the keyword list by stop words to obtain a filtered keyword list.
[0097] After obtaining the keyword list through the large model processing, the keywords in the keyword list can be filtered by the stop word list function, and the filtered keyword list is output and presented on the page.
[0098] In practical applications, Python can be used to read the keyword list after being processed by the large model, and the extracted keyword list is filtered by stop words. The stop word list stores the content that needs to be deleted, such as conjunctions, punctuation marks, etc., such as "of", ",", "already", etc. The stop word list also stores the stop words of other words that are obviously irrelevant to the keywords. By calling the stop word list processing function, the meaningless words in the keyword list are removed to form the final keyword list, and the tags of the file to be processed can be obtained based on the filtered keyword list.
[0099] In some embodiments, before processing the file to be processed using the large model, the method further includes: dividing the file to be processed according to the terms of the file to be processed to obtain the divided file to be processed; the processing of the file to be processed using the large model includes: processing the divided file to be processed using the large model, and if the processing is successful, obtaining the keywords of the divided file to be processed; wherein the keywords of the divided file to be processed correspond to the terms of the file to be processed.
[0100] Before processing the files in the large model, preprocessing is required. This preprocessing includes dividing the files into segments based on the clause information within them. Each segmented file consists of distinct and complete clauses.
[0101] In practical applications, a Python program can be written to clean the data in the files to be processed. This program calls a data partitioning function to divide a single file into clauses, creating a new Excel spreadsheet. The Excel file can have two columns: the first column represents the name of the file, and the second column represents the content of each clause within the file. The pre-processed file can correspond to multiple rows of content, which are then saved as separate rows in the Excel file. When there are multiple files to be processed, each file is processed sequentially, and the processed files are saved to a new Excel file.
[0102] By dividing the documents to be processed into clauses, the correspondence between keywords and each clause can be obtained when processing the documents after the clause division. This allows for direct access to the specific clauses and clause content corresponding to the keywords when performing document search based on keywords, which helps to enhance the user's experience in reading and searching documents.
[0103] In some embodiments, determining the prompt words and keyword examples corresponding to the file to be processed includes: obtaining the prompt words and keyword examples corresponding to the file to be processed based on the large model application framework; processing the file to be processed based on the prompt words and keyword examples using the large model includes: obtaining an instantiated large model through the large model application framework; concatenating the prompt words, keyword examples, and the main text content of the file to be processed based on the large model application framework to obtain input information; inputting the input information into the instantiated large model, and processing the file to be processed through the instantiated large model.
[0104] This embodiment further presents a method for extracting keywords from a large model based on a large model application framework, using a prompt, keyword examples, and the file to be processed. Specifically, the large model application framework can be LangChain, llamaindex, Dify, Coze, etc. Among them, the llamaindex framework is a data framework specifically designed for applications based on large models. It simplifies the document query process, making the processing of private or domain-specific data easy and efficient. Dify focuses on providing an open-source, flexible, and modular platform that supports multiple large models, suitable for developers requiring high customization and flexibility. Coze focuses on providing an easy-to-use and fast chatbot building platform, especially suitable for application scenarios requiring rapid chatbot deployment. In this embodiment, a suitable large model application framework can be selected to obtain the large model according to specific implementation requirements and preferences, and the file to be processed can be processed using the large model.
[0105] In practical applications, prompt templates can be built on top of a large model application framework using Few-shots. First, a formatter needs to be created to format the Few-shot examples as strings. Here, the formatter is a `PromptTemplate`, which can be customized based on the `input_variables` variable in the `PromptTemplate` object according to different business scenarios. For example, when extracting keywords from policy documents, `input_variables` can be set to "content" and "keywords", where `content` represents the policy document and `keywords` represents the keywords to be extracted. Next, a list containing examples is created, where each example is a dictionary representing the example input prompted by the formatter. Finally, a `FewShotPromptTemplate` object is created based on the `PromptTemplate`. This object can receive the Few-shot examples and the formatter for the examples. When the `FewShotPromptTemplate` is formatted, it uses the prompt example `example_prompt` for formatting and passes the specific example.
[0106] Taking LangChain as a large-scale model application framework as an example, the LangChain framework introduces related functions and classes such as PromptTemplate and FewShotPromptTemplate. Using the LangChain framework, a prompt and keyword examples are designed. The prompt, keyword examples, and the file to be processed are sent to the relevant functions of LangChain such as PromptTemplate and FewShotPromptTemplate. The relevant functions combine the prompt, keyword examples, and policy file to form a new string, thus completing the definition of the prompt, obtaining the input information, and then inputting the input information into the large model.
[0107] When calling a large model via LangChain, the process begins with defining a PromptTemplate to create or define a prompt template for interacting with the large model. Then, an Example Selector is created to select the most relevant examples, along with the business logic and the model invocation steps. When calling the large model, LangChain's API is used to invoke an external large language model; different large models can be selected. The address and name of the large model are passed in, and parameters such as temperature and top_p are specified to set the model's output. Finally, the input information obtained above is fed into the instantiated large model, the model's response is received, and post-processing is performed according to the business logic.
[0108] Based on the above method, the specific calling of the large model can be achieved through the following steps: Import the LangChain package, import relevant functions such as LLMChain and Xinference, determine the URL address and model identifier (Identity document, id) of the large model to be called, determine the relevant parameters of the large model such as temperature and top_p, and determine the final output result of the large model by setting the relevant parameters such as temperature and top_p. Input the large model processed by temperature and top_p into the Xinference function to complete the definition of the large model variables and instantiate the large model.
[0109] A large model with hundreds of billions of parameters can be invoked, and the concatenated input information can be passed to an instantiated large model for processing. The instantiated large model performs semantic understanding based on the input information and generates a keyword list for the file to be processed.
[0110] After batch reading the files to be processed, a large instantiated model can be obtained. This model can then be used to process the files step-by-step in a loop, outputting keyword results for each file. If the large model directly returns a keyword list, this list is saved in an Excel file. This Excel file contains two columns: the first column is the name of the file to be processed, and the second column is the list of keywords extracted by the large model. After processing the files using the above method, an Excel file is obtained. The contents of this Excel file are displayed on the front-end page, providing a keyword list corresponding to a policy document. If keyword retrieval fails, the file is segmented using the method described in the above embodiment.
[0111] As the number of model parameters increases, the model's capabilities also become stronger. Therefore, in this embodiment, an open-source large model with hundreds of billions of parameters can be selected to complete the keyword extraction task.
[0112] Based on the processing method given in the above embodiments, Figure 3 A flowchart of a keyword extraction method is shown, including:
[0113] Step 301: Batch read files.
[0114] Batch read policy documents.
[0115] Step 302: Design the prompt and examples.
[0116] After reading policy documents in batches, based on the policy documents and the expected output results, design the corresponding prompts and keyword examples for the policy documents.
[0117] For example, when extracting keywords from audit documents, a prompt could be designed as: "You are an audit expert and need to extract the keywords that best represent the entire audit document, up to 10. Output the keywords." Examples of suitable keywords could be:
[0118] examples = [
[0119] {"content": "First item xxx",
[0120] Keyword: "Objectivity, Professionals, xxx"
[0121] {"content": "Second item xxx",
[0122] "keywords": "company, business, xxx"
[0123] xxx).
[0124] Step 303: Call the large model.
[0125] Based on the method given in the above embodiments, a large model is invoked, and questions are posed to the large model based on the designed prompt and keyword examples, and the large model processes the file.
[0126] If the process is successful, proceed to step 304; if the process fails, proceed to steps 305 through 307.
[0127] Step 304: Output the keyword list.
[0128] If the large model is successfully processed, it indicates that the length of the currently processed policy document is less than the input threshold of the large model, and a keyword list for the currently processed policy document is obtained. After outputting the keyword list, step 308 is executed. For example, the output keyword list could be "IDC, maintenance, operation, management, security", where IDC represents Internet Data Center.
[0129] Step 305: Slide the window slice.
[0130] If the large model fails to process the document, it indicates that the length of the current policy document exceeds the input threshold of the large model. In this case, a sliding window is used to slice the policy document according to the clauses in the document, resulting in multiple sub-files. The sub-files obtained after slicing can be represented as [["Article 1 xxx", ..., "Article 10 xxx"], ["Article 11 xxx", ..., "Article 20 xxx"]...].
[0131] After obtaining the sliced sub-files, return to step 303, ask the large model for a query, and process the sub-files through the large model.
[0132] Step 306: Obtain a list of multiple keywords.
[0133] After processing the sub-files using the large model in step 303, the processing results for each sub-file are obtained, which are the keyword lists corresponding to each sub-file. For example, the keyword lists corresponding to each sub-file could be: [["IDC, maintenance, management, regulations, infrastructure, business support, maintenance management, quality assessment"], ["IDC, data center, security, maintenance, operation, personnel, management, resources"]..] etc.
[0134] After obtaining the keyword list corresponding to each sub-file, a question is posed to the large model based on the keyword list corresponding to each sub-file, and step 303 is executed. The large model processes the keyword list corresponding to each sub-file, and step 307 is executed after successful processing.
[0135] Step 307: Output the keyword list.
[0136] After processing the keyword lists corresponding to each sub-file using the large model, the large model extracts keywords again based on the keywords corresponding to the sub-files, and outputs the keyword list of the processed policy documents. For example, the output keyword list could be "accounting, management, unit, personnel, regulations". After outputting the keyword list, step 308 is executed.
[0137] Step 308: Keyword filtering.
[0138] Based on the keyword list output from the above steps, the keywords in the output keyword list are filtered to obtain a filtered keyword list.
[0139] Step 309: Output the results.
[0140] Keywords of the processed institutional documents.
[0141] This application provides a method for extracting keywords from institutional documents based on a large model. This includes designing a prompt and keyword examples corresponding to the institutional document. By concatenating the institutional document with the designed prompt and inputting it into the large model, a full-text understanding of the institutional document and extraction of core keywords can be achieved. This application, by acquiring institutional document data and employing specific prompt design techniques, solves the problems of limited keyword extraction, semantic incoherence, and incomplete coverage in traditional institutional document keyword extraction methods.
[0142] This application proposes a processing mechanism for keyword extraction from institutional documents. When a large model call or processing fails, a clause-level segmentation method is used to process the institutional document, and keywords are extracted from each segmented sub-document. By aggregating the keywords from all sub-documents, the large model is queried again to ensure the completeness and accuracy of the extraction results, thereby solving the data processing problem when a single large model call fails.
[0143] This application proposes a matching and updating process for institutional document tags, including performing similarity matching between extracted keywords and existing tags, and assigning successfully matched tags to institutional documents. For keywords that do not match, the process is pushed to reviewers for review and tag updating, forming a standardized and dynamically updated keyword extraction process for institutional documents, which improves the completeness and coverage of the tag system.
[0144] Compared with related technologies, the method based on the embodiments of this application can realize batch operations on the files to be processed, which is fast and convenient: by utilizing the efficient processing capabilities of large models, it can realize rapid tag extraction of a large number of institutional documents, which greatly saves manpower and time costs.
[0145] Compared with related technologies, the method provided in this application can achieve high keyword extraction accuracy, comprehensive coverage, and a richer tag library. The method can extract multiple keywords, and the extracted keywords can cover the core content of the entire text, avoiding the problems of limited keywords and semantic incoherence in traditional methods. It also increases the types of tags, forming a unified tag system and usage standards, and improving the accuracy of tag display in policy documents.
[0146] Compared with related technologies, the method based on the embodiments of this application can improve the correlation and summarization accuracy between tags and institutional documents: the keywords extracted through semantic understanding of the large model can more accurately reflect the main content of the institutional documents, thereby improving the correlation and summarization accuracy between tags and the main text of the institutional documents.
[0147] Compared with related technologies, the method provided in this application can increase the number of tags in a single policy document, refine data storage, and improve data quality: by increasing the number of tags in each policy document, the description of the policy document becomes more accurate, the document storage becomes more detailed, and the overall document quality and value are significantly improved. The method provided in this application can be extended to applications in other industries and professional documents; it is not only applicable to policy documents but can also be extended to keyword extraction and tag generation in other industries and professional documents, demonstrating broad application prospects.
[0148] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
[0149] Based on the information processing method proposed in the foregoing embodiments, this application also provides an information processing apparatus, such as... Figure 4 As shown, the information processing device includes:
[0150] The determination module 401 is used to determine the prompt words corresponding to the document to be processed, as well as keyword examples; wherein, the document to be processed includes policy documents.
[0151] The processing module 402 is used to process the file to be processed based on prompt words and keyword examples using a large model; in response to processing failure, the file to be processed is split into multiple sub-files according to the terms information of the file to be processed; wherein the length of each sub-file in the multiple sub-files is less than the input threshold of the large model; based on prompt words and keyword examples, the large model processes each sub-file to obtain the keywords of each sub-file.
[0152] In practical applications, the determination module 401 and the processing module 402 can be implemented based on a processor and a communication device.
[0153] In some embodiments, after obtaining the keywords of each sub-file, the processing module 402 is further configured to summarize the keywords of each sub-file to obtain summarized keywords; based on prompt words and keyword examples, the summarized keywords are processed through a large model to obtain a keyword list of the file to be processed.
[0154] In some embodiments, after obtaining the keyword list of the file to be processed, the processing module 402 is further configured to: determine the matching degree of each keyword in the keyword list with each tag in the preset tag library to obtain multiple matching degrees; if there is a matching degree greater than the matching degree threshold among the multiple matching degrees, determine the target keyword corresponding to the maximum matching degree and the target tag in the preset tag library; and use the target tag as the tag of the file to be processed; wherein, the tag of the file to be processed is used to identify or search the file to be processed.
[0155] In some embodiments, after obtaining the keyword list of the file to be processed, the processing module 402 is further configured to: send the keyword list and the file to be processed to the user device when multiple matching degrees are less than the matching degree threshold; obtain an addition instruction through the user device when the keyword list and the file to be processed have passed user review; and add the keyword list as a new tag to the preset tag library based on the addition instruction.
[0156] In some embodiments, after obtaining the keyword list of the file to be processed, the processing module 402 is further configured to perform stop word filtering on the keyword list to obtain a filtered keyword list.
[0157] In some embodiments, before processing the file to be processed by the large model, the processing module 402 is further configured to divide the file to be processed according to the terms of the file to be processed to obtain the divided file to be processed; correspondingly, the processing module 402 is specifically configured to process the divided file to be processed by the large model, and if the processing is successful, obtain the keywords of the divided file to be processed; wherein, the keywords of the divided file to be processed correspond to the terms of the file to be processed.
[0158] In some embodiments, the processing module 402 is specifically used to obtain prompt words and keyword examples corresponding to the file to be processed based on the large model application framework; obtain an instantiated large model through the large model application framework; concatenate the prompt words, keyword examples, and the main text content of the file to be processed based on the large model application framework to obtain input information; input the input information into the instantiated large model, and process the file to be processed through the instantiated large model.
[0159] It should be noted that the descriptions of the above device embodiments are similar to those of the above method embodiments, and have similar beneficial effects. For technical details not disclosed in the device embodiments of this application, please refer to the descriptions of the method embodiments of this application for understanding.
[0160] It should be noted that, in the embodiments of this application, if the above methods are implemented as software functional modules and sold or used as independent products, they can also be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiments of this application, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a terminal, server, etc.) to execute all or part of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), magnetic disks, or optical disks. Thus, the embodiments of this application are not limited to any specific hardware and software combination.
[0161] This application also provides an electronic device. Figure 5 This is a schematic diagram of the composition structure of an electronic device provided in an embodiment of this application, as shown below. Figure 5 As shown, the electronic device 50 may include:
[0162] Memory 501 is used to store executable instructions.
[0163] The processor 502 is used to implement any of the above-described information processing methods when executing executable instructions stored in the memory 501.
[0164] The processor 502 mentioned above can be at least one of ASIC, DSP, DSPD, PLD, FPGA, CPU, controller, microcontroller, and microprocessor.
[0165] The aforementioned computer-readable storage medium or memory 501 may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a magnetic random access memory (FRAM), a flash memory, a magnetic surface memory, an optical disc, or a compact disc read-only memory (CD-ROM), etc.; it may also be various terminals that include one or any combination of the above-mentioned memories, such as mobile phones, computers, tablet devices, personal digital assistants, etc.
[0166] This application embodiment further provides a non-transient computer storage medium, on which computer-executable instructions are stored, which are used to implement any of the information processing methods provided in the above embodiments.
[0167] Correspondingly, this application embodiment further provides a computer program product, the computer program product including computer executable instructions, which are used to implement any of the information processing methods provided in the above embodiments.
[0168] In some embodiments, the functions or modules of the apparatus provided in this application can be used to perform the methods described in the above method embodiments. The specific implementation can be referred to the description of the above method embodiments, and for the sake of brevity, it will not be repeated here.
[0169] The description of the various embodiments above tends to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to, and for the sake of brevity, they will not be repeated here.
[0170] The methods disclosed in the various method embodiments provided in this application can be arbitrarily combined to obtain new method embodiments without conflict.
[0171] The features disclosed in the various product embodiments provided in this application can be arbitrarily combined without conflict to obtain new product embodiments.
[0172] The features disclosed in the various method or device embodiments provided in this application can be arbitrarily combined without conflict to obtain new method or device embodiments.
[0173] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.
[0174] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims. All of these forms are within the protection scope of this application.
Claims
1. An information processing method, characterized in that, The method includes: Identify the prompt words corresponding to the documents to be processed, as well as examples of keywords; wherein, the documents to be processed include policy documents; Based on the prompt words and the keyword examples, the file to be processed is processed using a large model; In response to processing failure, the file to be processed is split into multiple sub-files according to the terms information of the file to be processed; wherein the length of each sub-file is less than the input threshold of the large model. Based on the prompt words and the keyword examples, the keywords of each sub-file are obtained by processing each sub-file through the large model.
2. The method according to claim 1, characterized in that, After obtaining the keywords of each sub-file, the method further includes: The keywords of each sub-file are summarized to obtain the summarized keywords; Based on the prompt words and the keyword examples, the aggregated keywords are processed by the large model to obtain the keyword list of the file to be processed.
3. The method according to claim 2, characterized in that, After obtaining the keyword list of the file to be processed, the method further includes: Determine the matching degree between each keyword in the keyword list and each tag in the preset tag library to obtain multiple matching degrees; If there is a matching degree greater than the matching degree threshold among the multiple matching degrees, determine the target keyword corresponding to the maximum matching degree, as well as the target tag in the preset tag library; The target tag is used as the tag of the file to be processed; wherein, the tag of the file to be processed is used to identify or find the file to be processed.
4. The method according to claim 3, characterized in that, After obtaining the keyword list of the file to be processed, the method further includes: If all the matching degrees are less than the matching degree threshold, the keyword list and the file to be processed are sent to the user device. The user device receives an add instruction from the keyword list and, if the file to be processed has passed user approval; Based on the added instruction, the keyword list is added as a new tag to the preset tag library.
5. The method according to claim 2, characterized in that, After obtaining the keyword list of the file to be processed, the method further includes: The keyword list is filtered for stop words to obtain a filtered keyword list.
6. The method according to any one of claims 1-5, characterized in that, Before processing the file to be processed using the large model, the method further includes: The file to be processed is divided according to the terms of the file to be processed, resulting in the divided file to be processed; The process of processing the file to be processed using a large model includes: The partitioned files are processed using a large model. If the processing is successful, the keywords of the partitioned files are obtained. The keywords of the partitioned files correspond to the terms of the files.
7. The method according to any one of claims 1-5, characterized in that, The prompt words corresponding to the file to be processed, and examples of keywords, include: Based on the large model application framework, obtain prompt words and keyword examples corresponding to the file to be processed; The process of processing the file to be processed based on the prompt words and the keyword examples using a large model includes: Obtain instantiated large models through the large model application framework; Based on the large model application framework, the prompt words, keyword examples, and the main text of the file to be processed are concatenated to obtain input information; the input information is then input into the instantiated large model, and the file to be processed is processed through the instantiated large model.
8. An information processing device, characterized in that, The device includes: The determination module is used to determine the prompt words corresponding to the file to be processed, as well as keyword examples; wherein, the file to be processed includes policy documents; The processing module is used to process the file to be processed using a large model based on the prompt words and the keyword examples; in response to processing failure, the file to be processed is split into multiple sub-files according to the terms information of the file to be processed; wherein the length of each sub-file is less than the input threshold of the large model; and the keywords of each sub-file are obtained by processing each sub-file using the large model based on the prompt words and the keyword examples.
9. An electronic device, characterized in that, The electronic device includes a processor and a memory for storing computer programs capable of running on the processor; wherein, The processor is used to run the computer program to perform the method according to any one of claims 1 to 7.
10. A non-transient computer storage medium having a computer program stored thereon, characterized in that, When executed by a processor, the computer program implements the method described in any one of claims 1 to 7.
11. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the method of any one of claims 1 to 7.