Document generation method and device, storage medium and electronic equipment

By calculating and matching the semantic similarity between the table data and the target content, the problems of low efficiency and low accuracy of traditional document automatic generation methods are solved, and the document content is highly customized and precisely matched, which improves the efficiency and accuracy of document automatic generation.

CN119670714AActive Publication Date: 2025-03-21YGSOFT INC

Patent Information

Application Number
CN202411737316.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-28
Publication Date
2025-03-21
Estimated Expiration
2044-11-28

AI Technical Summary

Technical Problem

Traditional automatic document generation methods are inefficient and low accuracy, especially when processing complex tabular data and high information density documents, resulting in inconsistent data extraction and misalignment of information.

Method used

By obtaining the target template, tabular data, and topics, calculate the semantic similarity between the table data and the target content, and match it to the corresponding directory title, and generate a document corresponding to the target topic.

Benefits of technology

It improves the efficiency and accuracy of automatic document generation, reduces the risks of manual intervention and errors, and ensures high customization and accurate matching of document content.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119670714A_ABST
    Figure CN119670714A_ABST
Patent Text Reader

Abstract

The invention discloses a document generation method and device, a storage medium and electronic equipment, and relates to the field of artificial intelligence. The method comprises the steps of obtaining a target template, table data and a target theme input by a target user; determining a target directory title associated with the target theme according to the target template; the semantic similarity of the table data, the target content and the target directory title is calculated, the target content is text content obtained from a target library and associated with the target theme and the target directory title, and the target library is a database comprising data and documents associated with multiple services; and matching the table data and the target content to a corresponding target directory title according to the semantic similarity to obtain a target document corresponding to the target topic. According to the method and the device, the technical problems of low efficiency and low accuracy when a traditional method is used for processing document automatic generation are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of artificial intelligence, and more specifically, to a document generation method, device, storage medium and electronic device. Background Art

[0002] In the current information age, document automatic generation technology has become a key tool to improve work efficiency and reduce human errors, especially in the fields of law, finance, scientific research and education, where there is a high demand for the rapid generation of large numbers of reports and documents. However, in the face of complex and diverse data sources, the limitations of traditional automatic generation methods have gradually become apparent, mainly in terms of efficiency and accuracy.

[0003] The problem of inefficiency stems from the traditional method's over-reliance on manual operations. Parsing and filling in document templates, building directories, and extracting key information from tables all require manual intervention, which is not only time-consuming, but also significantly increases the inconsistency and error risk of manual operations when processing large-scale data. In particular, when processing tables, complex formats such as merged cells, empty values, and negative numbers have become insurmountable obstacles, greatly affecting the accuracy and efficiency of data extraction.

[0004] The lack of accuracy is attributed to the shortcomings of existing technologies in integrating and matching structured data with document content. In traditional methods, the association between data and text mainly relies on manual judgment, which often leads to information dislocation or omission when dealing with documents with complex structures and high information density, seriously affecting the integrity and professionalism of the documents.

[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0006] The present application provides a document generation method, device, storage medium and electronic device to at least solve the technical problems of low efficiency and low accuracy of traditional methods when processing automatic document generation.

[0007] According to one aspect of the present application, a document generation method is provided, comprising: obtaining a target template, table data and target subject input by a target user; determining a target directory title associated with the target subject based on the target template; calculating the semantic similarity of the table data, target content and target directory title, wherein the target content is text content associated with the target subject and the target directory title obtained from a target library, wherein the target library is a database including data and documents associated with a variety of businesses; matching the table data and the target content to the corresponding target directory title based on the semantic similarity to obtain a target document corresponding to the target subject.

[0008] Optionally, a target directory title associated with a target subject is determined based on a target template, including: parsing the target template to obtain a directory structure, a directory title, and text content corresponding to the directory title of the target template; generating a target directory title matching the target subject based on the directory structure and directory title of the target template, wherein the target directory title has the same format as the directory title.

[0009] Optionally, the semantic similarity of the table data, the target content and the target directory title is calculated, including: performing data cleaning on the table data to obtain the target table data, wherein the data cleaning is used to process merged cells, null values ​​and negative numbers in the table; converting the data in the target table data into tuple form to obtain a tuple set corresponding to the target table data, wherein each tuple in the tuple set represents a row of data in the target table data; constructing M first indexes based on the tuple set, wherein M is an integer greater than or equal to 1, the key of the first index is used to represent any data feature of the tuple set, and the value of the first index is used to represent the tuple in the tuple set that includes the data feature; constructing N second indexes based on the target content, wherein N is an integer greater than or equal to 1, the key of the second index is used to represent any data feature in the target content, and the value of the second index is used to represent the text content in the target content that includes the data feature; determining the semantic similarity of the table data, the target content and the target directory title based on the M first indexes and the N second indexes.

