Article generation method and device, electronic equipment and storage medium

By generating an article outline using the first major language model and selecting a matching second major language model, the problem of the quality of articles generated by the major language model depending on the input content is solved, thus achieving high-quality article generation and reducing the professional requirements for users' writing.

CN121597831APending Publication Date: 2026-03-03BEIJING 58 INFORMATION TTECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511648859.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-11
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

In existing technologies, the quality of articles generated by large language models depends on the accuracy of the input content description, which requires users to cover a wide range of information, increases the requirements for writing professionalism, and affects the generation effect.

Method used

By obtaining the article topic, an article outline is generated using the first major language model, and a matching target model is selected from multiple second major language models. The article is generated by inputting the article outline and writing prompts. The second major language model is trained based on different types of articles.

Benefits of technology

It reduces the impact of users' writing ability on article quality, ensures the quality of generated articles, improves the effectiveness of article generation, and reduces the reliance on professional post-editing processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121597831A_ABST
    Figure CN121597831A_ABST
Patent Text Reader

Abstract

The invention provides an article generation method and device, electronic equipment and a storage medium, and relates to the technical field of computers. The article generation method comprises the steps of obtaining a theme of a to-be-generated article; inputting the theme and a model selection cue word into a first large language model to obtain an article outline and a model identifier, the model selection cue word being used for the first large language model to generate the article outline according to the theme, a target model matched with the article type indicated by the subject is selected from a plurality of second large language models, a model identifier of the target model is output, and each second large language model is obtained through training based on different types of articles and used for generating different types of articles; and inputting the article outline and a finished article cue word into the target model indicated by the model identifier to obtain a target article, the finished article cue word being used for the target model to generate an article according to the article outline. The article generation quality is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, electronic device and storage medium for generating articles. Background Technology

[0002] The development of large language models has led to their increasingly widespread application in people's daily lives. People are also beginning to use large language models in their writing, hoping to produce high-quality articles.

[0003] Currently, the process of generating articles using large language models typically involves: users inputting specific requirements and prompts into a general large language model, which then outputs an article that matches those requirements. Users then perform post-editing processes on the output, such as grammatical correction, sentence structure adjustment, and language polishing, to obtain a high-quality article that is accurate, fluent, and meets specific requirements.

[0004] Clearly, the higher the quality of the articles output by the large language model, the lower the user's need for post-editing. This effectively reduces the reliance of post-editing on the professional level of the editor and prevents it from affecting the article quality. However, the quality of the articles output by the large language model depends to some extent on the accuracy of the descriptions in the input text. Therefore, the current input text requirements for large language models often need to cover multiple aspects such as the topic, structure, style, outline, and ideas of the article to be generated. This results in a high level of professional writing required for the input text, making the quality of the generated articles highly dependent on the user's writing ability and prone to poor output. Summary of the Invention

[0005] In view of this, this application provides an article generation method, apparatus, electronic device, and storage medium, which can improve the quality of article generation to a certain extent.

[0006] According to a first aspect of this application, an article generation method is provided, the method comprising: Get the topic of the article to be generated; The topic and model selection prompts are input into the first language model to obtain an article outline and a model identifier. The model selection prompts are used by the first language model to generate an article outline based on the topic and to select a target model from multiple second language models that matches the article type indicated by the topic. The model identifier of the target model is output. Each second language model is trained based on different types of articles to generate different types of articles. The article outline and writing prompts are input into the target model indicated by the model identifier to obtain the target article. The writing prompts are used by the target model to generate the article based on the article outline.

[0007] According to a second aspect of this application, an article generation apparatus is provided, the apparatus comprising: The acquisition module is used to obtain the topic of the article to be generated; The first model processing module is used to input the topic and model selection prompt words into the first large language model to obtain an article outline and a model identifier. The model selection prompt words are used by the first large language model to generate an article outline based on the topic, and to select a target model from multiple second large language models that matches the article type indicated by the topic, and output the model identifier of the target model. Each second large language model is trained based on different types of articles to generate different types of articles. The second model processing module is used to input the article outline and text prompt words into the target model indicated by the model identifier to obtain the target article. The text prompt words are used by the target model to generate the article based on the article outline.

[0008] According to a third aspect of this application, an electronic device is provided, comprising: a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the article generation method as described in any of the first aspects. According to a fourth aspect of this application, a computer-readable storage medium is provided, on which a computer program is stored, which, when executed by a processor, implements the steps of the article generation method as described in any of the first aspects.

[0009] According to a fifth aspect of this application, a computer program product comprising instructions is provided, which, when run on a computer, causes the computer to perform the article generation method as described in any of the first aspects.

