CN116933751A - Article generation method and device, electronic equipment and storage medium - Google Patents

Article generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN116933751A
CN116933751A CN202310797366.5A CN202310797366A CN116933751A CN 116933751 A CN116933751 A CN 116933751A CN 202310797366 A CN202310797366 A CN 202310797366A CN 116933751 A CN116933751 A CN 116933751A
Authority
CN
China
Prior art keywords
template
user
target
input information
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310797366.5A
Other languages
Chinese (zh)
Inventor
李弘宇
吕尚文
孙月晴
刘璟
吴华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN202310797366.5A priority Critical patent/CN116933751A/en
Publication of CN116933751A publication Critical patent/CN116933751A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/10Text processing
    • G06F40/166Editing, e.g. inserting or deleting
    • G06F40/186Templates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/30Information retrieval; Database structures therefor; File system structures therefor of unstructured textual data
    • G06F16/33Querying
    • G06F16/332Query formulation
    • G06F16/3329Natural language query formulation or dialogue systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F40/00Handling natural language data
    • G06F40/20Natural language analysis
    • G06F40/205Parsing

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Artificial Intelligence (AREA)
  • Audiology, Speech & Language Pathology (AREA)
  • General Health & Medical Sciences (AREA)
  • Health & Medical Sciences (AREA)
  • Mathematical Physics (AREA)
  • Human Computer Interaction (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Machine Translation (AREA)

Abstract

The disclosure provides an article generation method, an article generation device, an electronic device and a storage medium, and relates to the technical field of artificial intelligence such as machine learning, natural language processing and the like. The specific implementation scheme is as follows: acquiring input information of a user; acquiring a matched target prompt template based on the input information of the user; generating a target article by adopting a pre-trained article generation model based on the input information of the user and the target prompt template; the target prompt template is used for indicating the architecture of a target article to be generated; the architecture comprises at least two types of content blocks of a target article, the sequence of the at least two types of content blocks and content description information of the content blocks of various types. The technology disclosed by the invention can effectively improve the logic of the generated target article, enhance the content richness of the target article, effectively improve the integrity and accuracy of the target article and more accord with the user expectation.

Description

Article generation method and device, electronic equipment and storage medium
Technical Field
The disclosure relates to the technical field of computers, in particular to the technical field of artificial intelligence such as deep learning and natural language processing, and especially relates to an article generating method, an article generating device, electronic equipment and a storage medium.
Background
With the significant breakthrough of large generative language models in the field of natural language processing (Natural Language Processing; NLP), how to accurately guide models to generate results that match the user's expectations remains a challenge to be solved.
For example, in the prior art, a large number of training samples may be constructed to train the generative language model such that the generative language model learns the capabilities of the generated articles. The requirement samples and corresponding article samples may be included in each training sample. Training. A demand sample is input to a generative language model, which may generate articles meeting respective demands based on the demand sample. And based on the generated article and the article sample, carrying out parameter adjustment on the generated language model so that the generated article is consistent with the article sample as much as possible.
Disclosure of Invention
The disclosure provides an article generation method, an article generation device, electronic equipment and a storage medium.
According to an aspect of the present disclosure, there is provided an article generating method including:
acquiring input information of a user;
acquiring a matched target prompt template based on the input information of the user;
Generating a target article by adopting a pre-trained article generation model based on the input information of the user and the target prompt template; the target prompt template is used for indicating the architecture of a target article to be generated; the architecture comprises at least two types of content blocks of a target article, the sequence of the at least two types of content blocks and content description information of the content blocks of various types.
According to another aspect of the present disclosure, there is provided an article generating apparatus including:
the information acquisition module is used for acquiring input information of a user;
the template acquisition module is used for acquiring a matched target prompt template based on the input information of the user;
the generating module is used for generating a target article by adopting a pre-trained article generating model based on the input information of the user and the target prompt template; the target prompt template is used for indicating the architecture of a target article to be generated; the architecture comprises at least two types of content blocks of a target article, the sequence of the at least two types of content blocks and content description information of the content blocks of various types. According to still another aspect of the present disclosure, there is provided an electronic apparatus including:
At least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the aspects and methods of any one of the possible implementations described above.
According to yet another aspect of the present disclosure, there is provided a non-transitory computer-readable storage medium storing computer instructions for causing the computer to perform the method of the aspects and any possible implementation described above.
According to yet another aspect of the present disclosure, there is provided a computer program product comprising a computer program which, when executed by a processor, implements the method of the aspects and any one of the possible implementations described above.
According to the technology disclosed by the invention, the logic of the generated target article can be effectively improved, the content richness of the target article is enhanced, the integrity and accuracy of the target article are effectively improved, and the method and the device are more in line with the expectations of users.
It should be understood that the description in this section is not intended to identify key or critical features of the embodiments of the disclosure, nor is it intended to be used to limit the scope of the disclosure. Other features of the present disclosure will become apparent from the following specification.
Drawings
The drawings are for a better understanding of the present solution and are not to be construed as limiting the present disclosure. Wherein:
FIG. 1 is a schematic diagram according to a first embodiment of the present disclosure;
FIG. 2 is a schematic diagram according to a second embodiment of the present disclosure;
FIG. 3 is a schematic diagram according to a third embodiment of the present disclosure;
FIG. 4 is a schematic diagram according to a fourth embodiment of the present disclosure;
FIG. 5 is a schematic diagram according to a fifth embodiment of the present disclosure;
fig. 6 is a block diagram of an electronic device for implementing the methods of embodiments of the present disclosure.
Detailed Description
Exemplary embodiments of the present disclosure are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present disclosure to facilitate understanding, and should be considered as merely exemplary. Accordingly, one of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the present disclosure. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
It will be apparent that the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments in this disclosure without inventive faculty, are intended to be within the scope of this disclosure.
It should be noted that, the terminal device in the embodiments of the present disclosure may include, but is not limited to, smart devices such as a mobile phone, a personal digital assistant (Personal Digital Assistant, PDA), a wireless handheld device, and a Tablet Computer (Tablet Computer); the display device may include, but is not limited to, a personal computer, a television, or the like having a display function.
In addition, the term "and/or" herein is merely an association relationship describing an association object, and means that three relationships may exist, for example, a and/or B may mean: a exists alone, A and B exist together, and B exists alone. In addition, the character "/" herein generally indicates that the front and rear associated objects are an "or" relationship.
The large-scale generation type language model in the prior art can be used for generating long texts with word numbers exceeding a certain number of thresholds, such as articles, and the generation mode is very simple and intelligent, has no limitation or constraint, and causes a certain gap between the generated articles and the expectations of users and poor accuracy.
FIG. 1 is a schematic diagram according to a first embodiment of the present disclosure; as shown in fig. 1, the present embodiment provides an article generating method, which specifically includes the following steps:
S101, acquiring input information of a user;
s102, acquiring a matched target prompt template based on input information of a user;
s103, generating a target article by adopting a pre-trained article generation model based on input information of a user and a target prompt template.
The input information of the user in this embodiment is used to define related information such as a requirement to be provided when the user wants to generate the target article, so as to generate the target article meeting the user's desire.
In this embodiment, in order to improve the accuracy of the generated target article, the matched target prompt template may be acquired first based on the input information of the user.
The target prompt template of the embodiment is used for indicating the architecture of a target article to be generated; the architecture includes at least two types of content blocks of the target article, an order of the at least two types of content blocks, and content description information of the respective types of content blocks. For example, at least two types of content blocks may include a title, a summary, a body, a conclusion or a summary, and a plurality of paragraphs in the body that describe different content, etc. The content description information of each content block is used for defining at least one of how to describe, what information is included, and what effect can be achieved for the corresponding type of content. For example, the content description information of the title may include "brief and clear, capable of summarizing the article theme".
The article generation model of the present embodiment is a large generation language model trained in advance. The article generation model is an end-to-end model. In the scenario of the embodiment, input is input information of a user and a target prompt template, the article generation model can generate a target article described by adopting the target prompt template based on the input information of the user and the target prompt template, and the target article has a complex and complete logic architecture and rich content and can more accord with a result expected by the user.
When the article generating model is pre-trained, a large number of training samples can be collected, and each training sample can comprise training input information of a training user, a corresponding training prompt template and marked articles. During training, training input information of a training user in a training sample is input into the article generating model through a corresponding training prompt template, and the article generating model can predict and output a predicted article based on the input information. And then, based on the marked article and the predicted article, carrying out parameter adjustment on the article generation model so that the predicted article is consistent with the marked article. The model is continuously trained by adopting the mode until the model converges in continuous multi-round training, and the training is finished at this time, so that the parameters of the article generating model are determined, and the article generating model is further determined.
When the method is used, the trained article generation model is deployed on the line, and the intelligent generation of the target article based on the input information of the user can be realized by adopting the mode of the embodiment.
According to the article generating method, the target prompt template matched with the input information of the user is obtained, the article generating model trained in advance is adopted to generate the target article based on the input information of the user and the target prompt template, so that the logic of the generated target article can be effectively improved, the content richness of the target article can be enhanced, the completeness and accuracy of the target article can be effectively improved, and the method is more in line with the expectations of the user. Moreover, the process of generating the article is very intelligent and convenient to use.
FIG. 2 is a schematic diagram according to a second embodiment of the present disclosure; as shown in fig. 2, the present embodiment provides an article generating method, which further describes the technical solution of the present disclosure in more detail on the basis of the technical solution of the embodiment shown in fig. 1, and specifically may include the following steps:
s201, acquiring input information of a user;
in this embodiment, the input information of the user may be a long text, for example, may be: let me write a tour mark about the spring tour, where the spring tour is a park, etc.
S202, detecting whether a matched target prompt template exists in a pre-generated prompt template library or not based on input information of a user; if yes, go to step S203; if not, executing step S204;
s203, acquiring a matched target prompt template from a pre-generated prompt template library based on input information of a user; step S205 is performed;
in this embodiment, each alert template in the alert template library generated in advance may be generated manually by an expert in each field. Similarly, each prompt template is used for indicating the architecture of the article generated based on the prompt template; the architecture includes at least two types of content blocks of the article, an order of the at least two types of content blocks, content description information of each type of content block, and so on.
In this embodiment, each hint template in the hint template library is designed and generated manually by an expert in the related field, and the accuracy is very high. For example, the alert template library may include alert templates of various subjects such as alert templates of a paraphrase article, alert templates of a science popularization article, and alert templates of an negotiable article. In addition, even if the same subject matter is adopted, the prompt template library can be provided with prompt templates with different structures, the structures of the generated articles are different, and the contents are also different. Moreover, the number of words required by the user is different, and the structures of the prompt templates can be set differently for articles with the same subject. For example, the richness of 500 words of the biography content is necessarily different from 800 words of the biography content. Therefore, the prompt templates with different word numbers and the same material requirement can be set in the prompt template library.
In one embodiment of the present disclosure, various attribute information of templates, such as topic types, etc., may be recorded in the hint template library. According to the input information of the user, the subject type of the target article which the user wants to generate can be known, and if the subject type of the target article corresponding to the input information of the user is detected to be included in the pre-generated prompt template library, the matched target prompt template can be considered to be included in the prompt template library; can be obtained directly. Otherwise, if the prompting template library does not include the question type of the target article corresponding to the input information of the user, the prompting template library is considered to have no matched target prompting template.
S204, generating a model by adopting a pre-trained prompt template based on input information of a user, and generating a target prompt template; step S205 is performed;
in particular, the user input information may be input into the alert template generation model, and the alert template generation model may intelligently output the responsive target alert template based on the user input information.
When the prompt template generation model is trained, each prompt template in the prompt template library set by the expert can be used for training. Specifically, for each prompt module, a corresponding training user requirement is created, and a training sample is built together with the corresponding prompt template. During training, input information of training users in each training sample is input into a prompt template generation model, and the prompt template generation model can predict and generate a matched prediction prompt template based on the input information. And then adjusting parameters of the prompting template generation model based on the marked prompting template and the predicted prompting template. In practical application, when the number of training samples constructed based on the prompt template library is small, more training samples can be constructed manually in a similar mode, and the prompt template generation model is trained, so that the prompt template generation model learns the capability of generating a corresponding target prompt template based on user requirements.
Optionally, in an embodiment of the present disclosure, when step S204 is specifically implemented, a model may be further generated by using a hint template based on input information of the user, and referring to a preset first resource library, to generate the target hint template.
The preset first resource library in this embodiment may be any existing resource library for searching and querying, for example, may be a resource library including various resource information. Specifically, when input information of a user is input into a prompt template generation model, the prompt template generation model generates a target prompt template by referring to resources in a first resource library based on the capability of generating the prompt template learned in advance. For example, the input information of the user includes: help write a tour mark about scenic spot A. The most representative target attraction in attraction a, or the most recently very fire target attraction, can be known by referencing the resources in the first repository, and then, in the architecture of the generated hint template, the content blocks associated with that target attraction can be added. By the method, the accuracy and the completeness of the generated target prompt template can be effectively improved.
S205, generating a model by adopting a pre-trained article based on input information of a user and a target prompt template, and generating a target article by referring to a preset second resource library.
When the method is specifically used, input information of a user and a target prompt template are input into an article generation model, and the article generation model can generate a target article which meets the requirements of the user and is described by adopting the target prompt template based on the input information and the target prompt template and by referring to a second preset resource library.
Alternatively, the preset second repository of the present embodiment may be a repository including various resource information. For example, if the input information of the user requires writing a tour mark about scenic spot a, the content description information of a content block with a section in the text in the target prompt template is: describing the travel process, including routes, attractions, etc., showing the own sights as detailed as possible. At this time, the article generating model may query each scenic spot about scenic spot a and a position in the scenic spot from the second repository, and further may determine a travel route of each scenic spot in the travel process, so as to be able to generate a more accurate target article.
Specifically, when the text generation model generates content information of any content block in the target article based on the target prompt template, the text generation model can be directly generated based on the capability learned in advance; the second resource library can be searched to obtain richer content information, so that a target article with richer content can be generated.
In the article generating method of the embodiment, a two-stage acquisition strategy is set in the process of acquiring the matched target prompt template. The prompt template library can be a plurality of high-frequency prompt templates which are designed manually by an expert and have very high accuracy, so that the requirements of many users for generating articles can be met.
However, in the process of generating the alert template library, an expert is required to have abundant experience and expertise, and in the face of complex and changeable user requirements and continuously developing technical environments, the alert template library generated in advance still has difficulty in ensuring that high-quality alert templates are generated in a short time. Based on this, the embodiment also provides an intelligent automatic generation target prompt template. Specifically, input information of a user is input to a pre-trained prompt template generation model, and the prompt template generation model can predict and output a target prompt template.
According to the prompt template generation model, the target prompt template can be intelligently generated, the prompt template meeting the user requirements can be quickly generated, and real-time response is realized. Compared with the traditional manual design prompt template library, the method has obvious advantages in time cost. The method makes up the deficiency of a prompt template library set by an expert, can meet the prompt templates of some low-frequency requirements, and effectively reduces the workload of the expert; and the coverage field is very wide, can be applicable to any demand field. The large-scale generated language model, such as the article generated model of the embodiment, has great value in the grounding of the actual application scene.
Based on the above mode, the embodiment can accurately and efficiently acquire the target prompt template matched with the input information of the user, and finally, based on the target prompt template and the input information of the user, the target article meeting the user requirement is accurately and efficiently generated by adopting the article generation model trained in advance.
FIG. 3 is a schematic diagram according to a third embodiment of the present disclosure; as shown in fig. 3, the present embodiment provides an article generating method, which further describes the technical solution of the present disclosure in more detail on the basis of the technical solution of the foregoing embodiment, and specifically may include the following steps:
s301, acquiring input information of a user;
in this embodiment, the information input interface of the user may be a portal, and all information that the user wants to input may be input from the portal.
Alternatively, in practical application, the information input interface of the user may also include two or more entries, where the user inputs information to be input from multiple entries, respectively. For example, a user demand entry may be included, for example, the entry user may input: a 500 word diary was written. The user's information input interface may further include a supplementary information portal that can input a supplementary information that the user increases based on the demand, at least one of travel location, colleague, time, weather, feeling, etc. to be embodied by the tour.
Alternatively, only the user's demand information may be included in the user's input information, and no supplementary information may be included.
S302, acquiring the semantic matching degree of the input information of the user and each prompting template by adopting a pre-trained semantic matching model based on the input information of the user and each prompting template in a prompting template library;
for example, the pre-trained semantic matching model in this embodiment can understand the semantics of the input information and each hint template, and match and predict the semantic matching degree between the input information and the information included in each hint template.
Optionally, in a specific implementation, after all the words included in the input information are segmented based on the semantics, the words may be input into the semantic matching model.
Similarly, the information included in each prompt template, such as content description information of each type of content block including the target article in the architecture, may be input into the semantic matching model after word segmentation.
Optionally, during training of the semantic matching model in this embodiment, a large number of training samples may be constructed, and each set of training samples may include input information of a training user and a training prompt template; if the sample is positive, marking the corresponding semantic matching degree as 1; otherwise, if the negative sample is not found, the corresponding semantic matching degree is marked as 0. And then inputting the input information of the training user in the training sample and the training prompt template into the semantic matching model. The semantic matching model predicts the matching degree of the two based on the input information through semantic understanding. And then adjusting parameters of the semantic matching model based on the predicted matching degree and the marked matching degree. According to the mode, a large number of training samples are adopted to train the semantic matching model continuously until the model converges, and the semantic matching model can be obtained.
When the method is used, the trained semantic matching model is deployed on the line, so that the prediction of the semantic matching degree of the input information of the user and each prompt template can be realized.
S303, detecting whether a value with highest semantic matching degree corresponding to each prompt template is larger than or equal to a preset threshold value; if yes, executing step S304; if not, go to step S305;
the preset threshold of the present embodiment may be set based on experience or timing requirements, for example, other values such as 0.5, 0.6, etc. may be used.
S304, acquiring a prompt template with highest semantic matching degree from a prompt template library, and taking the prompt template as a matched target prompt template; step S308 is performed;
by the method, the accuracy of the acquired target prompt template can be effectively ensured.
S305, determining that a target prompt template matched with the input information of the user is not included in the prompt template library; step S306 is executed;
in this embodiment, the value of the highest semantic matching degree corresponding to each hint template is smaller than the preset threshold, and the hint template matching effect in the hint template library is considered to be poor, so that the matched target hint template is not required to be obtained from the hint template library.
Optionally, in this embodiment, a mapping relationship between the requirement information and the alert template may also be stored in the alert template library. At this time, according to the above step S301, the user 'S demand information is acquired from the user' S input information. Then, directly searching a matched target prompt template from a prompt template library according to the requirement information of the user; by the method, the matched target prompt template can be accurately and efficiently obtained; if not, the target prompt template matched with the input information of the user is not included in the prompt template library.
In one embodiment of the present disclosure, since the requirement information of the user is not completely consistent with the requirement information stored in the alert template library, the semantic matching degree of the requirement information of the user and the requirement information corresponding to each alert template may be matched based on a pre-trained semantic matching model. And acquiring a prompt template corresponding to the target demand information, wherein the semantic matching degree is highest, and the value of the semantic matching degree is larger than a preset threshold value, and taking the prompt template as a target prompt template. The implementation principle is the same and will not be described in detail here.
S306, based on input information of a user, acquiring demand information and supplementary information of the user; step S307 is performed;
alternatively, if the input information of the user is acquired in step S301, the requirement information and the supplementary information of the user are acquired through different entries, and may be directly acquired at this time.
If the input information of the user is a whole, the requirement information and the supplementary information of the user need to be extracted from the input information.
Specifically, a pre-trained demand extraction model may be used to extract the user's demand information from the user's input information.
And extracting the supplementary information from the input information of the user by adopting a pre-trained supplementary information extraction model.
The requirement extraction model and the supplementary information extraction model can be trained by adopting a large amount of labeling data, so that the requirement extraction model learns the capability of extracting the requirement information of the user from the input information of the user, and the supplementary information extraction model learns the capability of extracting the supplementary information from the input information of the user, and the details are not repeated.
Alternatively, the supplemental information may not be included in the input information of the user, and the content extracted by the supplemental information extraction model may be empty.
S307, generating a model by adopting a prompt template based on the requirement information and the supplementary information of the user, and generating a target prompt template; step S308 is performed;
specifically, the requirement information and the supplementary information of the user can be input into a prompt template generation model, and the prompt template generation model can generate a target prompt template meeting the requirement of the user based on the input information.
It should be noted that, since the input information is added with the supplemental information, the generated target hint template needs to add the supplemental information to the description information of the corresponding content block.
For example, the following example is taken to describe the technical solution of the present disclosure:
Input information of the user: let me write a composition about spring tour, 500 words.
Inputting the user input information into a prompt template generation model, the generated target prompt model may be as follows:
the description of the experience and feel of spring travel is dominant and the composition can be accomplished with reference to the following steps.
[ subject ]: the content description information includes: it is brief and clear that the article theme can be summarized, and the reader's eyes can be attracted.
[ text ]:
section 1: the content description information includes: giving sufficient background information, introducing the characteristics of spring and the destination of travel;
section 2: the content description information includes: describing the travel process, including routes, attractions, etc., showing the own sights as detailed as possible;
section 3: the content description information includes: setting forth feelings of travel, including evaluation of scenic spots, understanding of local culture, etc.;
section 4: the content description information includes: discussion and views of articles, such as air temperature, precipitation, etc., are supported by citing specific facts and data;
section 5: the content description information includes: the discussion points or views proposed in the article are analyzed and interpreted to clarify the importance, rationality and the like of the article;
Section 6: the content description information includes: the main views in the article are summarized and the own insights and ideas are presented, such as benefits of spring travel, mental enjoyment of people in spring travel, etc.
If the input information of the user also comprises supplementary information, such as a person in the same line, the relevant content description can be added in the text section 2 of the target prompt template. In practical application, the user can also input other types of supplementary information, and corresponding content description information is added in the related content blocks in the generation of the target prompt template. Or a new content block and corresponding content block description information can be added to the target prompt template for describing the supplemental information.
Optionally, referring to the alternative implementation manner of step S204 in the embodiment shown in fig. 2, step S307 may also be implemented specifically by adopting a prompt template generation model based on the requirement information and the supplementary information of the user, and referring to a preset first resource library to generate a target prompt template; the implementation principle can be referred to the relevant description, and is not repeated here.
S308, generating a model by adopting a pre-trained article based on input information of a user and a target prompt template, and generating a target article by referring to a preset second resource library.
Alternatively, with reference to the relevant descriptions of the above embodiments, when this step is specifically implemented, the input information of the user may be differentiated, such as the requirement information and the supplementary information of the user. However, when the target article is generated, the requirement information, the supplementary information and the target prompt template of the user are input into the article generation model, the article generation model refers to all the input information, and when other resources need to be searched, other resources are searched from a preset second resource library to generate the target article, so that the content of the generated target article is richer.
Of course, when the target article is generated, after the requirement information, the supplementary information and the target prompt template of the user are input into the article generating model together, the article generating model may generate the target article by referring to only all the input information. The implementation principle is the same and will not be described in detail here.
In this embodiment, by dividing the input information into the requirement information and the supplementary information, more accurate processing can be performed, and the accuracy of the generated target prompt template is improved, so that the accuracy of the generated target article is improved.
According to the article generating method, the target prompt template matched with the input information of the user can be accurately and efficiently obtained, so that the content controllability and the architecture rationality of the generated target articles can be effectively improved, and the generated target articles are smooth in logic, smooth in content and rich.
FIG. 4 is a schematic diagram according to a fourth embodiment of the present disclosure; as shown in fig. 4, the present embodiment provides an article generating apparatus 400, including:
an information acquisition module 401, configured to acquire input information of a user;
a template obtaining module 402, configured to obtain a matched target prompt template based on the input information of the user;
the generating module 403 is configured to generate a target article by adopting a pre-trained article generating model based on the input information of the user and the target prompt template; the target prompt template is used for indicating the architecture of a target article to be generated; the architecture comprises at least two types of content blocks of a target article, the sequence of the at least two types of content blocks and content description information of the content blocks of various types.
The article generating device 400 of the present embodiment realizes the implementation principle and the technical effect of article generation by adopting the above modules, and is the same as the implementation of the above related method embodiments, and details of the above related method embodiments may be referred to in the description of the related method embodiments, which is not repeated herein.
FIG. 5 is a schematic diagram according to a fifth embodiment of the present disclosure; as shown in fig. 5, the present embodiment provides an article generating apparatus 500, including: the same name and function modules shown in fig. 4 are as follows: an information acquisition module 501, a template acquisition module 502, and a generation module 503.
In an embodiment of the present disclosure, the template acquisition module 502 is configured to:
and acquiring the matched target prompt template from a pre-generated prompt template library based on the input information of the user.
Optionally, in one embodiment of the present disclosure, the template acquisition module 502 is configured to:
based on the input information of the user and each prompting template in the prompting template library, acquiring the semantic matching degree of the input information of the user and each prompting template by adopting a pre-trained semantic matching model;
and acquiring the prompt template with the highest semantic matching degree from the prompt template library as the matched target prompt template.
Optionally, as shown in fig. 5, in an embodiment of the present disclosure, the article generating apparatus 500 further includes:
a determining module 504, configured to determine that the value with the highest semantic matching degree is greater than or equal to a preset threshold.
Optionally, in an embodiment of the present disclosure, the determining module 504 is further configured to determine that the alert template library does not include a target alert template matching the input information of the user if the value of the highest semantic matching degree is less than the preset threshold;
the template obtaining module 502 is further configured to generate the target prompt template by using a pre-trained prompt template generation model based on the input information of the user.
Optionally, in one embodiment of the present disclosure, the template acquisition module 502 is configured to:
based on the input information of the user, the prompt template generation model is adopted, and the target prompt template is generated by referring to a preset first resource library.
Optionally, in one embodiment of the present disclosure, the template acquisition module 502 is configured to:
acquiring demand information and supplementary information of the user based on the input information of the user;
and generating the target prompt template by adopting the prompt template generation model based on the requirement information of the user and the supplementary information.
Optionally, in one embodiment of the present disclosure, the template acquisition module 502 is configured to:
extracting the requirement information of the user from the input information of the user by adopting a pre-trained requirement extraction model;
and extracting the supplementary information from the input information of the user by adopting a pre-trained supplementary information extraction model.
Optionally, in one embodiment of the present disclosure, the information obtaining module 501 is configured to:
and acquiring the requirement information and the supplementary information of the user.
Optionally, in one embodiment of the present disclosure, the template acquisition module 502 is configured to:
And acquiring the matched target prompt template from the prompt template library based on the requirement information of the user.
Optionally, in one embodiment of the disclosure, the generating module 503 is configured to:
based on the input information of the user and the target prompt template, generating a model by adopting a pre-trained article, and generating the target article by referring to a preset second resource library.
The article generating device 500 of the present embodiment realizes the implementation principle and the technical effect of article generation by adopting the above modules, and is the same as the implementation of the above related method embodiments, and details of the above related method embodiments may be referred to in the description of the related method embodiments, which is not repeated here.
According to embodiments of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
Fig. 6 illustrates a schematic block diagram of an example electronic device 600 that may be used to implement embodiments of the present disclosure. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital processing, cellular telephones, smartphones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the disclosure described and/or claimed herein.
As shown in fig. 6, the apparatus 600 includes a computing unit 601 that can perform various appropriate actions and processes according to a computer program stored in a Read Only Memory (ROM) 602 or a computer program loaded from a storage unit 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the device 600 may also be stored. The computing unit 601, ROM 602, and RAM 603 are connected to each other by a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
Various components in the device 600 are connected to the I/O interface 605, including: an input unit 606 such as a keyboard, mouse, etc.; an output unit 607 such as various types of displays, speakers, and the like; a storage unit 608, such as a magnetic disk, optical disk, or the like; and a communication unit 609 such as a network card, modem, wireless communication transceiver, etc. The communication unit 609 allows the device 600 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
The computing unit 601 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of computing unit 601 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various computing units running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, etc. The computing unit 601 performs the various methods and processes described above, such as the methods described above of the present disclosure. For example, in some embodiments, the above-described methods of the present disclosure may be implemented as a computer software program tangibly embodied on a machine-readable medium, such as storage unit 608. In some embodiments, part or all of the computer program may be loaded and/or installed onto the device 600 via the ROM 602 and/or the communication unit 609. When the computer program is loaded into RAM 603 and executed by computing unit 601, one or more steps of the above-described methods of the present disclosure described above may be performed. Alternatively, in other embodiments, the computing unit 601 may be configured to perform the above-described methods of the present disclosure in any other suitable manner (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuit systems, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), systems On Chip (SOCs), complex Programmable Logic Devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs, the one or more computer programs may be executed and/or interpreted on a programmable system including at least one programmable processor, which may be a special purpose or general-purpose programmable processor, that may receive data and instructions from, and transmit data and instructions to, a storage system, at least one input device, and at least one output device.
Program code for carrying out methods of the present disclosure may be written in any combination of one or more programming languages. These program code may be provided to a processor or controller of a general purpose computer, special purpose computer, or other programmable data processing apparatus such that the program code, when executed by the processor or controller, causes the functions/operations specified in the flowchart and/or block diagram to be implemented. The program code may execute entirely on the machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and pointing device (e.g., a mouse or trackball) by which a user can provide input to the computer. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic input, speech input, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a background component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such background, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), and the internet.
The computer system may include a client and a server. The client and server are typically remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server may be a cloud server, a server of a distributed system, or a server incorporating a blockchain.
It should be appreciated that various forms of the flows shown above may be used to reorder, add, or delete steps. For example, the steps recited in the present disclosure may be performed in parallel or sequentially or in a different order, provided that the desired results of the technical solutions of the present disclosure are achieved, and are not limited herein.
The above detailed description should not be taken as limiting the scope of the present disclosure. It will be apparent to those skilled in the art that various modifications, combinations, sub-combinations and alternatives are possible, depending on design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of the present disclosure are intended to be included within the scope of the present disclosure.