[0010] Optionally, the semantic similarity between the table data, the target content and the target directory title is determined based on M first indexes and N second indexes, including: extracting title features of S titles in the target directory title to obtain S title features, where S is an integer greater than or equal to 1; based on the i-th title feature among the S title features, retrieving a tuple associated with the i-th title feature from the M first indexes, and calculating a first semantic similarity between the tuple and the i-th title feature, where i is a positive integer less than or equal to S; based on the i-th title feature among the S title features, retrieving text content associated with the i-th title feature from the N second indexes, and calculating a second semantic similarity between the text content and the i-th title feature.

[0011] Optionally, the table data and the target content are matched to the corresponding target directory title according to semantic similarity to obtain a target document corresponding to the target topic, including: when the first semantic similarity between the tuple and the i-th title feature is greater than a first preset threshold, the tuple is taken as the first tuple; when the second semantic similarity between the text content and the i-th title feature is greater than a second preset threshold, the text content is taken as the first text content; the first tuple, the first text content and the title corresponding to the i-th title feature are associated and converted into a dictionary form to obtain a dictionary corresponding to the i-th title feature; based on the S dictionaries corresponding to the S title features, the target document corresponding to the target topic is obtained.

[0012] Optionally, a target document corresponding to a target topic is obtained according to S dictionaries corresponding to S title features, including: expanding and integrating the text contents of the S dictionaries, the target topic, and the target template according to a large language model to generate a target document.

[0013] Optionally, after matching the table data and the target content to the corresponding target directory title according to semantic similarity to obtain the target document corresponding to the target subject, the document generation method also includes: format checking the target document according to the target template to obtain the target document after format checking.

[0014] According to another aspect of the present application, a document generation device is also provided, including: an acquisition unit, which acquires a target template, table data and target subject input by a target user; a determination unit, which determines a target directory title associated with the target subject based on the target template; a calculation unit, which calculates the semantic similarity of the table data, the target content and the target directory title, wherein the target content is text content associated with the target subject and the target directory title obtained from a target library, wherein the target library is a database including data and documents associated with multiple businesses; a matching unit, which matches the table data and the target content to the corresponding target directory title based on the semantic similarity to obtain a target document corresponding to the target subject.

[0015] According to another aspect of the present application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, wherein when the computer program runs, the device where the computer-readable storage medium is located executes the above-mentioned document generation method.

[0016] According to another aspect of the present application, an electronic device is also provided, wherein the electronic device includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by one or more processors, the one or more processors execute the above-mentioned document generation method.

[0017] In the present application, the target template, table data and target subject input by the target user are first obtained, and then the target directory title associated with the target subject is determined according to the target template, and then the semantic similarity of the table data, target content and target directory title is calculated to evaluate their relevance and matching, wherein the target content is the text content associated with the target subject and the target directory title obtained from the target library, wherein the target library is a database including data and documents associated with various businesses, and finally the table data and the target content are matched to the corresponding target directory title according to the semantic similarity to obtain the target document corresponding to the target subject, that is, through the method of semantic similarity analysis and intelligent matching, the purpose of highly customized and precise matching of document content is achieved, thereby realizing the technical effect of improving the efficiency and accuracy of automatic document generation, and further solving the technical problems of low efficiency and low accuracy of traditional methods in processing automatic document generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0019] Figure 1 is a flowchart of an optional document generation method according to an embodiment of the present application;

[0020] Figure 2 is a schematic diagram of an optional document generation method according to an embodiment of the present application;

[0021] Figure 3 It is a schematic diagram of an optional document generation device according to an embodiment of the present application. DETAILED DESCRIPTION

[0022] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0023] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application 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 interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising 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 devices.

[0024] It should also be noted that the information and data collected by this application are authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data comply with the relevant laws, regulations and standards of the relevant regions, take necessary confidentiality measures, do not violate public order and good customs, and provide corresponding operation portals for users to choose to authorize or refuse. For example, an interface is set up between this system and relevant users or institutions. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or institution through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or institution.