[0010] Compared with prior art, this application has the following advantages: The article generation method provided in this application, after obtaining the topic of the article to be generated, inputs the topic and model selection prompts into a first language model, so that the first language model can output an article outline according to the topic. Then, it selects a target model from multiple second language models that matches the article type indicated by the topic and outputs the model identifier of the target model. Finally, it inputs the article outline and writing prompts into the target model indicated by the model identifier to obtain the article generated by the target model based on the article outline.

[0011] In this technical solution, each second major language model is trained based on different types of articles to generate different types of articles. Therefore, by dynamically selecting a second major language model that matches the article type indicated by the topic of the article to be generated from the first major language model, the required article can be generated using a second major language model focused on generating articles of that specific type, ensuring the quality of the generated article. Furthermore, compared to related technologies that require inputting multiple aspects such as the topic, outline, and ideas of the article to be generated using a major language model, this technical solution only requires inputting the topic of the article to be generated into the first major language model to generate the required article matching the topic. Since the required level of expertise for writing the article topic is much lower than that for writing the outline and ideas, this article generation method effectively reduces the impact of the user's writing ability on the quality of the generated article, thereby further ensuring the quality of the generated article and improving the article generation effect. Attached Figure Description

[0012] Figure 1 This is a flowchart of an article generation method provided in an embodiment of this application; Figure 2 This is a flowchart of another article generation method provided in an embodiment of this application; Figure 3 This is a block diagram of an article generation device provided in an embodiment of this application; Figure 4 This is a block diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0013] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0014] Please refer to Figure 1This document illustrates a flowchart of an article generation method provided in an embodiment of this application. The article generation method can be applied to electronic devices. Optionally, the electronic device can be a mobile phone, tablet computer, laptop computer, PDA, in-vehicle electronic device, mobile internet device (MID), augmented reality (AR) / virtual reality (VR) device, robot, wearable device, ultra-mobile personal computer (UMPC), netbook, or personal digital assistant (PDA), etc., and can also be a server, network attached storage (NAS), personal computer (PC), television set, etc. This embodiment of the application does not specifically limit the scope. Figure 1 As shown, the article generation methods include: Step 101: Obtain the topic of the article to be generated.

[0015] In this embodiment, the theme refers to the central idea or main content of the article to be generated. In some embodiments, the theme of the article to be generated can be information input by the user. Accordingly, the electronic device can obtain the theme of the article to be generated input by the user. In other embodiments, the theme of the article to be generated can also be theme information generated by the user using an article theme generation tool based on the content keywords of the article to be generated. Here, article keywords can refer to the central words that the user wants the article to express. Optionally, the article theme generation tool can be an AI tool, a model tool, or other tool used to generate theme sentences based on keywords.

[0016] For example, a user can directly input the topic of the article to be generated into the electronic device, such as "Describe the pleasant life of a family going on a spring outing by the river," so that the electronic device can obtain the topic and generate an article with that topic as its central idea.

[0017] Step 102: Input the topic and model selection prompts into the first language model to obtain the article outline and model identifier.

[0018] In this embodiment, the electronic device inputs a topic and model selection prompt into a first language model, so that the first language model generates an article outline based on the topic in response to the model selection prompt, and selects a target model from multiple second language models that matches the article type indicated by the topic, and outputs the model identifier of the target model.

[0019] The article outline, also known as the article skeleton, refers to the structured and standardized information of the article content. It is used to clarify the article's theme, organize materials, and structure, ensuring the article is clear, logical, and highlights key points. Each of the multiple secondary language models is trained on different types of articles. Therefore, each secondary language model is used to generate different types of articles. The target model that matches the article type indicated by the topic refers to the secondary language model used to generate the article type indicated by the topic.

[0020] The model selection prompts are used by the first language model to generate an article outline based on the topic, and to select a target model from multiple second language models that matches the article type indicated by the topic, outputting the model identifier of the target model. Specifically, the first language model, in response to the model selection prompts, performs semantic analysis on the topic, generates an article outline, and determines the article type indicated by the topic; then, based on the article type generated by each second language model, it selects a target model that matches the article type indicated by the topic and outputs the model identifier of the target model.

[0021] Optionally, the model selection prompts can be pre-defined fixed content. Alternatively, the model selection prompts can be semantically instructive statements to generate an article. For example, model selection prompts could be "Please generate an article on the topic of...", "Generate an article", "Please output the article", etc.

[0022] In some embodiments, the model selection prompt can be information input by the user. Correspondingly, alternatively, the electronic device can acquire the user-inputted topic and model selection prompt, and input the topic and model selection prompt as first input data into a first language model. For example, a user inputs the information "Please generate an article on the topic of spring scenery" through the electronic device. The electronic device inputs "Please generate an article on the topic of spring scenery" as the first input data into the first language model. Here, the user-inputted topic is "spring scenery"; the model selection prompt is "Please generate an article on the topic of...".

