Text generation method and device based on large model, electronic equipment and storage medium
By introducing a text generation method based on large-models into traditional creative methods, using search vector libraries and large-models to generate text outlines and content, the problems of inefficiency and creativity limitation in traditional methods are solved, and efficient, personalized and logical text generation is achieved.
Patent Information
- Application Number
- CN202411654447.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-18
- Publication Date
- 2025-03-14
AI Technical Summary
Traditional creative methods have problems such as inefficiency, limited creativity and difficulty in generating personalized content.
The text generation method based on the big model is adopted to obtain the target topic input by the user, and the big model is used to efficiently retrieve clause vectors matching the target topic in the pre-constructed search vector library, and a text outline is constructed based on the matching results to generate the corresponding text content.
It improves the generation efficiency of target text, ensures the structural logic of the generated text and the richness of content, and provides users with efficient, personalized and accurate text generation services.
Smart Images

Figure CN119621958A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of artificial intelligence technology, specifically to technical fields such as natural language processing, deep learning, and reinforcement learning, and in particular to a text generation method, device, electronic device, and storage medium based on a large model. Background Art
[0002] With the popularization of the Internet and the development of social media, users can spread information, share knowledge and exchange ideas by creating articles, which is a common demand in daily life. However, traditional creation methods have technical problems such as low efficiency, limited creativity and difficulty in generating personalized content. Summary of the invention
[0003] The present invention provides a large model-based text generation method, device, electronic device and storage medium.
[0004] According to one aspect of the present disclosure, a text generation method based on a large model is provided, the method comprising:
[0005] Get the target topic entered by the user;
[0006] Using a large model to search for a clause vector matching the target topic from a pre-built search vector library according to the target topic to obtain a matching result, wherein the search vector library includes a plurality of clause vectors; and
[0007] A text outline is constructed according to the target topic and the matching result, and text content corresponding to the text outline is generated according to the text outline to obtain a target text.
[0008] According to another aspect of the present disclosure, a text generation device based on a large model is provided, comprising:
[0009] The acquisition module is used to obtain the target topic input by the user;
[0010] a matching module, configured to use a large model to search for a clause vector matching the target topic from a pre-built search vector library according to the target topic, and obtain a matching result, wherein the search vector library includes a plurality of clause vectors; and
[0011] A generating module is used to construct a text outline according to the target topic and the matching result, and to generate text content corresponding to the text outline according to the text outline to obtain a target text.
[0012] According to a third aspect of the present disclosure, there is provided an electronic device, including:
[0013] at least one processor; and
[0014] a memory communicatively connected to the at least one processor; wherein,
[0015] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any method in any of the above technical solutions.
[0016] According to a fourth aspect of the present disclosure, a non-transitory computer-readable storage medium storing computer instructions is provided, wherein the computer instructions are used to enable the computer to execute any one of the methods described in the above technical solutions.
[0017] According to a fifth aspect of the present disclosure, a computer program product is provided, including a computer program, wherein the computer program implements any one of the methods described in the above technical solutions when executed by a processor.
[0018] The present disclosure provides a text generation method, device, equipment and storage medium based on a large model. The present disclosure uses a large model to efficiently retrieve clause vectors matching the target topic in a pre-built search vector library according to the target topic input by the user, thereby ensuring the relevance and accuracy of the content. Then, the large model is used to build a text outline according to the matching results, and the corresponding text content is generated according to the text outline. This coherent process not only improves the generation efficiency of the target text, but also ensures the logical structure and richness of the content of the generated target text, providing users with an efficient, personalized and content-accurate text generation service.
[0019] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present disclosure, nor is it intended to limit the scope of the present disclosure. Other features of the present disclosure will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The accompanying drawings are used to better understand the present solution and do not constitute a limitation of the present disclosure.
[0021] Figure 1 is a schematic diagram of the steps of the text generation method based on a large model in an embodiment of the present disclosure;
[0022] Figure 2 is a flowchart of a text generation method based on a large model in an embodiment of the present disclosure;
[0023] Figure 3 A block diagram of the principle of a text generation device based on a large model in an embodiment of the present disclosure;
[0024] Figure 4 It is a block diagram of an electronic device used to implement the large model-based text generation method of an embodiment of the present disclosure. DETAILED DESCRIPTION
[0025] The following is a description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, including various details of the embodiments of the present disclosure to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present disclosure. Similarly, for the sake of clarity and conciseness, descriptions of well-known functions and structures are omitted in the following description.
[0026] In the relevant technical scheme, the article creation mainly includes the following two parts: the first part is to retrieve relevant sentences from the background knowledge base, and the second part is to create articles based on the relevant sentences. For the first part, the existing methods for retrieving related sentences mainly include the following methods, such as using keyword retrieval, BM25 (information retrieval model) retrieval, and using m3e (Mocha large-scale hybrid embedding model), bge (general embedding model) and other self-encoding retrieval models to retrieve related sentences. As for the second part, the existing technology is mostly to assist manual creation through preset templates, and manually input outlines and subheadings combined with large models to generate full text.
[0027] For the part of retrieving related sentences, if keyword search is used, a large number of irrelevant results will be returned. Users need to spend a lot of time to filter information and rely too much on the selection of keywords. If BM25 search is used, this method is based on the term frequency (TF) and inverse document frequency (IDF) model, which may not be able to fully capture the semantic information of the document, especially for semantically rich or context-dependent queries. The use of self-encoding retrieval models such as m3e and bge will lead to problems such as the inability to retrieve implicit associations and the inability to focus on important entities in sentences. Reports are generated by presetting templates and filtering paragraph by paragraph. As for the creation part based on related sentences, that is, using preset templates or manually inputting small chapter titles and combining them with large models to generate, there are too many parts that require manual intervention, which affects the generation efficiency and is not conducive to broadening the creator's thinking.
[0028] This shows that traditional creative methods have technical problems such as low efficiency, limited creativity, and difficulty in generating personalized content.
[0029] In order to solve the above technical problems, the present disclosure provides a text generation method based on a large model, see Figure 1 As shown, Figure 1 : is a schematic diagram of the steps of a text generation method based on a large model in an embodiment of the present disclosure. The method can be applied to a server side. The method includes:
[0030] Step S101, obtaining a target topic input by a user.
[0031] Specifically, the target topic input by the user is obtained, and the target topic refers to the title of the text to be generated input by the user. Then, text processing and vectorization techniques, such as natural language processing (NLP) and machine learning algorithms, are used to convert the target topic into a vector form. In this way, obtaining the target topic input by the user is conducive to obtaining a clause vector matching the target topic in the subsequent process.
[0032] Step S102: using a large model to search for a clause vector matching the target topic from a pre-built search vector library according to the target topic, and obtaining a matching result. The search vector library includes a plurality of clause vectors.
[0033] Specifically, "big models" refer to artificial intelligence models with high capacity and complexity, which can process and understand large amounts of data. For example, big models can be BERT (Bidirectional Encoder Representation Model Based on Transformer) and GPT (Generative Pre-trained Transformer Model). The "search vector library" is a pre-built database that contains multiple "clause vectors", which are mathematical representations of text clauses after vectorization for fast retrieval.
[0034] The implementation process of obtaining matching results is as follows: First, the server receives the target topic input by the user, and then uses the large model to find the clause vector that matches the target topic in the search vector library. This process involves a similarity algorithm to evaluate and match the similarity between vectors. The similarity algorithm can be, for example, cosine similarity or Euclidean distance algorithm. Through the calculation of similarity, the clause vector most relevant to the target topic can be output in the end, that is, the matching result. These matching results are the clauses or information fragments most relevant to the user query. This process can enable efficient retrieval of information related to user needs from a large amount of data, improve the accuracy of search and user experience, and lay the foundation for further content generation and analysis.
[0035] In this way, the target topic input by the user is obtained first, and then a large model is used to convert the user's query into a vector representation in a high-dimensional space. Then, an efficient matching algorithm is used to quickly find the most relevant clause vector in the huge vector library. This method not only shortens the search time, but also ensures that the returned results are highly consistent with the user's query intent, thereby greatly enhancing the user experience and the efficiency of information acquisition. That is, by accurately searching and matching the corresponding clause vector from the search vector library according to the target topic input by the user, the relevance and accuracy of information retrieval can be improved.
[0036] Step S103, constructing a text outline according to the target topic and the matching result, and generating text content corresponding to the text outline according to the text outline to obtain the target text.
[0037] Specifically, the "target topic" refers to the title of the text to be generated input by the user, and the "matching results" are the clause vectors related to the topic retrieved from the search vector library based on the target topic. The "text outline" is an organizational structure that summarizes the main content and structural layout of the text to be generated.
[0038] The process of obtaining the target text can be achieved in the following ways: first, a large model can be used to analyze the target topic and matching results to extract key information and concepts; then, this information is used to build a text outline, which defines the main chapters, sub-chapters and core ideas of each part of the text; then, according to this outline, the text content is automatically written through natural language generation (NLG) technology to ensure that each part revolves around the topic defined in the outline; finally, the generated text content is integrated into a complete target text, which not only covers the target topic of the user's query, but also has a clear structure and coherent content, providing users with a comprehensive and organized information overview. This process automates the creation of text content and improves the efficiency and quality of content generation.
[0039] In this way, by combining the target topic and the matching results to build a text outline, and generating the corresponding text content based on this outline, an automated and systematic text creation process is achieved. It not only improves the efficiency of content generation and ensures the organization and logic of information, but also makes the generated text content closely revolve around the topics that users care about, thereby providing users with more accurate, in-depth and structured information. This method greatly enriches the readability and practicality of the text through intelligent content organization and natural language generation technology, and improves the user's reading experience and the convenience of information acquisition.
[0040] The present disclosure provides a text generation method, apparatus, device and storage medium based on a big model. The present disclosure uses a big model to efficiently retrieve clause vectors matching the target topic in a pre-built search vector library based on the target topic input by the user, thereby ensuring the relevance and accuracy of the content. Then, the big model is used to build a text outline based on the matching results, and the corresponding text content is generated based on the text outline. This coherent process not only improves the generation efficiency of the target text, but also ensures the logical structure and richness of the content of the generated target text, providing users with an efficient, personalized and content-accurate text generation service.
[0041] In some optional embodiments, before obtaining the target topic input by the user, the method further includes:
[0042] Get background knowledge text;
[0043] Cut and preprocess the background knowledge text to obtain processed clauses;
[0044] The processed clauses are vectorized, and the vectorized clauses are integrated to construct a search vector library.
[0045] Specifically, obtaining background knowledge text refers to the process of collecting information and data related to a specific topic from various sources. These texts can include books, articles, research reports, online content, etc., which provide basic data for further analysis and processing. When obtaining background knowledge text, text materials related to the target topic are first identified and collected through automated tools or manual methods. Next, these text materials are input into a preprocessing stage, which may include steps such as cleaning data, removing irrelevant information, and standardizing formats to ensure the quality and consistency of the data. The preprocessed text will be used for subsequent vectorization processing, which involves converting the text into mathematical representations, such as vectors or matrices, so that machine learning algorithms can process and analyze these data more efficiently. In this way, key information can be extracted from a large amount of text to provide support for further data analysis, knowledge discovery, or content generation.
[0046] After obtaining the background knowledge text, the background knowledge text is cut and preprocessed in turn. Cutting the background knowledge text means breaking it into smaller units, usually sentences or clauses, for further processing. "Preprocessing" involves cleaning and standardizing these clauses, such as removing stop words and punctuation marks, and performing stem extraction or word form restoration, with the aim of simplifying the text and highlighting key information. The preprocessed clauses are then vectorized, which means that they are converted into numerical vectors so that the computer can understand and process them. Finally, the vectorized clauses are then integrated to build a search vector library, which contains multiple clause vectors, each of which represents the numerical features of a clause in the original text. In this way, the search vector library provides a basis for efficient and accurate text retrieval and analysis, making it possible to quickly find information related to a specific query in a large amount of text data.
[0047] In this way, by carefully cutting and preprocessing the background knowledge text, it is helpful to obtain structured and clean clauses, which lays the foundation for subsequent text analysis and information retrieval. Then, these clauses are vectorized, that is, converted into numerical vectors that can be recognized by computers, which not only retains the semantic information of the text, but also greatly improves the processing efficiency. Then, these vectorized clauses are integrated into a search vector library, making it possible to quickly retrieve relevant information in a huge text database, thereby significantly improving the accuracy and efficiency of information retrieval and bringing users a richer and more personalized content experience. This process not only optimizes the structure of the data, but also provides strong technical support for various text applications, such as intelligent search, content recommendation, and assisted creation.
[0048] In some optional embodiments, the background knowledge text is segmented and preprocessed to obtain processed clauses, including:
[0049] Cut the background knowledge text according to punctuation marks and preset cutting lengths to obtain cut clauses;
[0050] The cut clauses are format-standardized to obtain annotated clauses;
[0051] The clause information adjacent to the standardized clause is expanded into the standardized clause to obtain the processed clause.
[0052] Specifically, intelligent segmentation of background knowledge text is achieved by identifying punctuation marks in the text and following the preset segmentation length, with the aim of dividing long texts into smaller, semantically complete clause units.
[0053] After obtaining the segmented clauses, these clauses are then processed in a standardized format. "Format standardization" refers to further preprocessing of these segmented clauses, including unifying the format, removing unnecessary spaces, correcting spelling errors, etc., to obtain standardized clauses. For example, the segmented clauses are converted from traditional to simplified Chinese, adjusted for uppercase and lowercase, converted between full-width and half-width characters, and useless symbols such as HTML tags, emoticons, special line breaks, etc. are removed. For names of people that appear in the text, especially different translated names, the server will identify and unify their names through a large model, such as unifying "Sherman", "Sherman", and "Xueman" into "Sherman". In this way, by performing format standardization on the segmented clauses, it helps to eliminate redundancy and inconsistency in the text, making subsequent analysis more accurate.
[0054] After obtaining the annotated clauses, the langchain tool is used to enhance the context information, that is, to expand the information. In order to enhance the context information of each clause, the clause information adjacent to each standardized clause will be expanded, which means integrating the relevant content of the surrounding clauses into the target clause, thereby obtaining a processed clause rich in context information. This process not only improves the semantic richness of the clause, but also provides a more accurate data foundation for subsequent text analysis and information retrieval.
[0055] In this way, by intelligently cutting the background knowledge text according to punctuation and preset length, structured clauses can be obtained, which not only helps to maintain the integrity of semantics, but also facilitates subsequent processing. Standardizing the format of these clauses, such as unifying character formats and eliminating invalid symbols, can further improve the readability and consistency of the text. In addition, expanding the information of adjacent clauses into standardized clauses enhances the contextual coherence of the clauses, thereby obtaining processed clauses with richer information and more complete semantics. Such operations improve the quality and availability of text data, and lay a solid foundation for efficient text analysis, accurate information retrieval, and in-depth semantic understanding.
[0056] In some optional embodiments, a large model is used to search for a clause vector matching the target topic from a pre-built search vector library according to the target topic, and a matching result is obtained, including:
[0057] Get the keywords entered by the user;
[0058] A large model is used to expand the topic according to the target topic and keywords to obtain the expanded topic, and the clause vectors in the search vector library are matched according to the expanded topic and keywords to obtain the matching results.
[0059] Specifically, the scheme first obtains the target topic and related keywords input by the user through the user interface. These keywords are the concretization and refinement of the topic, which helps to define the search scope more accurately. Then, the input target topic is expanded using a large model. This step uses language processing technology to enrich and expand the topic content and generate a more detailed and comprehensive topic description, that is, the expanded topic. Then, according to this expanded topic and keywords, a matching operation is performed in the search vector library. The search vector library is constructed by cutting, preprocessing and vectorizing the background knowledge text, and contains multiple clause vectors. Through the matching algorithm, the clause vector most relevant to the expanded topic can be found in the vector library, and finally the matching results are obtained. These results will be used for subsequent content generation or analysis, thereby providing users with accurate information support. This process realizes the automated processing from user input to information retrieval, and improves the efficiency and relevance of information retrieval.
[0060] In this way, by obtaining the target topic and related keywords specified by the user, the user's query intent can be deeply understood, and then these inputs are intelligently expanded to enrich the connotation of the topic and expand the search scope. This expansion process helps to capture information that is closer to the user's query. Then, using the expanded topics and keywords, accurate matching is performed in the search vector library to retrieve highly relevant clause vectors to obtain matching results. This series of operations greatly improves the accuracy and comprehensiveness of information retrieval, ensures that users can quickly obtain high-quality content closely related to their queries, improves user experience, and makes information acquisition more efficient and goal-oriented.
[0061] In some optional embodiments, the clause vectors in the search vector library are matched according to the expanded subject and keywords to obtain matching results, including:
[0062] Obtain the clause vectors that match the expanded topic and keywords in the search vector library;
[0063] Filter a preset number of clause vectors from the matched clause vectors to obtain a target clause vector;
[0064] The extended information of the target clause vector is obtained, and the target clause vector is concatenated with the extended information to obtain a matching result.
[0065] Specifically, the scheme first involves retrieving clause vectors that match the expanded topics and keywords input by the user from the search vector library. The "search vector library" is a database that stores a large amount of text data converted into vector form, and the "clause vector" is a numerical representation of the text clause, which enables the computer to identify semantic similarities by comparing these vectors. Next, a preset number of the most relevant clause vectors are selected from these matching vectors. This step is usually based on similarity scores or other relevance metrics. Then, "extended information" refers to additional context or metadata related to these clause vectors, which are extracted and spliced with the clause vectors. Finally, through this splicing, a matching result that integrates key information and rich context can be generated, providing strong support for user creation or query. This process realizes the rapid extraction and organization of information from a large amount of data, and improves the accuracy and efficiency of information retrieval.
[0066] In this way, by accurately matching the expanded topics and keywords, relevant clause vectors are efficiently retrieved from the search vector library, and then a preset number of the most relevant clause vectors are selected as target clause vectors. Furthermore, by obtaining the extended information of these target clause vectors and intelligently splicing them with the clause vectors, rich and comprehensive matching results are generated. This process not only improves the relevance and accuracy of information, but also enhances the depth and breadth of content, ensures the quality and practicality of the output results, and greatly improves the efficiency and quality of text generation.
[0067] In some optional embodiments, generating text content corresponding to the text outline according to the text outline to obtain the target text includes:
[0068] Get the subheadings in the text outline;
[0069] Combine the target topic with the subheading to obtain a combined topic;
[0070] Search the search vector library for a clause vector that matches the concatenated topic, and generate text content corresponding to the subheading based on the matching clause vector;
[0071] Integrate the text contents corresponding to all subheadings in the text outline to obtain the target text.
[0072] Specifically, a "text outline" refers to the structural framework of a document or article, which consists of a series of subheadings, each of which summarizes the main content of the corresponding section. This solution first involves extracting the subheadings in the text outline, which are short descriptions of each part of the article structure, helping to organize and guide the generation of content. Then, these subheadings are spliced with the target topic to form a more specific spliced topic, which allows the content of each section to be more closely centered around the central topic. Then, using this spliced topic, it is matched in the search vector library to obtain the matching clause vector. Then, the corresponding text content is generated for each subheading based on the matching clause vector. Here, the clause vector is a vector representation of text data, making it possible to retrieve similar content. Finally, the text content corresponding to all subheadings in the text outline is integrated. Through this orderly organization and splicing, a complete target text is formed, thereby realizing the automatic generation process from outline to complete content. This solution improves the efficiency and personalization of content generation, making the generated text richer and more targeted.
[0073] In this way, the subheadings in the text outline are first extracted, and then they are spliced with the target topic to form a more specific topic. This step makes content generation more focused and targeted. Next, the clause vectors that match these specific topics are found in the search vector library, and the text content closely related to each subheading is generated accordingly. Finally, the text content corresponding to all subheadings is integrated to form a comprehensive and coherent target text. This process not only improves the relevance and accuracy of the content, but also ensures the coherence and integrity of the text, thereby generating high-quality target texts and significantly improving writing efficiency and content quality.
[0074] In some optional embodiments, the method further comprises:
[0075] If no clause vector matching the concatenated topic is found in the search vector library, the large model is used to generate text content corresponding to the subheading.
[0076] Specifically, when the search vector library fails to find a clause vector that matches the concatenated topic, the solution uses a large model to generate text content corresponding to the subheading. The "large model" here refers to a large language model that can learn the laws of language based on a large amount of text data and generate coherent text by predicting the probability of the next word. This model is usually pre-trained and can understand rich language patterns and contextual relationships, so that it can still create relevant content based on topics and keywords when there is no directly matching clause vector. This process involves text generation technology, in which the model generates new text content by learning the distribution of data, ensuring that even when the information is not completely matched, text closely related to the subheading can be generated to meet the user's query needs.
[0077] In this way, when the search vector library fails to find a clause vector that matches the concatenated topic, the solution uses the large model to generate text content corresponding to the subheading, ensuring that even when faced with novel or uncommon topics, it can flexibly respond and produce highly relevant text. This design improves the robustness and adaptability of the content generation system, ensuring the quality and relevance of the content when there is a lack of sufficient vector matching, providing users with more comprehensive and reliable text output, and enhancing the practicality and flexibility of writing assistance tools.
[0078] In some optional embodiments, the method further includes: generating an article abstract according to the text outline and the text content of the target text.
[0079] Specifically, an article summary is a brief statement of the main content of the article, which is designed to quickly convey the core information of the article. Create a short summary through the outline and the specific text content. In this process, you first need to determine the outline of the article, which usually contains the main parts and subheadings of the article, which outline the structure and main purpose of the article. Next, analyze this structural information and the specific text of the article to extract key sentences and core concepts. Then, using natural language processing techniques, such as extractive summarization methods or abstractive summarization methods, the system intelligently combines this key information into a coherent summary. This summary is designed to provide readers with a quick overview of the main content of the article without having to read the full text. Ultimately, this summary should accurately reflect the theme and main points of the article, while remaining concise enough to be quickly read and understood.
[0080] In this way, by generating an article summary based on the text outline and text content, the key information and main idea of the article can be automatically extracted and summarized, providing users with a way to quickly grasp the core content of the article. This automated summary generation process not only saves readers time in screening and reading the full text, but also improves the accessibility and efficiency of information, making it easier to understand and share long texts. In addition, it helps to quickly identify and obtain important content in an environment of information overload, thereby improving the efficiency and quality of information processing.
[0081] In order to understand the technical solution of this application as a whole, see Figure 2 , Figure 2 : is a flowchart of a text generation method based on a large model in an embodiment of the present disclosure. Specifically, the method includes:
[0082] Step S201, obtaining background knowledge text.
[0083] Specifically, obtaining background knowledge text refers to the process of collecting information and data related to a specific topic from various sources. These texts can include books, articles, research reports, online content, etc., which provide basic data for further analysis and processing. When obtaining background knowledge text, first identify and collect text materials related to the target topic through automated tools or manual methods.
[0084] Step S202 , cutting the background knowledge text according to punctuation marks and a preset cutting length to obtain cut clauses.
[0085] Specifically, intelligent segmentation of background knowledge text is achieved by identifying punctuation marks in the text and following the preset segmentation length, with the aim of dividing long texts into smaller, semantically complete clause units.
[0086] Step S203: Standardize the format of the segmented clauses to obtain annotated clauses.
[0087] Specifically, after obtaining the cut clauses, these clauses are then subjected to standardized format processing. "Format standardization processing" refers to further preprocessing of these cut clauses, including unifying the format, removing unnecessary spaces, correcting spelling errors, etc., to obtain standardized clauses. For example, the cut clauses are converted from traditional to simplified Chinese, adjusted for uppercase and lowercase, converted between full-width and half-width characters, and useless symbols such as HTML (web page) tags, emoticons, special line breaks, etc. are removed. For names of people appearing in the text, especially different translated names, the system will identify and unify their names through a large model, such as unifying "Sherman", "Sherman", and "Sherman" into "Sherman". In this way, by performing format standardization processing on the cut clauses, it is helpful to eliminate redundancy and inconsistency in the text, making subsequent analysis more accurate.
[0088] Step S204, expanding the clause information adjacent to the standardized clause into the standardized clause to obtain a processed clause.
[0089] Specifically, in order to enhance the contextual information of each clause, the clause information adjacent to each standardized clause will be expanded, which means integrating the relevant content of the surrounding clauses into the target clause, thereby obtaining a processed clause rich in contextual information. This process not only improves the semantic richness of the clause, but also provides a more accurate data foundation for subsequent text analysis and information retrieval.
[0090] Step S205 , vectorizing the processed clauses, and integrating the vectorized clauses to construct a search vector library.
[0091] Specifically, the preprocessed clauses are then vectorized, that is, converted into numerical vectors so that the computer can understand and process them. Finally, the vectorized clauses are then integrated to build a search vector library, which contains multiple clause vectors, each of which represents the numerical characteristics of a clause in the original text. In this way, the search vector library provides a basis for efficient and accurate text retrieval and analysis, making it possible to quickly find information related to a specific query in a large amount of text data.
[0092] Step S206, obtaining the target topic and keywords input by the user.
[0093] Specifically, the target topic and related keywords input by the user are obtained through the user interface. These keywords are the concretization and refinement of the topic, which helps to define the search scope more accurately.
[0094] Step S207, expanding the topic according to the target topic and keywords to obtain an expanded topic.
[0095] Specifically, the input target topic is expanded. This step uses language processing technology to enrich and expand the topic content and generate a more detailed and comprehensive topic description, namely the expanded topic.
[0096] Step S208, matching the clause vectors in the search vector library according to the expanded subject and keywords to obtain matching results.
[0097] Specifically, according to the expanded topic and keywords, a matching operation is performed in the search vector library, which is constructed by cutting, preprocessing and vectorizing the background knowledge text and contains multiple clause vectors. Through the matching algorithm, the clause vector most relevant to the expanded topic can be found in the vector library, and finally the matching results are obtained. These results will be used for subsequent content generation or analysis, thereby providing users with accurate information support. This process realizes the automated processing from user input to information retrieval, improving the efficiency and relevance of information retrieval.
[0098] Step S209, constructing a text outline according to the target topic and the matching results.
[0099] Specifically, the target topic and the matching results are input into a large language model, and the text outline is obtained through the large language model.
[0100] Step S210, obtaining subheadings in the text outline.
[0101] Specifically, subheadings in the text outline are extracted, which are brief descriptions of each part in the article structure and help organize and guide the generation of content.
[0102] Step S211, generating text content corresponding to the text outline according to the text outline to obtain the target text and the summary.
[0103] Specifically, after obtaining the subheadings in the text outline, the corresponding text content is generated for each subheading. Finally, the text content corresponding to all subheadings in the text outline is integrated. Through this orderly organization and splicing, a complete target text is formed, thereby realizing the automatic generation process from outline to complete content. This solution improves the efficiency and personalization of content generation, making the generated text richer and more targeted. Optionally, after obtaining the target text, an article summary is generated according to the text outline and the text content of the target text.
[0104] In this way, through a series of refined processing steps, efficient conversion from background knowledge text acquisition, cutting, standardization, expansion to vectorization is achieved, and a rich search vector library is constructed. Subsequently, by intelligently matching the target topics and keywords entered by the user, an accurate text outline is generated, and text content and summaries that are highly relevant to user needs are produced accordingly. The entire process not only improves the accuracy of information retrieval and the personalization of content generation, but also greatly improves processing efficiency, ensures the coherence of text content and the consistency of themes, and provides users with a powerful text creation and information retrieval tool.
[0105] The following describes an apparatus embodiment of the present application, which can be used to execute the large model-based text generation method in the above-mentioned embodiment of the present application. For details not disclosed in the apparatus embodiment of the present application, please refer to the above-mentioned embodiment of the large model-based text generation method of the present application.
[0106] The present disclosure also provides a text generation device 300 based on a large model, such as Figure 3 As shown, including:
[0107] Acquisition module 301, used to acquire the target subject input by the user;
[0108] A matching module 302 is used to use a large model to search for a clause vector matching the target topic from a pre-built search vector library according to the target topic to obtain a matching result, wherein the search vector library includes multiple clause vectors; and
[0109] The generating module 303 is used to construct a text outline according to the target topic and the matching result, and to generate text content corresponding to the text outline according to the text outline to obtain the target text.
[0110] In some optional embodiments, the device further includes a processing module, which is used before obtaining the target topic input by the user:
[0111] Get background knowledge text;
[0112] Cut and preprocess the background knowledge text to obtain processed clauses;
[0113] The processed clauses are vectorized, and the vectorized clauses are integrated to construct a search vector library.
[0114] In some optional embodiments, the processing module cuts and preprocesses the background knowledge text to obtain processed clauses, including:
[0115] Cut the background knowledge text according to punctuation marks and preset cutting lengths to obtain cut clauses;
[0116] The cut clauses are format-standardized to obtain annotated clauses;
[0117] The clause information adjacent to the standardized clause is expanded into the standardized clause to obtain the processed clause.
[0118] In some optional embodiments, the matching module 302 uses a large model to search for a clause vector matching the target topic from a pre-built search vector library according to the target topic, and obtains a matching result, including:
[0119] Get the keywords entered by the user;
[0120] A large model is used to expand the topic according to the target topic and keywords to obtain the expanded topic, and the clause vectors in the search vector library are matched according to the expanded topic and keywords to obtain the matching results.
[0121] In some optional embodiments, the matching module 302 matches the clause vectors in the search vector library according to the expanded subject and keyword to obtain matching results, including:
[0122] Obtain the clause vectors that match the expanded topic and keywords in the search vector library;
[0123] Filter a preset number of clause vectors from the matched clause vectors to obtain a target clause vector;
[0124] The extended information of the target clause vector is obtained, and the target clause vector is concatenated with the extended information to obtain a matching result.
[0125] In some optional embodiments, the generating module 303 generates text content corresponding to the text outline according to the text outline to obtain the target text, including:
[0126] Get the subheadings in the text outline;
[0127] Combine the target topic with the subheading to obtain a combined topic;
[0128] Search the search vector library for a clause vector that matches the concatenated topic, and generate text content corresponding to the subheading based on the matching clause vector;
[0129] Integrate the text contents corresponding to all subheadings in the text outline to obtain the target text.
[0130] In some optional embodiments, the generation module 303 is further used to use the large model to generate text content corresponding to the subheading if no clause vector matching the concatenated topic is found in the search vector library.
[0131] In the technical solution disclosed herein, the acquisition, storage and application of user personal information involved are in compliance with the provisions of relevant laws and regulations and do not violate public order and good morals.
[0132] According to an embodiment of the present disclosure, the present disclosure also provides an electronic device, a readable storage medium and a computer program product.
[0133] Figure 4 A schematic block diagram of an example electronic device 400 that can be used to implement an embodiment of the present disclosure is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present disclosure described and / or required herein.
[0134] like Figure 4 As shown, the electronic device 400 includes a computing unit 401, which can perform various appropriate actions and processes according to a computer program stored in a read-only memory (ROM) 402 or a computer program loaded from a storage unit 408 into a random access memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the device 400 can also be stored. The computing unit 401, the ROM 402, and the RAM 403 are connected to each other via a bus 404. An input / output (I / O) interface 405 is also connected to the bus 404.
[0135] A number of components in the device 400 are connected to the I / O interface 405, including: an input unit 406, such as a keyboard, a mouse, etc.; an output unit 407, such as various types of displays, speakers, etc.; a storage unit 408, such as a disk, an optical disk, etc.; and a communication unit 409, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 409 allows the device 400 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0136] The computing unit 401 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the computing unit 401 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various computing units running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processors, controllers, microcontrollers, etc. The computing unit 401 performs the various methods and processes described above, such as a text generation method based on a large model. For example, in some embodiments, the text generation method based on a large model may be implemented as a computer software program, which is tangibly contained in a machine-readable medium, such as a storage unit 408. In some embodiments, part or all of the computer program may be loaded and / or installed on the device 400 via ROM 402 and / or communication unit 409. When the computer program is loaded into RAM 403 and executed by the computing unit 401, one or more steps of the applet distribution described above may be performed. Alternatively, in other embodiments, the computing unit 401 may be configured to perform a text generation method based on a large model in any other appropriate manner (e.g., by means of firmware).
[0137] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0138] The program code for implementing the method of the present disclosure may be written in any combination of one or more programming languages. These program codes may be provided to a processor or controller of a general-purpose computer, a special-purpose computer, or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0139] In the context of the present disclosure, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0140] To provide interaction with a user, the systems and techniques described herein 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 the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0141] The systems and techniques described herein may be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), and the Internet.
[0142] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship of client and server is generated by computer programs running on respective computers and having a client-server relationship with each other. The server may be a cloud server, a server of a distributed system, or a server combined with a blockchain.
[0143] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this disclosure can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solutions disclosed in this disclosure can be achieved, and this document does not limit this.
[0144] The above specific implementations do not constitute a limitation on the protection scope of the present disclosure. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present disclosure shall be included in the protection scope of the present disclosure.
Claims
1. A text generation method based on a large model, the method comprising: Get the target topic entered by the user; Using a large model to search for a clause vector matching the target topic from a pre-built search vector library according to the target topic to obtain a matching result, wherein the search vector library includes a plurality of clause vectors; and A text outline is constructed according to the target topic and the matching result, and text content corresponding to the text outline is generated according to the text outline to obtain a target text.
2. The method according to claim 1, wherein: Before obtaining the target subject input by the user, the method further includes: Get background knowledge text; Cutting and preprocessing the background knowledge text to obtain processed clauses; The processed clauses are vectorized, and the vectorized clauses are integrated to construct a search vector library.
3. The method according to claim 2, wherein: The background knowledge text is cut and preprocessed to obtain processed clauses, including: Cut the background knowledge text according to punctuation marks and a preset cutting length to obtain cut clauses; Performing format standardization processing on the cut clauses to obtain annotated clauses; The clause information adjacent to the standardized clause is expanded into the standardized clause to obtain a processed clause.
4. The method according to claim 1, wherein: The use of the large model to search for a clause vector matching the target topic from a pre-built search vector library according to the target topic, and obtaining a matching result includes: Get the keywords entered by the user; The large model is used to expand the topic according to the target topic and the keywords to obtain the expanded topic, and the clause vectors in the search vector library are matched according to the expanded topic and the keywords to obtain a matching result.
5. The method according to claim 4, wherein: The step of matching the clause vectors in the search vector library according to the expanded subject and the keyword to obtain a matching result includes: Obtaining a clause vector in the search vector library that matches the expanded topic and the keyword; Filtering a preset number of clause vectors from the matched clause vectors to obtain a target clause vector; The extended information of the target clause vector is obtained, and the target clause vector is concatenated with the extended information to obtain the matching result.
6. The method according to any one of claims 1 to 5, wherein: Generating text content corresponding to the text outline according to the text outline to obtain a target text includes: Get the subheadings in the text outline; Splicing the target topic with the subheading to obtain a spliced topic; Searching for a clause vector matching the concatenated topic from the search vector library, and generating text content corresponding to the subheading according to the matching clause vector; The text contents corresponding to all subheadings in the text outline are integrated to obtain the target text.
7. The method according to claim 6, wherein: The method further comprises: If no clause vector matching the concatenated topic is found in the search vector library, a large model is used to generate text content corresponding to the subheading.
8. A text generation device based on a large model, comprising: The acquisition module is used to obtain the target topic input by the user; a matching module, configured to use a large model to search for a clause vector matching the target topic from a pre-built search vector library according to the target topic, and obtain a matching result, wherein the search vector library includes a plurality of clause vectors; and A generating module is used to construct a text outline according to the target topic and the matching result, and to generate text content corresponding to the text outline according to the text outline to obtain a target text.
9. The device according to claim 8, wherein: The device further comprises a processing module, which is used before obtaining the target subject input by the user: Get background knowledge text; Cutting and preprocessing the background knowledge text to obtain processed clauses; The processed clauses are vectorized, and the vectorized clauses are integrated to construct a search vector library.
10. The device according to claim 9, wherein: The processing module cuts and preprocesses the background knowledge text to obtain processed clauses, including: Cut the background knowledge text according to punctuation marks and a preset cutting length to obtain cut clauses; Performing format standardization processing on the cut clauses to obtain annotated clauses; The clause information adjacent to the standardized clause is expanded into the standardized clause to obtain a processed clause.
11. The device according to claim 8, wherein: The matching module uses a large model to search for a clause vector matching the target topic from a pre-built search vector library according to the target topic, and obtains a matching result, including: Get the keywords entered by the user; The large model is used to expand the topic according to the target topic and the keywords to obtain the expanded topic, and the clause vectors in the search vector library are matched according to the expanded topic and the keywords to obtain a matching result.
12. The device according to claim 11, wherein The matching module matches the clause vector in the search vector library according to the expanded subject and the keyword to obtain a matching result, including: Obtaining a clause vector in the search vector library that matches the expanded topic and the keyword; Filtering a preset number of clause vectors from the matched clause vectors to obtain a target clause vector; The extended information of the target clause vector is obtained, and the target clause vector is concatenated with the extended information to obtain the matching result.
13. The device according to any one of claims 8 to 12, wherein: The generating module generates text content corresponding to the text outline according to the text outline to obtain a target text, including: Get the subheadings in the text outline; Splicing the target topic with the subheading to obtain a spliced topic; Searching for a clause vector matching the concatenated topic from the search vector library, and generating text content corresponding to the subheading according to the matching clause vector; The text contents corresponding to all subheadings in the text outline are integrated to obtain the target text.
14. The device according to claim 13, wherein: The generation module is also used to use a large model to generate text content corresponding to the subheading if no clause vector matching the spliced topic is found in the search vector library.
15. An electronic device, comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 7.
16. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-7.
17. A computer program product, comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 7.