[0025] According to an embodiment of the present application, an embodiment of a method for generating a document is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0026] It should be noted that a document generation system is used as the execution subject of the document generation method of the embodiment of the present application. It is understandable that the document generation method provided in the embodiment of the present application can also be executed by other systems or devices, and the embodiment of the present application does not specifically limit this.

[0027] Figure 1 is a flowchart of an optional document generation method according to an embodiment of the present application, such as Figure 1 As shown, the method comprises the following steps:

[0028] Step S101, obtaining a target template, table data and target subject input by a target user.

[0029] Optionally, the target template is a document template preset by the user, including a document structure, a title and some fixed content, which is used to guide the automatic generation of the document; the target subject is a core topic or business requirement around which the document that the user needs to generate revolves.

[0030] Optionally, the document generation system receives a target template, form data, and a specific target topic input by a user.

[0031] Step S102, determining a target directory title associated with the target theme according to the target template.

[0032] Optionally, the document generation system determines, based on the target template and the target subject, a directory title related to the subject input by the user.

[0033] Step S103, calculating the semantic similarity among the table data, the target content and the target directory title.

[0034] In step S103, the target content is text content associated with the target subject and the target directory title obtained from the target library.

[0035] In step S103, the target database is a database including data and documents associated with various businesses.

[0036] Optionally, the target database is a knowledge base, which is a database containing multi-domain information, which is organized and classified, covering basic data, professional terms, industry standards, complex theoretical knowledge and practical experience. The data in the knowledge base may come from multiple channels, including but not limited to public literature and resources, professional databases, historically produced documents, user input and feedback.

[0037] Optionally, the document generation system calculates the semantic similarity of the table data, target content and target directory title to measure the similarity in meaning between two or more texts or data and to determine the relevance of the table data and target content to the target directory title.

[0038] Step S104, matching the table data with the target content to the corresponding target directory title according to the semantic similarity, and obtaining the target document corresponding to the target topic.

[0039] Optionally, the document generation system matches the table data and target content to corresponding target directory titles based on semantic similarity, and ultimately generates a document that meets user needs, including precisely matched table data and target content, and fully matches the target subject.

[0040] It can be seen from the contents of steps S101 to S104 that in the present application, the target template, table data and target subject input by the target user are first obtained, and then the target directory title associated with the target subject is determined according to the target template, and then the semantic similarity of the table data, target content and target directory title is calculated to evaluate their relevance and matching, wherein the target content is the text content associated with the target subject and the target directory title obtained from the target library, wherein the target library is a database including data and documents associated with various businesses, and finally the table data and the target content are matched to the corresponding target directory title according to the semantic similarity to obtain the target document corresponding to the target subject, that is, through the method of semantic similarity analysis and intelligent matching, the purpose of highly customized and precise matching of document content is achieved, thereby realizing the technical effect of improving the efficiency and accuracy of automatic document generation, and further solving the technical problems of low efficiency and low accuracy of traditional methods in processing automatic document generation.

[0041] In an optional embodiment, the document generation system first parses the target template to obtain the directory structure, directory title, and text content corresponding to the directory title of the target template, and then generates a target directory title that matches the target subject based on the directory structure and directory title of the target template, wherein the target directory title has the same format as the directory title.

[0042] Optionally, the document generation system can intelligently predict and fill in the directory titles based on the topics entered by the user and the structure of the existing templates, maintaining the consistency of the overall format.

[0043] Optionally, the document generation system uses regular expressions and natural language processing technology to perform in-depth analysis of the target template uploaded by the target user. Through these technical means, the system can accurately identify the directory structure, directory titles and specific content corresponding to the titles in the template. Then, the system will segment the identified directory titles and contents and store them as independent text files. This processing method not only ensures the clarity of the document structure and facilitates the subsequent management and call of the directory and content by the system, but also maintains the traceability of the content. Then, the document generation system automatically generates a set of new directory titles that closely match the target topic input by the user based on the parsed directory structure and directory titles through a large language model and knowledge base, while maintaining the same format as the original template directory title.