[0023] In addition, the model selection prompts can also be information automatically set by the electronic device after obtaining the topic of the article to be generated. Correspondingly, alternatively, the electronic device can obtain pre-set model selection prompts after obtaining the topic, or generate model selection prompts according to the generation rules of model selection prompts, so that the topic and model selection prompts are arranged into a fixed format and used as the first input data, which is then input into the first large language model.

[0024] For example, the model selection prompt is "Please generate an article with the topic '...'", where the topic is article topic A. The electronic device organizes the topic and model selection prompt into: "Please generate an article with article topic A as the topic." In another example, the model selection prompt is "Please generate an article based on the following topic", where the topic is article topic A. The electronic device organizes the topic and model selection prompt into: "Please generate an article based on the following topic, article topic A." By organizing the topic and model selection prompt into a unified, fixed format, the primary language model can more effectively parse input information, improving model processing efficiency.

[0025] In some embodiments of this application, the first large language model can be a basic language model. A basic language model refers to a large language model that has been pre-trained on large-scale text data and has mastered the ability to use a general language. The basic language model can understand and generate natural language, but it has not been finely tuned for specific tasks to adapt to specific application environments.

[0026] In other embodiments, the first major language model may also be a task-specific model. The first major language model may be trained using multiple first training sample data sets. The first training sample data sets include: model-selected prompt words and training article topics. For example, the first major language model may be Baichuan2-13B-Chat, ChatGLM2-6B, etc.

[0027] Optionally, the convergence condition for the first large language model can be: the number of training iterations of the first large language model is greater than a first quantity threshold. Alternatively, each first training sample data also includes a first label, which includes the outline of the training article and the model identifier corresponding to the training article topic. The convergence condition for the first large language model can also be: the output accuracy is greater than a first accuracy threshold. Output accuracy refers to the ratio of the number of times the first large language model outputs accurate results to the total number of outputs. Specifically, the accurate output result of the first large language model is determined when the outline and model identifier output by the first large language model based on the training article topic are accurate. Outline accuracy can mean that the similarity between the outline output by the first large language model based on the training article topic and the outline in the first label corresponding to that training article topic is greater than a first similarity threshold. Model identifier accuracy can mean that the model identifier output by the first large language model based on the training article topic is the same as the model identifier in the first label corresponding to that training article topic.

[0028] In this embodiment, multiple second-large language models are used. Each second-large language model is used to generate different types of articles.

[0029] In some embodiments, article types can be categorized according to the article's domain and / or application scenario. Specifically, article types can be categorized by domain, or by application scenario, or by both domain and application scenario.

[0030] Based on this, a second major language model can be trained separately for different domains and / or application scenarios, so that each second major language model can be adapted to different domains and / or application scenarios to generate articles in the adapted domain and / or application scenario, resulting in multiple second major language models for generating different types of articles. Then, a model identifier is assigned to each trained second major language model. For example, the model identifier can be a model number. Alternatively, the model identifier can also be a combination of model number and article type information. The article type is the type of article output by the second major language model, as indicated by the model identifier.

[0031] For example, for a single domain and application scenario, i.e., a single article type, a second major language model is trained using multiple second training sample data to obtain a second major language model for generating articles of that type. The second training sample data includes: training article outlines for training articles in that domain and application scenario. Optionally, the convergence condition for the second major language model can be: the number of training iterations of the second major language model is greater than a second quantity threshold. Alternatively, each second training sample data also includes a second label, which includes the training article corresponding to the training article outline. The convergence condition for the second major language model can also be: the output accuracy is greater than a second accuracy threshold. Output accuracy refers to the ratio of the number of times the second major language model outputs accurate results to the total number of outputs. Specifically, the second major language model is considered to output accurate results when the similarity between the article output by the second major language model based on the training article outline and the training article in the second label corresponding to that training article outline is greater than a second similarity threshold. Similarly, for each domain and application scenario, a second major language model adapted to that domain and application scenario can be trained to obtain multiple second major language models.

[0032] For example, article types categorized by field and application scenario can include: agriculture - wheat planting, agriculture - vegetable planting, industry - steelmaking, industry - ironmaking, computer - network construction, computer - network equipment research and development, etc.

[0033] For agriculture—specifically wheat cultivation—the second training sample data consists of training articles about wheat cultivation, and the corresponding training outline is the outline of such articles about wheat cultivation. The second language model trained based on this second training sample data is then used to generate articles about wheat cultivation.

[0034] For computer network construction, the second training sample data contains training articles about network construction, and the corresponding training outline is the outline of such articles. The second major language model trained based on this second training sample data is used to generate articles about network construction. By analogy, at least six second major language models can be obtained, each used to generate one of six types of articles.

