Text abstract generation method and device, program product and electronic equipment
By segmenting text blocks and generating abstracts using prior information and language models, the problem of insufficient accuracy and comprehensiveness of long text summary in the prior art is solved, and a more efficient summary generation process is achieved.
Patent Information
- Application Number
- CN202411700810.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-25
- Publication Date
- 2025-02-28
AI Technical Summary
The prior art has problems of insufficient accuracy and comprehensiveness when extracting abstracts from long texts.
By obtaining the pending text, dividing it into multiple text blocks, and determining the prompt information based on the general prior information or prior information of the target field, generating local summary information in combination with the language model, and finally integrating it into global summary information.
Improves the accuracy and comprehensiveness of the summary, reduces the processing complexity of long and ultra-long texts, simplifies processing flow and reduces implementation costs.
Smart Images

Figure CN119537581A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of natural language processing, and in particular to a text summary generation method, a text summary generation device, a computer program product, and an electronic device. Background Art
[0002] In the processing scenarios of news, blogs, papers and other texts, it is sometimes necessary to extract summaries from texts, especially long texts. In the related technologies, most of the extracted summaries are insufficient in accuracy and comprehensiveness. Therefore, it is necessary to propose an improvement scheme. Summary of the invention
[0003] The present disclosure provides a text summary generation method, a text summary generation device, a computer program product and an electronic device, so as to at least to some extent solve the problem that the summaries extracted by the related technologies are insufficient in accuracy and comprehensiveness.
[0004] According to a first aspect of the present disclosure, a text summary generation method is provided, the method comprising: obtaining a text to be processed; dividing the text to be processed into a plurality of text blocks; determining first prompt information according to general prior information and / or prior information of a target domain; the target domain is the domain to which the text to be processed belongs; combining each text block with the first prompt information respectively to obtain second prompt information; processing the second prompt information using a first language model to generate local summary information corresponding to each text block; and forming global summary information of the text to be processed by integrating the local summary information.
[0005] Optionally, dividing the text to be processed into multiple text blocks includes at least one of the following methods: obtaining preset delimiters and text segmentation parameters, and dividing the text to be processed into multiple text blocks according to the delimiters and the text segmentation parameters; dividing the text to be processed into sentences, and integrating and / or re-dividing the sentences according to the semantic information of the sentences to obtain multiple text blocks.
[0006] Optionally, determining the first prompt information based on general prior information and / or prior information of the target domain includes: when it is determined that the text to be processed belongs to the target domain, determining the first prompt information based on the prior information of the target domain; when it is impossible to determine the domain to which the text to be processed belongs, determining the first prompt information based on general prior information.
[0007] Optionally, the target domain prior information includes summary rule information of the target domain; and the general prior information includes general context constraint information.
[0008] Optionally, the obtaining of the text to be processed includes: obtaining an original document; extracting text from the original document and performing preprocessing to obtain the text to be processed.
[0009] Optionally, forming the global summary information of the text to be processed by integrating the local summary information includes: splicing the local summary information according to the order of each text block in the text to be processed; and processing the spliced local summary information using an information integration model to obtain the global summary information.
[0010] Optionally, the method further comprises at least one of the following steps: after obtaining the local summary information, performing a first verification process on the local summary information using a first verification model; after obtaining the global summary information, performing a second verification process on the global summary information using a second verification model.
[0011] According to a second aspect of the present disclosure, a text summary generating device is provided, the device comprising: a text acquisition module, configured to acquire a text to be processed; a text segmentation module, configured to segment the text to be processed into a plurality of text blocks; a first prompt engineering module, configured to determine first prompt information according to general prior information and / or prior information of a target domain; the target domain is the domain to which the text to be processed belongs; a second prompt engineering module, configured to respectively combine each text block with the first prompt information to obtain second prompt information; a local summary generating module, configured to process the second prompt information using a first language model to generate local summary information corresponding to each text block; and a global summary generating module, configured to form global summary information of the text to be processed by integrating the local summary information.
[0012] According to a third aspect of the present disclosure, a computer program product is provided, including a computer program, wherein when the computer program is executed by a processor, the method of the first aspect and possible implementations thereof are implemented.
[0013] According to a fourth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the method of the above-mentioned first aspect and its possible implementation methods by executing the executable instructions.
[0014] The technical solution disclosed in this disclosure has the following beneficial effects:
[0015] In the process of generating a summary, general prior information or prior information of the target domain is introduced to determine the first prompt information, the first prompt information and each text block in the text to be processed are combined to obtain the second prompt information, the second prompt information is processed by the first language model to generate local summary information corresponding to each text block, and then integrated to form the global summary information of the text to be processed. In this way, when the first language model processes the second prompt information corresponding to each text block, it can fully learn and mine text information from each text block, and under the guidance of the prior information, it can find key information more accurately, so that the local summary information corresponding to each text block and the global summary information finally integrated have high accuracy and comprehensiveness, and reduce the processing of long texts and super-long texts, which is conducive to simplifying the processing flow and reducing the cost of implementing the solution. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] Figure 1 A flowchart of a text summary generation method in this exemplary embodiment is shown.
[0017] Figure 2 A flow chart for determining first prompt information in this exemplary embodiment is shown.
[0018] Figure 3 A flowchart for obtaining global summary information in this exemplary embodiment is shown.
[0019] Figure 4 A flowchart showing another method for generating a text summary in this exemplary embodiment is shown.
[0020] Figure 5 A schematic diagram of the structure of a network configuration file processing device in this exemplary embodiment is shown.
[0021] Figure 6 A schematic structural diagram of an electronic device in this exemplary embodiment is shown. DETAILED DESCRIPTION
[0022] Exemplary embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings.
[0023] The accompanying drawings are schematic diagrams of the present disclosure and are not necessarily drawn to scale. Some of the block diagrams shown in the accompanying drawings may be functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in hardware modules or integrated circuits, or in networks, processors or microcontrollers. The embodiments can be implemented in various forms and should not be construed as being limited to the examples set forth herein. The features, structures or characteristics described in the present disclosure may be combined in one or more embodiments in any suitable manner. In the description below, many specific details are provided to provide a full description of the embodiments of the present disclosure. However, those skilled in the art should appreciate that one or more specific details may be omitted when implementing the technical solution of the present disclosure, or one or more specific details may be replaced by other methods, components, devices, steps, etc.
[0024] In the processing scenarios of news, blogs, papers and other texts, it is sometimes necessary to extract summaries from texts, especially long texts. In the related technology, encoders and decoders are trained and used to process texts to extract summaries. This method has the problem of insufficient summary accuracy and comprehensiveness, especially when processing long texts, the problem becomes more serious.
[0025] In view of the above problems, an exemplary embodiment of the present disclosure provides a text summary generation method. Figure 1 An exemplary process of a method for processing a network configuration file is shown, which may include the following steps S110 to S160:
[0026] Step S110, obtaining the text to be processed;
[0027] Step S120, dividing the text to be processed into a plurality of text blocks;
[0028] Step S130, determining first prompt information according to the general prior information and / or the prior information of the target domain; the target domain is the domain to which the text to be processed belongs;
[0029] Step S140, combining each text block with the first prompt information to obtain second prompt information;
[0030] Step S150, using the first language model to process the second prompt information to generate local summary information corresponding to each text block;
[0031] Step S160 , forming global summary information of the text to be processed by integrating the local summary information.
[0032] based on Figure 1The method introduces general prior information or prior information of the target domain to determine the first prompt information during the summary generation process, combines the first prompt information with each text block in the text to be processed to obtain the second prompt information, processes the second prompt information using the first language model to generate local summary information corresponding to each text block, and then integrates them to form the global summary information of the text to be processed. In this way, when the first language model processes the second prompt information corresponding to each text block, it can fully learn and mine text information from each text block, and under the guidance of the prior information, it can find key information more accurately, so that the local summary information corresponding to each text block and the global summary information finally integrated have high accuracy and comprehensiveness, and reduce the processing of long texts and super-long texts, which is conducive to simplifying the processing flow and reducing the cost of implementing the solution.
[0033] Below Figure 1 Provide detailed instructions for each step.
[0034] refer to Figure 1 , in step S110, the text to be processed is obtained.
[0035] The text to be processed is the text for which a summary needs to be generated, and can be any type and any length of text. The present disclosure does not limit the method for obtaining the text to be processed, such as the text to be processed can be input by a user.
[0036] In one implementation, the above-mentioned obtaining of the text to be processed may include the following steps:
[0037] Get the original document;
[0038] Extract text from the original document and perform preprocessing to obtain the text to be processed.
[0039] The original document may be a rich text file, including documents in doc, docx, pdf and other formats. The text may be directly extracted from the original document, or extracted by OCR (Optical Character Recognition). For example, the docx package of Python is used to extract text from documents in doc and docx formats, and the pdfplumber package of Python is used to extract text from documents in pdf format.
[0040] Preprocessing includes but is not limited to: data cleaning and text error correction. For example, data cleaning can be performed based on regular expressions or OCR methods to remove irrelevant information such as watermarks and attachments in the text. Text error correction tools, dictionaries, etc. can be used to correct typos in the text, or to correct recognition errors in the text extraction process. The preprocessing process is represented as follows:
[0041]
[0042] Among them, Clean represents the data cleaning operation, and T(x) represents the text after data cleaning, that is, the text to be processed. i Represents text extracted from the original document.
[0043] The above provides a solution for processing original documents, which reduces the initial requirements for the text to be processed and reduces the cost of pre-processing such as early data cleaning.
[0044] Continue to refer Figure 1 In step S120, the text to be processed is divided into multiple text blocks.
[0045] Since the lengths of different texts to be processed vary and there may be long texts, the texts to be processed are divided into text blocks to facilitate subsequent processing and ensure the comprehensiveness of the summary.
[0046] In one embodiment, the above-mentioned dividing the to-be-processed text into a plurality of text blocks includes at least one of the following methods:
[0047] Get the preset delimiter and text segmentation parameters, and divide the text to be processed into multiple text blocks according to the delimiter and text segmentation parameters. Among them, the delimiter can be punctuation marks, paragraph marks, chapter marks, etc. in the text. According to the delimiter, it can be divided according to the sentences, paragraphs, chapters and other structures that originally existed in the text to be processed. The text segmentation parameters include but are not limited to the maximum length and minimum length of the text block, the overlapping length (indicating the character length that can overlap between adjacent text blocks, so that some characters can be divided into multiple adjacent text blocks at the same time, so that a certain amount of information redundancy is left when dividing the text blocks to avoid information loss), etc. The text segmentation parameters are equivalent to setting relevant constraints and rules for the segmentation process, which ensures the regularity of the text blocks to a certain extent and facilitates subsequent processing. Exemplarily, the process of segmenting the text to be processed can refer to the following formula:
[0048]
[0049] Among them, Split represents the segmentation operation, S(x) represents the segmented text block, U represents the separator, and V represents the text segmentation parameter.
[0050] ② Segment the text to be processed into sentences, integrate and / or re-segment the sentences according to the semantic information of the sentences to obtain multiple text blocks. For example, the text to be processed can be segmented into individual sentences by a strategy (such as according to the separator), and then a semantic segmentation model such as Cross-Segment or SeqModel is used to realize text re-segmentation through semantic understanding at the sentence level, or different sentences that express similar semantics or have strong semantic continuity can be integrated, or some sentences can be re-segmented, some sentences can be re-integrated, and the text re-segmented from some sentences can be combined with the text re-segmented from other sentences or other sentences to form text blocks.
[0051] Through one or more of the above methods, the semantic integrity and accuracy of the text can be ensured during text segmentation, which is conducive to the subsequent generation of high-quality summary information.
[0052] Continue to refer Figure 1 In step S130, the first prompt information is determined according to the general prior information and / or the prior information of the target domain; the target domain is the domain to which the text to be processed belongs.
[0053] In this article, prompt information can refer to all or part of the information input into the language model, which is used to provide guidance information for the language model to generate summaries and other information. Prior information can be constraints or knowledge information for summaries that are common to specific fields or all fields, including but not limited to the following: information that should be included in the summary, such as in the medical field, the summary generally needs to cover key information such as symptoms, and in the field of meeting minutes, the summary generally needs to cover key information such as time, place, people, and topics; rules that the summary should comply with, such as the limitation rules on the length of the summary, the authenticity rules, the structural distribution rules of different contents, etc.; knowledge and experience in different fields or industries, such as knowledge bases, professional terminology bases, etc.
[0054] In one embodiment, reference Figure 2 As shown, the above-mentioned determination of the first prompt information according to the general prior information and / or the prior information of the target domain may include the following steps S210 and S220:
[0055] Step S210: when it is determined that the text to be processed belongs to the target domain, first prompt information is determined according to prior information of the target domain.
[0056] Among them, the text to be processed may contain domain-related information, such as a record of which field the entire text belongs to, thereby directly determining the target field. Alternatively, keywords can be extracted from the text to be processed, and the target field can be determined based on the keywords. Alternatively, the semantics of the text to be processed can be understood and the target field can be determined based on the semantics. In one embodiment, a pre-trained domain recognition model can be used to process the text to be processed or one or more text blocks in the text to be processed, and a domain recognition result can be output to determine the target field. When it is determined that the text to be processed belongs to the target field, the first prompt information is determined based on the prior information of the target field. In one embodiment, the prior information of the target field includes summary rule information of the target field. The following formula can be used as a reference:
[0057] P i (x)=Prompt(T(x),C i ) (3)
[0058] Wherein, Prompt represents the operation of generating the first prompt information, P i (x) indicates the first prompt information, C i Represents summary rule information for the target realm.
[0059] Step S220: when the field to which the to-be-processed text belongs cannot be determined, first prompt information is determined according to general prior information.
[0060] In some cases, it may be impossible to determine the field to which the text to be processed belongs, for example, the text to be processed does not directly record the field-related information, or it is impossible to extract field-related keywords from the text to be processed. In this case, the first prompt information can be determined based on the general prior information to obtain the first prompt information with generality. In one embodiment, the general prior information includes general context constraint information.
[0061] P(x)=Prompt(T(x),C) (4)
[0062] Wherein, Prompt represents an operation of generating the first prompt information, P(x) represents the first prompt information, and C represents the general context constraint information.
[0063] Continue to refer Figure 1 In step S140, each text block is combined with the first prompt information to obtain the second prompt information.
[0064] Exemplarily, for the entire text to be processed, unified first prompt information can be obtained, and the first prompt information is combined with each text block to obtain second prompt information corresponding to each text block.
[0065] In one implementation, the first prompt information may be split according to different text blocks to obtain first prompt sub-information corresponding to each text block, and each text block may be combined with the corresponding first prompt sub-information to obtain second prompt information corresponding to each text block.
[0066] Continue to refer Figure 1 In step S150, the second prompt information is processed using the first language model to generate local summary information corresponding to each text block.
[0067] The first language model can be any AI (Artificial Intelligence) language model, such as a large language model (LLM). The first language model can be a pre-training model, or a model that has been fully trained or fine-tuned for a specific field or scenario. Local summary information is summary information for a single text block, expressing the key content of a single text block. It is local information for the entire text to be processed, so it is called local summary information.
[0068] Exemplarily, after the second prompt information corresponding to each text block is obtained, it is respectively input into the first language model, and after processing, the local summary information corresponding to each text block is output.
[0069] In one implementation, parameters such as temperature of the first language model may be adjusted to adjust the randomness of the local summary information, so as to control the accuracy of summary generation.
[0070] Exemplarily, the process of generating local summary information can refer to the following formula:
[0071]
[0072] Among them, Generate represents the summary generation function, that is, the first language model. A(x) represents the local summary information.
[0073] Continue to refer Figure 1 In step S160, the global summary information of the text to be processed is formed by integrating the local summary information.
[0074] The global summary information is the summary information of the entire text to be processed, which can reflect the key content of the entire text to be processed, so it is called the global summary information. For example, the local summary information can be spliced or merged based on regular expressions to form the global summary information, and further processing can be performed on the basis of splicing or merging, such as deleting duplicate information, to obtain the global summary information.
[0075] In one embodiment, reference Figure 3 As shown, the above-mentioned process of integrating the local summary information to form the global summary information of the text to be processed may include the following steps S310 and S320:
[0076] Step S310, splicing the local summary information according to the order of each text block in the text to be processed;
[0077] Step S320: Process the spliced local summary information using the information integration model to obtain global summary information.
[0078] For example, the local summary information corresponding to text block 1 is arranged in the front, and the local summary information corresponding to text block 2 is spliced thereafter. Similarly, all local summary information is spliced together in text order. Then the information integration model is used for processing. The information integration model can be a pre-trained model, or it can be a model that has been fully trained or fine-tuned for a specific field or scenario. Exemplarily, the information integration model can be a T5 model (Text-to-Text Transfer Transformer, a natural language processing model based on the Transformer structure), or it can be other natural language processing models. The spliced local summary information is input into the information integration model, and after processing, the global summary information is output.
[0079] The above integration process can refer to the following formula:
[0080]
[0081] Among them, T5 represents the T5 model, and O(x) represents the integrated global summary information.
[0082] In one embodiment, the text summary generation method further includes at least one of the following steps:
[0083] After obtaining the local summary information, performing a first verification process on the local summary information using a first verification model;
[0084] After the global summary information is obtained, a second verification process is performed on the global summary information using a second verification model.
[0085] Among them, the first verification process is used to verify whether the local summary information has errors or does not conform to language habits and rules, and may include one or more processing methods. The first verification model may include one or more machine learning models for implementing the first verification process. Exemplarily, the first verification process may include but is not limited to: text correction and text optimization (such as polishing) for local summary information. The first verification model includes a BERT model and a second language model. The second language model can be a pre-trained model, or a model that has been fully trained or fine-tuned for a specific field or scenario, and can be the same model as the above-mentioned first language model or a different model. The local summary information is input into the BERT model to implement text correction, and the local summary information after the text correction is obtained, and then the local summary information after the text correction is input into the second language model (such as after being combined with the first text polishing template, the first text polishing template is used to guide the second language model to perform text polishing) to achieve text polishing and obtain the local summary information after the first verification process.
[0086] The first verification process can refer to the following formula:
[0087]
[0088]
[0089] Among them, BERT represents the BERT model, Refine represents text polishing, that is, the second language model, C(x) represents the local summary information after text error correction, and R(x) represents the local summary information after text error correction and text polishing, that is, the local summary information after the first verification processing.
[0090] It should be understood that if the first verification process is performed on the local summary information, then in step S160, the global summary information of the text to be processed can be formed by integrating the local summary information after the first verification process.
[0091] The second verification process is used to verify whether the global summary information has errors or does not conform to language habits and rules, and corresponding optimization can also be performed. The second verification model may include one or more machine learning models for implementing the second verification process. Exemplarily, the second verification process may include but is not limited to: text error correction and text optimization (such as polishing) for the global summary information. The second verification model includes a BERT model and a third language model. The third language model can be a pre-trained model, or a model that has been fully trained or fine-tuned for a specific field or scenario, and can be the same model as the first or second language model or a different model. For example, the second language model is the same as the third language model and different from the first language model. The global summary information is input into the BERT model to implement text error correction, and the global summary information after text error correction is obtained, and then the global summary information after text error correction is input into the third language model (such as after combining with the second text polishing template, the second text polishing template is used to guide the third language model to perform text polishing, which can be the same as or different from the first text polishing template) to achieve text polishing and obtain the global summary information after the second verification process. The global summary information can be the summary information finally output.
[0092] Through the above first verification process or the second verification process, the accuracy and fluency of the local summary information or the global summary information can be effectively improved.
[0093] In one embodiment, when the text to be processed is divided into text blocks. The first prompt information corresponding to each text block can be determined according to the general prior information and / or the prior information of the target field, and in combination with each text block. Then each text block is combined with the corresponding first prompt information to obtain the second prompt information corresponding to each text block. Exemplarily, the key fields of the target field covered in each text block can be identified according to the prior information of the target field, such as identifying the keywords in the text block, and determining the key fields corresponding to the keywords, i.e. the key fields of the target field covered in the text block. The key fields can reflect the key information of which aspects of the target field the text block is involved in. The first prompt information corresponding to the text block is formed based on the key fields, or the first prompt information corresponding to the text block is formed based on the prior information of the target field and the key fields, such as combining the prior information of the target field and the key fields to obtain the first prompt information. Adding the relevant information of the key fields in the first prompt information can play the role of prompting the language model (such as the first language model) to extract which important contents from the text block.
[0094] In one embodiment, the text blocks can be sorted according to the key fields of the target domain covered in each text block. The prior information of the target domain may include the order of the key fields, indicating the order of different information in the text summary of the target domain, which conforms to people's reading habits. According to the sorting results of the text blocks, the local summary information corresponding to each text block is integrated to obtain the global summary information.
[0095] In one embodiment, the local summary information may include summary information corresponding to different key fields. One or more local summary information may be split according to the key fields to obtain summary information corresponding to a single key field, and then the summary information corresponding to different key fields may be integrated according to the order of the key fields included in the prior information of the target domain to obtain the global summary information.
[0096] Figure 4 A schematic flow chart of a text summary generation method is shown, comprising the following steps:
[0097] Step S401, extracting text from an original document in a rich text format and preprocessing it to obtain a text to be processed;
[0098] Step S402, dividing the text to be processed into a plurality of text blocks;
[0099] Step S403, determining first prompt information according to the general prior information and / or the prior information of the target domain;
[0100] Step S404, combining each text block with the first prompt information to obtain second prompt information corresponding to each text block;
[0101] Step S405, inputting each text block into the first language model for processing to generate local summary information corresponding to each text block;
[0102] Step S406, performing a first verification process on the local summary information;
[0103] Step S407, integrating the local summary information after the first verification process to obtain global summary information;
[0104] Step S408: perform a second verification process on the global summary information, and output the global summary information after the second verification process.
[0105] The exemplary embodiment of the present disclosure also provides a text summary generation device. Figure 5 As shown, the text summary generating device 500 may include:
[0106] The text acquisition module 510 is configured to acquire the text to be processed;
[0107] The text segmentation module 520 is configured to segment the text to be processed into a plurality of text blocks;
[0108] The first prompt engineering module 530 is configured to determine the first prompt information according to the general prior information and / or the prior information of the target domain; the target domain is the domain to which the text to be processed belongs;
[0109] The second prompt engineering module 540 is configured to combine each text block with the first prompt information to obtain second prompt information;
[0110] A local summary generating module 550 is configured to process the second prompt information using a first language model to generate local summary information corresponding to each text block;
[0111] The global summary generating module 560 is configured to form the global summary information of the text to be processed by integrating the local summary information.
[0112] In one embodiment, dividing the text to be processed into multiple text blocks includes at least one of the following methods: obtaining preset delimiters and text segmentation parameters, and dividing the text to be processed into multiple text blocks according to the delimiters and the text segmentation parameters; dividing the text to be processed into sentences, and integrating and / or re-dividing the sentences according to the semantic information of the sentences to obtain multiple text blocks.
[0113] In one embodiment, the determining of the first prompt information based on general prior information and / or prior information of the target domain includes: when it is determined that the text to be processed belongs to the target domain, determining the first prompt information based on the prior information of the target domain; when it is impossible to determine the domain to which the text to be processed belongs, determining the first prompt information based on general prior information.
[0114] In one implementation, the target domain prior information includes summary rule information of the target domain; and the general prior information includes general context constraint information.
[0115] In one implementation, the obtaining of the text to be processed includes: obtaining an original document; extracting text from the original document and performing preprocessing to obtain the text to be processed.
[0116] In one embodiment, the forming of the global summary information of the text to be processed by integrating the local summary information includes: splicing the local summary information according to the order of each text block in the text to be processed; and processing the spliced local summary information using an information integration model to obtain the global summary information.
[0117] In one embodiment, the local summary generation module 550 is further configured to: after obtaining the local summary information, perform a first verification process on the local summary information using a first verification model; and / or the global summary generation module 560 is further configured to: after obtaining the global summary information, perform a second verification process on the global summary information using a second verification model.
[0118] The specific details of each part of the above-mentioned device have been described in detail in the implementation method of the method part. The undisclosed details can be found in the implementation method of the method part, so they will not be repeated here.
[0119] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the exemplary embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. Conversely, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0120] The exemplary embodiments of the present disclosure also provide a computer program product, which includes a computer program, and when the computer program is executed by a processor, the above-mentioned named entity recognition method is implemented.
[0121] In one embodiment, the computer program product may be a tangible product containing a computer program, such as a computer-readable storage medium storing a computer program. The readable storage medium may be a storage medium based on electrical, magnetic, optical, electromagnetic, infrared, or other signals, including but not limited to: random access memory (RAM), read-only memory (ROM), magnetic tape, floppy disk, flash memory (Flash), mechanical hard disk (HDD), solid-state drive (SSD), and the like. Exemplarily, the computer program product may be implemented as a non-volatile storage medium storing a computer program, such as a read-only memory, a NAND flash memory, and the like.
[0122] In one embodiment, the computer program product may be an intangible product including a computer program. Exemplarily, the computer program product may be implemented as a virtual digital product, such as a digital file storing an executable file, an installation package, etc. of the computer program.
[0123] The code of the computer program can be written in one or more programming languages. Programming languages such as C language, Java, C++, etc. The program code can be executed entirely on the user computing device, or partially on the user computing device, or as a separate software package, or partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In the case of a remote computing device, the remote computing device can be connected to the user computing device through any type of network, such as a local area network (LAN), a wide area network (WAN), etc., or can be connected to an external computing device (e.g., an Internet connection provided by an operator).
[0124] Computer programs can be carried or transmitted through electrical, magnetic, optical, electromagnetic, infrared and other signals. Electronic devices can convert signals carrying computer programs into digital signals to run computer programs. When a computer program is running on an electronic device, its code is used to enable the electronic device to execute (more specifically, the processor of the electronic device can execute) the method steps of various exemplary embodiments of the present disclosure, such as the following steps: Step S110, obtain the text to be processed; Step S120, divide the text to be processed into multiple text blocks; Step S130, determine the first prompt information based on the general prior information and / or the prior information of the target field; the target field is the field to which the text to be processed belongs; Step S140, respectively combine each text block and the first prompt information to obtain the second prompt information; Step S150, use the first language model to process the second prompt information to generate local summary information corresponding to each text block; Step S160, form the global summary information of the text to be processed by integrating the local summary information.
[0125] The above method is executed based on a computer program. In the process of generating a summary, general prior information or prior information of the target field is introduced to determine the first prompt information, the first prompt information and each text block in the text to be processed are combined to obtain the second prompt information, the second prompt information is processed by the first language model to generate local summary information corresponding to each text block, and then integrated to form the global summary information of the text to be processed. In this way, when the first language model processes the second prompt information corresponding to each text block, it can fully learn and mine text information from each text block, and under the guidance of the prior information, it can find key information more accurately, so that the local summary information corresponding to each text block and the global summary information finally integrated have high accuracy and comprehensiveness, and reduce the processing of long texts and super-long texts, which is conducive to simplifying the processing flow and reducing the cost of implementing the solution.
[0126] The exemplary embodiments of the present disclosure also provide an electronic device. The electronic device may include a processor and a memory. The memory stores executable instructions of the processor, such as a computer program. The processor executes the method steps of various exemplary embodiments of the present disclosure by executing the executable instructions.
[0127] Reference below Figure 6 , the electronic device is exemplarily described in the form of a general-purpose computing device. It should be understood that Figure 6 The electronic device 600 shown is only an example and should not limit the functions and scope of use of the embodiments of the present disclosure.
[0128] like Figure 6 As shown, the electronic device 600 may include: a processor 610 , a memory 620 , a bus 630 , an I / O (input / output) interface 640 , and a network adapter 650 .
[0129] The memory 620 may include a volatile memory, such as a RAM 621, a cache unit 622, and may also include a non-volatile memory, such as a ROM 623. The memory 620 may also include one or more program modules 624, such program modules 624 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or a combination thereof may include the implementation of a network environment. For example, the program module 624 may include each module in the above-mentioned device.
[0130] The processor 610 may include one or more processing units. For example, the processor 610 may include an AP (Application Processor), a modem processor, a GPU (Graphics Processing Unit), an ISP (Image Signal Processor), a controller, an encoder, a decoder, a DSP (Digital Signal Processor), a baseband processor and / or an NPU (Neural-Network Processing Unit), etc.
[0131] The processor 610 can be used to execute the executable instructions stored in the memory 620, which may include method steps of various exemplary embodiments of the present disclosure, such as executing the following steps: step S110, obtaining the text to be processed; step S120, dividing the text to be processed into multiple text blocks; step S130, determining the first prompt information according to the general prior information and / or the prior information of the target domain; the target domain is the domain to which the text to be processed belongs; step S140, combining each text block and the first prompt information respectively to obtain the second prompt information; step S150, processing the second prompt information using the first language model to generate local summary information corresponding to each text block; step S160, forming the global summary information of the text to be processed by integrating the local summary information.
[0132] Based on the processor 610 executing the above method, in the summary generation process, general prior information or prior information of the target field is introduced to determine the first prompt information, the first prompt information and each text block in the text to be processed are combined to obtain the second prompt information, the second prompt information is processed by the first language model to generate local summary information corresponding to each text block, and then integrated to form the global summary information of the text to be processed. In this way, when the first language model processes the second prompt information corresponding to each text block, it can fully learn and mine text information from each text block, and under the guidance of the prior information, it can find key information more accurately, so that the local summary information corresponding to each text block and the global summary information finally integrated have high accuracy and comprehensiveness, and reduce the processing of long texts and super-long texts, which is conducive to simplifying the processing flow and reducing the cost of implementing the solution.
[0133] The bus 630 is used to realize the connection between different components of the electronic device 600, and may include a data bus, an address bus, and a control bus.
[0134] The electronic device 600 can communicate with one or more external devices 700 (eg, a keyboard, a mouse, an external controller, etc.) through the I / O interface 640 .
[0135] The electronic device 600 can communicate with one or more networks through the network adapter 650. For example, the network adapter 650 can provide mobile communication solutions such as 3G / 4G / 6G, or wireless communication solutions such as wireless LAN, Bluetooth, near field communication, etc. The network adapter 650 can communicate with other modules of the electronic device 600 through the bus 630.
[0136] although Figure 6Not shown, other hardware and / or software modules may also be provided in the electronic device 600, including but not limited to: a display, a microcode, a device driver, a redundant processor, an external disk drive array, a RAID system, a tape drive, and a data backup storage system.
[0137] As can be seen from the above, the technical solution of the present disclosure can be implemented as a method, an apparatus, a system, a computer program product, a storage medium, an electronic device, etc. Those skilled in the art can understand that various aspects of the present disclosure can be specifically implemented in the following forms, namely: a complete hardware implementation, a complete software implementation (including firmware, microcode, etc.), or an implementation combining hardware and software, such as being respectively referred to as a "circuit", "module" or "system".
[0138] It should be understood that the present disclosure is not limited to the specific method steps or structures described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from the scope thereof. Those skilled in the art will easily think of other embodiments based on the specific embodiments provided by the present disclosure. Therefore, the specific embodiments provided by the present disclosure are only exemplary, and the scope and spirit of the present disclosure are indicated by the claims, and any variations, uses or adaptive changes of the present disclosure should be covered, which follow the general principles of the present disclosure and include common knowledge or customary technical means in the technical field that are not disclosed in the present disclosure.
Claims
1. A text summary generation method, characterized in that: The method comprises: Get the text to be processed; Splitting the text to be processed into multiple text blocks; Determining first prompt information according to general prior information and / or prior information of a target domain; the target domain is the domain to which the text to be processed belongs; Combining each text block with the first prompt information to obtain second prompt information; Processing the second prompt information using the first language model to generate local summary information corresponding to each text block; The global summary information of the text to be processed is formed by integrating the local summary information.
2. The method according to claim 1, characterized in that The step of dividing the to-be-processed text into a plurality of text blocks includes at least one of the following methods: Obtaining a preset delimiter and text segmentation parameters, and segmenting the to-be-processed text into a plurality of text blocks according to the delimiter and the text segmentation parameters; The text to be processed is segmented into sentences, and the sentences are integrated and / or re-segmented according to semantic information of the sentences to obtain a plurality of text blocks.
3. The method according to claim 1, characterized in that The determining of the first prompt information according to the general prior information and / or the prior information of the target domain includes: In the case where it is determined that the text to be processed belongs to the target domain, determining the first prompt information according to prior information of the target domain; When the field to which the to-be-processed text belongs cannot be determined, the first prompt information is determined according to general prior information.
4. The method according to claim 3, characterized in that The prior information of the target domain includes summary rule information of the target domain; and the general prior information includes general context constraint information.
5. The method according to claim 1, characterized in that: The step of obtaining the text to be processed includes: Get the original document; The text is extracted from the original document and preprocessed to obtain the text to be processed.
6. The method according to claim 1, characterized in that The step of forming the global summary information of the text to be processed by integrating the local summary information includes: splicing the local summary information according to the order of each text block in the text to be processed; The information integration model is used to process the spliced local summary information to obtain the global summary information.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises at least one of the following steps: After obtaining the local summary information, performing a first verification process on the local summary information using a first verification model; After the global summary information is obtained, a second verification process is performed on the global summary information using a second verification model.
8. A text summary generation device, characterized in that: The device comprises: A text acquisition module is configured to acquire the text to be processed; A text segmentation module, configured to segment the to-be-processed text into a plurality of text blocks; A first prompt engineering module is configured to determine first prompt information according to general prior information and / or prior information of a target domain; the target domain is the domain to which the text to be processed belongs; A second prompt engineering module is configured to combine each text block with the first prompt information to obtain second prompt information; A local summary generating module is configured to process the second prompt information by using a first language model to generate local summary information corresponding to each text block; The global summary generation module is configured to form global summary information of the text to be processed by integrating the local summary information.
9. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device, characterized in that: include: processor; as well as A memory, configured to store executable instructions of the processor; The processor is configured to perform the method of any one of claims 1 to 7 by executing the executable instructions.
Citation Information
Cited By
Text processing method and device, electronic equipment, storage medium and program product
CN120523936A