Claims (25)

1. An article generation method comprising:
acquiring input information of a user;
acquiring a matched target prompt template based on the input information of the user;
generating a target article by adopting a pre-trained article generation model based on the input information of the user and the target prompt template; the target prompt template is used for indicating the architecture of a target article to be generated; the architecture comprises at least two types of content blocks of a target article, the sequence of the at least two types of content blocks and content description information of the content blocks of various types.
2. The method of claim 1, wherein obtaining a matching target hint template based on input information of the user comprises:
and acquiring the matched target prompt template from a pre-generated prompt template library based on the input information of the user.
3. The method of claim 2, wherein obtaining the matching target alert template from a pre-generated alert template library based on the user's input information, comprises:
based on the input information of the user and each prompting template in the prompting template library, acquiring the semantic matching degree of the input information of the user and each prompting template by adopting a pre-trained semantic matching model;
and acquiring the prompt template with the highest semantic matching degree from the prompt template library as the matched target prompt template.
4. A method according to claim 3, wherein the hint template with the highest semantic matching degree is obtained from the hint template library, and before being the target hint template for matching, the method further comprises:
and determining that the value with the highest semantic matching degree is larger than or equal to a preset threshold value.
5. The method of claim 4, wherein obtaining a matching target hint template based on input information of the user, further comprises:
If the value with the highest semantic matching degree is smaller than the preset threshold value, determining that the prompting template library does not comprise a target prompting template matched with the input information of the user;
and generating a model by adopting a pre-trained prompt template based on the input information of the user, and generating the target prompt template.
6. The method of claim 5, wherein generating the target hint template using a pre-trained hint template generation model based on input information of the user, comprises:
based on the input information of the user, the prompt template generation model is adopted, and the target prompt template is generated by referring to a preset first resource library.
7. The method of claim 5, wherein generating the target hint template using a pre-trained hint template generation model based on input information of the user, comprises:
acquiring demand information and supplementary information of the user based on the input information of the user;
and generating the target prompt template by adopting the prompt template generation model based on the requirement information of the user and the supplementary information.
8. The method of claim 7, wherein obtaining the user's demand information and supplemental information based on the user's input information comprises:
Extracting the requirement information of the user from the input information of the user by adopting a pre-trained requirement extraction model;
and extracting the supplementary information from the input information of the user by adopting a pre-trained supplementary information extraction model.
9. The method of claim 2, wherein obtaining input information of a user comprises:
and acquiring the requirement information and the supplementary information of the user.
10. The method of claim 9, wherein obtaining the matching target alert template from a pre-generated alert template library based on the user's input information, comprises:
and acquiring the matched target prompt template from the prompt template library based on the requirement information of the user.
11. The method of any of claims 1-10, wherein generating a target article using a pre-trained article generation model based on the user's input information and the target alert template comprises:
based on the input information of the user and the target prompt template, generating a model by adopting a pre-trained article, and generating the target article by referring to a preset second resource library.
12. An article generating apparatus comprising:
The information acquisition module is used for acquiring input information of a user;
the template acquisition module is used for acquiring a matched target prompt template based on the input information of the user;
the generating module is used for generating a target article by adopting a pre-trained article generating model based on the input information of the user and the target prompt template; the target prompt template is used for indicating the architecture of a target article to be generated; the architecture comprises at least two types of content blocks of a target article, the sequence of the at least two types of content blocks and content description information of the content blocks of various types.
13. The apparatus of claim 12, wherein the template acquisition module is configured to:
and acquiring the matched target prompt template from a pre-generated prompt template library based on the input information of the user.
14. The apparatus of claim 13, wherein the template acquisition module is configured to:
based on the input information of the user and each prompting template in the prompting template library, acquiring the semantic matching degree of the input information of the user and each prompting template by adopting a pre-trained semantic matching model;
And acquiring the prompt template with the highest semantic matching degree from the prompt template library as the matched target prompt template.
15. The apparatus of claim 14, wherein the apparatus further comprises:
and the determining module is used for determining that the value with the highest semantic matching degree is greater than or equal to a preset threshold value.
16. The apparatus of claim 15, wherein:
the determining module is further configured to determine that the alert template library does not include a target alert template that matches the input information of the user if the value with the highest semantic matching degree is less than the preset threshold;
the template acquisition module is further used for generating a model by adopting a pre-trained prompt template based on the input information of the user, and generating the target prompt template.
17. The apparatus of claim 16, wherein the template acquisition module is configured to:
based on the input information of the user, the prompt template generation model is adopted, and the target prompt template is generated by referring to a preset first resource library.
18. The apparatus of claim 16, wherein the template acquisition module is configured to:
acquiring demand information and supplementary information of the user based on the input information of the user;
And generating the target prompt template by adopting the prompt template generation model based on the requirement information of the user and the supplementary information.
19. The apparatus of claim 18, wherein the template acquisition module is configured to:
extracting the requirement information of the user from the input information of the user by adopting a pre-trained requirement extraction model;
and extracting the supplementary information from the input information of the user by adopting a pre-trained supplementary information extraction model.
20. The apparatus of claim 13, wherein the information acquisition module is configured to:
and acquiring the requirement information and the supplementary information of the user.
21. The apparatus of claim 20, wherein the template acquisition module is configured to:
and acquiring the matched target prompt template from the prompt template library based on the requirement information of the user.
22. The apparatus of any of claims 12-21, wherein the generating module is configured to:
based on the input information of the user and the target prompt template, generating a model by adopting a pre-trained article, and generating the target article by referring to a preset second resource library.
23. An electronic device, comprising:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,,
the memory stores instructions executable by the at least one processor to enable the at least one processor to perform the method of any one of claims 1-11.
24. A non-transitory computer readable storage medium storing computer instructions for causing the computer to perform the method of any one of claims 1-11.
25. A computer program product comprising a computer program which, when executed by a processor, implements the method according to any of claims 1-11.
CN202310797366.5A 2023-06-30 2023-06-30 Article generation method and device, electronic equipment and storage medium Pending CN116933751A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310797366.5A CN116933751A (en) 2023-06-30 2023-06-30 Article generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310797366.5A CN116933751A (en) 2023-06-30 2023-06-30 Article generation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116933751A true CN116933751A (en) 2023-10-24