[0035] Step 103: Input the article outline and writing prompts into the target model indicated by the model identifier to obtain the target article. The writing prompts are used by the target model to generate the article based on the article outline.

[0036] Optionally, the electronic device can obtain text prompts after obtaining the article outline, and input the article outline and text prompts into the target model indicated by the model identifier, so that the target model generates an article based on the article outline in response to the text prompts. The article is an article with the topic input into the first language model as its theme.

[0037] In some embodiments, the prompt words can be pre-defined information. Alternatively, the prompt words can be information generated by the electronic device according to the prompt word generation rules. Optionally, the content of the prompt words can be pre-defined fixed content. Alternatively, the content of the prompt words can be a statement that semantically instructs the generation of an article. For example, the prompt words can be "Please generate an article based on the input article outline", "Generate an article", "Please output the article", etc.

[0038] In one alternative implementation, the electronic device can format the article outline and prompts into a fixed format and use them as the second input data to the second language model. For example, the prompts are "Please generate an article with ... as the core," and the article outline is Article Outline A. The electronic device formats the article outline and prompts as: "Please generate an article with Article Outline A as the core." In another example, the prompts are "Please generate an article based on the subsequent outline," and the article outline is Article Outline A. The electronic device formats the article outline and prompts as: "Please generate an article based on the subsequent outline, Article Outline A." By formatting the article outline and prompts into a unified, fixed format, the second language model can more effectively parse the input information, improving model processing efficiency.

[0039] In one alternative implementation, a large language model library can be established, and multiple trained second-large language models can be loaded into the library. Each second-large language model is configured with a model identifier, which can be associated with the type of article generated by the second-large language model. The large language model library is abstracted into a method interface, resulting in a model invocation interface. This interface allows the second-large language models in the large language model library to be invoked based on their model identifiers. Specifically, after obtaining the article outline and model identifier from the first-large language model, the electronic device can use the model identifier, article outline, and text prompts as input parameters to invoke the model invocation interface. This allows the target article to be obtained by inputting the article outline and text prompts into the target model indicated by the model identifier.

[0040] In this embodiment, after obtaining the topic of the article to be generated, the topic and model selection prompts are input into a first language model so that the first language model can output an article outline based on the topic. Then, a target model matching the article type indicated by the topic is selected from multiple second language models, and its model identifier is output. Finally, the article outline and writing prompts are input into the target model indicated by the model identifier to obtain the article generated by the target model based on the article outline.

[0041] In this technical solution, each second major language model is trained based on different types of articles to generate different types of articles. Therefore, by dynamically selecting a second major language model that matches the article type indicated by the topic of the article to be generated from the first major language model, the required article can be generated using a second major language model focused on generating articles of that specific type, ensuring the quality of the generated article. Furthermore, compared to related technologies that require inputting multiple aspects such as the topic, outline, and ideas of the article to be generated using a major language model, this technical solution only requires inputting the topic of the article to be generated into the first major language model to generate the required article matching the topic. Since the required level of expertise for writing the article topic is much lower than that for writing the outline and ideas, this article generation method effectively reduces the impact of the user's writing ability on the quality of the generated article, thereby further ensuring the quality of the generated article and improving the article generation effect.

[0042] In some embodiments of this application, such as Figure 2 As shown, after inputting the article outline and writing prompts into the target model indicated by the model identifier in step 103 to obtain the target article, the article generation method further includes: Step 104: Divide the target article into segments to determine the paragraphs.

[0043] Optionally, the electronic device can input the target article into a segmentation model to identify paragraphs of the target article. For example, the segmentation model can be an embedding model such as Word2Vec or Global Statistical Word Embedding (GloVe), or a sequence model such as a Bidirectional Long Short-Term Memory (BiLSTM)-Conditional Random Field (CRF) model or a Gated Recurrent Unit (GRU)-CRF model.

[0044] Step 105: Extract the keywords and image material types for each paragraph.

[0045] In this embodiment, the image keywords refer to text tags used to describe information such as image content, theme, or style. Specifically, image keywords at least indicate the main idea, characters, emotions, and logical relationships described in the paragraph content. Image material type refers to the type of image corresponding to the paragraph. Optionally, image types can be categorized according to content theme, at least as follows: people, natural scenery, cityscapes, animals, food, etc. Alternatively, image types can also be categorized according to visual style, such as: hand-drawn, punk, or minimalist, etc.

[0046] In some embodiments, the electronic device can extract at least one image keyword and at least one image material type for each paragraph, in order to limit the images in the paragraph by the image keyword and image material type. Optionally, the process of the electronic device extracting the image keyword and image material type for each paragraph may include: inputting the content of each paragraph and the image prompt words into a third language model to obtain the image keyword and image material type for each paragraph.

[0047] Among them, the image prompts are used by the third language model to extract image keywords for a single paragraph based on its content, and to select image types from multiple image types that match the content of the paragraph. These multiple image types refer to the types of images that can be output by various image output tools available to electronic devices.

[0048] Optionally, the electronic device can sequentially input the content of each paragraph and the accompanying image prompts into a third language model, so that the third language model can sequentially output the accompanying image keywords and image material types for each paragraph. Specifically, for the content of each paragraph, the third language model can, in response to the accompanying image prompts, perform text analysis processing on the content of a single paragraph to extract content keywords, sentiment keywords, and text style keywords, thus obtaining the paragraph's accompanying image keywords. These accompanying image keywords include the paragraph's content keywords, sentiment keywords, and text style keywords.

[0049] Content keywords refer to words that directly express the core theme, entities, or key information of the text, primarily indicating what the text is about. Emotional keywords refer to words that express the text's emotional tone or mood, primarily indicating the attitude or emotion conveyed. Text style keywords refer to words that express the text's language style or writing characteristics, primarily indicating how the text expresses information. For example, in the text "Today we went skiing at A Snow Mountain. The weather was sunny and bright, and everyone had a great time," the content keywords are "A Snow Mountain," "skiing," "party," and "sunny weather"; the emotional keyword is "happy"; and the text style keyword is "colloquial."

[0050] In some embodiments of this application, the third language model can also be a basic language model. Alternatively, the third language model can be a task-specific model used to extract image keywords and image material types from the input content in response to image prompts. The third language model can be trained using multiple third training sample data. The third training sample data includes: image prompts and training text. For example, the third language model can be Baichuan2-13B-Chat, ChatGLM2-6B, etc.

[0051] Optionally, the image prompt can be pre-set information. Alternatively, the image prompt can also be information generated by the electronic device according to image prompt generation rules. Optionally, the content of the image prompt can be pre-set fixed content. Alternatively, the content of the image prompt can be a statement that semantically indicates the extraction of image information for the content. For example, the image prompt can be "Please output the image information for the input content" or "Generate the image information for the input content," etc.

[0052] In one alternative implementation, the electronic device can organize the content of a single paragraph and the accompanying image prompt into a fixed format and use it as third input data to a third language model. For example, given the image prompt "Please output the image information for...", the electronic device organizes the content of a single paragraph and the image prompt into: "Please output + paragraph content + image information". Another example, given the image prompt "Please output image information", the electronic device organizes the content of a single paragraph and the image prompt into: "Please output image information: + paragraph content".

[0053] By organizing the content and accompanying image prompts into a unified, fixed format, the third language model can more effectively parse the input information, improving its processing efficiency. Furthermore, using the third language model to extract image keywords and image material types for each paragraph can effectively ensure the accuracy of these extractions to a certain extent.

[0054] In some embodiments, the electronic device can also extract the image keywords and image material types for each paragraph according to preset extraction rules. Preset extraction rules are used to define the words in the text content that are image keywords, and to define the correspondence between image keywords and image material types. For example, preset extraction rules can be used to define words or phrases that appear relatively frequently in the text content as image keywords; the subject, object, and core verb of each sentence in the text content as image keywords, etc. Furthermore, preset extraction rules also define the correspondence between image keywords and image material types to match image material types based on image keywords. It should be noted that preset extraction rules can be manually set labeling rules, or rules generated in advance using statistical principles, etc.

[0055] Step 106: For each paragraph, use the target image output tool that matches the type of the accompanying image material from among multiple image output tools, and obtain the target image output by the target image output tool based on the accompanying image keywords.

[0056] Each image output tool is used to output different types of images. Specifically, each image output tool may correspond to at least one image type, and is used to output images of that image type. The single image material type extracted by the electronic device is one of the image types. For each paragraph, the electronic device can obtain the correspondence between image output tools and image types. Based on this correspondence and the paragraph's image material type, it determines the target image output tool corresponding to that image material type, inputs the image keywords into the target image output tool, and obtains the target image output by the target image output tool based on the image keywords. This results in the target image for each paragraph. The target image for a single paragraph describes the content indicated by the image keywords for that paragraph. By extracting the image material type required for a paragraph, and utilizing image output tools focused on generating images of that image material type, paragraph images are generated based on the paragraph's image keywords, ensuring that the generated images accurately describe the content indicated by the paragraph's image keywords, thus improving the quality of image generation.