[0044] From the above content, it can be seen that the document generation system can identify and parse the directory structure of the target template through regular expressions and natural language processing technology, extract directory titles and related text content, greatly simplifying the initial preparation steps of document generation and improving overall efficiency. It can also intelligently generate a set of new directory titles that are consistent with the original template directory title format based on the target theme provided by the user. The generated target directory title has the same format as the original template directory title, but the content is more in line with the target theme, realizing the standardization of document format and personalized customization of content, meeting the specific requirements for document format and content in different business scenarios. At the same time, through automated parsing and intelligent generation of directory titles, the system significantly reduces manual intervention in the document generation process, reduces the risk of errors caused by manual operations, and improves the accuracy and reliability of document generation.

[0045] In an optional embodiment, the document generation system first performs data cleaning on the table data to obtain target table data, wherein data cleaning is used to process merged cells, null values ​​and negative numbers in the table, and then converts the data in the target table data into tuple form to obtain a tuple set corresponding to the target table data, wherein each tuple in the tuple set represents a row of data in the target table data, and then constructs M first indexes based on the tuple set, wherein M is an integer greater than or equal to 1, the key of the first index is used to represent any data feature of the tuple set, and the value of the first index is used to represent the tuple in the tuple set that includes the data feature, and then constructs N second indexes based on the target content, wherein N is an integer greater than or equal to 1, the key of the second index is used to represent any data feature in the target content, and the value of the second index is used to represent the text content in the target content that includes the data feature, and finally determines the semantic similarity of the table data, the target content and the target directory title based on the M first indexes and the N second indexes.

[0046] Optionally, the document generation system receives a target template, tabular data with a complex format, and a target subject provided by a user, and first cleans the tabular data to process special formats such as merged cells, empty values, and negative numbers to ensure data integrity and consistency. The cleaned tabular data is then converted into a structured set of tuples (such as extracting key digital information from the tabular data and converting it into a tuple structure), where each tuple corresponds to a row of records in the table or each tuple corresponds to a column of records in the table, to facilitate subsequent data processing and index construction. Then, the document generation system constructs M first indexes, where M is an integer greater than or equal to 1, and the key value of each first index corresponds to a specific data feature in the tuple set, such as date, amount, name, etc., and the index value contains all tuples containing the feature. This It helps to quickly retrieve and match specific data. Subsequently, the system retrieves text content related to the target topic and target directory title from the knowledge base (target library) and constructs N second indexes, where N is also an integer greater than or equal to 1. The key value of each second index corresponds to a data feature in the text, and the index value contains all text fragments containing the feature, which ensures that content that is highly relevant to the target topic can be accurately identified. Finally, the system calculates the semantic similarity between the table data and the target content under different directory titles based on the constructed first and second indexes to determine the matching relationship between them. Through semantic similarity analysis and intelligent matching, the system matches the key information in the table data with the most relevant text content, integrates it into the target directory title, and generates a complete and data-accurate target document.

[0047] From the above content, it can be seen that the document generation system reduces manual intervention and speeds up data preparation by automatically processing merged cells, null values ​​and negative numbers, ensuring the quality and consistency of data for subsequent processing, converting tabular data into a set of tuples to facilitate rapid retrieval and efficient processing by the system, improving the flexibility and speed of matching data with document content, and constructing the first and second indexes to achieve rapid positioning of data features and instant retrieval of related text content, greatly reducing search time and improving matching efficiency. By calculating semantic similarity, the system can intelligently match tabular data with the most relevant text content and integrate it into the target directory title, ensuring the accuracy and professionalism of document generation and avoiding incorrect matching and information omissions.

[0048] In an optional embodiment, the document generation system extracts title features of S titles in the target directory title to obtain S title features, where S is an integer greater than or equal to 1, and then retrieves a tuple associated with the i-th title feature from M first indexes based on the i-th title feature among the S title features, and calculates a first semantic similarity between the tuple and the i-th title feature, where i is a positive integer less than or equal to S, and finally retrieves text content associated with the i-th title feature from N second indexes based on the i-th title feature among the S title features, and calculates a second semantic similarity between the text content and the i-th title feature.

[0049] Optionally, the document generation system first extracts title features of S titles from the target directory title, which may be keywords, phrases or other descriptive elements. Subsequently, for each extracted title feature, i.e., the i-th title feature (i is a positive integer less than or equal to S), the system retrieves all tuples closely related to the feature from the previously constructed M first indexes, and calculates the first semantic similarity between these tuples and the i-th title feature. Through such an index retrieval mechanism, the system can quickly locate the table data related to the directory title feature, avoiding full table scanning and significantly improving the efficiency of data matching. Subsequently, the system continues to use N second indexes to retrieve the text content associated with the same group of title features, i.e., the i-th title feature, and calculates the second semantic similarity between these text contents and the feature. The step of calculating the second semantic similarity further enhances the system's intelligent matching capability for document content, ensuring that the generated document content is highly relevant to the target subject and directory title.

