A method, apparatus and equipment for generating public notices
By obtaining basic announcement information and upstream documents, using the historical case library and outline template library to generate announcement document generation instructions, and calculating them in a large-scale language model, combined with retrieval-enhanced generation technology, the problem of lack of creativity and personalization in announcement document generation is solved. , improve the level of automation and accuracy, and reduce the workload.
Patent Information
- Application Number
- CN202410943328.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-15
- Publication Date
- 2024-09-20
- Estimated Expiration
- 2044-07-15
AI Technical Summary
When generating announcement documents, the existing technology lacks creativity and personalized expression, makes it difficult to flexibly respond to special situations, has a heavy workload, and lacks automation and accuracy.
By obtaining the basic information of the announcement and upstream documents, using the historical case library and outline template library, the announcement document generation instructions are generated, and input into the large-scale language model for calculation. Combined with the retrieval enhancement generation technology, external relevant knowledge is extracted to generate highly professional and Accurate announcement document.
It improves the automation level and accuracy of announcement documents, reduces workload, avoids excessive associations from large-scale language models, and reduces model annotation work.
Smart Images

Figure CN118485054B
Abstract
Description
Technical Field
[0001] The embodiments of this specification relate to the field of artificial intelligence technology, and in particular, to a method, device and equipment for generating public announcement documents. Background Art
[0002] With the development of robotic process automation technology, most announcement documents are currently generated in an automated way, such as methods based on robotic process automation (RPA) and announcement templates, generative model methods, and large model methods for single vector library case retrieval.
[0003] However, although the method based on robotic process automation (RPA) and announcement templates is simple and fast, the templates used in this method require a large number of fixed text fragments, so that the generated documents are often stereotyped and lack the necessary creativity and personalized expression. In addition, they are highly dependent on preset templates. It is difficult to respond flexibly to element types or special circumstances not covered in the templates, resulting in the generated documents being unable to meet actual needs. When the templates or template elements involved change, the rules need to be manually updated, which results in a large maintenance workload.
[0004] The traditional generative model method is pre-trained on general corpus data, and then fine-tuned on specific text generation tasks. During the fine-tuning stage, it is necessary to manually annotate the original materials to the training set of the final announcement content. The model will use this training set for further training, capturing the complexity and specific format of the text through a large number of example documents, so that the model can better understand the materials and generate reports. Although this method improves flexibility, it is insufficient in terms of diversity. The generated text may appear too standardized and lack personalized expression. The acceptable length of the input information and the maximum length of the output text are both small, making it difficult to meet the complex and diverse document scenarios. For new types of templates or template elements that the model has not seen, a large amount of data needs to be collected and annotated again, resulting in a large workload.
[0005] The large model method of single vector library similar case retrieval usually uses a text embedding model to vectorize historical case text or text blocks and store them in the vector database. In use, the related similar cases are obtained as RAG context prompts through vector matching text similarity. Then the RAG text is spliced to generate the prompt and call the large model for generation. However, since the announcement has relatively many fixed sentences and grammars, the proportion of key information in the semantic vector becomes weak, which will cause the similarity between texts to be not very referenceable.
[0006] How to generate highly professional and accurate announcement documents and improve the level of automation and reduce the workload to a certain extent is a problem that needs to be solved urgently. Summary of the invention
[0007] The embodiments of this specification provide a method, device and equipment for generating announcement documents, which utilize the powerful text generation capabilities of large-scale language models and the information richness of retrieval-enhanced generation technology to generate announcement documents, thereby improving the automation level, professionalism and accuracy of announcement document generation and significantly reducing workload.
[0008] The specific technical solutions of the embodiments of this specification are as follows:
[0009] On the one hand, the embodiment of this specification provides a method for generating a public notice document, including:
[0010] Obtaining basic announcement information and upstream documents corresponding to the announcement document to be generated, wherein the upstream document indicates subject information corresponding to the announcement document to be generated;
[0011] Obtaining historical cases corresponding to the upstream documents from the historical case library as reference cases;
[0012] Obtaining an outline template corresponding to the basic information of the announcement from an outline template library;
[0013] Generate announcement document generation instructions based on the upstream documents, outline templates and reference cases;
[0014] The announcement document generation instruction is input into a pre-trained large-scale language model for calculation to obtain the announcement document.
[0015] Furthermore, the basic information of the announcement includes the type of announcement;
[0016] Acquiring an outline template corresponding to the basic information of the announcement from an outline template library further includes:
[0017] An outline template corresponding to the announcement type is obtained from the outline template library, wherein the outline template library includes a plurality of announcement types and pre-established outline templates corresponding to each announcement type.
[0018] Furthermore, the historical case library includes a case text library, a case vector library and an element knowledge library.
[0019] Furthermore, the steps of constructing the case text library include:
[0020] Using the outline template corresponding to the historical case to semi-structure the historical case, obtain the text paragraph structure of the historical case and the text paragraph contents corresponding to the multiple text paragraphs, and store the correspondence between the text paragraph structure, the text paragraph contents, the text paragraphs and the historical case in the case text library;
[0021] The steps of constructing the case vector library include:
[0022] Converting the text paragraph content of the historical case in the case text library into a historical case vector through a text embedding model, and storing the corresponding relationship between the historical case vector, the text paragraph and the historical case in the case vector library;
[0023] The steps of constructing the element knowledge base include:
[0024] The text paragraph contents of the historical cases in the case text library are converted into historical case elements through a knowledge extraction model, and the corresponding relationship among the historical case elements, text paragraphs and historical cases is stored in the case vector library.
[0025] Furthermore, obtaining historical cases corresponding to the upstream documents from the historical case library as reference cases further includes:
[0026] According to the upstream document, the text paragraph content is matched in the case text library by conditional screening and full-text retrieval, and the matched text paragraph content belonging to the same historical case is obtained, and the text paragraph content, the corresponding text paragraph, the corresponding text paragraph structure and the historical case to which it belongs are used as reference case text;
[0027] The upstream document is converted into a semantic vector through a text embedding model, and the historical case vector is matched in the case vector library through conditional screening and full-text retrieval according to the semantic vector of the upstream document, and the text paragraph corresponding to the matched historical case vector is obtained, and the text paragraph corresponding to the historical case vector and the historical case are used as reference case vectors;
[0028] Extract case elements from the upstream document through a knowledge extraction model, match historical case elements in the element knowledge base through conditional screening and full-text retrieval according to the case elements of the upstream document, and obtain text paragraphs corresponding to the matched historical case elements, and use the historical case elements, the corresponding text paragraphs and the historical case as reference case elements;
[0029] The reference case text, reference case vector and reference case elements are aggregated according to corresponding text paragraphs and the text paragraph structure to obtain the reference case.
[0030] Furthermore, the reference case text, the reference case vector and the reference case elements are aggregated according to the corresponding text paragraphs and the text paragraph structure to obtain the reference case further comprising:
[0031] Aggregate the text paragraph content, historical case vector, and historical case elements corresponding to the same text paragraph under the same historical case to obtain a text paragraph case corresponding to the text paragraph;
[0032] Multiple text paragraph cases under the same historical case are aggregated according to the text paragraph structure corresponding to the historical case to obtain the reference case.
[0033] Furthermore, the method further comprises:
[0034] Calculating a first matching score between each reference case text and the upstream document;
[0035] Calculating a second matching score between each reference case vector and the semantic vector of the upstream document;
[0036] calculating a third matching score between each reference case element and the case element of the upstream instrument;
[0037] When multiple reference cases are obtained, for each reference case, a weighted sum is performed based on the first matching score of the reference case text, the second matching score of the reference case vector, and the third matching score of the reference case element corresponding to each text paragraph case in the reference case to obtain a paragraph aggregation score of the text paragraph case, and a final score of the reference case is calculated based on the paragraph aggregation scores of multiple text paragraph cases under the reference case;
[0038] At least one reference case whose final score meets a predetermined score requirement is selected from the multiple reference cases as a final reference case.
[0039] Furthermore, generating an announcement document generation instruction based on the upstream document, outline template and reference case further includes:
[0040] Extracting contents corresponding to the multiple sections of the outline template in the reference case;
[0041] The announcement document generation instruction is generated according to the contents corresponding to multiple sections of the upstream document and outline template.
[0042] On the other hand, the embodiment of this specification also provides a device for generating a public notice document, the device comprising:
[0043] An information acquisition unit, used to acquire basic announcement information and an upstream document corresponding to the announcement document to be generated, wherein the upstream document indicates subject information corresponding to the announcement document to be generated;
[0044] A reference case determination unit, used to obtain a historical case corresponding to the upstream document from a historical case library as a reference case;
[0045] An outline template determining unit, used to obtain an outline template corresponding to the basic information of the announcement from an outline template library;
[0046] An announcement document generation instruction generating unit, used to generate an announcement document generation instruction according to the upstream document, outline template and reference case;
[0047] The announcement document generation unit is used to input the announcement document generation instruction into a pre-trained large-scale language model for calculation to obtain the announcement document.
[0048] On the other hand, an embodiment of the present specification further provides a computer device, including a memory, a processor, and a computer program stored in the memory, and the processor implements the above method when executing the computer program.
[0049] Using the embodiment of this specification, first obtain the basic information of the announcement and the upstream document corresponding to the announcement document to be generated, then obtain the historical case corresponding to the upstream document from the historical case library as a reference case, then obtain the outline template corresponding to the basic information of the announcement from the outline template, then generate the announcement document generation instruction according to the upstream document, the outline template and the reference case, and finally input the announcement generation instruction into the pre-trained large-scale language model for calculation to obtain the announcement document. The embodiment of this specification introduces the historical case library, and combines the use of retrieval enhancement generation technology to retrieve from historical cases, so as to extract the external relevant knowledge corresponding to the upstream document of the announcement document to be generated, and use the external relevant knowledge to guide the large-scale language model to more accurately generate a more informative announcement document, and use the external relevant knowledge to input the prompt information into the large-scale language model, so as to avoid the large-scale language model from generating too many associations, thereby improving the accuracy of the announcement document, and the embodiment of this specification does not require the staff to repeatedly perform model annotation, and only needs to store the historical cases in the historical case library to enrich the historical case information, thereby reducing the workload of the staff. BRIEF DESCRIPTION OF THE DRAWINGS
[0050] In order to more clearly illustrate the embodiments of this specification or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0051] Figure 1 It is a schematic diagram of a system for implementing a method for generating a public notice document in an embodiment of this specification;
[0052] Figure 2 The figure is a flow chart of a method for generating a public notice document according to an embodiment of the present specification;
[0053] Figure 3The figure is a schematic diagram of the process of constructing a historical case library in the embodiment of this specification;
[0054] Figure 4 It is a flowchart of obtaining a historical case corresponding to the upstream document from a historical case library as a reference case in an embodiment of this specification;
[0055] Figure 5 The figure shows a flow chart of obtaining the reference case by aggregating the reference case text, the reference case vector and the reference case elements according to the corresponding text paragraphs and the text paragraph structure in the embodiment of the present specification;
[0056] Figure 6 The figure is a schematic diagram of the process of determining the final reference case in the embodiment of this specification;
[0057] Figure 7 Shown is a flow chart of a method for matching relevant historical case data in an embodiment of this specification;
[0058] Figure 8 It is a schematic diagram of the process of generating an announcement document generation instruction according to the upstream document, outline template and reference case in the embodiment of this specification;
[0059] Fig. 9 It is a flowchart of the method for generating announcement content based on large-scale language model and retrieval enhancement generation in the embodiment of this specification;
[0060] Fig.10 The figure shows a schematic diagram of the structure of a notification document generating device in an embodiment of the present specification;
[0061] Fig.11 The figure is a schematic diagram of the structure of a computer device in an embodiment of the present specification.
[0062]
Description of reference numerals
[0063] 101. Terminal;
[0064] 102. Server;
[0065] 1001. Information acquisition unit;
[0066] 1002. Reference case determination unit;
[0067] 1003. Outline template determination unit;
[0068] 1004. Announcement document generation instruction generation unit;
[0069] 1005. Announcement document generation unit;
[0070] 1102. Computer equipment;
[0071] 1104. Processing equipment;
[0072] 1106. Storage resources;
[0073] 1108. Driving mechanism;
[0074] 1110, input / output module;
[0075] 1112. Input device;
[0076] 1114. Output device;
[0077] 1116. Presentation equipment;
[0078] 1118. Graphical user interface;
[0079] 1120, network interface;
[0080] 1122. Communication link;
[0081] 1124. Communication bus. DETAILED DESCRIPTION
[0082] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. Based on the embodiments in the embodiments of this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the embodiments of this specification.
[0083] It should be noted that the terms "first", "second", etc. in the description and claims of the embodiments of this specification and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the embodiments of this specification described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, device, product or equipment that includes a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or equipment.
[0084] It should be noted that the acquisition, storage, use, and processing of data in the technical solutions of the embodiments of this specification comply with the relevant provisions of national laws and regulations.
[0085] It should be noted that in the embodiments of this specification, certain software, components, models and other existing solutions in the industry may be mentioned, which should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solution of this application, but it does not mean that the applicant has or will necessarily use the solution.
[0086] like Figure 1 The diagram is a schematic diagram of an implementation system for generating an announcement document in an embodiment of the present specification, including a terminal 101 and a server 102. The terminal 101 and the server 102 can communicate with each other through a network, which may include a local area network (LAN), a wide area network (WAN), the Internet or a combination thereof, and is connected to a website, a user device (such as a computing device) and a back-end system.
[0087] The user can input the basic information of the announcement and the upstream document of the announcement document to be generated into the server 102 through the terminal 101. The server 102 stores the historical case library, the outline template library and the pre-trained large-scale language model. The server 102 generates the announcement document based on the basic information of the announcement and the announcement document based on the historical case library, the outline template library and the large-scale language model, and then provides the announcement document to the user through the terminal 101.
[0088] Alternatively, the server 102 may be a node of a cloud computing system (not shown), or each server may be a separate cloud computing system including a plurality of computers interconnected by a network and operating as a distributed processing system.
[0089] In addition, it should be noted that Figure 1 What is shown is only an application environment provided by the embodiment of this specification. In actual application, it can also be applied to other environments, and this specification does not limit it.
[0090] In response to the problems existing in the prior art, an embodiment of this specification provides a method for generating announcement documents, which utilizes the powerful text generation capabilities of a large-scale language model and the information richness of retrieval-enhanced generation technology to generate announcement documents, thereby improving the automation level, professionalism and accuracy of announcement document generation and significantly reducing the workload. Figure 2 The figure shows a flowchart of a method for generating an announcement document according to an embodiment of the present specification. The figure describes the process of generating an announcement document. The order of steps listed in the embodiment is only one way of executing the steps among many orders, and does not represent the only order of execution. When the actual system or device product is executed, it can be executed in the order or in parallel according to the method shown in the embodiment or the accompanying drawings. Specifically, Figure 2 As shown, the method may be executed by the server 102, and may include:
[0091] Step 201: Obtaining basic announcement information and upstream documents corresponding to the announcement document to be generated, wherein the upstream document indicates subject information corresponding to the announcement document to be generated;
[0092] Step 202: Obtain a historical case corresponding to the upstream document from a historical case library as a reference case;
[0093] Step 203: Acquire an outline template corresponding to the basic information of the announcement from an outline template library;
[0094] Step 204: Generate an announcement document generation instruction based on the upstream document, outline template and reference case;
[0095] Step 205: Input the announcement document generation instruction into a pre-trained large-scale language model for calculation to obtain the announcement document.
[0096] The embodiments of this specification introduce a historical case library, and use retrieval enhancement generation technology to search from historical cases, so as to extract external relevant knowledge corresponding to the upstream documents of the announcement document to be generated, and use the external relevant knowledge to guide the large-scale language model to more accurately generate more information-rich announcement documents. The external relevant knowledge can also be used to input prompt information into the large-scale language model to avoid excessive associations in the large-scale language model, thereby improving the accuracy of the announcement document. In addition, the embodiments of this specification do not require staff to repeatedly annotate models. They only need to store historical cases in the historical case library to enrich the historical case information, thereby reducing the workload of staff.
[0097] In the embodiments of the present specification, the upstream document represents the subject information corresponding to the announcement document to be generated. The upstream document needs to include the names of multiple parties involved in the case, the cause of the case and the document type. The document type may include judgments, notices, public notices, etc. For example, the upstream document is the name of the judgment, such as "The second instance judgment on the copyright ownership and infringement dispute between XX Personnel Publishing House Co., Ltd. and XX Company".
[0098] In the embodiment of this specification, the basic information of the announcement includes the announcement type, so that the outline template corresponding to the announcement type is obtained from the outline template library. The announcement type can include internal enterprise announcements, community announcements, campus announcements, court announcements, etc. Specifically, the large category of announcement types can be further subdivided, for example, court announcements include judgment documents, etc., which are not limited in the embodiment of this specification. It can be understood that the formats of announcement documents corresponding to different announcement types are different, so the embodiment of this specification pre-constructs outline templates corresponding to multiple announcement types and stores them in the outline template library.
[0099] Exemplarily, the method of the embodiment of this specification can be applied to the generation of court announcement documents. The upstream document is the name of the judgment issued by the court. The announcement type includes the judgment document, etc. The basic information includes the cause of action, case number and document type, etc. The document type includes civil judgment, criminal judgment, etc.
[0100] In the embodiments of this specification, the outline template can be obtained by the staff after summarizing multiple types of announcement documents. For example, the staff summarizes the outline templates of announcement documents and upstream documents in historical cases into an outline template library corresponding to the type, subject, and purpose of the announcement document. The outline template library uses the traditional relational database PostgreSQL and the document database Minio. The outline template file is stored in the document database, and the mapping of the document type, subject, purpose and the storage address of the outline template file is stored in the relational database.
[0101] In the embodiments of this specification, the basic information of the announcement may also include basic information consisting of the case cause, case number, document type, and a brief description of the requirements for the announcement document, etc., which is not limited in the embodiments of this specification.
[0102] It can be understood that the embodiments of this specification are announcement documents generated by using a large-scale language model (LLM). The instructions for generating the announcement documents can be instruction (Prompt) templates that are specifically designed and debugged. The large-scale language model can be obtained by fine-tuning the tasks based on the mainstream general pre-trained large-scale language model (such as Baichuan). The fine-tuning training is to select 50 samples of each type of announcement to construct corresponding training sets and test sets. The training process of the large-scale language model is a well-known technology in the field and will not be repeated here.
[0103] The announcement document generation instruction of the embodiment of this specification is to guide the large-scale language model to generate the corresponding content (that is, the announcement document). In order to avoid the large-scale language model from generating too many associations when generating the announcement document, resulting in low accuracy of the announcement document, the embodiment of this specification obtains the reference case corresponding to the upstream document, and the reference case can limit the LLM from generating too many associations. Because the embodiment of this specification adopts the retrieval enhanced generation (RAG) technology, it can be understood that the basic information (case number, case cause, etc.) is the input of the current query, and the purpose is to prompt the LLM key information to avoid hallucinations. The upstream document is also the input of the current query, and the purpose is to provide it to the LLM to capture the announcement content.
[0104] According to one embodiment of the present specification, the historical case library includes a case text library, a case vector library and an element knowledge library.
[0105] Further, Figure 3The figure is a schematic diagram of the process of constructing a historical case library in the embodiment of this specification. It should be noted that: Figure 3 The process of building an outline template library has been explained above and will not be repeated here.
[0106] Specifically, the steps of constructing the case text library include:
[0107] Using the outline template corresponding to the historical case to semi-structure the historical case, obtain the text paragraph structure of the historical case and the text paragraph contents corresponding to the multiple text paragraphs, and store the correspondence between the text paragraph structure, the text paragraph contents, the text paragraphs and the historical case in the case text library;
[0108] In this step, the upstream documents and the generated announcement documents corresponding to the historical case category are semi-structured and disassembled in combination with the outline template library, and converted into semi-structured data containing the key structured information of the document, the text paragraph structure, and the text paragraph content, forming a case text library. For example, historical cases of legal type will be semi-structured and disassembled according to chapters, clauses, and projects, and historical cases of paper type will be semi-structured and disassembled according to abstracts, references, and citations. Semi-structured data is stored in JSON format, and the case text library uses the full-text retrieval database ElasticSearch (ES database).
[0109] The steps of constructing the case vector library include:
[0110] Converting the text paragraph content of the historical case in the case text library into a historical case vector through a text embedding model, and storing the corresponding relationship between the historical case vector, the text paragraph and the historical case in the case vector library;
[0111] In this step, the text paragraph content of the case text library is converted into text vectors through the text embedding model to form a case vector library corresponding to the case text and its source paragraphs. The text embedding model uses the Transformer model (such as the BGE model). The text vector dimension is 768. The case vector library uses the vector retrieval database milvus.
[0112] The steps of constructing the element knowledge base include:
[0113] The text paragraph contents of the historical cases in the case text library are converted into historical case elements through a knowledge extraction model, and the corresponding relationship among the historical case elements, text paragraphs and historical cases is stored in the case vector library.
[0114] In this step, the text paragraph content of the case text library is converted into element information through a fine-tuned knowledge extraction model to form a case element library corresponding to the case text. The knowledge extraction model uses a model that is fine-tuned for downstream tasks based on a Transformer pre-trained model (such as the BERT model). The fine-tuning task is a named entity recognition (NER) task that uses BiLSTM as the feature extraction layer and CRF as the result correction layer. The case element library uses the traditional relational database PostgreSQL. The mapping relationship between the case and the included elements is stored in the relational database.
[0115] In some other embodiments of the present specification, a historical case library corresponding to different announcement types may also be constructed to avoid the historical case library formed by historical cases corresponding to all announcement types being too large, resulting in reduced storage and matching efficiency.
[0116] Then, historical cases corresponding to the upstream documents are obtained based on the historical case library. In addition, historical cases corresponding to both the announcement type and the upstream documents can also be obtained, that is, the corresponding historical case library is first determined according to the announcement type, and then the historical case corresponding to the upstream document is determined from the determined historical case library.
[0117] According to one embodiment of this specification, Figure 4 As shown, obtaining historical cases corresponding to the upstream documents from the historical case library as reference cases further includes:
[0118] Step 401: Match the text paragraph content in the case text library by conditional screening and full-text retrieval according to the upstream document, and obtain the text paragraph structure corresponding to the matched text paragraph content belonging to the same historical case, and use the matched text paragraph content, the corresponding text paragraph, the corresponding text paragraph structure and the historical case to which it belongs as the reference case text;
[0119] Step 402: convert the upstream document into a semantic vector through a text embedding model, and match the historical case vector in the case vector library through conditional screening and full-text retrieval according to the semantic vector of the upstream document, and obtain the text paragraph corresponding to the matched historical case vector, and use the text paragraph corresponding to the historical case vector and the historical case as the reference case vector;
[0120] Step 403: extract case elements from the upstream document through the knowledge extraction model, match historical case elements in the element knowledge base through conditional screening and full-text retrieval according to the case elements of the upstream document, and obtain text paragraphs corresponding to the matched historical case elements, and use the historical case elements, the corresponding text paragraphs and the historical case as reference case elements;
[0121] Step 404: Aggregate the reference case text, reference case vector and reference case elements according to corresponding text paragraphs and the text paragraph structure to obtain the reference case.
[0122] It can be understood that the embodiment of this specification converts upstream documents into semantic vectors and case elements, and then matches them in the pre-constructed case text library, case vector library and element knowledge library respectively, and obtains matching results corresponding to the three dimensions of text dimension, vector dimension and element knowledge dimension respectively, thereby achieving more accurate matching of historical cases, thereby generating more accurate prompt templates based on more accurate historical cases and providing them to the large-scale language model. The more accurate the prompt template is, the more accurate the announcement document generated by the large-scale language model is.
[0123] According to one embodiment of this specification, Figure 5 As shown, the reference case text, reference case vector and reference case elements are aggregated according to the corresponding text paragraphs and the text paragraph structure to obtain the reference case further comprising:
[0124] Step 501: Aggregate the text paragraph content, historical case vector, and historical case elements corresponding to the same text paragraph under the same historical case to obtain a text paragraph case corresponding to the text paragraph;
[0125] Step 502: Aggregate multiple text paragraph cases under the same historical case according to the text paragraph structure corresponding to the historical case to obtain the reference case.
[0126] In an embodiment of the present specification, the results of the three dimensions matched with the same text paragraphs of the same historical case are aggregated to obtain a text paragraph case corresponding to the text paragraph, and then the text paragraph cases are aggregated based on the text paragraph structure corresponding to the historical case to obtain a reference case.
[0127] In some other embodiments of this specification, such as Figure 6 As shown, the method also includes:
[0128] Step 601: Calculate a first matching score between each reference case text and the upstream document;
[0129] Step 602: Calculate a second matching score between each reference case vector and the semantic vector of the upstream document;
[0130] Step 603: Calculate a third matching score between each reference case element and the case element of the upstream document;
[0131] Step 604: when multiple reference cases are obtained, for each reference case, a weighted sum is performed based on the first matching score of the reference case text corresponding to each text paragraph case in the reference case, the second matching score of the reference case vector, and the third matching score of the reference case element to obtain a paragraph aggregation score of the text paragraph case, and a final score of the reference case is calculated based on the paragraph aggregation scores of multiple text paragraph cases under the reference case;
[0132] Step 605: Select at least one reference case whose final score meets the predetermined score requirement from the multiple reference cases as the final reference case.
[0133] In the embodiments of this specification, the first matching score, the second matching score and the third matching score can all be provided by the corresponding case text library, case vector library or element knowledge library when outputting the matching result, that is, the matching score can be provided by the corresponding database. Alternatively, the staff can calculate the similarity between the matching result and the corresponding input to obtain the corresponding matching score.
[0134] When multiple reference cases are obtained, for each reference case, the paragraph aggregation score corresponding to each text paragraph case is first calculated, and then the final score of the reference case is calculated based on the aggregation scores of each paragraph (for example, the average of the paragraph aggregation scores is calculated as the final score), and finally at least one reference case whose final score meets the predetermined score requirements is selected as the final reference case, so as to generate the announcement document generation instruction based on the final reference case. For example, a reference case whose predetermined score exceeds a predetermined threshold value is selected, or multiple reference cases whose predetermined scores rank first are selected, which is not limited in the embodiments of this specification.
[0135] For example, Figure 7 The flowchart of the method for matching relevant historical case data in the embodiment of this specification is shown as follows:
[0136] First, according to the announcement type, match the corresponding document outline template from the outline template library through conditional filtering.
[0137] Then, according to the announcement type, basic information, and upstream documents, historical cases are matched from the case text library through conditional screening and full-text search, and the full-text matching score of the case text is calculated. The full-text search method can query similar cases with text overlap as much as possible. In specific operations, the weight of invalid and meaningless words will be weakened through a custom stop word library. The widest range of similar cases is recalled through full-text search.
[0138] Then, the upstream documents are converted into semantic vectors through a text embedding model. According to the announcement type and the semantic vector of the upstream document, historical cases are matched from the case vector library through conditional screening and vector retrieval. That is, semantically similar cases are recalled through semantic retrieval, and the case vector matching score is calculated.
[0139] Then, the elements contained in the upstream documents are extracted through the knowledge extraction model, and historical cases are matched from the case knowledge base through conditional screening based on the announcement type, basic information, and elements contained in the upstream documents. That is, cases with highly overlapping key information are recalled through knowledge retrieval, and the full-text matching score of the case text is calculated.
[0140] Finally, after aggregating the historical cases of multiple recalls, the scores of different recall sources for the same case are weighted and summed as the final score of the case. The top few cases are selected as reference cases based on the score ranking. The advantage of this method is that it ensures that similar cases are highly similar in key information on the basis of similar semantics and text content.
[0141] According to one embodiment of this specification, Figure 8 As shown, the instructions for generating announcement documents based on the upstream documents, outline templates and reference cases further include:
[0142] Step 801: extracting the contents corresponding to the multiple sections of the outline template in the reference case;
[0143] Step 802: Generate the announcement document generation instruction according to the contents corresponding to the multiple sections of the upstream document and outline template.
[0144] In the embodiment of this specification, the sections in the outline template are also divided by the staff when generating the outline template. The embodiment of this specification extracts the content corresponding to multiple sections of the outline template in the reference case, and then generates the announcement document generation instruction according to the content corresponding to multiple sections of the upstream document and the outline template.
[0145] Specifically, Fig. 9 The flowchart of the method for generating announcement content based on large-scale language model and retrieval enhancement is shown. After determining the outline template and reference case, select a section in the outline template, obtain the content of the corresponding section of the reference case, and obtain the reference section content. Then, the announcement type, basic information, upstream documents, brief description of requirements, and the content of the reference section are used to generate the announcement generation instruction based on retrieval enhancement (i.e., prompt template). Then, the announcement generation instruction based on retrieval enhancement is input into the pre-trained large-scale language model for calculation, and the large-scale language model outputs the section content. Finally, according to the outline template, all sections in the template are traversed, and the content of each section is filled in the corresponding template. The final announcement document is obtained.
[0146] Based on the same inventive concept, the embodiment of this specification also provides a device for generating a public notice document, such as Fig.10 As shown, including:
[0147] The information acquisition unit 1001 is used to acquire basic announcement information and upstream documents corresponding to the announcement document to be generated, wherein the upstream documents represent subject information corresponding to the announcement document to be generated;
[0148] A reference case determination unit 1002 is used to obtain a historical case corresponding to the upstream document from a historical case library as a reference case;
[0149] An outline template determining unit 1003 is used to obtain an outline template corresponding to the basic information of the announcement from an outline template library;
[0150] An announcement document generation instruction generating unit 1004 is used to generate an announcement document generation instruction according to the upstream document, the outline template and the reference case;
[0151] The announcement document generation unit 1005 is used to input the announcement document generation instruction into a pre-trained large-scale language model for calculation to obtain the announcement document.
[0152] Since the principle of solving the problem by the above device is similar to that of the above method, the implementation of the above device can refer to the implementation of the above method, and the repeated parts will not be repeated.
[0153] like Fig.11The structure diagram of the computer device of the embodiment of this specification is shown. The apparatus in this specification can be the computer device in this embodiment, and the method in this specification is executed. The computer device 1102 may include one or more processing devices 1104, such as one or more central processing units (CPUs), and each processing unit may implement one or more hardware threads. The computer device 1102 may also include any storage resource 1106, which is used to store any kind of information such as code, settings, data, etc. Non-limiting, for example, the storage resource 1106 may include any one or more combinations of the following: any type of RAM, any type of ROM, flash memory device, hard disk, optical disk, etc. More generally, any storage resource can use any technology to store information. Further, any storage resource can provide volatile or non-volatile retention of information. Further, any storage resource can represent a fixed or removable component of the computer device 1102. In one case, when the processing device 1104 executes an associated instruction stored in any storage resource or a combination of storage resources, the computer device 1102 can perform any operation of the associated instruction. The computer device 1102 also includes one or more drive mechanisms 1108 for interacting with any storage resources, such as a hard disk drive mechanism, an optical disk drive mechanism, and the like.
[0154] The computer device 1102 may also include an input / output module 1110 (I / O) for receiving various inputs (via input devices 1112) and for providing various outputs (via output devices 1114). A specific output mechanism may include a presentation device 1116 and an associated graphical user interface (GUI) 1118. In other embodiments, the input / output module 1110 (I / O), input device 1112, and output device 1114 may not be included, and the computer device 1102 may be used as a computer device in a network. The computer device 1102 may also include one or more network interfaces 1120 for exchanging data with other devices via one or more communication links 1122. One or more communication buses 1124 couple the components described above together.
[0155] The communication link 1122 may be implemented in any manner, for example, through a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 1122 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc. governed by any protocol or combination of protocols.
[0156] The embodiments of the present specification also provide a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and the computer program implements the above method when executed by a processor.
[0157] The embodiments of the present specification also provide a computer-readable instruction, wherein when a processor executes the instruction, the program therein causes the processor to execute the above method.
[0158] It should be understood that in the various embodiments of the present specification, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present specification.
[0159] It should also be understood that in the embodiments of this specification, the term "and / or" is only a description of the association relationship of the associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in the embodiments of this specification generally indicates that the associated objects before and after are in an "or" relationship.
[0160] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of this specification can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of the embodiments of this specification.
[0161] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0162] In the several embodiments provided in the embodiments of this specification, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or it can be an electrical, mechanical or other form of connection.
[0163] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of this specification.
[0164] In addition, each functional unit in each embodiment of the present specification can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above integrated unit can be implemented in the form of hardware or in the form of software functional units.
[0165] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of this specification is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the method described in each embodiment of the embodiment of this specification. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program code.
[0166] The embodiments of this specification use specific embodiments to illustrate the principles and implementation methods of the embodiments of this specification. The description of the above embodiments is only used to help understand the methods and core ideas of the embodiments of this specification. At the same time, for those skilled in the art, according to the ideas of the embodiments of this specification, there will be changes in the specific implementation methods and application scopes. In summary, the content of this specification should not be understood as a limitation on the embodiments of this specification.
Claims
1. A method for generating a public notice document, characterized in that: The method comprises: Obtaining basic announcement information and upstream documents corresponding to the announcement document to be generated, wherein the upstream document indicates subject information corresponding to the announcement document to be generated; Obtaining historical cases corresponding to the upstream documents from the historical case library as reference cases; Obtaining an outline template corresponding to the basic information of the announcement from an outline template library; Generate announcement document generation instructions based on the upstream documents, outline templates and reference cases; Inputting the announcement document generation instruction into a pre-trained large-scale language model for calculation to obtain the announcement document; The historical case library includes a case text library, a case vector library and an element knowledge library; The steps of constructing the case text library include: Using the outline template corresponding to the historical case to semi-structure the historical case, obtain the text paragraph structure of the historical case and the text paragraph contents corresponding to the multiple text paragraphs, and store the correspondence between the text paragraph structure, the text paragraph contents, the text paragraphs and the historical case in the case text library; The steps of constructing the case vector library include: Converting the text paragraph content of the historical case in the case text library into a historical case vector through a text embedding model, and storing the corresponding relationship between the historical case vector, the text paragraph and the historical case in the case vector library; The steps of constructing the element knowledge base include: The text paragraph contents of the historical cases in the case text library are converted into historical case elements through a knowledge extraction model, and the corresponding relationship among the historical case elements, the text paragraphs and the historical cases is stored in the case vector library; Obtaining historical cases corresponding to the upstream documents from the historical case library as reference cases further includes: According to the upstream document, the text paragraph content is matched in the case text library by conditional screening and full-text retrieval, and the matched text paragraph content belonging to the same historical case is obtained, and the text paragraph content, the corresponding text paragraph, the corresponding text paragraph structure and the historical case to which it belongs are used as reference case text; The upstream document is converted into a semantic vector through a text embedding model, and the historical case vector is matched in the case vector library through conditional screening and full-text retrieval according to the semantic vector of the upstream document, and the text paragraph corresponding to the matched historical case vector is obtained, and the text paragraph corresponding to the historical case vector and the historical case are used as reference case vectors; Extract case elements from the upstream document through a knowledge extraction model, match historical case elements in the element knowledge base through conditional screening and full-text retrieval according to the case elements of the upstream document, and obtain text paragraphs corresponding to the matched historical case elements, and use the historical case elements, the corresponding text paragraphs and the historical case as reference case elements; The reference case text, reference case vector and reference case elements are aggregated according to corresponding text paragraphs and the text paragraph structure to obtain the reference case.
2. The method according to claim 1, characterized in that The basic information of the announcement includes the type of announcement; Acquiring an outline template corresponding to the basic information of the announcement from an outline template library further includes: An outline template corresponding to the announcement type is obtained from the outline template library, wherein the outline template library includes a plurality of announcement types and pre-established outline templates corresponding to each announcement type.
3. The method according to claim 1, characterized in that Aggregating the reference case text, the reference case vector and the reference case elements according to the corresponding text paragraphs and the text paragraph structure to obtain the reference case further includes: Aggregate the text paragraph content, historical case vector, and historical case elements corresponding to the same text paragraph under the same historical case to obtain a text paragraph case corresponding to the text paragraph; Multiple text paragraph cases under the same historical case are aggregated according to the text paragraph structure corresponding to the historical case to obtain the reference case.
4. The method according to claim 1, characterized in that: The method further comprises: Calculating a first matching score between each reference case text and the upstream document; Calculating a second matching score between each reference case vector and the semantic vector of the upstream document; calculating a third matching score between each reference case element and the case element of the upstream instrument; When multiple reference cases are obtained, for each reference case, a weighted sum is performed based on the first matching score of the reference case text, the second matching score of the reference case vector, and the third matching score of the reference case element corresponding to each text paragraph case in the reference case to obtain a paragraph aggregation score of the text paragraph case, and a final score of the reference case is calculated based on the paragraph aggregation scores of multiple text paragraph cases under the reference case; At least one reference case whose final score meets a predetermined score requirement is selected from the multiple reference cases as a final reference case.
5. The method according to claim 1, characterized in that Generating the announcement document generation instruction based on the upstream document, outline template and reference case further includes: Extracting contents corresponding to the multiple sections of the outline template in the reference case; The announcement document generation instruction is generated according to the contents corresponding to multiple sections of the upstream document and outline template.
6. A device for generating a public notice document, characterized in that: The device comprises: An information acquisition unit, used to acquire basic announcement information and an upstream document corresponding to the announcement document to be generated, wherein the upstream document indicates subject information corresponding to the announcement document to be generated; A reference case determination unit, used to obtain a historical case corresponding to the upstream document from a historical case library as a reference case; An outline template determining unit, used to obtain an outline template corresponding to the basic information of the announcement from an outline template library; An announcement document generation instruction generating unit, used to generate an announcement document generation instruction according to the upstream document, outline template and reference case; An announcement document generation unit, used for inputting the announcement document generation instruction into a pre-trained large-scale language model for calculation to obtain the announcement document; The historical case library includes a case text library, a case vector library and an element knowledge library; The steps of constructing the case text library include: Using the outline template corresponding to the historical case to semi-structure the historical case, obtain the text paragraph structure of the historical case and the text paragraph contents corresponding to the multiple text paragraphs, and store the correspondence between the text paragraph structure, the text paragraph contents, the text paragraphs and the historical case in the case text library; The steps of constructing the case vector library include: Converting the text paragraph content of the historical case in the case text library into a historical case vector through a text embedding model, and storing the corresponding relationship between the historical case vector, the text paragraph and the historical case in the case vector library; The steps of constructing the element knowledge base include: The text paragraph contents of the historical cases in the case text library are converted into historical case elements through a knowledge extraction model, and the corresponding relationship among the historical case elements, the text paragraphs and the historical cases is stored in the case vector library; Obtaining historical cases corresponding to the upstream documents from the historical case library as reference cases further includes: According to the upstream document, the text paragraph content is matched in the case text library by conditional screening and full-text retrieval, and the matched text paragraph content belonging to the same historical case is obtained, and the text paragraph content, the corresponding text paragraph, the corresponding text paragraph structure and the historical case to which it belongs are used as reference case text; The upstream document is converted into a semantic vector through a text embedding model, and the historical case vector is matched in the case vector library through conditional screening and full-text retrieval according to the semantic vector of the upstream document, and the text paragraph corresponding to the matched historical case vector is obtained, and the text paragraph corresponding to the historical case vector and the historical case are used as reference case vectors; Extract case elements from the upstream document through a knowledge extraction model, match historical case elements in the element knowledge base through conditional screening and full-text retrieval according to the case elements of the upstream document, and obtain text paragraphs corresponding to the matched historical case elements, and use the historical case elements, the corresponding text paragraphs and the historical case as reference case elements; The reference case text, reference case vector and reference case elements are aggregated according to corresponding text paragraphs and the text paragraph structure to obtain the reference case.
7. A computer device comprising a memory, a processor, and a computer program stored in the memory, characterized in that: When the processor executes the computer program, the method according to any one of claims 1 to 5 is implemented.