[0057] It should be noted that, as mentioned earlier, a single paragraph can have multiple image material types. Based on this, the electronic device can determine at least one image output tool corresponding to any given image material type, and then select the target image output tool from among those image output tools, according to the correspondence between image output tools and image types, and the multiple image material types of the paragraph.

[0058] Specifically, the electronic device can, when given multiple image output tools corresponding to any given image material type, select any one of these tools as the target image output tool. Alternatively, the electronic device can select the image output tool corresponding to the most image material types among the multiple image output tools as the target image output tool, so as to generate a target image that is more suitable for the paragraph's image material type.

[0059] In some embodiments, the electronic device employs a target image output tool that matches the type of accompanying image material from among a plurality of image output tools. The process of obtaining the target image output tool based on the accompanying image keywords may include: Step 1061: Obtain the correspondence between image types and image output interfaces. Each image output interface is an interface abstracted from a different image output tool, used to call the corresponding image output tool.

[0060] Specifically, the electronic device can abstract the method interface generated by each image output tool, obtaining the image output interface corresponding to each tool. Then, based on the image type and output interface corresponding to each tool, it establishes and stores the correspondence between image types and output interfaces. Therefore, after extracting the accompanying keywords and image material types for each paragraph, the electronic device can obtain the pre-stored correspondence between image types and output interfaces.

[0061] Optionally, the correspondence between image type and image output interface refers to the correspondence between image type and the interface identifier of the image output interface. The interface identifier can be the interface address or interface name of the image output interface, and the interface name is a pointer to the interface address.

[0062] Step 1062: Based on the correspondence between image type and image output interface, determine the target image output interface corresponding to the image material type.

[0063] Optionally, the electronic device can select an image output interface corresponding to the image material type from the correspondence between image types and image output interfaces to obtain the target image output interface. In some embodiments, as mentioned above, the number of image material types in a single paragraph can be multiple. Based on the correspondence between image types and image output interfaces, and the multiple image material types in the paragraph, the electronic device can determine at least one image output interface corresponding to any image material type, and determine the target image output interface from that image output interface.

[0064] Specifically, the electronic device can, given multiple image output interfaces corresponding to any given image material type, select any one of these interfaces as the target image output interface. Alternatively, the electronic device can select the image output interface corresponding to the most image material types among the multiple image output interfaces as the target image output interface. This allows the device to generate target images that are more suitable for the paragraph's image material type when using the target image output interface to call the image output tool, thereby improving the quality of the generated paragraph images.

[0065] Step 1063: Using the image keywords as the interface input parameters, call the target image output interface to obtain the target image.

[0066] After determining the target image output interface, the electronic device can call the target image output interface with the image keywords as the interface input parameters. The image output tool called through the target image output interface can then generate the target image based on the image keywords, thus obtaining the target image.

[0067] Step 107: Insert the target image for each paragraph into the corresponding paragraph.

[0068] Optionally, the electronic device can insert the target image into a designated position within a paragraph using set settings. These settings can include floating, background, or embedded elements. The designated position can be at the end of the paragraph, the beginning of the paragraph, or the center of the paragraph. For example, the electronic device can randomly insert the target image for each paragraph into random positions within the paragraph using random settings, thereby improving the overall flexibility of the image selection in the article. Furthermore, since the article generation method provided in this application can generate high-quality articles with high-quality images, users can perform relatively simple post-editing processing on the generated article, such as simple editing of the text content and simple adjustment of the images, to obtain the final article. Clearly, the target article generated by the technical solution of this application can effectively reduce the need for users to perform post-editing processing, reduce the workload of human intervention, and thus effectively reduce the dependence of post-editing processing on the professional level of article editing, further ensuring article quality.

[0069] In this embodiment, after obtaining the topic of the article to be generated, the topic and model selection prompts are input into a first language model so that the first language model can output an article outline based on the topic. Then, a target model matching the article type indicated by the topic is selected from multiple second language models, and its model identifier is output. Finally, the article outline and writing prompts are input into the target model indicated by the model identifier to obtain the article generated by the target model based on the article outline.

[0070] In this technical solution, each second major language model is trained based on different types of articles to generate different types of articles. Therefore, by dynamically selecting a second major language model that matches the article type indicated by the topic of the article to be generated from the first major language model, the required article can be generated using a second major language model focused on generating articles of that specific type, ensuring the quality of the generated article. Furthermore, compared to related technologies that require inputting multiple aspects such as the topic, outline, and ideas of the article to be generated using a major language model, this technical solution only requires inputting the topic of the article to be generated into the first major language model to generate the required article matching the topic. Since the required level of expertise for writing the article topic is much lower than that for writing the outline and ideas, this article generation method effectively reduces the impact of the user's writing ability on the quality of the generated article, thereby further ensuring the quality of the generated article and improving the article generation effect.

[0071] Please refer to Figure 3 The diagram illustrates a block diagram of an article generation apparatus provided in an embodiment of this application. Figure 3As shown, the article generation device 300 includes: an acquisition module 301, a first model processing module 302, and a second model processing module 303.

[0072] Module 301 is used to obtain the topic of the article to be generated; The first model processing module 302 is used to input the topic and model selection prompt words into the first large language model to obtain the article outline and model identifier. The model selection prompt words are used by the first large language model to generate the article outline based on the topic, and to select the target model that matches the article type indicated by the topic from multiple second large language models, and output the model identifier of the target model. Each second large language model is trained based on different types of articles to generate different types of articles. The second model processing module 303 is used to input the article outline and text prompt words into the target model indicated by the model identifier to obtain the target article. The text prompt words are used by the target model to generate the article based on the article outline.

[0073] Optionally, the article generation device 300 also includes: a segmentation module, an extraction module, an image generation module, and an insertion module; The segmentation module is used to segment the target article and determine its paragraphs. The extraction module is used to extract the image keywords and image material types for each paragraph. The image keywords should at least indicate the main idea, characters, emotions, and logical relationships described in the paragraph content. The image generation module is used to select a target image output tool from multiple image output tools that matches the type of accompanying image material for each paragraph. It retrieves the target image output tool based on the accompanying image keywords. Each image output tool is used to output different types of images. The Insert module is used to insert the target image into a paragraph.

[0074] Optionally, the extraction module is also used for: Input the content of each paragraph and the accompanying image prompts into the third language model to obtain the accompanying image keywords and image material types for each paragraph. The accompanying image prompts are used by the third language module to extract the accompanying image keywords of a paragraph based on the content of a single paragraph, and to select the accompanying image material type that matches the content of the paragraph from multiple accompanying image material types. These multiple accompanying image material types belong to the types of images that can be output by multiple image output tools.

[0075] Optionally, each image output tool corresponds to at least one image type and is used to output images of the corresponding image type, with the accompanying image material type being one of the image types; the image generation module is also used for: Obtain the correspondence between image types and image output interfaces. Each image output interface is an interface that is abstracted from a different image output tool and is used to call the corresponding image output tool. Based on the correspondence between image type and image output interface, determine the target image output interface corresponding to the image material type; The target image is obtained by calling the target image output interface with the image keywords as input parameters.

[0076] In this embodiment, after obtaining the topic of the article to be generated, the topic and model selection prompts are input into a first language model so that the first language model can output an article outline based on the topic. Then, a target model matching the article type indicated by the topic is selected from multiple second language models, and its model identifier is output. Finally, the article outline and writing prompts are input into the target model indicated by the model identifier to obtain the article generated by the target model based on the article outline.

[0077] In this technical solution, each second major language model is trained based on different types of articles to generate different types of articles. Therefore, by dynamically selecting a second major language model that matches the article type indicated by the topic of the article to be generated from the first major language model, the required article can be generated using a second major language model focused on generating articles of that specific type, ensuring the quality of the generated article. Furthermore, compared to related technologies that require inputting multiple aspects such as the topic, outline, and ideas of the article to be generated using a major language model, this technical solution only requires inputting the topic of the article to be generated into the first major language model to generate the required article matching the topic. Since the required level of expertise for writing the article topic is much lower than that for writing the outline and ideas, this article generation method effectively reduces the impact of the user's writing ability on the quality of the generated article, thereby further ensuring the quality of the generated article and improving the article generation effect.

[0078] In another embodiment provided in this application, an electronic device is also provided. The electronic device may include: a processor, a memory, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the various processes of the above-described article generation method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0079] For example, such as Figure 4 As shown, the electronic device may specifically include: a processor 401, a storage device 402, a touch-enabled display screen 403, an input device 404, an output device 405, and a communication device 408. The electronic device may have one or more processors 401. Figure 4 Taking a processor 401 as an example. The processor 401, storage device 402, display screen 403, input device 404, output device 405 and communication device 408 of this electronic device can be connected by a bus or other means.

[0080] In another embodiment provided in this application, a computer-readable storage medium is also provided, which stores instructions that, when executed on a computer, cause the computer to perform any of the article generation methods described in the above embodiments.

[0081] In another embodiment provided in this application, a computer program product containing instructions is also provided, which, when run on a computer, causes the computer to execute any of the article generation methods described in the above embodiments.

[0082] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0083] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element.

[0084] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.

[0085] The embodiments of the present invention have been described above with reference to the accompanying drawings. However, the present invention is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of the present invention without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of the present invention.

[0086] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed in this invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementations should not be considered beyond the scope of this invention.

[0087] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

[0088] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative. For instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0089] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0090] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.