[0050] From the above content, it can be seen that the document generation system utilizes the constructed first index and second index to achieve fast retrieval and matching, avoiding a full-range scan of the entire database, greatly improving the speed and efficiency of data processing. By calculating the first semantic similarity between tuples and title features, as well as the second semantic similarity between text content and title features, the system can intelligently filter out the data and content that are most relevant to the directory title features, ensuring the accuracy and professionalism of document generation, reducing manual intervention, and lowering the error rate.

[0051] In an optional embodiment, the document generation system takes the tuple as the first tuple when the first semantic similarity between the tuple and the i-th title feature is greater than a first preset threshold, and takes the text content as the first text content when the second semantic similarity between the text content and the i-th title feature is greater than a second preset threshold. The first tuple and the first text content are then associated with the title corresponding to the i-th title feature and converted into a dictionary form to obtain a dictionary corresponding to the i-th title feature. Finally, based on the S dictionaries corresponding to the S title features, a target document corresponding to the target topic is obtained.

[0052] Optionally, the keys of the dictionary represent the individual titles in the target directory. These titles are the skeleton of the document structure and are stored in the form of keys to facilitate subsequent positioning and content filling. The values ​​are tabular data and text content that match the title. The combination of values ​​can ensure a close association between the tabular data and the text content, making it easier for the system to automatically fill in the corresponding content based on the directory title.

[0053] Optionally, the document generation system introduces two preset thresholds when processing the matching of tuples and text content to ensure that the matching degree between data and content meets certain standards. When the first semantic similarity between the tuple and the i-th title feature exceeds the first preset threshold, the tuple is regarded as the "first tuple", which means that it is sufficiently relevant to the specific title feature and can be used as part of the matching data. Similarly, when the second semantic similarity between the text content and the i-th title feature exceeds the second preset threshold, the text content is marked as "first text content", indicating that its relevance and matching degree with the title feature also meet the requirements. The system then associates this set of first tuples and first text content with the corresponding i-th title feature, and converts it into dictionary form to create a dictionary corresponding to the i-th title feature. The keys and values ​​contained in the dictionary represent the title features, the matching table data and text content, respectively, forming a structured data set to facilitate subsequent document generation operations. Finally, the system will construct the corresponding dictionaries based on the S extracted title features, and then integrate these S dictionaries to generate a document structure and content that fully matches the target topic. This method ensures that each link in the document generation process is based on highly matching data, thereby improving the accuracy and professionalism of the generated documents.

[0054] From the above content, it can be seen that the document generation system incorporates highly matching data and content into the document, and the generated documents are significantly improved in professionalism and relevance, which can better meet the specific needs of users. It not only improves the professionalism and accuracy of the document, but also significantly improves the efficiency and quality of document generation. The use of the dictionary structure enables the system to quickly retrieve and integrate information, greatly accelerating the speed of document generation and improving work efficiency.

[0055] In an optional embodiment, the document generation system expands and integrates the text contents of S dictionaries, target topics, and target templates according to the large language model to generate a target document.

[0056] Optionally, the document generation system uses a large language model to deeply expand and integrate the S dictionaries that have been constructed, the target topic input by the user, and the original text content in the target template to generate the final target document. The S dictionaries contain tabular data and text content related to different title features. These dictionaries serve as input to the large model and provide the specific information and data basis required to generate documents. Through the processing of the large model, the system can understand the information in these dictionaries, and combine them with the target topic to generate content with greater depth and breadth, while integrating with the original content in the target template to ensure that the generated document contains both automatically processed data and maintains the style and framework of the user template.

[0057] Optionally, the document generation system obtains the document content in the decomposed target template, and also creates a corresponding index for the document content. In the same way as the above-mentioned calculation of the similarity between the tuple and the target title, the target title is compared with the document content to calculate the semantic similarity between the two. The goal of the similarity calculation is to find the content fragments that are most relevant to each target title, ensuring that each part of the new document closely fits the subject requirements. When the calculated similarity between the content and the title is higher than the set threshold, the system will add these content fragments to the corresponding title in the newly generated document, thereby ensuring the relevance and accuracy of the document content. This process not only improves the intrinsic quality of the document, but also ensures that the new document is consistent with the target template in structure and content, while incorporating more in-depth information related to the subject, enhancing the professionalism and readability of the document.