Family

ID=88391742

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310797366.5A Pending CN116933751A (en) 2023-06-30 2023-06-30 Article generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116933751A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111008522A (en) * 2019-12-11 2020-04-14 浙江大搜车软件技术有限公司 Automatic article writing method and device, computer equipment and storage medium
CN111046645A (en) * 2019-12-11 2020-04-21 浙江大搜车软件技术有限公司 Method and device for generating article, computer equipment and storage medium
CN113705210A (en) * 2021-08-06 2021-11-26 北京搜狗科技发展有限公司 Article outline generation method and device for generating article outline
CN115630640A (en) * 2022-12-23 2023-01-20 苏州浪潮智能科技有限公司 Intelligent writing method, device, equipment and medium
CN115905470A (en) * 2022-11-14 2023-04-04 中国平安人寿保险股份有限公司 Method and device for generating financial article, computer equipment and storage medium
CN116151194A (en) * 2023-04-04 2023-05-23 上海燧原科技有限公司 Method, device, equipment and storage medium for generating Chinese universal language

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111008522A (en) * 2019-12-11 2020-04-14 浙江大搜车软件技术有限公司 Automatic article writing method and device, computer equipment and storage medium
CN111046645A (en) * 2019-12-11 2020-04-21 浙江大搜车软件技术有限公司 Method and device for generating article, computer equipment and storage medium
CN113705210A (en) * 2021-08-06 2021-11-26 北京搜狗科技发展有限公司 Article outline generation method and device for generating article outline
CN115905470A (en) * 2022-11-14 2023-04-04 中国平安人寿保险股份有限公司 Method and device for generating financial article, computer equipment and storage medium
CN115630640A (en) * 2022-12-23 2023-01-20 苏州浪潮智能科技有限公司 Intelligent writing method, device, equipment and medium
CN116151194A (en) * 2023-04-04 2023-05-23 上海燧原科技有限公司 Method, device, equipment and storage medium for generating Chinese universal language