[0091] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, ROM, RAM, magnetic disks, or optical disks.

[0092] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the technical scope disclosed in the present invention should be included within the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be determined by the scope of the claims.

Claims

1. A method for generating articles, characterized in that, The method includes: Get the topic of the article to be generated; The topic and model selection prompts are input into the first language model to obtain an article outline and a model identifier. The model selection prompts are used by the first language model to generate an article outline based on the topic and to select a target model from multiple second language models that matches the article type indicated by the topic. The model identifier of the target model is output. Each second language model is trained based on different types of articles to generate different types of articles. The article outline and writing prompts are input into the target model indicated by the model identifier to obtain the target article. The writing prompts are used by the target model to generate the article based on the article outline.

2. The method according to claim 1, characterized in that, The method further includes: The target article is segmented to determine its paragraphs; Extract the image keywords and image material types for each paragraph. The image keywords are used to indicate at least the main idea, characters, emotions, and logical relationships described in the paragraph content. For each paragraph, a target image output tool matching the image material type from among multiple image output tools is used to obtain the target image output tool based on the image keywords. Each image output tool is used to output different types of images. Insert the target image into the paragraph.

3. The method according to claim 2, characterized in that, The extraction of image keywords and image material types for each paragraph includes: Input the content of each paragraph and the accompanying image prompts into the third language model to obtain the accompanying image keywords and image material types for each paragraph. The accompanying image prompts are used by the third language module to extract the accompanying image keywords of the paragraph based on the content of a single paragraph, and to select the accompanying image material type that matches the content of the paragraph from multiple accompanying image material types, wherein the multiple accompanying image material types belong to the types of images that can be output by the multiple image output tools.

4. The method according to claim 2 or 3, characterized in that, Each of the image output tools corresponds to at least one image type and is used to output an image of the corresponding image type, wherein the accompanying image material type is one of the image types; The step of using a target image output tool that matches the image material type from among multiple image output tools, and obtaining the target image output by the target image output tool based on the image keywords, includes: Obtain the correspondence between the image type and the image output interface. Each image output interface is an interface generated by abstracting a different image output tool, which is used to call the corresponding image output tool. Based on the correspondence between the image type and the image output interface, determine the target image output interface corresponding to the image material type; The target image is obtained by calling the target image output interface with the image keywords as the interface input parameters.

5. An article generation device, characterized in that, The device includes: The acquisition module is used to obtain the topic of the article to be generated; The first model processing module is used to input the topic and model selection prompt words into the first large language model to obtain an article outline and a model identifier. The model selection prompt words are used by the first large language model to generate an article outline based on the topic, and to select a target model from multiple second large language models that matches the article type indicated by the topic, and output the model identifier of the target model. Each second large language model is trained based on different types of articles to generate different types of articles. The second model processing module is used to input the article outline and text prompt words into the target model indicated by the model identifier to obtain the target article. The text prompt words are used by the target model to generate the article based on the article outline.

6. The apparatus according to claim 5, characterized in that, The device further includes: The segmentation module is used to segment the target article and determine the paragraphs of the target article; The extraction module is used to extract the image keywords and image material types for each paragraph. The image keywords are used to indicate at least the main idea, characters, emotions, and logical relationships described in the paragraph content. The image generation module is used to, for each paragraph, employ a target image output tool from among multiple image output tools that matches the type of accompanying image material, and obtain the target image output by the target image output tool based on the accompanying image keywords. Each image output tool is used to output different types of images. An insertion module is used to insert the target image into the paragraph.

7. The apparatus according to claim 6, characterized in that, The extraction module is also used for: Input the content of each paragraph and the accompanying image prompts into the third language model to obtain the accompanying image keywords and image material types for each paragraph. The accompanying image prompts are used by the third language module to extract the accompanying image keywords of the paragraph based on the content of a single paragraph, and to select the accompanying image material type that matches the content of the paragraph from multiple accompanying image material types, wherein the multiple accompanying image material types belong to the types of images that can be output by the multiple image output tools.

8. The apparatus according to claim 6 or 7, characterized in that, Each of the image output tools corresponds to at least one image type and is used to output an image of the corresponding image type, wherein the accompanying image material type is one of the image types; the image generation module is further used for: Obtain the correspondence between the image type and the image output interface. Each image output interface is an interface generated by abstracting a different image output tool, which is used to call the corresponding image output tool. Based on the correspondence between the image type and the image output interface, determine the target image output interface corresponding to the image material type; The target image is obtained by calling the target image output interface with the image keywords as the interface input parameters.

9. An electronic device, characterized in that, include: A processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the article generation method as described in any one of claims 1 to 4.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the article generation method as described in any one of claims 1 to 4.