[0058] Optionally, Figure 2 is a schematic diagram of an optional document generation method according to an embodiment of the present application, such as Figure 2As shown, the user inputs a text template, a table and a subject, and the document generation system segments the text template into a text template directory and content, and stores the text template directory in a separate file, and stores the text template title and the content corresponding to the title in another file. Such segmentation facilitates the system to process the directory and content separately in the future, and then generates a new directory title about the subject based on the text template directory and the subject input by the user, and then extracts and processes the data information of the table data input by the user, and converts the processed table data into a tuple form through natural language processing technology (NLP), and then inserts the table data and the generated text content (based on the knowledge base The content related to the subject is generated) into the most similar directory based on similarity matching, that is, by generating a dictionary structure corresponding to the directory title and the table data and text content, and finally using the large language model to generate each chapter of the new document according to the matched dictionary, the new directory title, and the content of the text template, and finally combines them together to form the target document. In addition, it should be noted that the user can also enter relevant keywords for the system to generate and match content.

[0059] From the above content, it can be seen that the document generation system uses the content generation capability of the large model to not only expand the document content, but also increase the in-depth analysis and professional knowledge, improve the professionalism and information content of the document, significantly speed up the process of content expansion and integration, reduce manual intervention, save labor costs, and improve the efficiency of document generation.

[0060] In an optional embodiment, the document generation system performs format verification on the target document according to the target template to obtain a format-verified target document.

[0061] Optionally, after generating the target document, the document generation system starts a format verification process. This step is to ensure that the generated document meets the format requirements of the target template, including but not limited to font type, font size, paragraph spacing, title level, chart position, etc. Through format verification, the system can automatically check whether the target document fully complies with the style and layout specifications of the target template, effectively avoiding visual confusion and loss of professionalism caused by inconsistent formats.

[0062] For example, for the compilation of scientific research literature, users upload relevant research topics and relevant literature database information through the system. The system uses natural language processing technology to extract literature abstracts, keywords and main research results, automatically compiles literature reviews in the specified format, and provides citation formatting functions; for market research reports, users upload survey questionnaire data and statistical results through the system. The system automatically generates market research reports containing charts, data analysis and conclusions according to the preset report structure, and supports multiple chart types and data visualization options; for the automatic generation of legal documents, users input the basic facts and legal terms of the case, and the system automatically matches the corresponding legal document templates based on this information, generates legal documents such as contracts and complaints, and automatically performs format verification and clause review; for the production of courseware in the education industry, users provide course outlines and knowledge points, and the system combines the education resource library to automatically generate courseware containing teaching objectives, content summaries, exercises and answers, and supports the integration of multiple teaching media resources; for the compilation of medical records, the system extracts patient medical records, examination results and treatment records from the hospital information system, and automatically generates structured medical reports and discharge summaries to ensure the standardization and accuracy of medical documents. From the above content, we can see that the document generation system can realize automatic document generation in a variety of fields by combining natural language processing, data analysis, template matching and content generation technologies, which significantly improves the speed and quality of document processing, while also reducing the error rate and improving the consistency and professionalism of information.

[0063] From the above content, it can be seen that format verification ensures that the target document generated by the system is completely consistent with the target template in format, improves the professional appearance and overall quality of the document. This automated verification process reduces the need for manual inspection, avoids format errors caused by human negligence or omissions, improves the efficiency and reliability of document generation, and performs format verification based on the target template, so that the system can generate documents that conform to specific styles and standards, meet the format requirements of different industries and scenarios, and enhance the flexibility and applicability of the service.

[0064] According to another aspect of an embodiment of the present application, a schematic diagram of a document generating device is also provided. Figure 3 is a schematic diagram of an optional document generation device according to an embodiment of the present application, such as Figure 3 As shown, the document generation device includes: an acquisition unit 301, a determination unit 302, a calculation unit 303, and a matching unit 304.