Similar Documents

Publication Publication Date Title
KR102350543B1 (en) Semantic representation model processing method, device, electronic equipment and storage medium
CN111625635A (en) Question-answer processing method, language model training method, device, equipment and storage medium
CN111783468B (en) Text processing method, device, equipment and medium
CN112101041A (en) Entity relationship extraction method, device, equipment and medium based on semantic similarity
CN112836487B (en) Automatic comment method and device, computer equipment and storage medium
CN108345612A (en) A kind of question processing method and device, a kind of device for issue handling
US20230094730A1 (en) Model training method and method for human-machine interaction
CN110209810A (en) Similar Text recognition methods and device
CN103885933A (en) Method and equipment for evaluating text sentiment
CN106528538A (en) Method and device for intelligent emotion recognition
CN110852047A (en) Text score method, device and computer storage medium
CN113360001A (en) Input text processing method and device, electronic equipment and storage medium
CN111553138B (en) Auxiliary writing method and device for standardizing content structure document
CN111401044A (en) Title generation method and device, terminal equipment and storage medium
CN113850080A (en) Rhyme word recommendation method, device, equipment and storage medium
CN115438149A (en) End-to-end model training method and device, computer equipment and storage medium
CN111428011B (en) Word recommendation method, device, equipment and storage medium
CN110020429B (en) Semantic recognition method and device
CN112528146B (en) Content resource recommendation method and device, electronic equipment and storage medium
CN108197105B (en) Natural language processing method, device, storage medium and electronic equipment
CN114120166A (en) Video question and answer method and device, electronic equipment and storage medium
CN114461749B (en) Data processing method and device for conversation content, electronic equipment and medium
CN116933751A (en) Article generation method and device, electronic equipment and storage medium
CN114218431A (en) Video searching method and device, electronic equipment and storage medium
CN110704623A (en) Method, device, system and storage medium for improving entity identification rate based on Rasa _ Nlu framework

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination