Automatic paper first draft generation method and system and electronic equipment
By employing guided topic selection, automated literature retrieval, and a large language model with multiple roles, this technology addresses the issues of efficiency and professionalism in generating initial drafts of papers. It enables efficient, multimodal paper writing and audiovisual integration, resulting in high-quality initial drafts.
Patent Information
- Application Number
- CN202410935468.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-12
- Publication Date
- 2024-11-15
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
Existing technologies that utilize large language models to assist in generating initial drafts of papers face challenges such as low efficiency in topic selection, lack of professional writing skills, and insufficient image content, making it difficult to quickly generate high-quality initial drafts.
By guiding thesis topic selection, automated literature retrieval and knowledge base construction, combined with the deep understanding and reasoning capabilities of large language models, a thesis framework is generated, and writing and revision are carried out using multi-role settings. Visual auxiliary materials are inserted by combining structured video and image information recognition technology.
It enables the rapid and professional generation of first drafts of papers, improves writing efficiency and quality, achieves multimodal output and audiovisual integration, and enriches the forms of information dissemination.
Smart Images

Figure CN118966162A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and more specifically, to an automatic paper draft generation method, system and electronic device. Background Art
[0002] In academic research, researchers often need to consult a large amount of literature and organize relevant professional knowledge before they can determine the specific research direction or paper title. In the process of writing papers, there are sometimes problems such as confusion of ideas, unclear expression of views, unclear logic, lack of professionalism, and lack of standardization. Therefore, it is of great practical significance to help researchers improve the efficiency and accuracy of acquiring professional knowledge, quickly determine the research direction and paper title, sort out the ideas of paper writing, make writing more standardized and professional, and improve the efficiency and quality of scientific research. In recent years, large language models have been widely used in various text generation tasks due to their powerful understanding and summarization capabilities. These models can quickly process and analyze large amounts of text data, and in theory can be used to assist in the generation of field paper drafts. However, in the practice of applying large language models to the generation of paper drafts, there are still some challenges and limitations such as low efficiency in topic selection, lack of professionalism in writing, and lack of picture content.
[0003] The invention patent application with publication number CN 117725894 A discloses an intelligent assistance system for the academic field, which guides users to select research directions, paper titles and recommends paper outlines through prompt words, helps users to clarify writing ideas and logic, and improves writing efficiency and quality. The system includes a paper writing module, which is used to respond to intelligent assistance requests, obtain multiple preset prompt words; obtain the research topic input by the user, generate a first research direction with the research topic, and generate a first writing question and answer sentence with the first research direction; in response to the first selection instruction, generate a first paper title with the research topic and the target research direction, and generate a second writing question and answer sentence with the first paper title; in response to the second selection instruction, generate a first paper outline with the research topic, the target research direction, and the target paper title, and generate a third writing question and answer sentence with the first paper outline; in response to the third selection instruction, send the target paper outline to the terminal held by the user. The system helps users to clarify the ideas and logic of paper writing, so that users can express their views clearly and improve writing efficiency and quality.
[0004] The invention patent application with the publication number CN 117725894 A discloses a method and system for generating a field review based on a large language model, including the following steps: obtaining the references cited in the review paper and its chapters to build a dynamic paper database; the user inputs the field information of the paper to be queried, performs a coarse-grained search of the paper in the dynamic paper database, returns the relevant paper search results, and filters according to the user's portrait information to obtain the final relevant paper; uses the paper parsing instructions and the trained paper parsing model to extract and summarize the key information of the final relevant paper to obtain the summary results of the final relevant paper; inputs the summary results of the final relevant paper and the review generation instructions into the trained review generation model, returns the field review that meets the user's preferences to the user, and realizes the generation of field reviews based on the large language model. This method can improve the efficiency of researchers in acquiring and integrating new knowledge. Summary of the invention
[0005] In view of the above-mentioned defects of the prior art, the present invention provides a method, system and electronic device for automatically generating a first draft of a paper, which allows users to clarify the topic of the paper by entering keywords or answering questions, and can also intelligently construct a paper framework, and automatically retrieve and integrate literature in related fields to form a local knowledge base; on this basis, the method can utilize the deep understanding and reasoning capabilities of a large language model, combined with multi-role settings, to write and revise the first draft of the paper, and combine structured video image information recognition technology to insert appropriate visual auxiliary materials into the paper, so as to enrich the expression form of the paper and enhance the information dissemination effect.
[0006] To achieve the above object, on the one hand, the present invention provides an automatic paper draft generation method, characterized in that it includes the following steps:
[0007] S1, automatic paper draft content generation;
[0008] S2, pictures to match references for the paper;
[0009] The S1 comprises the following sub-steps:
[0010] S1.1. Obtain the paper topic input by the researcher or conduct guided paper topic selection: When conducting guided paper topic selection, collect the researcher's major and academic qualifications, set the role of the large language model as an expert scholar in the corresponding major, conduct interactive Q&A with the researcher based on the large language model, gradually collect the researcher's information, and the model raises more detailed questions based on the researcher's choice to conduct guided paper topic selection;
[0011] S1.2, input the obtained paper topic, topic description and general paper format into the constructed structure function Prompt, which guides the large language model to give a paper framework that fits the topic through prompts;
[0012] S1.3, automated literature retrieval and knowledge base construction;
[0013] S1.4, Automatically generate content based on large language models;
[0014] S1.5. Automated content evaluation: Introduce a supervisory role to evaluate the output of the model;
[0015] The content of the first draft of the paper is obtained through the cooperation of four intelligent agents: questioner, information retrieval, writer, and editor. The output quality of each role will affect the final output of the paper.
[0016] The S2 comprises the following sub-steps:
[0017] S2.1, extract pictures and text blocks from references;
[0018] S2.2, matching the corresponding captions in sequence according to the picture numbers, and importing them into the large language model to obtain a description of the picture;
[0019] S2.3. Match the image description with the relevant description in the first draft of the paper, and extract the images with consistent descriptions and insert them into the paper;
[0020] The S1.4 comprises the following sub-steps:
[0021] S1.4.1. Generate a series of relevant questions based on research topics and professional directions to guide the direction of information retrieval;
[0022] S1.4.2. Retrieve information related to the question through the knowledge base, generate answers to the question using a large language model, and build a dictionary containing key information;
[0023] S1.4.3. Based on the writing requirements and ideas of the paper, use the large language model to construct the student role as the writer, refer to the retrieved knowledge point information, and generate preliminary content with clear logic and clear views; finally, introduce the role of the editor to perform multiple rounds of optimization and modification on the preliminary content without changing the paper's arguments.
[0024] Furthermore, the S1.3 is implemented by using Selenium to search the Connected Papers database, including the following steps:
[0025] S1.3.1. Select Firefox browser, transfer the download path to the driver function webdriver.Firefox(), and then access the spliced website. The splicing method is as follows:
[0026] U = quto(U0, Key, P)
[0027] Among them, quto is the splicing algorithm, U is the URL of the searched document, Key is the search keyword, and P is the search page number. By changing the value of P, you can target different pages to obtain more document information;
[0028] S1.3.2. After obtaining the webpage source code through driver.page_source, use the BeautifulSoup library to extract the paper link, including the PDF link that can be directly downloaded and the article DOI; for the PDF link, use Selenium to access it, and then use BeautifulSoup to point to the download button, and for the DOI, add the free open source website prefix and then access it through Selenium; after traversing all levels of titles, the download is completed, and the references are saved in folders with different title names;
[0029] S1.3.3. Use LlamaIndex to automatically build a knowledge base.
[0030] Furthermore, the S1.3.3 comprises the following steps:
[0031] S1.3.3.1. Read document data from the specified folder using the tools in the llama_index.core library;
[0032] S1.3.3.2. Convert these document data into vector indexes;
[0033] S1.3.3.3, use the storage_context.persist method to save this index to a specific location on disk;
[0034] S1.3.3.4. To configure access permissions for external services, set environment variables to build a query engine for text query operations based on saved indexes.
[0035] Furthermore, the specific implementation of S2 includes the following steps:
[0036] SII.I. Import necessary libraries and modules: os library is used to process file and directory paths, re library is used for regularized text pattern matching, time library is used for time processing, PyMuPDF library is the algorithm core library for PDF and image editing, and openai library provides large language model embedding;
[0037] SII.II, import and process documents: call the open function in the PyMuPDF library to directly input the target document into the system, obtain the variables of the file attributes, extract the pictures in the document one by one by traversing the document pages, and use the regular expression r′fig.*′ to extract the text block containing the caption; import the text block into the constructed large language model to obtain the description of the picture;
[0038] SII.III. Image Restoration: Construct the image restoration function algorithm recoverpix; the purpose of this function is to recover the image pixel data from the specified PDF document, taking into account the transparency and color space definition that the image may contain;
[0039] SII.IV, Image Saving: Name the processed image as the image description extracted by the large speech model to complete the image description, and directly extract it in the subsequent image matching.
[0040] Furthermore, the image restoration algorithm recoverpix includes the following process: try to extract the image and its transparency mask (if any), and try to merge them to restore the complete transparency information of the image; if the image has a specific color space definition but no transparency mask, convert it to RGB color space; the function finally returns a dictionary containing image data, color space information and file extension, or directly returns the original image data if the image has no special requirements; the original image data can be obtained according to the following formula:
[0041] IMG=recoverpix(W RGB+CMYK , IMG0) where IMG is the processed image data, IMG0 is the initial image data, W RGB+CMYK are the parameters of the corresponding color space respectively.
[0042] Furthermore, S2 also includes S3, generating an introductory video of the paper.
[0043] Furthermore, the S3 comprises the following steps:
[0044] S3.1. Use a commercial speech synthesis module to synthesize the article summary into speech as the audio track of the video; use the pictures cited in the article as the video content;
[0045] S3.2. Use Python's OpenCV module to stitch the two together to get the video.
[0046] On the other hand, the present invention provides an automated paper draft generation system, characterized by comprising:
[0047] Automated paper content generation module, which obtains or guides the acquisition of paper topics, performs automated chapter construction, automated literature retrieval and knowledge base construction, automated content generation, and automated content evaluation;
[0048] The image matching module extracts pictures and text blocks from references; matches the corresponding captions in sequence according to the picture numbers, and imports them into the large language model to obtain a description of the picture; matches the picture description with the relevant description in the first draft of the paper, and extracts pictures with consistent descriptions and inserts them into the paper.
[0049] Furthermore, the system also includes a paper introduction video generation module.
[0050] On the other hand, the present invention provides an electronic device, characterized by a memory storing executable program code; a processor coupled to the memory; the processor calls the executable program code stored in the memory to execute the above-mentioned automated paper draft generation method.
[0051] Compared with the prior art, the present invention has the following technical effects:
[0052] (1) The present invention solves the problems of information collection and data processing in paper writing by adopting multiple automated algorithms, and utilizes the deep understanding and reasoning capabilities of a large language model, combined with multi-role settings, to quickly and automatically write and revise papers.
[0053] (2) The present invention uses multiple Python libraries to extract and restore images in the paper, and uses a large model to match the content with the images, thereby solving the problem that automated paper writing is limited to a single mode and achieving the effect of multi-modal output.
[0054] (3) The present invention solves the problem that paper reading is limited to vision through speech synthesis and video synthesis technology, and achieves the effect of combining audio and video in paper reading. BRIEF DESCRIPTION OF THE DRAWINGS
[0055] Figure 1 The figure is a flow chart of a method for automatically generating a first draft of a paper in one embodiment of the present invention.
[0056] Figure 2 Schematic diagram of the process of selecting a paper topic in one embodiment of the present invention.
[0057] Figure 3 A schematic diagram of the process of constructing a paper framework in one embodiment of the present invention.
[0058] Figure 4 Schematic diagram of the roles in the process of automated paper draft generation in one embodiment of the present invention.
[0059] Figure 5 The figure is a schematic diagram of the process of generating an introductory video of a paper in one embodiment of the present invention. DETAILED DESCRIPTION
[0060] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, but they are not intended to limit the present invention.
[0061] In the following detailed description, many specific details are set forth to provide a more thorough understanding of the present invention. However, it is obvious to those skilled in the art that well-known algorithms and models (such as large language models) are not shown in detail to avoid obscuring the subject matter of the present invention.
[0062] In addition, the order of execution of actions, steps, etc. in the devices and methods shown in the claims, specifications and drawings can be implemented in any order as long as there is no special explicit limitation on the order and the output of the previous processing is not used in the subsequent processing.
[0063] Example 1
[0064] See also Figure 1 This embodiment provides an automated paper draft generation method, comprising the following steps:
[0065] S1, automatic paper draft content generation;
[0066] S2, pictures used as reference for paper matching.
[0067] S1 includes the following sub-steps:
[0068] S1.1. Obtain the paper topic input by the researcher or conduct guided paper topic selection: When conducting guided paper topic selection, collect the researcher's major and academic qualifications, set the role of the large language model as an expert and scholar in the corresponding profession, conduct interactive Q&A with the researcher based on the large language model, gradually collect researcher information, and the model asks more detailed questions based on the researcher's choice to conduct guided paper topic selection. Therefore, this embodiment provides two methods for paper topic selection. Before the paper begins, the model will collect the researcher's major and academic qualifications to provide assistance for subsequent topic selection and writing. The model will then ask the researcher whether he or she has a clear research topic. If so, the researcher will be guided to enter the topic. Otherwise, the pre-constructed automatic topic selection function will be called to conduct guided paper topic selection. The topic selection method determines the logic as follows: Figure 2 As shown in the figure. If there is a problem in the function call process, the model will directly guide the researcher to enter the research topic, thereby avoiding the crash of the entire program. When automatically selecting topics, the model role is set as an expert scholar in the corresponding major through the embedding of grade and major. The model will conduct interactive Q&A with the researcher and gradually collect information about the researcher. Each time a question is asked, the researcher can choose a suitable direction from two options, and the model will ask more detailed questions based on the choice.
[0069] S1.2. See Figure 3 , the obtained paper topic, topic description and general paper format are input into the constructed structure function, which guides the large language model to give a paper framework that fits the topic through prompts.
[0070] S1.3, automated literature search and knowledge base building. As an achievable example, S1.3 is implemented by using Selenium to search the Connected Papers database, including the following steps:
[0071] S1.3.1. Select Firefox browser, transfer the download path to the driver function webdriver.Firefox(), and then access the spliced website. The splicing method is as follows:
[0072] U = quto(U0, Key, P)
[0073] Among them, quto is the splicing algorithm, U is the URL of the searched document, Key is the search keyword, and P is the search page number. By changing the value of P, you can target different pages to obtain more document information;
[0074] S1.3.2. After obtaining the webpage source code through driver.page_source, use the BeautifulSoup library to extract the paper link, including the PDF link that can be directly downloaded and the article DOI; for the PDF link, use Selenium to access it, and then use BeautifulSoup to point to the download button, and for the DOI, add the prefix of the free open source website and then access it through Selenium; after traversing the titles at all levels, the download is completed, and the references are saved in folders with different title names. Selenium can drive the browser to complete various operations, such as simulated clicks. After using BeautifulSoup to identify the elements that need to be operated, you can use Selenium to operate on an element and adopt the appropriate web page element positioning method to operate. As a browser testing automation tool, Selenium has a driver (WebDriver) that can automatically perform browser control to simulate human interaction with web applications, and can upload, download files, pop-up windows and dialogue barriers, thereby effectively avoiding the anti-crawler means of web pages.
[0075] S1.3.3, use LlamaIndex to automatically build a knowledge base. As a feasible example, the knowledge base built in this embodiment is mainly used for data processing and information collection. This method discusses the implementation of LlamaIndex. LlamaIndex (GPT index) is the data framework for LLM applications. Building with LlamaIndex usually involves using the LlamaIndex core and a set of selected integrations (or plug-ins): first, document data is read from a specified folder through the tools in the llama_index.core library, and these document data are converted into vector indexes for efficient text search and matching. Then, use the storage_context.persist method to save this index to a specific location on disk so that it can be loaded and used later. Setting environment variables is to configure access rights to external services (such as OpenAI's API) to build a query engine for text query operations based on saved indexes. LlamaIndex not only supports batch reading of multiple types of documents, but also significantly reduces operation time, providing strong support for efficient paper writing. Based on the above analysis, this paper finally chooses LlamaIndex as the preferred solution for building the knowledge base to fully utilize its advantages of efficiency and ease of use.
[0076] S1.4, automatically generate content based on a large language model. S1.4 includes the following sub-steps:
[0077] S1.4.1. Generate a series of relevant questions based on research topics and professional directions to guide the direction of information retrieval;
[0078] S1.4.2, retrieve information related to the question through the knowledge base, and use a large language model (such as GPT4.0) to generate answers to the questions and build a dictionary containing key information. The GPT4.0 model used in this embodiment is a large multimodal language model developed by OpenAI. It not only continues its excellent performance in the field of natural language processing, especially in processing complex information extraction and summarization, but also further integrates image processing capabilities. Through image embedding technology and API interface, GPT4.0 realizes interactive processing of text and images, and provides strong technical support for the structured recognition and design of video picture information. Although GPT4.0 has increased in processing time and cost compared to GPT-3.5, its excellent performance and rich functions have brought significant convenience and value to the research and application of related fields. The core technologies of GPT4.0 include Transformer, Proximal Policy Optimization (PPO), Supervised Fine-Tuning (SFT), Reward Modeling (RM), Rule-based Reward Model (RBRM), etc.
[0079] S1.4.3. Based on the writing requirements and ideas of the paper, use the large language model to build the student role, refer to the retrieved knowledge point information, and generate preliminary content with clear logic and clear views; finally, introduce the role of the editor (such as an outstanding scholar in the field), and without changing the thesis argument, conduct multiple rounds of optimization and modification of the preliminary content to make the paper more rigorous and logically more rigorous. During the whole process, multiple rounds of editors can be invited to adjust the content as needed to achieve higher paper quality requirements.
[0080] S1.5. Automated content evaluation: Introduce a supervisory role to evaluate the output of the model.
[0081] See also Figure 4 The content of the first draft of the paper is obtained through the cooperation of four intelligent agents: questioner, information retrieval, writer, and editor. The output quality of each role will affect the final output of the paper. Therefore, it is necessary to supervise the behavior of each role. If it does not meet the requirements, the work should be repeated until it meets the standards.
[0082] After completing the first draft of the paper, you need to match the images of the references to the paper, that is, proceed to step S2. S2 includes the following sub-steps:
[0083] S2.1, extract pictures and text blocks from references;
[0084] S2.2, matching the corresponding captions in sequence according to the picture numbers, and importing them into the large language model to obtain a description of the picture;
[0085] S2.3. Match the image description with the relevant description in the first draft of the paper, and extract the images with consistent descriptions and insert them into the paper.
[0086] It should be noted that S2 does not perform image recognition directly, but it can also meet the basic requirements of paper image generation.
[0087] As an implementable example, the specific implementation of S2 includes the following steps:
[0088] SII.I. Import necessary libraries and modules: os library is used to process file and directory paths, re library is used for regularized text pattern matching, time library is used for time processing, PyMuPDF library is the algorithm core library for PDF and image editing, and openai library provides large language model embedding.
[0089] SII.II, import and process documents: call the open function in the PyMuPDF library, i.e. the fitz library, to directly input the target document into the system, obtain the variables of the file attributes, extract the images in the document one by one by traversing the document pages, and use the regular expression r′fig.*′ to extract the text block containing the caption; import the text block into the constructed large language model to obtain the description of the image. For PDF documents in the same format, PyMuPDF can extract all the image files and text blocks of a document at one time.
[0090] PyMuPDF is a powerful image and text extraction tool with a variety of different image and text extraction options. Among them, PyMuPDF can extract images, plain text, extract text in blocks, extract word lists, convert PDF files into fully usable HTML files, etc. In addition, PyMuPDF also has the function of creating TextPage objects, which contain Python dictionaries of PDF file pages, each dictionary embedded with more detailed information, which is a powerful tool for determining the various parts of a PDF file. After extracting the image and text, a description of the image content can be obtained through processing with a large language model. Image recognition is thus indirectly achieved.
[0091] SII.III, Image Restoration: Since the extracted image may have anti-color difference, resulting in the output being different from the actual image, this embodiment constructs an image restoration function algorithm recoverpix; the purpose of this function is to restore image pixel data from a specified PDF document, and take into account the transparency and color space definition that the image may contain;
[0092] SII.IV, Image Saving: Name the processed image as the image description extracted by the large speech model to complete the image description, and directly extract it in the subsequent image matching.
[0093] As one of the preferred examples, the image restoration algorithm recoverpix includes the following process: try to extract the image and its transparency mask (if any), and try to merge them to restore the complete transparency information of the image; if the image has a specific color space definition but no transparency mask, convert it to RGB color space to ensure compatibility; the function finally returns a dictionary containing image data, color space information and file extension, or directly returns the original image data if there is no special requirement for the image; the original image data can be obtained according to the following formula:
[0094] IMG=recoverpix(W RGB+CMYK ,IMG0)
[0095] Among them, IMG is the processed image data, IMG0 is the initial image data, and W RGB+CMYK are the parameters of the corresponding color space. Using the image restoration algorithm recoverpix to restore the image can restore the information of the original image in the paper to the greatest extent, avoiding the problem of missing image data during the extraction process.
[0096] Example 2
[0097] This embodiment provides an automated method for generating a first draft of a paper. In addition to the steps described in Embodiment 1, the method further includes S3 after S2, i.e., generating an introductory video of the paper.
[0098] As an example of what can be done, see Figure 5 , said S3 comprises the following steps:
[0099] S3.1. Use a commercial speech synthesis module to synthesize the article summary into speech as the audio track of the video; use the pictures cited in the article as the video content;
[0100] S3.2. Use Python's OpenCV module to stitch the two together to get the video.
[0101] The following is an introduction to the speech synthesis module and OpenCV module.
[0102] Speech synthesis is the use of computer technology to convert text information into natural and fluent speech. Speech synthesis systems usually need to convert text into playable audio files by calling REST API interfaces and save the generated speech. During the speech synthesis process, users usually need to obtain credentials such as API keys to start development and integrate the corresponding SDK into the local project. Common speech synthesis companies include Baidu AI, Tencent Cloud, iFlytek, etc., which provide their own speech synthesis systems and services. Among them, Baidu AI's speech synthesis technology has been widely used in the fields of smart homes and smart enterprises.
[0103] After obtaining the audio file, the video production process starts immediately. In this process, we used OpenCV, an industry-leading computer vision tool library. OpenCV provides a wealth of image processing and computer vision algorithms, which are carefully designed and optimized to meet the needs of various application scenarios. Although the core implementation of OpenCV is based on C++, its excellent cross-platform features enable it to seamlessly connect with multiple programming languages such as Python, Java, and MATLAB, greatly improving development efficiency and flexibility. Therefore, video synthesis can be achieved through Python calls. The specific process is shown in the figure below. After obtaining the audio file, it is necessary to capture its duration and count the number of pictures. Based on these two elements, the appropriate picture repetition frequency is obtained, and then the two sets of data are transmitted to OpenCV. After being processed by the internal function, the target video file can be obtained.
[0104] Example 3
[0105] This embodiment provides an automated paper draft generation system, which uses the method described in Embodiment 1 to automatically generate a paper draft, including:
[0106] The module for automatic paper content generation obtains or guides the acquisition of paper topics, performs automatic chapter construction, automatic literature retrieval and knowledge base construction, automatic content generation, and automatic content evaluation.
[0107] The image matching module extracts pictures and text blocks from references; matches the corresponding captions in sequence according to the picture numbers, and imports them into the large language model to obtain a description of the picture; matches the picture description with the relevant description in the first draft of the paper, and extracts pictures with consistent descriptions and inserts them into the paper.
[0108] Example 4
[0109] This embodiment provides an automated paper draft generation system. In addition to the modules described in Example 3, the system also includes a paper introduction video generation module, which generates a video using the method described in Example 2.
[0110] Example 5
[0111] This embodiment provides an electronic device, comprising a memory storing executable program code; a processor coupled to the memory; the processor calls the executable program code stored in the memory to execute the automated paper draft generation method described in Embodiment 1 or Embodiment 2.
[0112] In order to facilitate technical personnel in this field to understand the implementation process and effect of the present invention, we take financial engineering as an example. Through guided questions, we can determine the topic of, for example, a review of China's financial development. By retrieving papers, we can generate a paper introducing the review of China's financial development, and provide relevant pictures and an introductory video for learning in related directions.
[0113] In summary, the present invention proposes an innovative framework for automatically constructing the structure and content of academic papers. This framework not only allows users to clarify the topic of the paper by entering keywords or answering questions, but also intelligently constructs the paper framework, and automatically retrieves and integrates literature in related fields to form a local knowledge base. On this basis, the framework can use the deep understanding and reasoning capabilities of the large language model, combined with multi-role settings, to write and revise the first draft of the paper. Finally, combined with structured video image information recognition technology, appropriate visual auxiliary materials are inserted into the paper, and an introductory video is generated to enrich the expression of the paper and enhance the dissemination effect of information.
[0114] Those skilled in the art should understand that those skilled in the art can implement variations by combining the prior art and the above embodiments, which will not be described in detail here. Such variations do not affect the essential content of the present invention, and will not be described in detail here.
[0115] The above describes the preferred embodiments of the present invention. It should be understood that the present invention is not limited to the above-mentioned specific embodiments, and the devices and structures that are not described in detail should be understood to be implemented in a common manner in the art; any technician familiar with the art can use the above-disclosed methods and technical contents to make many possible changes and modifications to the technical solutions of the present invention without departing from the scope of the technical solutions of the present invention, or modify them into equivalent embodiments of equivalent changes, which does not affect the essential content of the present invention. Therefore, any simple modifications, equivalent changes and modifications made to the above embodiments based on the technical essence of the present invention without departing from the content of the technical solutions of the present invention are still within the scope of protection of the technical solutions of the present invention.
[0116] Those skilled in the art will appreciate that the units, i.e., algorithm steps, of the various examples described in conjunction with this embodiment can be implemented in electronic hardware or in a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
Claims
1. A method for automatically generating a first draft of a paper, characterized in that: The following steps are involved: S1, automatic paper draft content generation; S2, pictures to match references for the paper; The S1 comprises the following sub-steps: S1.
1. Obtain the paper topic input by the researcher or conduct guided paper topic selection: When conducting guided paper topic selection, collect the researcher's major and academic qualifications, set the role of the large language model as an expert scholar in the corresponding major, conduct interactive Q&A with the researcher based on the large language model, gradually collect the researcher's information, and the model raises more detailed questions based on the researcher's choice to conduct guided paper topic selection; S1.2, input the obtained paper topic, topic description and general paper format into the constructed structure function Prompt, which guides the large language model to give a paper framework that fits the topic through prompts; S1.3, automated literature retrieval and knowledge base construction; S1.4, Automatically generate content based on large language models; S1.
5. Automated content evaluation: Introduce a supervisory role to evaluate the output of the model; The content of the first draft of the paper is obtained through the cooperation of five intelligent agents: questioner, information retrieval, writer, editor, and supervisor. The output quality of each role will affect the final output of the paper. The S2 comprises the following sub-steps: S2.1, extract pictures and text blocks from references; S2.2, matching the corresponding captions in sequence according to the picture numbers, and importing them into the large language model to obtain a description of the picture; S2.
3. Match the image description with the relevant description in the first draft of the paper, and extract the images with consistent descriptions and insert them into the paper; The S1.4 comprises the following sub-steps: S1.4.
1. Generate a series of relevant questions based on research topics and professional directions to guide the direction of information retrieval; S1.4.
2. Retrieve information related to the question through the knowledge base, generate answers to the question using a large language model, and build a dictionary containing key information; S1.4.
3. Based on the writing requirements and ideas of the paper, use the large language model to construct the student role as the writer, refer to the retrieved knowledge point information, and generate preliminary content with clear logic and clear views; finally, introduce the role of the editor to perform multiple rounds of optimization and modification on the preliminary content without changing the paper's arguments.
2. The method for generating an automated paper draft according to claim 1, characterized in that: S1.3 is implemented by using Selenium to search the Connected Papers database, and includes the following steps: S1.3.
1. Select Firefox browser, transfer the download path to the driver function webdriver.Firefox(), and then access the spliced website. The splicing method is as follows: U=quto(U0,,Key,P) Among them, quto is the splicing algorithm, U is the URL of the searched document, Key is the search keyword, and P is the search page number. By changing the value of P, you can target different pages to obtain more document information; S1.3.
2. After obtaining the webpage source code through driver.page_source, use the BeautifulSoup library to extract the paper link, including the PDF link that can be directly downloaded and the article DOI; for the PDF link, use Selenium to access it, and then use BeautifulSoup to point to the download button, and for the DOI, add the free open source website prefix and then access it through Selenium; after traversing all levels of titles, the download is completed, and the references are saved in folders with different title names; S1.3.
3. Use LlamaIndex to automatically build a knowledge base.
3. The method for generating an automated paper draft according to claim 2, characterized in that: The S1.3.3 comprises the following steps: S1.3.3.
1. Read document data from the specified folder using the tools in the llama_index.core library; S1.3.3.
2. Convert these document data into vector indexes; S1.3.3.3, use the storage_context.persist method to save this index to a specific location on disk; S1.3.3.
4. To configure access permissions for external services, set environment variables to build a query engine for text query operations based on saved indexes.
4. The method for automatically generating a first draft of a paper according to claim 1, characterized in that: The specific implementation of S2 includes the following steps: SII.I. Import necessary libraries and modules: os library is used to process file and directory paths, re library is used for regularized text pattern matching, time library is used for time processing, PyMuPDF library is the algorithm core library for PDF and image editing, and openai library provides large language model embedding; SII.II, import and process documents: call the open function in the PyMuPDF library to directly input the target document into the system, obtain the variables of the file attributes, extract the pictures in the document one by one by traversing the document pages, and use the regular expression r′fig.*′ to extract the text block containing the caption; import the text block into the constructed large language model to obtain the description of the picture; SII.III. Image Restoration: Construct the image restoration function algorithm recoverpix; the purpose of this function is to recover the image pixel data from the specified PDF document, taking into account the transparency and color space definition that the image may contain; SII.IV, Image Saving: Name the processed image as the image description extracted by the large speech model to complete the image description, and directly extract it in the subsequent image matching.
5. The method for automatically generating a first draft of a paper according to claim 4, characterized in that: The image restoration algorithm recoverpix includes the following process: try to extract the image and its transparency mask (if it exists), and try to merge them to restore the complete transparency information of the image; if the image has a specific color space definition but no transparency mask, convert it to RGB color space; the function finally returns a dictionary containing image data, color space information and file extension, or directly returns the original image data if the image has no special requirements; the original image data can be obtained according to the following formula: IMG=recoverpix(W RGB+CMYK ,IMG0) Among them, IMG is the processed image data, IMG0 is the initial image data, and W RGB+CMYK are the parameters of the corresponding color space respectively.
6. The method for automatically generating a first draft of a paper according to any one of claims 1 to 5, characterized in that: S2 also includes S3, an introductory video on generating the paper.
7. The method for automatically generating a first draft of a paper according to claim 6, characterized in that: The S3 comprises the following steps: S3.
1. Use a commercial speech synthesis module to synthesize the article summary into speech as the audio track of the video; use the pictures cited in the article as the video content; S3.
2. Use Python's OpenCV module to stitch the two together to get the video.
8. An automated paper draft generation system, characterized in that: include: Automated paper content generation module, which obtains or guides the acquisition of paper topics, performs automated chapter construction, automated literature retrieval and knowledge base construction, automated content generation, and automated content evaluation; The image matching module extracts pictures and text blocks from references; matches the corresponding captions in sequence according to the picture numbers, and imports them into the large language model to obtain a description of the picture; matches the picture description with the relevant description in the first draft of the paper, and extracts pictures with consistent descriptions and inserts them into the paper.
9. The automatic paper draft generation system according to claim 8 is characterized in that: The system also includes a paper introduction video generation module.
10. An electronic device, characterized in that: A memory storing executable program code; a processor coupled to the memory; the processor calling the executable program code stored in the memory to execute the method for automatically generating a first draft of a paper according to any one of claims 1 to 7.
Citation Information
Cited By
Academic paper retrieval method and device based on large language model driving and medium
CN119357335A
Systematized literature review method and system based on large language model
CN120104789A
Medical first draft generation method and device based on large model and electronic equipment
CN120353848A
Method, device and equipment for evaluating medical information research capability of large language model
CN122266820A
Method, device and equipment for evaluating medical information research capability of large language model
CN122266820B