[0065] Optionally, an acquisition unit 301 is used to acquire a target template, table data and target subject input by a target user; a determination unit 302 is used to determine a target directory title associated with the target subject based on the target template; a calculation unit 303 is used to calculate the semantic similarity between the table data, the target content and the target directory title, wherein the target content is text content associated with the target subject and the target directory title obtained from a target library, wherein the target library is a database including data and documents associated with a variety of businesses; a matching unit 304 is used to match the table data and the target content to the corresponding target directory title based on the semantic similarity to obtain a target document corresponding to the target subject.

[0066] Optionally, the determination unit 302 includes: a first parsing subunit and a first generating subunit. The first parsing subunit is used to parse the target template to obtain the directory structure, directory title and text content corresponding to the directory title of the target template; the first generating subunit is used to generate a target directory title matching the target theme according to the directory structure and directory title of the target template, wherein the target directory title has the same format as the directory title.

[0067] Optionally, the calculation unit 303 includes: a first processing subunit, a first conversion subunit, a first construction subunit, a second construction subunit, and a first determination subunit. Among them, the first processing subunit is used to perform data cleaning on the table data to obtain the target table data, wherein the data cleaning is used to process the merged cells, null values ​​and negative numbers in the table; the first conversion subunit is used to convert the data in the target table data into tuple form to obtain a tuple set corresponding to the target table data, wherein each tuple in the tuple set represents a row of data in the target table data; the first construction subunit is used to construct M first indexes based on the tuple set, wherein M is an integer greater than or equal to 1, the key of the first index is used to represent any data feature of the tuple set, and the value of the first index is used to represent the tuple in the tuple set that includes the data feature; the second construction subunit is used to construct N second indexes based on the target content, wherein N is an integer greater than or equal to 1, the key of the second index is used to represent any data feature in the target content, and the value of the second index is used to represent the text content in the target content that includes the data feature; the first determination subunit is used to determine the semantic similarity of the table data, the target content and the target directory title based on the M first indexes and the N second indexes.

[0068] Optionally, the first determination subunit includes: a first extraction module, a first calculation module, and a second calculation module. The first extraction module is used to extract the title features of S titles in the target directory title to obtain S title features, where S is an integer greater than or equal to 1; the first calculation module is used to retrieve the tuple associated with the i-th title feature from M first indexes based on the i-th title feature in the S title features, and calculate the first semantic similarity between the tuple and the i-th title feature, where i is a positive integer less than or equal to S; the second calculation module is used to retrieve the text content associated with the i-th title feature from N second indexes based on the i-th title feature in the S title features, and calculate the second semantic similarity between the text content and the i-th title feature.

[0069] Optionally, the matching unit 304 includes: a second determining subunit, a third determining subunit, a second processing subunit, and a fourth determining subunit. The second determining subunit is used to use the tuple as the first tuple when the first semantic similarity between the tuple and the i-th title feature is greater than a first preset threshold; the third determining subunit is used to use the text content as the first text content when the second semantic similarity between the text content and the i-th title feature is greater than a second preset threshold; the second processing subunit is used to associate the first tuple, the first text content, and the title corresponding to the i-th title feature, and convert them into a dictionary form to obtain a dictionary corresponding to the i-th title feature; the fourth determining subunit is used to obtain a target document corresponding to the target topic based on the S dictionaries corresponding to the S title features.

[0070] Optionally, the fourth determination subunit includes: a first generation module, which is used to expand and integrate the text contents of S dictionaries, target topics, and target templates according to the large language model to generate a target document.

[0071] Optionally, the document generation device further includes: a verification unit, configured to perform format verification on the target document according to the target template to obtain the target document after format verification.

[0072] According to another aspect of the present application, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, wherein when the computer program is executed, the device where the computer-readable storage medium is located executes the above-mentioned document generation method.

[0073] According to another aspect of the present application, an electronic device is also provided, wherein the electronic device includes one or more processors and a memory, the memory being used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the above-mentioned document generation method.

[0074] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0075] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0076] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. 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 mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0077] 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 units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.

[0078] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0079] 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, in essence, 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, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0080] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for generating a document, characterized in that: include: Obtain the target template, form data and target subject input by the target user; Determine a target catalog title associated with the target topic according to the target template; Calculating the semantic similarity between the table data, the target content and the target directory title, wherein the target content is text content associated with the target subject and the target directory title obtained from a target library, wherein the target library is a database including data and documents associated with various businesses; The table data and the target content are matched to the corresponding target directory title according to the semantic similarity to obtain a target document corresponding to the target topic.

