Document generation method, related device, equipment and storage medium
By receiving official documents to generate instructions, auxiliary documents and portrait description text, and combining these information to generate official documents, the problem of time-consuming and labor-intensive writing of traditional official documents and difficulty in meeting personalized needs is solved, and the effect of reducing the time and manpower of official documents is achieved, while meeting personalized needs.
Patent Information
- Application Number
- CN202510050162.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-13
- Publication Date
- 2025-06-13
AI Technical Summary
Traditional official documents are time-consuming and labor-intensive, and difficult to meet personalized needs. The existing technology is difficult to effectively reduce the time and manpower required for official documents while meeting personalized needs.
By receiving official documents from the target object, the image description text of the target object is obtained, and the official documents are generated based on these inputs. This method combines official documents to generate instructions, key information of auxiliary documents and portrait description text to generate official documents that meet personalized needs.
There is no need to write official documents manually, which reduces the time and labor required to write official documents. At the same time, by referring to auxiliary documents and portrait description text, the generated official documents can better meet personalized needs.
Smart Images

Figure CN120146054A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of robot technology, and in particular, to a document generation method and related devices, equipment, and storage media. Background Art
[0002] Official documents are important tools for information transmission and decision-making execution within and outside administrative units, enterprises, and organizations such as groups, and are of extremely important significance for ensuring the operation and scientific decision-making of the organization.
[0003] Currently, traditional official document writing is usually carried out by staff. Due to the large number and variety of official documents, as well as the complexity and tediousness of the official document writing process, official document writing is time-consuming and laborious. In addition, thanks to the rapid development of generative artificial intelligence technology, using generative artificial intelligence technology to automatically generate official documents has gradually replaced manual writing, but it is difficult to meet personalized needs. In view of this, how to reduce the time and manpower required for official document writing and meet the personalized needs of official document writing has become an urgent problem to be solved. Summary of the Invention
[0004] The main technical problem to be solved by this application is to provide a document generation method and related devices, equipment, and storage media, which can reduce the time and manpower required for document writing and meet the personalized needs of document writing.
[0005] To solve the above technical problem, in the first aspect of this application, a document generation method is provided, including: receiving a document generation instruction input by a target object and an auxiliary document uploaded for this document generation, and obtaining a portrait description text of the target object; wherein, the expected document of the target object is related to the content of the auxiliary document, and the portrait description text describes the portrait tags related to document writing of the target object in natural language; generating a first target document based on at least the document generation instruction, the key information of the auxiliary document, and the portrait description text.
[0006] To solve the above technical problem, in the second aspect of this application, a document generation device is provided, including: a generation preparation module and a document generation module. The generation preparation module is used to receive a document generation instruction input by a target object and an auxiliary document uploaded for this document generation, and obtain a portrait description text of the target object; wherein, the expected document of the target object is related to the content of the auxiliary document, and the portrait description text describes the portrait tags related to document writing of the target object in natural language; the document generation module is used to generate a first target document based on at least the document generation instruction, the key information of the auxiliary document, and the portrait description text.
[0007] To solve the above technical problems, a third aspect of the present application provides an electronic device, which at least includes a memory and a processor coupled to each other. The memory stores at least program instructions, and the processor is configured to execute the program instructions to implement the official document generation method in the first aspect above.
[0008] To solve the above technical problems, a fourth aspect of the present application provides a computer-readable storage medium storing program instructions that can be run by a processor, and the program instructions are used to implement the official document generation method in the first aspect above.
[0009] In the above solution, an official document generation instruction input by a target object and an auxiliary document uploaded for the generation of the current official document are received, and a portrait description text of the target object is obtained. The expected official document of the target object is related to the content of the auxiliary document, and the portrait description text describes the portrait tags related to official document writing of the target object in natural language. Then, based at least on the official document generation instruction, the key information of the auxiliary document, and the portrait description text, a first target official document is generated. Therefore, on the one hand, since there is no need for manual writing of official documents, the time and manpower required for official document writing can be reduced, and the key information in the auxiliary document related to the content of the expected official document is also referred to during the official document generation process, which helps to constrain the specific content of the generated official document to revolve around the key information as much as possible. On the other hand, since the portrait description text of the target object is further referred to during the official document generation process, and the portrait description text describes the portrait tags related to official document writing of the target object in natural language, it can be made to fit the portrait tags of the target object and official document writing as much as possible during the official document generation process, which helps to meet the personalized needs of the target object for official document writing. Therefore, it is possible to reduce the time and manpower required for official document writing and meet the personalized needs of official document writing. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] Figure 1 is a schematic flowchart of an embodiment of the official document generation method of the present application; Figure 2 is a schematic framework diagram of an embodiment of the official document generation device of the present application; Figure 3 is a schematic framework diagram of an embodiment of the electronic device of the present application; Figure 4 is a schematic framework diagram of an embodiment of the computer-readable storage medium of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS
[0011] The solutions of the embodiments of the present application will be described in detail below with reference to the accompanying drawings of the specification.
[0012] In the following description, specific details such as specific system architectures, interfaces, and technologies are presented for the purpose of illustration rather than limitation, so as to thoroughly understand the present application.
[0013] The terms "system" and "network" are often used interchangeably in this document. The term " / or" in this document is merely a description of the relationship between associated objects, indicating that there can be three relationships. For example, A / or B can represent: A exists alone, A and B exist simultaneously, and B exists alone. In addition, the fragment " / " in this document generally indicates that the associated objects before and after are in an "or" relationship. In addition, "multiple" in this document means two or more than two.
[0014] Please refer to Figure 1 , Figure 1 is a schematic flowchart of an embodiment of the official document generation method of this application. Specifically, it may include the following steps: Step S11: Receive the official document generation instruction input by the target object and the auxiliary document uploaded for this official document generation, and obtain the portrait description text of the target object.
[0015] In an implementation scenario, the target object can input the official document generation instruction through input methods such as text input and voice input, and the input method of the official document generation instruction is not limited here. In addition, the official document generation instruction may specifically include the theme, genre, etc. of the expected official document, and the specific content of the official document generation instruction is not limited here. Exemplarily, the official document generation instruction may include but is not limited to the following content: "Please help me draft a notice that Agency A accepts the handling of Business B normally during the Spring Festival" and "Please help me write a letter from Property Company C to Owner D urging payment of property fees". The above examples are only for the purpose of facilitating the understanding of the official document generation instruction and listing several possible examples, and no further examples of the official document generation instruction will be given here.
[0016] In the embodiments of the present disclosure, the expected official document of the target object is related to the content of the auxiliary document. It should be noted that the auxiliary document may include, but is not limited to: word documents, audio files, pictures, PDF documents, etc. The specific format of the auxiliary document is not limited herein. As a possible example, taking the official document generation instruction "Please help me draft a notice on the normal acceptance of business B by Agency A during the Spring Festival" as an example, the auxiliary document may include the meeting minutes of the normal acceptance of business B by Agency A during the Spring Festival; or, as another possible example, taking the official document generation instruction "Please help me write a letter from Property Company C to Owner D urging payment of property fees" as an example, the auxiliary document may include the property fee payment records of Owner D. Of course, the above examples are only for the convenience of understanding several possible examples of the auxiliary document, and other possible situations of the auxiliary document will not be exemplified one by one here. To facilitate subsequent official document generation based on the auxiliary document, the key information of the auxiliary document can also be extracted for direct reference in the subsequent official document generation process. Specifically, element extraction can be performed based on the auxiliary document to obtain the content of several official document elements as the key information of the auxiliary document, and the several official document elements include at least one of the theme, type, abstract, main idea, factual data, and domain knowledge. The above method can constrain the specific content of the generated official document to revolve around the key information as much as possible by extracting the content of the official document elements in the auxiliary document as the key information, so as to make the generated official document as accurate as possible in the official document elements such as the main idea, factual data, and domain knowledge without deviation.
[0017] In an implementation scenario, as a possible example, the large language model can be used through prompt engineering to extract elements from the auxiliary document to obtain the key information. In addition, to process different types of auxiliary documents, for word documents, third-party open-source libraries (such as docx, openpyxl, etc.) can be used for parsing; or, for non-scanned PDF documents, third-party open-source libraries (such as pypdf, etc.) can be used for parsing; or, for scanned PDF documents, images or audio, large model tools such as Spark large model can be used for information extraction. Of course, the above examples are only several possible examples of parsing different formats of auxiliary documents in the actual application process, and other formats of auxiliary documents will not be exemplified one by one here.
[0018] In an implementation scenario, for the official document element "Subject", it represents the central topic of the auxiliary document, such as "Conversation content of the meeting on XXX"; for the official document element "Type", it represents the document type of the auxiliary document, such as meeting minutes, reports, forms, manuscripts, etc.; for the official document element "Abstract", it represents a summary of the content of the auxiliary document, which can cover the main structure in the auxiliary document; for the official document elements "Main viewpoints", "Factual data", and "Domain knowledge", they can be regarded as the knowledge involved in the auxiliary document, and this knowledge is mainly used to constrain and guide the subsequent generation of official documents so as not to deviate from the knowledge-based expression.
[0019] In an implementation scenario, as a possible example, the key information can be represented in structured data, and the representation method of the key information is not limited here.
[0020] In the embodiments of the present disclosure, the portrait description text describes the portrait tags related to official document writing of the target object in natural language. It should be noted that the portrait tags can specifically involve the occupation, text preferences, style, etc. of the target object, and the specific involvement of the portrait tags is not limited here. For example, it can also include other portrait tags related to official document writing such as education and document type, and no further examples are given here.
[0021] In an implementation scenario, as a possible example, the generation of official documents can be implemented by a large language model, that is, the first target official document generated in the subsequent steps can be generated by the large language model. Then, in order to obtain the portrait description text of the target object, the conversation data between the target object and the large language model before the generation of the official document can be obtained as historical conversations, and based on the analysis of the historical conversations, short-term portrait data of the target object can be obtained. The short-term portrait data at least includes portrait tags related to official document writing, so that at least the portrait tags related to official document writing in the existing portrait data of the target object can be adjusted based on the short-term portrait data to obtain new existing portrait data of the target object. Furthermore, based on the new existing portrait data of the target object, the portrait description text of the target object can be obtained. In the above manner, by analyzing the historical conversations of the target object to obtain the short-term portrait data of the target object, and accordingly updating and adjusting the portrait tags related to official document writing in its existing portrait data to obtain the portrait description text of the target object, on the one hand, it can ensure the stability of the overall user portrait and the diversity of the coverage as much as possible, and on the other hand, it can help enhance the understanding of the user intention and personalization of the target object.
[0022] In a specific implementation scenario, the work scope and industry background of the target object are usually relatively stable, and the style of the official documents to be written has obvious personalized characteristics. Therefore, the more times the target object converses with the large language model, the more accurate the personalized characteristics of its portrait data, and further the analysis angle of the document information and the writing style of the official documents are more in line with its needs.
[0023] In a specific implementation scenario, the portrait tags related to official document writing may include, but are not limited to: occupation, education, text style, document type, etc. Other possible cases will not be exemplified one by one here. As a possible example, according to the new existing portrait data of the target object, the following portrait description text can be obtained: You may work in the community service sector, responsible for government services and community affairs. Skills, especially good at official document writing, focus on improving the efficiency of government services and optimizing processes through digital means. The point is to promote the "XXX" system to improve the service experience of residents and businesses. You pay attention to details and like concise and formal official document style. And emphasize the timeliness and effectiveness of services. Your goal is to improve the quality of public services and public satisfaction through innovative services Spend.
[0024] It should be noted that the above examples are only one possible example of the portrait description text, and other possible cases will not be exemplified one by one here.
[0025] In another implementation scenario, different from the foregoing implementation manner, as another possible example, in order to obtain the portrait description text of the target object, the portrait description text of the target object can also be generated based on the basic requirements of official document writing. For example, in this case, the following portrait description text can be generated, including but not limited to: You are an office worker who is good at writing official documents. Your documents meet the basic standards of official documents, use accurate words and appropriate language, and have good content. The content is clear and concise.
[0026] It should be noted that the above examples are only one possible example of the portrait description text generated based on the basic requirements of official document writing, and the specific content of the portrait description text is not limited here. The above method, based on the basic requirements of official document writing, generates the portrait description text of the target object, which can reduce the complexity of obtaining the portrait description text as much as possible and improve the speed of obtaining the portrait description text.
[0027] In yet another implementation scenario, different from the foregoing implementation, as another possible example, in order to obtain the portrait description text of the target object, it is also possible to respond to the target object's operation of setting the label attributes for the label categories related to official document writing, and based on the label attributes configured by the setting operation, obtain the portrait labels of the label categories, and based on the portrait labels of various label categories, obtain the portrait description text of the target object. It should be noted that the label categories related to official document writing may include, but are not limited to: occupation, official document type, official document style, etc. In addition, several options representing label attributes can be set under the label category for the target object to select the label attributes as the portrait labels of the label category; or, an input box can also be set under the label category for the target object to manually input the label attributes as the portrait labels of the label category. Of course, the above examples are only several possible examples of performing the configuration operation on the label attributes of the label category in the actual application process, and other possible configuration operations are not exemplified one by one here. For example, in this case, if the target object sets label attributes such as "enterprises and institutions", "education industry", "notice", "report", etc., the following portrait description text can be generated, including but not limited to: You are a staff member of an enterprise or institution, working in the education industry, mainly writing notices, reports and other types of public arts.
[0028] It should be noted that the above example is only one possible example of generating the portrait description text based on the setting operation, and the specific content of the portrait description text is not limited here. The above method, by responding to the target object's operation of setting the label attributes for the label categories related to official document writing, obtaining the portrait labels of the label categories based on the label attributes configured by the setting operation, and obtaining the portrait description text of the target object based on the portrait labels of various label categories, can support the target object to obtain the portrait description text by configuring the label attributes for the label categories, which helps to improve the convenience of the target object in setting the portrait description text.
[0029] In one implementation scenario, after obtaining the portrait description text of the target object, as a possible example, the following relevant steps for official document generation can be directly executed. Or, as another possible example, before generating the official document, the portrait description text of the target object can also be output first, and in response to detecting the modification instruction of the target object for the portrait description text, the portrait description text can be modified based on the modification instruction to obtain the new portrait description text of the target object. The above method, after obtaining the portrait description text of the target object and before generating the official document, outputs the portrait description text of the target object first, and then in response to detecting the modification instruction of the target object for the portrait description text, modifies the portrait description text based on the modification instruction to obtain the new portrait description text of the target object, which can support the target object to modify the portrait description text before generating the official document.
[0030] Step S12: Generate a first target official document based on at least the official document generation instruction, the key information of the auxiliary document, and the portrait description text.
[0031] In an implementation scenario, as described above, the first target official document can be generated by a large language model. Then, a prompt instruction can be constructed based on the official document generation instruction, the key information, and the portrait description text. The prompt instruction is used to indicate the reference priority and reference scope of the official document generation instruction, the key information, and the portrait description text when the large language model generates an official document. The reference priority of the official document generation instruction is higher than that of the portrait description text, and the reference scope of the key information is all information. On this basis, the prompt instruction can be input into the large language model to obtain the output content of the large language model as the first target official document. It should be noted that the large language model can include, but is not limited to, open-source large models such as Llama and Bloom. Alternatively, the large language model can also be obtained by fine-tuning the parameters of an open-source large model with a specific corpus (such as high-quality data manually refined and annotated for specific tasks). Alternatively, the large language model can also be a custom large model. The specific source of the large language model is not limited here. In the above method, defining the reference priority and reference scope in the prompt instruction can minimize the ambiguity of the instruction content and improve the quality of official document generation.
[0032] In another implementation scenario, different from the foregoing implementation manner, as another possible example, before generating an official document, a document library can be obtained first. The document library can contain several preset official documents. The preset official documents can be provided with a first semantic encoding, which can be encoded based on the description set of the preset official document. The description set can include at least one of the theme, the organization, and the type. Then, based on the official document generation instruction and the key information of the auxiliary document, a description set of the expected official document can be obtained, and a second semantic encoding can be obtained by encoding based on the description set of the expected official document. Thus, based on the similarity between the second semantic encoding and the first semantic encoding of each preset official document in the document library, a preset official document can be selected as a demonstration official document. Furthermore, based on the official document generation instruction, the key information of the auxiliary document, the portrait description text, and the demonstration official document, a first target official document can be generated. In the above method, semantic encoding is extracted through the description set, and based on this, a demonstration official document related to the expected official document is retrieved, and the demonstration official document is further combined for reference during the official document generation process. On the one hand, it can achieve official document matching at the semantic level, which helps to improve the accuracy of retrieving the demonstration official document. On the other hand, further combining the demonstration official document during the official document generation process can further reduce the ambiguity of the instruction content and improve the quality of official document generation.
[0033] In a specific implementation scenario, the preset tool can be used to collect official document data of different institutions, different types, and different themes on the open platform and include them in the official document library. Alternatively, the official document data generated historically can also be obtained and included in the official document library. Alternatively, the official document data uploaded by the user can also be obtained and included in the official document library. Of course, the above examples are only several possible examples of the establishment of the official document library. Other possible ways to establish the official document library are not limited here, and no examples are given one by one. For example, the official document library can also be selectively established by using different combinations of the above methods or further combined with other methods according to actual conditions. After that, in order to improve the accuracy of semantic coding, as a possible implementation method, the official document data in the official document library can also be cleaned, formatted, sensitive words filtered, and security checked before semantic coding. On this basis, for each preset official document in the official document library, the subject, agency, and type can be combined into a description set, and then its feature vector is generated through sentence-level semantic coding, so that each preset official document in the official document library has a first semantic code, which can make the preset official documents of different institutions, different types, and different themes distinguished by the first semantic code. Of course, in addition to the subject, organization, and type, the description set can also include attributes of other dimensions (such as writing style, industry, etc.). We will not limit the specific attributes of other dimensions included in the description set, nor will we give examples one by one.
[0034] In a specific implementation scenario, semantic encoding can be achieved through sentence transformer. For example, training data can be constructed on a self-built official document database. Its task is to accurately classify the training data and train it through contrast loss, so that it can fine-tune the parameters on the pre-trained model, and then obtain the best possible embedding feature representation for the official document database (i.e., the aforementioned semantic encoding vector). It should be noted that the specific process of model training can refer to the technical details of contrast loss, sentence transformer, etc., which will not be repeated here.
[0035] In a specific implementation scenario, based on the prompt project, the large language model can be used to generate instructions and key information of auxiliary documents based on official documents to obtain a description set of the expected official documents. It should be noted that the fields returned by the large language model may include subject, type, agency, etc. Among them, the agency may specifically include but is not limited to: administrative agencies, enterprises, institutions, social groups, etc.; the type may specifically include but is not limited to: orders, decisions, announcements, notices, notifications, circulars, motions, reports, requests, replies, opinions, letters, meeting minutes, investigation reports, work plans, work summaries, proposals, suggestions, explanations, speeches, briefing information, letters, notices, notes, forms, and major events. In addition, the subject may depend on the specific situation and will not be listed here one by one.
[0036] In a specific implementation scenario, after obtaining the first semantic code of each preset document in the document library and the second semantic code of the expected document, the similarity between the first semantic code and the second semantic code can be measured by Euclidean distance, and then the preset document with the highest similarity can be selected as a demonstration document.
[0037] In a specific implementation scenario, after selecting a model official document, a prompt instruction can be constructed based on the official document generation instruction, key information, portrait description text and model official document, and the prompt instruction is used to indicate the reference priority and reference range of the large language model to the official document generation instruction, key information, portrait description text and model official document when the official document is generated, and the reference priority of the official document generation instruction is higher than the portrait description text, the reference range of the key information is all information, and the reference range of the model official document includes structural specifications and language characteristics. On this basis, the prompt instruction can be input into the large language model to obtain the output content of the large language model as the first target official document. The above method, defining the reference priority and reference range in the prompt instruction, can make the structural specifications and language characteristics of the model official document referenced during the document generation process, but without quoting the actual content of the model official document, so as to minimize the ambiguity of the instruction content and improve the quality of document generation.
[0038] In an implementation scenario, after the first target official document is generated, the official document generation instruction and key information can be selected as the benchmark information to extract the element content of several official document elements in the benchmark information, and extract the element content of several official document elements in the first target official document, so as to generate the first adjustment instruction of the first target official document on the corresponding official document element in response to the inconsistency between the element content of the benchmark information and the first target text on the same official document element, and then modify the first target official document based on the first adjustment instruction of the official document element to obtain the second target official document. In the above method, the official document generation instruction and key information are selected as the benchmark information, and the first adjustment instruction of the official document element of the first target official document is generated by comparing the element content of the official document element in the benchmark information with the element content of the official document element in the first target official document, so as to modify the first target official document accordingly, so that the instruction following of the final generated official document and the official document generation instruction and the knowledge consistency with the auxiliary document can be achieved, which is helpful to improve the quality of the generated official document.
[0039] In a specific implementation scenario, when selecting key information as the benchmark information, several document elements may include, but are not limited to, main ideas, factual data, domain knowledge, etc. Then, the element contents of the key information regarding the main ideas, factual data, and domain knowledge can be extracted, and the element contents of the first target document regarding the main ideas, factual data, and domain knowledge can be extracted. On this basis, it is possible to compare whether the element contents of the main ideas, factual data, and domain knowledge are consistent for each element of the key information and the first target document. For example, for the document element "main idea", by comparing whether the element content of the "main idea" in the key information is consistent with the element content of the "main idea" in the first target document, it is possible to determine whether there are errors, omissions, etc. in the key points of the first target document. And in the case of errors, omissions, etc. in the key points, a first adjustment instruction regarding the document element "main idea" can be generated (for example, for the case of key point errors, the first adjustment instruction may include the wrongly expressed key point and its correct expression, and for the case of key point omission, the first adjustment instruction may include the omitted key point); similarly, for the document element "factual data", by comparing whether the element content of the "factual data" in the key information is consistent with the element content of the "factual data" in the first target document, it is possible to determine whether there are factual expression errors, omissions, etc. in the first target document. And in the case of factual expression errors, omissions, etc., a first adjustment instruction regarding the document element "factual data" can be generated (for example, for the case of factual expression errors, the first adjustment instruction may include the wrongly expressed factual content and its correct expression, and for the case of factual omission, the first adjustment instruction may include the omitted factual content); similarly, for the document element "domain knowledge", by comparing whether the element content of the "domain knowledge" in the key information is consistent with the element content of the "domain knowledge" in the first target document, it is possible to determine whether there are knowledge errors, omissions, etc. in the first target document. And in the case of knowledge errors, omissions, etc., a first adjustment instruction regarding the document element "domain knowledge" can be generated (for example, for the case of knowledge errors, the first adjustment instruction may include the wrongly expressed knowledge content and its correct expression, and for the case of knowledge omission, the first adjustment instruction may include the omitted knowledge content). Of course, the above examples are only several possible examples of the first adjustment instruction when several document elements include main ideas, factual data, and domain knowledge when selecting key information as the benchmark information. Other possible situations are not exemplified one by one here.In the above method, when selecting key information as the reference information, if several document elements include main ideas, factual data, and domain knowledge, then extract the element contents of the key information regarding main ideas, factual data, and domain knowledge respectively, and extract the element contents of the first target document regarding main ideas, factual data, and domain knowledge respectively. Then, compare the element contents of main ideas, factual data, and domain knowledge of the key information and the first target text element by element to check whether they are consistent. Therefore, when selecting key information as the reference information, it is possible to achieve knowledge consistency analysis of the generated document.
[0040] In a specific implementation scenario, when selecting a document generation instruction as the reference information, several document elements include but are not limited to: genre, theme, writing perspective, scope, style, content requirements, time, location, format, and structure, etc. Then, it is possible to extract the element contents of the key information regarding genre, theme, writing perspective, scope, style, content requirements, time, location, format, and structure respectively, and extract the element contents of the first target document regarding genre, theme, writing perspective, scope, style, content requirements, time, location, format, and structure respectively. On this basis, it is possible to compare the element contents of genre, theme, writing perspective, scope, style, content requirements, time, location, format, and structure of the document generation instruction and the first target document element by element to check whether they are consistent. When the element contents comparison of any document element is inconsistent (such as omission, error, etc.), a first adjustment instruction for the corresponding document element can be generated. Specifically, the generation process of the first adjustment instruction when selecting key information as the reference information can be referred to, which will not be elaborated here. In the above method, when selecting a document generation instruction as the reference information, by comparing the element contents of genre, theme, writing perspective, scope, style, content requirements, time, location, format, and structure of the document generation instruction and the first target document element by element to generate the first adjustment instruction for the corresponding document element, it is possible to achieve instruction following analysis of the generated document when selecting a document generation instruction as the reference information.
[0041] In a specific implementation scenario, after obtaining the first adjustment instructions for each document element, the first target document can be modified based on the first adjustment instructions of the first target document regarding each document element, and then the second target document can be obtained. Exemplarily, through prompt engineering, the first adjustment instructions can be used to rewrite and polish the local content of the first target document to obtain the second target document, so as to improve the fault tolerance rate of document generation, achieve adaptive optimization, and reduce problems such as potential knowledge errors, loss of key document information, and non-following of some instructions that may occur in the first generated document. Furthermore, it can further improve the quality of document generation.
[0042] In an implementation scenario, after the first target official document is generated, different from the foregoing implementation, it is also possible to generate a second adjustment instruction for the first target official document in response to the fact that the first target text does not match the portrait label for official document writing in the portrait description text, and the second adjustment instruction is used to indicate adjusting the first target official document to match the portrait label for official document writing in the portrait description text, and then modify the first target official document based on the second adjustment instruction of the first target official document to obtain a second target official document. As a possible example, in the actual application process, relevant options regarding whether to enable portrait inspection can be set in the relevant configurations for official document generation, and when it is detected that the relevant options regarding whether to enable portrait inspection are in the enabled state, the foregoing steps of detecting whether the first target text matches the portrait label for official document writing in the portrait description text can be executed, while when it is detected that the relevant options regarding whether to enable portrait inspection are in the disabled state, the foregoing steps of detecting whether the first target text matches the portrait label for official document writing in the portrait description text may not be executed. In the above manner, by detecting whether the first target text matches the portrait label for official document writing in the portrait description text, and in the case of detecting a mismatch, generating a second adjustment instruction for the first target official document, so as to adjust the first target official document accordingly to match the portrait label for official document writing in the portrait description text, so as to achieve a review check on whether the generated official document matches the user portrait.
[0043] In the above solution, an official document generation instruction input by a target object and an auxiliary document uploaded for the current official document generation are received, and a portrait description text of the target object is obtained, and the expected official document of the target object is related to the content of the auxiliary document, and the portrait description text describes the portrait label related to official document writing of the target object in natural language. Then, at least based on the official document generation instruction, the key information of the auxiliary document, and the portrait description text, the first target official document is generated. Therefore, on the one hand, since there is no need for manual writing of the official document, the time and manpower required for official document writing can be reduced, and the key information in the auxiliary document related to the content of the expected official document is also referred to during the official document generation process, which helps to restrict the specific content of the generated official document to revolve around the key information as much as possible. On the other hand, since the portrait description text of the target object is further referred to during the official document generation process, and the portrait description text describes the portrait label related to official document writing of the target object in natural language, it is possible to conform to the portrait label of the target object related to official document writing as much as possible during the official document generation process, which helps to meet the personalized needs of the target object regarding official document writing. Therefore, it is possible to reduce the time and manpower required for official document writing and meet the personalized needs of official document writing.
[0044] Please refer to Figure 2 , Figure 2It is a framework schematic diagram of an embodiment of the official document generation device of the present application. The official document generation device 20 includes: a generation preparation module 21 and an official document generation module 22. The generation preparation module 21 is configured to receive an official document generation instruction input by a target object and an auxiliary document uploaded for the current official document generation, and obtain a portrait description text of the target object. Among them, the expected official document of the target object is related to the content of the auxiliary document, and the portrait description text describes the portrait tags related to official document writing of the target object in natural language. The official document generation module 22 is configured to generate a first target official document based on at least the official document generation instruction, the key information of the auxiliary document, and the portrait description text.
[0045] In the above solution, the official document generation device 20 receives an official document generation instruction input by a target object and an auxiliary document uploaded for the current official document generation, and obtains a portrait description text of the target object. The expected official document of the target object is related to the content of the auxiliary document, and the portrait description text describes the portrait tags related to official document writing of the target object in natural language. Then, based on at least the official document generation instruction, the key information of the auxiliary document, and the portrait description text, a first target official document is generated. Therefore, on the one hand, since there is no need for manual writing of official documents, the time and manpower required for official document writing can be reduced, and the key information in the auxiliary document related to the content of the expected official document is also referred to during the official document generation process, which helps to restrict the specific content of the generated official document to revolve around the key information as much as possible. On the other hand, since the portrait description text of the target object is further referred to during the official document generation process, and the portrait description text describes the portrait tags related to official document writing of the target object in natural language, it can be as close as possible to the portrait tags of the target object and official document writing during the official document generation process, which helps to meet the personalized needs of the target object for official document writing. Therefore, it can reduce the time and manpower required for official document writing and meet the personalized needs of official document writing.
[0046] In some publicly disclosed embodiments, the first target official document is generated by a large language model. The generation preparation module 21 includes a dialogue acquisition sub-module, which is configured to acquire the dialogue data between the target object and the large language model before the current official document generation as historical dialogue. The generation preparation module 21 includes a portrait generation sub-module, which is configured to analyze the historical dialogue to obtain short-term portrait data of the target object. Among them, the short-term portrait data at least includes portrait tags related to official document writing. The generation preparation module 21 includes a tag adjustment sub-module, which is configured to adjust at least the portrait tags related to official document writing in the existing portrait data of the target object based on the short-term portrait data to obtain new existing portrait data. The generation preparation module 21 includes a description generation sub-module, which is configured to obtain a portrait description text of the target object based on the new existing portrait data.
[0047] In some disclosed embodiments, the generation preparation module 21 includes a first generation sub-module for generating a portrait description text of a target object based on the basic requirements of official document writing; the generation preparation module 21 includes a second generation sub-module for, in response to the target object setting the label attributes of a label category related to official document writing, obtaining the portrait labels of the label category based on the label attributes configured by the setting operation, and obtaining the portrait description text of the target object based on the portrait labels of various label categories.
[0048] In some disclosed embodiments, the official document generation device 20 includes a description output module for outputting the portrait description text of the target object; the official document generation device 20 includes a description modification module for, in response to detecting a modification instruction of the target object for the portrait description text, modifying the portrait description text based on the modification instruction to obtain a new portrait description text of the target object.
[0049] In some disclosed embodiments, the official document generation device 20 includes an element extraction module for extracting elements based on an auxiliary document to obtain the content of several official document elements as the key information of the auxiliary document; wherein, the several official document elements include at least one of a theme, a type, an abstract, a main idea, factual data, and domain knowledge.
[0050] In some disclosed embodiments, the official document generation device 20 includes an information selection module for respectively selecting an official document generation instruction and key information as benchmark information; the official document generation device 20 includes a content extraction module for extracting the element content of several official document elements from the benchmark information, and extracting the element content of several official document elements from a first target official document; the official document generation device 20 includes a first instruction module for, in response to the element content of the same official document element in the benchmark information being inconsistent with that in the first target text, generating a first adjustment instruction for the corresponding official document element of the first target official document; the official document generation device 20 includes a first modification module for modifying the first target official document based on the first adjustment instruction for the official document element of the first target official document to obtain a second target official document.
[0051] In some disclosed embodiments, in the case of selecting the key information as the benchmark information, the several official document elements include a main idea, factual data, and domain knowledge, and the content extraction module is specifically configured to extract the element content of the main idea, factual data, and domain knowledge respectively from the key information; extract the element content of the main idea, factual data, and domain knowledge respectively from the first target official document; wherein, the key information and the first target text compare the element content of the main idea, factual data, and domain knowledge one by one to check whether they are consistent.
[0052] In some disclosed embodiments, in the case of selecting a document generation instruction as the reference information, several document elements include genre, theme, writing perspective, scope, style, content requirements, time, place, format, and structure. The content extraction module is specifically configured to extract the element contents of the document generation instruction regarding genre, theme, writing perspective, scope, style, content requirements, time, place, format, and structure respectively; extract the element contents of the first target document regarding genre, theme, writing perspective, scope, style, content requirements, time, place, format, and structure respectively; wherein, the element contents of the document generation instruction and the first target document text are compared element by element to determine whether they are consistent in terms of genre, theme, writing perspective, scope, style, content requirements, time, place, format, and structure.
[0053] In some disclosed embodiments, the document generation device 20 includes a second instruction module, configured to generate a second adjustment instruction for the first target document in response to the portrait tags regarding document writing in the first target text not matching those in the portrait description text; wherein, the second adjustment instruction is used to indicate adjusting the first target document to match the portrait tags regarding document writing in the portrait description text; the document generation device 20 includes a second modification module, configured to modify the first target document based on the second adjustment instruction of the first target document to obtain a second target document.
[0054] In some disclosed embodiments, the document generation device 20 includes a library acquisition module, configured to acquire a document library; wherein, the document library contains several preset documents, and the preset documents are provided with a first semantic encoding, which is encoded based on a description set of the preset documents, and the description set includes at least one of theme, organization, and type; the document generation device 20 includes a description extraction module, configured to obtain a description set of the expected document based on the document generation instruction and the key information of the auxiliary document; the document generation device 20 includes a semantic encoding module, configured to encode based on the description set of the expected document to obtain a second semantic encoding; the document generation device 20 includes a document selection module, configured to select a preset document as a demonstration document based on the similarity between the second semantic encoding and the first semantic encoding of each preset document in the document library; the document generation module 22 is specifically configured to generate a first target document based on the document generation instruction, the key information of the auxiliary document, the portrait description text, and the demonstration document.
[0055] In some disclosed embodiments, the official document generation module 22 includes an instruction construction module for constructing a prompt instruction based on an official document generation instruction, key information, portrait description text, and a demonstration official document. The prompt instruction is used to indicate the reference priority and reference scope of the official document generation instruction, key information, portrait description text, and demonstration official document during official document generation. The reference priority of the official document generation instruction is higher than that of the portrait description text. The reference scope of the key information is all information, and the reference scope of the demonstration official document includes structural specifications and language features. The official document generation module 22 includes a model processing module for inputting the prompt instruction into a large language model to obtain the output content of the large language model as a first target official document.
[0056] Please refer to Figure 3 , Figure 3 , which is a schematic framework diagram of an embodiment of the electronic device of the present application. The electronic device 30 at least includes a memory 31 and a processor 32 that are coupled to each other. At least program instructions are stored in the memory 31, and the processor 32 is configured to execute the program instructions to implement the steps in any of the above-mentioned embodiments of the official document generation method. Specifically, reference can be made to the foregoing disclosed embodiments, which will not be elaborated herein. As a possible example, the electronic device 30 may include, but is not limited to, a smart phone, a tablet computer, a server, etc. The specific type of the electronic device 30 is not limited herein.
[0057] Specifically, the processor 32 is configured to control itself and the memory 31 to implement the steps in any of the above-mentioned embodiments of the official document generation method. The processor 32 may also be referred to as a CPU (Central Processing Unit). The processor 32 may be an integrated circuit chip with signal processing capabilities. The processor 32 may also be a general-purpose processor, a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. Additionally, the processor 32 may be implemented jointly by integrated circuit chips.
[0058] In the above solution, the electronic device 30 receives a document generation instruction input by a target object and an auxiliary document uploaded for the generation of the current document, and obtains a portrait description text of the target object. The expected document of the target object is related to the content of the auxiliary document, and the portrait description text describes the portrait tags related to document writing of the target object in natural language. Then, based on at least the document generation instruction, the key information of the auxiliary document, and the portrait description text, the first target document is generated. Therefore, on the one hand, since there is no need for manual document writing, the time and manpower required for document writing can be reduced, and the key information in the auxiliary document related to the content of the expected document is also referred to during the document generation process, which helps to restrict the specific content of the generated document to revolve around the key information as much as possible. On the other hand, since the portrait description text of the target object is further referred to during the document generation process, and the portrait description text describes the portrait tags related to document writing of the target object in natural language, it is possible to fit the portrait tags of the target object and document writing as much as possible during the document generation process, which helps to meet the personalized needs of the target object for document writing. Therefore, it is possible to reduce the time and manpower required for document writing and meet the personalized needs of document writing.
[0059] Please refer to Figure 4 , Figure 4 FIG. is a schematic framework diagram of an embodiment of the computer-readable storage medium 40 of the present application. The computer-readable storage medium 40 stores program instructions 41 that can be run by a processor, and the program instructions 41 are used to implement the steps in any of the above-described embodiments of the document generation method.
[0060] In the above solution, the computer-readable storage medium 40 receives a document generation instruction input by a target object and an auxiliary document uploaded for the generation of the current document, and obtains a portrait description text of the target object. The expected document of the target object is related to the content of the auxiliary document, and the portrait description text describes the portrait tags related to document writing of the target object in natural language. Then, based on at least the document generation instruction, the key information of the auxiliary document, and the portrait description text, the first target document is generated. Therefore, on the one hand, since there is no need for manual document writing, the time and manpower required for document writing can be reduced, and the key information in the auxiliary document related to the content of the expected document is also referred to during the document generation process, which helps to restrict the specific content of the generated document to revolve around the key information as much as possible. On the other hand, since the portrait description text of the target object is further referred to during the document generation process, and the portrait description text describes the portrait tags related to document writing of the target object in natural language, it is possible to fit the portrait tags of the target object and document writing as much as possible during the document generation process, which helps to meet the personalized needs of the target object for document writing. Therefore, it is possible to reduce the time and manpower required for document writing and meet the personalized needs of document writing.
[0061] In some embodiments, the functions or modules included in the apparatus provided by the embodiments of the present disclosure can be used to execute the methods described in the above method embodiments. The specific implementation can refer to the description of the above method embodiments. For the sake of brevity, it will not be repeated here.
[0062] The above descriptions of the various embodiments tend to emphasize the differences between the various embodiments. The similarities or similarities between them can be referred to each other. For the sake of brevity, they will not be repeated in this article.
[0063] In several embodiments provided in the present application, it should be understood that the disclosed methods and apparatuses can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For example, the division of modules or units is only a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the apparatus or unit can be in electrical, mechanical or other forms.
[0064] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0065] In addition, the functional units in the various embodiments of the present application can be integrated in a processing unit, or each unit can exist physically alone, or two or more units can be integrated in one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0066] 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 present application 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. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) or a processor to execute all or part of the steps of each implementation method of the present application. 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.
[0067] If the technical solution of this application involves personal information, the product using the technical solution of this application has clearly informed the personal information processing rules and obtained the individual's voluntary consent before processing the personal information. If the technical solution of this application involves sensitive personal information, the product using the technical solution of this application has obtained the individual's separate consent before processing the sensitive personal information, and at the same time meets the "explicit consent" requirement. For example, on personal information collection devices such as cameras, clear and prominent signs are set to inform that the personal information collection scope has been entered and personal information will be collected. If the individual voluntarily enters the collection scope, it is deemed that he or she agrees to the collection of his or her personal information; or on the device that processes personal information, the personal information processing rules are notified by obvious signs / information, and the individual's authorization is obtained through pop-up information or by asking the individual to upload his or her personal information; among them, the personal information processing rules may include information such as the personal information processor, the purpose of personal information processing, the processing method, and the type of personal information processed.
Claims
1. A method for generating an official document, characterized in that: include: Receive the official document generation instruction input by the target object and the auxiliary document uploaded for this official document generation, and obtain the portrait description text of the target object; wherein the expected official document of the target object is related to the content of the auxiliary document, and the portrait description text describes the portrait tags of the target object related to the official document writing in natural language; A first target official document is generated based at least on the official document generation instruction, the key information of the auxiliary document and the portrait description text.
2. The method according to claim 1, characterized in that The first target document is generated by a large language model, and the step of obtaining a portrait description text of the target object includes: Acquire the conversation data between the target object and the large language model before the current document is generated as the historical conversation; Analyzing the historical conversations to obtain short-term portrait data of the target object; wherein the short-term portrait data at least includes portrait tags related to official document writing; Based on the short-term portrait data, at least one portrait label related to official document writing in the existing portrait data of the target object is adjusted to obtain new existing portrait data; Based on the new existing portrait data, a portrait description text of the target object is obtained.
3. The method according to claim 1, characterized in that The step of obtaining the portrait description text of the target object further includes any of the following: Based on the basic needs of official document writing, generate a portrait description text of the target object; In response to the target object performing a tag attribute setting operation on a tag category related to official document writing, a portrait tag of the tag category is obtained based on the tag attributes configured by the setting operation, and a portrait description text of the target object is obtained based on the portrait tags of various tag categories.
4. The method according to claim 1, characterized in that: After acquiring the portrait description text of the target object and before generating the first target document based at least on the document generation instruction, the key information of the auxiliary document and the portrait description text, the method further includes: Outputting a portrait description text of the target object; In response to detecting a modification instruction of the target object to the portrait description text, the portrait description text is modified based on the modification instruction to obtain a new portrait description text of the target object.
5. The method according to claim 1, characterized in that After receiving the document generation instruction input by the target object and the auxiliary document uploaded for the current document generation, and before generating the first target document based at least on the document generation instruction, the key information of the auxiliary document and the portrait description text, the method further includes: Based on the auxiliary document, element extraction is performed to obtain the contents of several official document elements as key information of the auxiliary document; wherein the several official document elements include at least one of the subject, type, summary, main point, factual data, and domain knowledge.
6. The method according to claim 1, characterized in that After generating the first target official document based at least on the official document generation instruction, the key information of the auxiliary document and the portrait description text, the method further includes: Selecting the document generation instruction and the key information respectively as benchmarking information; Extracting element contents of several official document elements in the benchmarking information, and extracting element contents of the several official document elements in the first target official document; In response to the fact that the element contents of the benchmarking information and the first target text regarding the same official document element are inconsistent, generating a first adjustment instruction of the first target official document regarding the corresponding official document element; The first target official document is modified based on the first adjustment instruction regarding the official document element of the first target official document to obtain a second target official document.
7. The method according to claim 6, characterized in that In the case where the key information is selected as the benchmarking information, the several official document elements include main viewpoints, factual data and domain knowledge, and the extracting of element contents of the several official document elements in the benchmarking information includes: Extracting the key information respectively about the main viewpoint, the factual data and the domain knowledge; The extracting element contents of the plurality of official document elements from the first target official document includes: Extracting the element contents of the first target document respectively regarding the main viewpoint, the factual data and the domain knowledge; The key information is compared with the first target text element by element to determine whether the main viewpoints, the factual data and the elements of the domain knowledge are consistent.
8. The method according to claim 6, characterized in that In the case where the official document generation instruction is selected as the benchmarking information, the several official document elements include genre, theme, writing perspective, scope, style, content requirements, time, place, format and structure, and the extracting of the element content of the several official document elements in the benchmarking information includes: Extracting the elements of the document generation instruction regarding the genre, the subject, the writing perspective, the scope, the style, the content requirements, the time, the location, the format and the structure; The extracting element contents of the plurality of official document elements from the first target official document includes: Extracting the elements of the first target document respectively regarding the genre, the theme, the writing perspective, the scope, the style, the content requirements, the time, the location, the format and the structure; The official document generation instruction compares the first target official document text element by element to see whether the genre, subject, writing perspective, scope, style, content requirements, time, place, format and structure are consistent.
9. The method according to claim 1, characterized in that: After generating the first target official document based at least on the official document generation instruction, the key information of the auxiliary document and the portrait description text, the method further includes: In response to the first target text not being consistent with the portrait tag about document writing in the portrait description text, generating a second adjustment instruction for the first target document; wherein the second adjustment instruction is used to instruct to adjust the first target document to be consistent with the portrait tag about document writing in the portrait description text; The first target official document is modified based on the second adjustment instruction of the first target official document to obtain a second target official document.
10. The method according to claim 1, characterized in that Before generating the first target official document based at least on the official document generation instruction, the key information of the auxiliary document and the portrait description text, the method further includes: Acquire a document library; wherein the document library includes a plurality of preset documents, and the preset documents are provided with a first semantic code, the first semantic code is obtained by encoding based on a description set of the preset documents, and the description set includes at least one of a subject, an agency, and a type; Based on the official document generation instruction and key information of the auxiliary document, a description set of the expected official document is obtained; Encoding based on the description set of the expected official document to obtain a second semantic code; Based on the similarity between the second semantic code and the first semantic code of each of the preset official documents in the official document library, selecting the preset official document as a model official document; The generating a first target official document based at least on the official document generation instruction, the key information of the auxiliary document and the portrait description text comprises: Based on the official document generation instruction, the key information of the auxiliary document, the portrait description text and the sample official document, the first target official document is generated.
11. The method according to claim 10, characterized in that The generating the first target official document based on the official document generation instruction, the key information of the auxiliary document, the portrait description text and the sample official document comprises: Based on the official document generation instruction, the key information, the portrait description text and the sample official document, a prompt instruction is constructed; wherein the prompt instruction is used to indicate the reference priority and reference range of the official document generation instruction, the key information, the portrait description text and the sample official document by the large language model when generating the official document, and the reference priority of the official document generation instruction is higher than that of the portrait description text, the reference range of the key information is all information, and the reference range of the sample official document includes structural specifications and language characteristics; The prompt instruction is input into the large language model to obtain output content of the large language model as the first target document.
12. A document generation device, characterized in that: include: A generation preparation module is used to receive the official document generation instruction input by the target object and the auxiliary document uploaded for this official document generation, and obtain the portrait description text of the target object; wherein the expected official document of the target object is related to the content of the auxiliary document, and the portrait description text describes the portrait label of the target object related to the official document writing in natural language; The official document generation module is used to generate a first target official document based at least on the official document generation instruction, the key information of the auxiliary document and the portrait description text.
13. An electronic device, characterized in that: The invention at least comprises a memory and a processor coupled to each other, wherein the memory at least stores program instructions, and the processor is used to execute the program instructions to implement the document generation method according to any one of claims 1 to 11.
14. A computer-readable storage medium, characterized in that: Program instructions that can be executed by a processor are stored, and the program instructions are used to implement the document generation method described in any one of claims 1 to 11.