2. The method for generating a document according to claim 1, characterized in that: Determining a target catalog title associated with the target theme according to the target template includes: Parsing the target template to obtain the directory structure, directory title and text content corresponding to the directory title of the target template; A target directory title matching the target theme is generated according to the directory structure and directory title of the target template, wherein the target directory title has the same format as the directory title.

3. The method for generating a document according to claim 1, characterized in that: Calculating the semantic similarity between the table data, the target content and the target directory title, including: Performing data cleaning on the table data to obtain target table data, wherein the data cleaning is used to process merged cells, empty values ​​and negative numbers in the table; Convert the data in the target table data into a tuple form to obtain a tuple set corresponding to the target table data, wherein each tuple in the tuple set represents a row of data in the target table data; Constructing M first indexes according to the tuple set, where M is an integer greater than or equal to 1, the key of the first index is used to represent any data feature of the tuple set, and the value of the first index is used to represent the tuple in the tuple set that includes the data feature; Constructing N second indexes according to the target content, where N is an integer greater than or equal to 1, a key of the second index is used to represent any data feature in the target content, and a value of the second index is used to represent text content in the target content including the data feature; The semantic similarity among the table data, the target content and the target directory title is determined according to the M first indexes and the N second indexes.

4. The method for generating a document according to claim 3, characterized in that: Determining the semantic similarity of the table data, the target content, and the target directory title according to the M first indexes and the N second indexes includes: Extracting title features of S titles in the target directory title to obtain S title features, where S is an integer greater than or equal to 1; According to the i-th title feature among the S title features, a tuple associated with the i-th title feature is retrieved from the M first indexes, and a first semantic similarity between the tuple and the i-th title feature is calculated, wherein i is a positive integer less than or equal to S; According to the i-th title feature among the S title features, text content associated with the i-th title feature is retrieved from the N second indexes, and a second semantic similarity between the text content and the i-th title feature is calculated.

5. The method for generating a document according to claim 4, characterized in that: Matching the table data and the target content to the corresponding target directory title according to the semantic similarity to obtain a target document corresponding to the target topic, including: When the first semantic similarity between the tuple and the i-th title feature is greater than a first preset threshold, taking the tuple as the first tuple; In the case where the second semantic similarity between the text content and the i-th title feature is greater than a second preset threshold, the text content is used as the first text content; Associating the first tuple, the first text content and the title corresponding to the i-th title feature, and converting them into a dictionary form to obtain a dictionary corresponding to the i-th title feature; According to the S dictionaries corresponding to the S title features, a target document corresponding to the target topic is obtained.

6. The method for generating a document according to claim 5, characterized in that: According to the S dictionaries corresponding to the S title features, a target document corresponding to the target topic is obtained, including: The text contents of the S dictionaries, the target topic, and the target template are expanded and integrated according to the large language model to generate the target document.

7. The method for generating a document according to claim 2, characterized in that: After matching the table data and the target content to the corresponding target directory title according to the semantic similarity to obtain a target document corresponding to the target topic, the document generation method further includes: The target document is format-checked according to the target template to obtain a target document after format-checking.

8. A document generation device, characterized in that: include: An acquisition unit, which acquires a target template, table data, and target subject input by a target user; a determination unit, for determining a target catalog title associated with the target theme according to the target template; A calculation unit, calculating the semantic similarity between the table data, the target content and the target directory title, wherein the target content is text content associated with the target subject and the target directory title obtained from a target library, wherein the target library is a database including data and documents associated with various businesses; A matching unit matches the table data and the target content to the corresponding target directory title according to the semantic similarity to obtain a target document corresponding to the target topic.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed, the device where the computer-readable storage medium is located executes the document generation method according to any one of claims 1 to 7.

10. An electronic device, characterized in that: It includes one or more processors and a memory, wherein the memory is used to store one or more programs, wherein when the one or more programs are executed by the one or more processors, the one or more processors execute the document generation method described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Official document automatic writing method and device

    CN109657223A

  • Data extraction system

    CN113678118A

  • Key text information extraction method and device

    CN114510553A

  • Document template generation method for text management system

    CN116882380A

  • Interactive text processing method and device, electronic equipment and storage medium

    CN117473034A

Cited By

  • Project report generation method and device

    CN120124614A

  • Intelligent checking method and system for university graduation reply slide content

    CN120747995A