Content generation method and system, electronic device

By expanding keywords, setting SEO constraint parameters and semantic scoring in AI content generation, and combining vector databases for automatic completion, the problem of insufficient SEO rules and semantic relevance in existing technologies is solved, achieving efficient and automated content generation and optimization.

CN122491286APending Publication Date: 2026-07-31YIYUNYING (SHANDONG) NETWORK TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
YIYUNYING (SHANDONG) NETWORK TECHNOLOGY CO LTD
Filing Date
2026-05-07
Publication Date
2026-07-31

AI Technical Summary

Technical Problem

Existing AI content generation technologies cannot automatically meet search engine optimization rules, lack real-time quantitative assessment methods for the semantic relevance between generated content and user topics, and lack automated completion mechanisms when semantic relevance is insufficient, resulting in low content generation efficiency and low quality.

Method used

By acquiring user-input keywords and requirements, keyword semantic expansion is performed, SEO constraint parameters are set, a structured prompt word input large language model is generated, semantic relevance scores are calculated, semantic completion is performed when insufficient, and missing information is retrieved using a vector database to achieve automatic content optimization.

Benefits of technology

It enables automatic compliance with SEO rules during content generation, improves the automation and semantic relevance of content generation, avoids problems discovered after manual modification and publication, and enhances content quality and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122491286A_ABST
    Figure CN122491286A_ABST
Patent Text Reader

Abstract

This application discloses a content generation method. The method includes: acquiring user-input keywords, target article length, role definition, and style requirements; semantically expanding and extracting long-tail keywords based on the user-input keywords to obtain an expanded keyword set; determining constraint parameters according to the target article length, including the frequency of occurrence of each keyword in the keyword set set according to a preset ratio, and the set of positions where the user-input keywords must appear; dynamically assembling the constraint parameters, role definition, style requirements, and expanded keyword set into structured prompts, inputting them into a large language model to generate initial content; calculating the semantic relevance score between the initial content and the user-input keywords, and semantically completing the initial content when the score is lower than a preset threshold to obtain the target content. This method achieves an intelligent closed loop of automatic SEO constraint embedding, real-time semantic quality assessment, and adaptive completion.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of CMS website building technology, specifically a content generation method and system, and an electronic device. Background Technology

[0002] In today's digital age, websites have become crucial platforms for businesses, organizations, and individuals to showcase their image and disseminate information. Content Management Systems (CMS), as core tools for website construction and management, provide users with convenient content creation, publishing, and management functions. With the development of artificial intelligence technology, especially the maturity of large language models, utilizing AI to automatically generate website content has become an important means of improving content production efficiency. However, existing AI content generation technologies still have the following technical shortcomings in practical applications:

[0003] First, existing technologies cannot automatically meet search engine optimization (SEO) rules during content generation. Traditional AI content generation methods typically rely solely on user-input keywords or simple suggestions. The generated content lacks quantitative constraints in terms of keyword density and keyword placement (such as the first paragraph, title tags, etc.), resulting in the generated content often requiring extensive manual post-production modifications to meet SEO requirements, thus reducing the automation and efficiency of content generation.

[0004] Second, existing technologies lack quantitative assessment methods for the semantic relevance between generated content and user-specified topics. Current content quality assessments mainly rely on subjective human judgment or user behavior metrics after publication (such as click-through rate and dwell time), which cannot evaluate the semantic matching degree between generated content and user-specified topics in a timely and objective manner during the content generation stage. This results in low-quality content being discovered only after publication, leading to a waste of resources.

[0005] Third, when the semantic relevance of the generated content is insufficient, existing technologies lack automated completion mechanisms. Typically, manual editing or regeneration of the entire content is required, failing to achieve a closed-loop control of "optimization upon generation," thus hindering efficient improvement of content quality.

[0006] Therefore, how to automatically embed SEO quantitative constraints during the content generation process, instantly assess the semantic relevance of the generated content to the topic, and automatically supplement it when the relevance is insufficient, so as to efficiently generate content that not only conforms to SEO rules but also has high semantic relevance, is a technical problem that urgently needs to be solved in this field.

[0007] It should be noted that the information disclosed in the background section above is only used to enhance the understanding of the background of the embodiments of this disclosure, and therefore may include information that does not constitute prior art known to those skilled in the art. Summary of the Invention

[0008] To provide a basic understanding of some aspects of the disclosed embodiments, a brief summary is given below. This summary is not intended as a general commentary, nor is it intended to identify key / important components or describe the scope of protection of these embodiments, but rather as a prelude to the detailed description that follows.

[0009] This disclosure provides a content generation method, system, and electronic device, aiming to solve the technical problems of existing AI content generation technologies that cannot automatically meet search engine optimization rules during the generation process, lack real-time quantitative evaluation methods for the semantic relevance between generated content and user topics, and lack an automated completion mechanism when semantic relevance is insufficient.

[0010] In some embodiments, a content generation method includes the following steps:

[0011] Obtain user-input keywords, target article length, role definition, and style requirements;

[0012] Based on the keywords input by the user, semantic expansion of the keywords is performed and long-tail keywords are extracted to obtain an expanded set of keywords;

[0013] The constraint parameters are determined based on the target article length. The constraint parameters include setting the frequency of occurrence of each keyword in the expanded keyword set according to a preset ratio, and the set of positions where the user-input keywords must appear.

[0014] The constraint parameters, role definitions, style requirements, and the expanded keyword set are dynamically assembled into structured prompt words, which are then input into a large language model to generate initial content.

[0015] Calculate the semantic relevance score between the initial content and the keywords input by the user. When the semantic relevance score is lower than a preset threshold, perform semantic completion on the initial content to obtain the target content.

[0016] In some embodiments, a content generation system includes:

[0017] The acquisition module is configured to acquire user-input keywords, target article length, role definition, and style requirements.

[0018] The keyword processing module is configured to perform semantic expansion of the keywords input by the user and extract long-tail keywords to obtain an expanded keyword set;

[0019] The constraint parameter calculation module is configured to determine constraint parameters based on the target article length. The constraint parameters include the frequency of occurrence of each keyword in the expanded keyword set according to a preset ratio, and the set of positions where the user-input keywords must appear.

[0020] The prompt word assembly and generation module is configured to dynamically assemble the constraint parameters, role definitions, style requirements, and the expanded keyword set into structured prompt words, which are then input into a large language model to generate initial content.

[0021] The semantic scoring and completion module is configured to calculate the semantic relevance score between the initial content and the keywords input by the user, and when the semantic relevance score is lower than a preset threshold, perform semantic completion on the initial content to obtain the target content.

[0022] In some embodiments, an electronic device includes: a processor, a memory, and a computer program stored in the memory, wherein the processor, when executing the computer program, implements the aforementioned content generation method.

[0023] The content generation method, system, and electronic device provided in this disclosure can achieve the following technical effects:

[0024] In this embodiment, firstly, by setting the frequency of each keyword in the expanded keyword set according to a preset ratio based on the target article length, the search engine optimization rules are directly quantified into calculable constraint parameters and embedded in structured prompts. This ensures that the content generated by the large language model meets the keyword density and distribution requirements from the source, eliminating the need for manual post-production modification and significantly improving the automation level and SEO compliance of content generation. Secondly, by calculating the semantic relevance score between the initial content and the keywords input by the user, an instantaneous quantitative assessment of the semantic matching degree between the generated content and the user's topic is achieved, avoiding the lag of relying on user behavior indicators after publication. Finally, when the semantic relevance score is lower than a preset threshold, the initial content is automatically semantically completed. Missing semantic information is retrieved from the vector database and inserted into the relevant content position, ensuring that the final target content not only conforms to search engine optimization rules but also has high semantic relevance. This solves the technical problems of existing technologies that cannot simultaneously consider SEO constraints and semantic quality, and lack instant assessment and automatic completion mechanisms.

[0025] The above general description and the description below are exemplary and explanatory only, and are not intended to limit the embodiments of this disclosure. Attached Figure Description

[0026] One or more embodiments are illustrated by way of example with reference to the accompanying drawings. These illustrations and drawings do not constitute a limitation on the embodiments. Elements having the same reference numerals in the drawings are shown as similar elements. The drawings are not to be scaled. And wherein:

[0027] Figure 1 This is a schematic diagram of the microservice architecture of the content generation system provided in this embodiment of the disclosure;

[0028] Figure 2 This is a flowchart illustrating the content generation method provided in this embodiment of the disclosure;

[0029] Figure 3 This is a schematic diagram of the process for semantic completion of initial content provided in an embodiment of this disclosure;

[0030] Figure 4 This is a schematic diagram of the structure of the content generation system provided in this embodiment of the disclosure;

[0031] Figure 5 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this disclosure. Detailed Implementation

[0032] To provide a more detailed understanding of the features and technical content of the embodiments of this disclosure, the implementation of the embodiments of this disclosure will be described in detail below with reference to the accompanying drawings. The accompanying drawings are for illustrative purposes only and are not intended to limit the embodiments of this disclosure. In the following technical description, for ease of explanation, several details are used to provide a full understanding of the disclosed embodiments. However, one or more embodiments may still be implemented without these details. In other cases, well-known structures and devices may be simplified in their depiction to simplify the drawings.

[0033] The terms "first," "second," etc., used in the specification, claims, and accompanying drawings of this disclosure are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate for the embodiments of this disclosure described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion.

[0034] Unless otherwise stated, the term "multiple" means two or more.

[0035] In this embodiment of the disclosure, the character " / " indicates that the objects before and after it are in an "or" relationship. For example, A / B means: A or B.

[0036] The term "and / or" describes an association between objects, indicating that three relationships can exist. For example, A and / or B means: A or B, or A and B.

[0037] The term "correspondence" can refer to an association or binding relationship. The correspondence between A and B means that there is an association or binding relationship between A and B.

[0038] Figure 1 The microservice architecture of the content generation system in this embodiment is shown, which mainly includes a user interaction layer, an API gateway layer, a microservice layer, a data layer, and an optional asynchronous message queue layer.

[0039] Users input keywords, target article length, content theme, style requirements, and other information via a web interface or mobile app (located in the user interaction layer). These requests are forwarded to the microservice layer via the API gateway layer (responsible for authentication, rate limiting, and routing). The AI ​​generation service, SEO optimization service, and content management service in the microservice layer collaborate to complete the content generation task: the AI ​​generation service calls the large language model, receives the assembled prompts, and returns the generated initial content; the SEO optimization service handles the computational logic related to search engine optimization, including constraint parameter generation, semantic scoring, gap vector calculation, originality detection, and rewriting; the content management service manages the reading and writing of the vector database (storing paragraph vectors, retrieving and completing content), metadata storage in the relational database, cache management, and content type identification and feature extraction. The services communicate asynchronously through a message queue layer (such as Kafka) to decouple time-consuming tasks (such as large model calls and semantic completion) and avoid long wait times for the front end. The data layer includes a Milvus vector database (storing semantic vectors), a PostgreSQL relational database (storing content metadata), and a Redis cache (storing hot data), providing data read and write support for the microservice layer. The entire system involves a series of steps, including semantic expansion, constraint parameter determination, structured prompt word assembly, large language model generation, semantic scoring and completion, ultimately outputting target content that meets SEO requirements and is semantically relevant. The following section will combine... Figure 2 The flowchart shown illustrates the content generation process and provides a detailed explanation of the specific steps involved in this method.

[0040] Reference Figure 2 As shown, the content generation method in this embodiment includes the following steps:

[0041] S1: Obtain the keywords, target article length, role definition, and style requirements input by the user.

[0042] Users input the core keywords they want the article to revolve around, the desired article length, role definition, and style requirements into the interactive interface of the website content management system. These inputs will be used for subsequent suggestion word assembly. The system can also receive other parameters specified by the user. For example, a cross-border e-commerce merchant selling outdoor products wants to generate an SEO article about "hiking backpacks" on their UK site. The input would be: English keyword "hiking backpack", target article length of 1200 words, role definition "a local UK editor familiar with outdoor gear", and style requirements "professional, practical, conforming to British English spelling and conventions, and targeting British hiking enthusiasts".

[0043] S2: Based on the keywords input by the user, perform semantic expansion of the keywords and extract long-tail keywords to obtain the expanded keyword set.

[0044] To obtain the expanded keywords, step S2 is achieved through the following sub-steps:

[0045] S21: Calculate the set of semantically similar words for the keywords input by the user based on the word embedding model.

[0046] The system uses a pre-trained word embedding model (e.g., Word2Vec) to convert user-input keywords into vectors. It then calculates the cosine similarity of these vectors with other words to identify semantically similar words. A similarity threshold (e.g., 0.75) is set, and words exceeding this threshold are added to the semantically similar word set. For example, inputting "artificial intelligence" yields similar words such as "machine learning," "deep learning," and "natural language processing." This expansion method fully leverages the continuous representation capabilities of word embedding models in the semantic space, enabling the discovery of more potential related words compared to traditional thesaurus methods. In cross-border scenarios, the system can pre-build multilingual industry corpora (e.g., product description sets from Amazon and eBay websites) and use cross-lingual word embedding models (e.g., LASER, XLM-R) to achieve cross-semantic expansion of keywords, thus adapting to the extraction needs of long-tail keywords in different language environments.

[0047] S22: Extract a set of long-tail keywords from an industry corpus based on a statistical model.

[0048] The system pre-constructs an industry corpus related to the user's domain (such as a collection of documents in the healthcare field). Using the TF-IDF (Term Frequency-Inverse Document Frequency) algorithm, it calculates the co-occurrence frequency of each candidate word with the user-input keywords in the corpus, selecting the most frequent words as a set of long-tail keywords. Examples include "application of artificial intelligence in medical image diagnosis" and "machine learning-assisted drug development." TF-IDF effectively filters out representative and distinctive long-tail keywords within a specific domain.

[0049] S23: Merge to obtain the expanded set of keywords.

[0050] The user-input keywords, the set of semantically similar words, and the set of long-tail keywords are combined (the union is taken), and duplicates are removed to obtain an expanded keyword set. This set significantly enriches the topic vocabulary compared to the original input, which helps improve the recall rate and ranking of subsequent generated content in search engines.

[0051] S3: Determine SEO constraint parameters based on the target article length.

[0052] In step S3, quantified SEO rules are automatically generated based on the target article length. This specifically includes the following sub-steps S31 to S32:

[0053] S31: Set the frequency of each keyword in the expanded keyword set according to a preset ratio.

[0054] The system sets the frequency of the main keyword (i.e., the keyword entered by the user) to a certain proportion of the target article length N. In this embodiment, this proportion is 2.5% (i.e., N × 0.025). The frequency of related words (including semantically similar words and long-tail keywords) is set to another proportion of the target article length N, which is 1.5% (i.e., N × 0.015). The proportion coefficients can also be dynamically adjusted according to the article length range. For example, if the system defaults or the user specifies N = 1000 words, the main keyword needs to appear approximately 25 times, and each related word needs to appear approximately 15 times. This proportion is not set arbitrarily, but is an empirical value based on a large number of SEO experiments: a main keyword density of 2.5% ensures that the theme is prominent without being stuffed, while a related word density of 1.5% supplements the breadth of the theme.

[0055] Those skilled in the art will understand that, in addition to setting the keyword frequency based on a preset ratio using the "target article length" as a benchmark, the following three methods can also be used: 1. Based on a fixed absolute value setting: regardless of the article length, the main keyword is required to appear a fixed number of times (e.g., 20-30 times), and related keywords 5-10 times. This method is suitable for scenarios with relatively fixed article lengths (e.g., product description pages), and is simple and direct; or, 2. Based on the statistical distribution of historical best content: statistically analyze a collection of published articles with excellent search engine rankings, calculate the average frequency and standard deviation of each keyword, and use this as the frequency target for newly generated content (e.g., take the mean ± 0.5 times the standard deviation); or, 3. Based on user-defined density parameters: allow users to directly input the desired density of each keyword in the interface (e.g., 2%), and the system calculates the absolute frequency accordingly.

[0056] S32: Set the set of positions where the keywords entered by the user must appear.

[0057] The system mandates that user-entered keywords must appear in the first paragraph, an H1 tag (level 1 heading), at least one H2 tag (level 2 heading), and the last paragraph. These positions are considered to have the highest weight in search engine ranking algorithms. Explicitly specifying these positions makes the constraint parameters calculable and verifiable.

[0058] S4: Dynamically assemble structured prompts and generate initial content.

[0059] In step S4, the constraint parameters, preset role definitions, style requirements, and expanded keyword set are dynamically assembled into structured prompt words, which are then input into the large language model to generate initial content. This step specifically includes the following:

[0060] S41: Assemble four layers of prompts according to the preset multi-level template structure.

[0061] The system fills the template with the constraint parameters obtained from S31-S32, the preset role definitions, style requirements, and the expanded keyword set obtained from S2, in a fixed order, generating a four-layer structured prompt word consisting of a constraint layer, a role layer, a style layer, and a content layer arranged in sequence. Among these layers:

[0062] Constraint layer: Constraint parameters are embedded in key-value pairs, for example: "Keyword density: main word 2.5%, related words 1.5%; Forced position: first paragraph, H1, H2, last paragraph".

[0063] Role layer: Defines the writing identity and professional knowledge background of the generated content, such as "a senior medical and health editor with medical knowledge and understanding of industry terminology".

[0064] Style layer: Defines the tone, formality, and target audience of the generated content, such as "professional but not obscure tone, high formality, and target audience is medical professionals".

[0065] Content layer: Provides an expanded set of keywords as material for generating content, such as "artificial intelligence; machine learning; deep learning; medical image diagnosis" in list form.

[0066] The four layers of information are sequentially assembled into a complete prompt text in the order of "constraints → roles → style → content". This hierarchical structure enables the large language model to clearly distinguish between "rules that must be followed", "roles that need to be played", "expression style" and "available vocabulary", significantly improving the model's compliance with instructions.

[0067] S42: Input the structured prompts into the large language model to generate initial content.

[0068] The system calls the API of large language models (such as GPT-4, LLaMA, etc.), taking the above structured prompts as input. The model generates a complete article based on the prompts, which serves as the initial content. Since the prompts already embed detailed SEO rules and role style constraints, the generated content initially meets the requirements in terms of keyword density, distribution, and professional tone.

[0069] S5: Calculate semantic relevance scores and perform semantic completion on the initial content when necessary.

[0070] After generating initial content, the system automatically verifies whether the user-input keywords appear in a preset set of locations. Specifically, the verification method involves using regular expressions or an HTML parser to extract the first paragraph, the text within each H1 tag, the text within each H2 tag, and the last paragraph of the initial content, and checking whether the user-input keywords appear as complete words or phrases in any of these areas (ignoring case for English and using substring matching for Chinese). If a keyword is missing from the first paragraph, any H1 tag, any H2 tag, or the last paragraph, it is determined that the location set constraint is not met. The system then triggers automatic repair: either by instructing the large language model to insert the missing keyword into the corresponding position via a prompt, or by having the post-processor directly add the keyword to the corresponding position (e.g., automatically adding keywords to H1 tags in the case of missing H1 tags).

[0071] Step S5 enables self-assessment and self-repair of content quality. Refer to [reference needed]. Figure 3 As shown, this specifically includes sub-steps S51 to S53:

[0072] S51: Use a semantic encoder to calculate the cosine similarity between each paragraph and the user's keywords, and then sum the results in a weighted average to obtain a semantic relevance score.

[0073] The system employs a pre-trained sentence-level semantic encoder (e.g., Sentence-BERT) to encode user-input keywords (i.e., topic keywords) into fixed-dimensional topic vectors (e.g., 384-dimensional). Similarly, the initial content is segmented into natural paragraphs, and each paragraph is encoded into a paragraph vector. The cosine similarity (simi) between each paragraph vector and the topic vector is calculated.

[0074] Then, a weighted sum is calculated based on the paragraph positions, assigning different weights accordingly. The first and last paragraphs are each assigned a first weight, while all middle paragraphs receive a second weight equally. This means the total weight of all middle paragraphs is equal to the second weight, and the first weight is greater than the second weight. In one specific implementation, a ratio of 2:1 is used, meaning the first and last paragraphs each receive 25% of the weight, and all middle paragraphs receive the remaining 50% (this ratio range was determined based on extensive SEO experiments, ensuring the importance of the first and last paragraphs without excessively underestimating the importance of the middle paragraphs). The weighted sum formula is:

[0075] ,

[0076] Where M is the total number of paragraphs, which is greater than 3. and These are the semantic vector cosine similarities between the first and last paragraphs and the keywords entered by the user. The semantic vector cosine similarity between the i-th paragraph (from the 2nd to the (M-1)th paragraph, excluding the beginning and end) and the keywords entered by the user is calculated. A total weight of 0.5 for each of the middle paragraphs is evenly distributed across the M-2 middle paragraphs. This score ranges from 0 to 1, and multiplying it by 100 yields a percentage score. This positional weighting strategy fully considers the importance search engines place on the beginning and end of the article, and compared to a simple full-text average, it better reflects the true SEO effect.

[0077] S52: When the score is lower than the preset threshold, calculate the semantic gap vector and retrieve the completion content from the vector database.

[0078] If the semantic relevance score is lower than a preset threshold (e.g., 0.7 or 70), the system automatically triggers semantic completion. First, the semantic gap vector V is calculated. gap The formula is:

[0079]

[0080] in, This represents the topic semantic vector after the user-input keywords are encoded by Sentence-BERT, where M is the total number of paragraphs in the initial content, and w i Let i be the weight of the i-th segment. Let V be the semantic vector of the i-th paragraph. This semantic gap vector V gap This points to directions in the semantic meaning of the topic that are not covered by existing paragraphs, and is used to subsequently retrieve the most similar text fragments from the vector database for completion. Then, the system uses V... gap For the query vector, an approximate nearest neighbor search is performed in the Milvus vector database. This database pre-stores semantic vectors of massive amounts of high-quality domain-specific text fragments, and the retrieval yields vectors related to V. gap The K most similar candidate contents (e.g., Top-3).

[0081] S53: Insert the retrieved completed content into the paragraph position in the initial content that has the highest relevance to the semantic gap vector to obtain the target content.

[0082] Since semantic gap vectors point to uncovered directions within the topic, paragraphs with higher relevance to the gap vector require more information in that direction. Therefore, inserting the completed content into this position achieves the most efficient semantic completion. After insertion, the semantic relevance score can be recalculated; if it still doesn't meet the standard, the completion process is repeated until the requirements are met. By locating the missing topic dimension through vector subtraction and then accurately retrieving supplementary material from an external knowledge base using vector retrieval, a closed loop of "generation as optimization" is achieved. Compared to traditional manual rewriting or simple regeneration, this method boasts a high degree of automation, a clear objective, and significant efficiency.

[0083] Example 2

[0084] As another preferred embodiment, the system of this application adopts a progressive completion strategy based on dual threshold triggering to balance content quality and modification costs. Specifically, a lower first threshold L and a higher second threshold H are set, where L < H. The first threshold L and the second threshold H are set based on statistical analysis of a large amount of SEO experimental data. Both are thresholds for semantic relevance scores, such as 0.8 times and 1.2 times the historical average score, or empirical values ​​set according to user requirements for content quality, such as 0.6 and 0.8. When the semantic relevance score is lower than L, global completion is triggered, that is, the complete completion process described in S52 to S53 above is executed: calculating the semantic gap vector, retrieving the most similar content in the vector database, and inserting it into the paragraph position with the highest relevance to the semantic gap vector. When the semantic relevance score is greater than or equal to L and less than H, the system performs targeted micro-completion: first, for the semantic gap vector V... gap Dimensional decomposition: Specifically, the system predefines a set of semantic topic vectors T1, T2, ..., T3, each topic vector corresponding to an interpretable semantic direction (e.g., "technical principles, application scenarios, market data, competitive analysis", etc.), and its vector representation can be obtained in advance through any of the following methods: (1) extract topic-word distribution from the domain corpus using Latent Dirichlet Allocation (LDA), and then obtain topic vectors by word embedding weighted average; (2) domain experts define a set of representative keywords for each topic direction (e.g., "algorithm, model, training, inference" corresponds to "technical principles"), use word embedding model to obtain word vectors for each keyword, and calculate weighted average using equal weight or TF-IDF weight, and then obtain topic vectors by L2 normalization. The set of topic direction vectors can be dynamically adjusted or filtered according to the semantics of the keywords input by the user, retaining only those related to V. theme Topic directions with cosine similarity higher than a set threshold are selected to avoid introducing irrelevant topics. Then, the projection component value of the semantic gap vector onto each topic vector is calculated: pj = V gap ·T j (j=1,2,...n), where "·" represents the dot product of vectors. The top K thematic directions with the largest absolute values ​​(pj > 0) are extracted for supplementation; the larger the value, the higher the degree of semantic missingness in that thematic direction. Finally, the top K dimensions with the largest absolute values ​​(K can be preset to 3) are extracted. These dimensions represent the most missing and need-to-be-supplemented thematic directions in the current content, denoted as T. j To query the vector, perform an approximate nearest neighbor search in the vector database to obtain the vector with respect to T. j The most similar candidate completion content (e.g., Top-1 or Top-2); calculate the vector of each paragraph in the initial content and T. jThe cosine similarity is used to select the paragraph with the highest similarity as the insertion point (i.e., the paragraph most relevant to the missing topic, and the most natural and coherent way to add content nearby). The retrieved completed content is then inserted after this paragraph to form the updated initial content. Targeted micro-completion can accurately supplement the most lacking topic information, avoiding excessive modification of the entire text.

[0085] Example 3

[0086] After obtaining the initial or target content through steps S1 to S5, as another preferred implementation, this method can also perform an originality detection process. This process reuses the Sentence-BERT semantic encoder built in S51 to avoid redundant calculations. Specifically, each paragraph of the content to be detected is encoded into a semantic vector, and cosine similarity is calculated with each document vector in a pre-established existing document vector library (including publicly available Internet documents, website historical articles, etc.). The maximum similarity value of each paragraph is taken as the originality score of that paragraph. A preset originality threshold is set. When the similarity score of a paragraph is higher than the threshold, the system determines that the paragraph has a plagiarism risk. At this time, the system automatically triggers a rewriting sub-process: First, the context of the paragraph (one paragraph before and one paragraph before) is extracted as a semantic reference; then, the keywords input by the user, the context of the paragraph, and an instruction (such as "please rewrite in a different way") are concatenated into a new prompt word, which is then re-input into the large language model to generate a replacement paragraph. Finally, the system replaces the original paragraph with the newly generated paragraph and repeats the above similarity detection until the similarity scores of all paragraphs are lower than the threshold. Simultaneously, the system uses the originality similarity score of the paragraph as a weighting factor to dynamically adjust the semantic relevance score calculated in S51. For example, the new score = original score × (1 - 0.2 × similarity score), causing highly similar content to be automatically downgraded in subsequent evaluations. For instance, when the similarity score = 0 (completely original), the new score = original score × 1, with no penalty; when the similarity score = 0.5 (moderate similarity), the new score = original score × (1 - 0.1) = original score × 0.9, with a mild penalty. The coefficient 0.2 is an empirical balance value that determines the sensitivity of the penalty. A value that is too large may lead to a significant drop in score even for low similarity (e.g., 0.3), while a value that is too small will not adequately penalize highly similar content. A typical value range is 0.15 to 0.25. This mechanism ensures that the final output content has high originality, thereby avoiding search engine penalties for duplicate content and ensuring the goal of generating high-quality, SEO-compliant content.

[0087] Example 4

[0088] After the target content is published on the website, the system in this embodiment of the invention can also periodically retrieve data such as page ranking, click-through rate, and user dwell time through search engine monitoring APIs (such as Google Search Console). This data serves as reward signals for reinforcement learning. Specifically, the Proximal Policy Optimization (PPO) algorithm is used to optimize the constraint parameters (e.g., keyword density thresholds of 2.5% and 1.5%, and position set) in the structured prompts. The input to the PPO algorithm is the current constraint parameters and the reward signal composed of ranking changes, click-through rate, and dwell time; the output is the optimized constraint parameters. For example, the reward function is designed as: R = Δranking × a + ΔCTR × b +Δdwell time × c - operation cost, where Δrank is the number of digits the ranking improves, ΔCTR is the percentage increase in click-through rate, Δdwell time is the number of seconds the dwell time increases, operation cost is the cost of triggering a rewrite or parameter adjustment, and a, b, and c are preset weight coefficients. In one embodiment, a=10, b=15, and c=1.5. Those skilled in the art can adjust these values ​​according to actual business needs and the typical range of changes in various indicators. For example, a can be 5-20, b can be 10-30, and c can be 0.5-3. The state is set as: the current constraint parameter vector, including the main keyword density threshold (current value), the related word density threshold, and the satisfaction status of the position set (0 / 1 encoding). The action is set as: discrete adjustment of each constraint parameter, such as: increasing the main keyword density by 0.2%, decreasing it by 0.2%, or keeping it unchanged; the same applies to the related word density; adding a forced position or deleting a forced position from the position set. A two-layer fully connected network (64 neurons in each hidden layer) is used, with a pruning parameter of 0.2, a discount factor of 0.99, and a learning rate of 3×10. -4 Simultaneously, a Deep Q-Network (DQN) is employed to optimize content generation parameters (article length, keyword density, number of images, number of internal links). The DQN algorithm takes the current state vector (including ranking, CTR, bounce rate, and competitor data) as input and outputs the Q-value of each action. The system selects the action with the highest Q-value as the adjustment instruction for the content generation parameters. The DQN state space includes: current ranking, CTR, bounce rate, and competitor data (such as average ranking of peers, average word count, etc.); the action space includes discrete adjustment values ​​for the parameters, such as article length +500 words, keyword density +0.5%, etc. Hyperparameters: experience replay pool capacity 2000, batch size 32, target network update frequency 100 steps, learning rate 1×10⁻⁶. -3Network structure: The input layer size is equal to the state dimension (e.g., 8-dimensional), with two fully connected hidden layers (128 and 64 neurons respectively), and the output layer size is equal to the action space size. After training, the optimized constraint parameters are used as constraint parameters in the next content generation, and the optimized content generation parameters are used as the default configuration parameters for generating initial content in the next generation. This forms a closed loop of "generation—publishing—monitoring—optimization—regeneration," enabling the system's content generation strategy to continuously evolve based on real feedback, thus solving the deficiency in existing technologies that cannot dynamically adjust generation parameters based on ranking feedback.

[0089] Example 5

[0090] As a preferred implementation method with the highest semantic gap vector relevance, the system may optionally perform a content type identification step before or after content generation. First, a fine-tuned BERT multi-label classifier is loaded. This classifier has been trained on a large-scale corpus labeled with content types (such as product descriptions, user guides, etc.). Product descriptions are explanatory texts used to introduce product functions, specifications, advantages, usage scenarios, and user value, commonly found on e-commerce detail pages, product introduction pages, or promotional materials. Their characteristics include highlighting product selling points, including key parameters, and having marketing intent. User guides are step-by-step texts used to instruct users on specific operations or tasks, commonly found in software help documents, device user manuals, tutorials, etc. Their characteristics include clear structure, containing ordered steps (such as step one, step two), and emphasizing operability. The system inputs the beginning (or the entirety) of the initial or target content into the classifier, and the model outputs a type label and a corresponding semantic feature vector (e.g., the CLS vector of the last layer of BERT). Subsequently, the system calculates the constraint parameter values ​​suitable for the content type based on this semantic feature vector using a preset mapping function. Mapping functions are used to convert semantic feature vectors corresponding to content types into specific constraint parameter values.

[0091] In one specific embodiment, the mapping function adopts a linear weighted form: Keyword density threshold = Baseline density × (1 + α × First type coefficient). The baseline density is derived from historical best content data statistics, for example, set to 2.5% for the main keyword (corresponding to the target article length ratio). α is an adjustment factor, ranging from 0 to 1, which can be determined through offline experiments, for example, α = 0.3. The first type coefficient is assigned according to the content type: +0.4 for product description (increasing keyword density), -0.3 for operation guide (decreasing keyword density), and 0 for ordinary article. For the weight allocation value of the middle paragraph, the mapping function is: Middle paragraph weight ratio = Baseline middle weight × (1 + β × Second type coefficient), where the baseline middle weight is 50% (corresponding to 25% for the first and last paragraphs), β is an adjustment factor, and the second type coefficient is -0.2 for product description (decreasing middle weight) and 0 for operation guide (remaining unchanged). The parameters in the above mapping function (baseline density, α, β, type coefficient) can be obtained by performing grid search or regression analysis on representative samples to ensure that the output parameters can optimize the SEO effect of the generated content. Those skilled in the art will understand that the mapping function can also take other forms, such as those based on decision trees or simple lookup tables, which can output corresponding parameter values ​​as long as a semantic feature vector is input, all of which fall within the scope of protection of this application. For example, for product description types, the mapping function outputs a higher keyword density threshold (e.g., 3%) and adjusts the paragraph position weight distribution to: 30% for the first paragraph, 30% for the last paragraph, and 40% for the middle paragraphs (i.e., relatively reducing the weight of the middle paragraphs); for operation guide types, the mapping function outputs a lower keyword density threshold (e.g., 1.5%) and keeps the weight of the middle paragraphs unchanged (i.e., 25% for the first paragraph, 25% for the last paragraph, and 50% for the middle paragraphs). The system automatically replaces or weights and integrates the parameter values ​​output by the mapping function into the original constraint parameters for subsequent content generation or regeneration. This mechanism realizes "content type-aware SEO parameter adaptation," enabling content in different scenarios to automatically adopt the most suitable SEO strategy, further improving the ranking potential of the generated content in search engines.

[0092] Example 6

[0093] Reference Figure 4 As shown, corresponding to Embodiment 1 above, this disclosure also provides a content generation system, including the following modules:

[0094] The acquisition module 101 is configured to acquire the keywords and target article length input by the user, and its output is connected to the input of the keyword processing module.

[0095] The keyword processing module 102 is configured to perform semantic expansion of the keywords input by the user and extract long-tail keywords to obtain an expanded keyword set. Its output is connected to the input of the constraint parameter calculation module.

[0096] The constraint parameter calculation module 103 is configured to determine constraint parameters based on the target article length. The constraint parameters include the frequency of occurrence of each keyword in the expanded keyword set according to a preset ratio, and the set of positions where the user-input keywords must appear. Its output is connected to the input of the prompt word assembly and generation module.

[0097] The prompt word assembly and generation module 104 is configured to dynamically assemble the constraint parameters, preset role definitions, style requirements, and the expanded keyword set into structured prompt words, input them into the large language model 105 to generate initial content, and the output of the large language model 105 is connected to the input of the semantic scoring and completion module.

[0098] The semantic scoring and completion module 106 is configured to calculate the semantic relevance score between the initial content and the keywords input by the user. When the semantic relevance score is lower than a preset threshold, the initial content is semantically completed to obtain the target content. The semantic completion includes calculating a semantic gap vector and retrieving the completed content from a vector database.

[0099] Each of the above modules executes steps S1 to S5 in the method embodiment, and their specific implementation methods, data transmission relationships, and working principles are described in the corresponding descriptions in the method embodiment, and will not be repeated here. Each module of this system can be implemented in software, hardware, or a combination of both, and deployed in a website content management system to achieve efficient, intelligent, and SEO-optimized automatic content generation.

[0100] Combination Figure 5 As shown, this disclosure also provides a content generation electronic device, including a processor 800 and a memory 801. Optionally, the device may further include a communication interface 802 and a bus 803. The processor 800, communication interface 802, and memory 801 can communicate with each other via the bus 803. The communication interface 802 can be used for information transmission. The processor 800 can call logical instructions in the memory 801 to execute the content generation method of the above embodiments.

[0101] Furthermore, the logic instructions in the aforementioned memory 801 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium.

[0102] The memory 801, as a computer-readable storage medium, can be used to store software programs and computer-executable programs, such as program instructions / modules corresponding to the methods in the embodiments of this disclosure. The processor 800 executes functional applications and data processing by running the program instructions / modules stored in the memory 801, that is, it implements the content generation method in the above embodiments.

[0103] The memory 801 may include a program storage area and a data storage area. The program storage area may store the operating system and application programs required for at least one function; the data storage area may store data created based on the use of the terminal device. Furthermore, the memory 801 may include high-speed random access memory and may also include non-volatile memory.

[0104] The foregoing description and accompanying drawings fully illustrate embodiments of the present disclosure to enable those skilled in the art to practice them. Other embodiments may include structural, logical, electrical, procedural, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the order of operation may vary. Parts and features of some embodiments may be included in or replace parts and features of other embodiments. Moreover, the terminology used in the embodiments of this disclosure is for descriptive purposes only and is not intended to limit the claims. As used in the description of the embodiments and claims, the singular forms “a,” “an,” and “the” are intended to equally include the plural forms unless the context clearly indicates otherwise. Similarly, the term “and / or” as used in the embodiments of this disclosure refers to any and all possible combinations of one or more of the associated listed elements. Additionally, when used in embodiments of this disclosure, the term "comprise" and its variations "comprises" and / or "comprising" refer to the presence of stated features, integrals, steps, operations, elements, and / or components, but do not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components, and / or groups thereof. Without further limitations, an element defined by the phrase "comprises a..." does not exclude the presence of other identical elements in the process, method, or apparatus that includes said element. In this document, each embodiment may focus on the differences from other embodiments, and similar or identical parts between embodiments can be referred to mutually. For methods, products, etc., disclosed in the embodiments, if they correspond to the method section disclosed in the embodiments, then the relevant parts can be referred to the description of the method section.

[0105] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of this disclosure. Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.

Claims

1. A content generation method, applied to a website content management system, characterized in that, include: Obtain user-input keywords, target article length, role definition, and style requirements; Based on the keywords input by the user, semantic expansion of the keywords is performed and long-tail keywords are extracted to obtain an expanded set of keywords; The constraint parameters are determined based on the target article length. The constraint parameters include setting the frequency of occurrence of each keyword in the expanded keyword set according to a preset ratio, and the set of positions where the user-input keywords must appear. The constraint parameters, role definitions, style requirements, and the expanded keyword set are dynamically assembled into structured prompt words, which are then input into a large language model to generate initial content. Calculate the semantic relevance score between the initial content and the keywords input by the user. When the semantic relevance score is lower than a preset threshold, perform semantic completion on the initial content to obtain the target content.

2. The method according to claim 1, characterized in that, The dynamic assembly of the constraint parameters, role definitions, style requirements, and the expanded keyword set into structured prompts includes: Following a pre-defined multi-level template structure, the constraint parameters, role definitions, style requirements, and expanded keyword set are filled into the corresponding level positions, generating a four-layer structured prompt consisting of a constraint layer, a role layer, a style layer, and a content layer arranged in sequence; wherein, The constraint layer is used to embed the constraint parameters into the structured prompt words in the form of key-value pairs; The role layer is used to define the writing identity and professional knowledge background of the generated content; The style layer is used to define the tone, formality, and target audience of the initial content; The content layer is used to provide the expanded set of keywords as material for generating content.

3. The method according to claim 1, characterized in that, The process of semantically expanding the keywords based on user input and extracting long-tail keywords results in an expanded keyword set including: The set of semantically similar words for the keywords input by the user is calculated based on the word embedding model; Based on a statistical model, a set of long-tail keywords with the highest co-occurrence frequency with the keywords input by the user is extracted from an industry corpus. The user-input keywords, the semantically similar word set, and the long-tail keyword set are merged to obtain the expanded keyword set.

4. The method according to claim 1, characterized in that, The calculation of the semantic relevance score between the initial content and the keywords input by the user includes: The semantic encoder encodes the keywords input by the user and each paragraph of the initial content into semantic vectors. The cosine similarity between each paragraph vector and the semantic vector of the keywords input by the user is calculated. The vectors are then weighted and summed based on different weights assigned to the paragraph positions to obtain the semantic relevance score. The position set includes the first paragraph, H1 label, H2 label, and the last paragraph. The weighting based on paragraph position includes: the first paragraph and the last paragraph are each assigned a first weight, and the middle paragraphs are evenly assigned a second weight.

5. The method according to claim 4, characterized in that, The semantic completion of the initial content includes: Calculate a semantic gap vector, which is equal to the semantic vector of the keyword input by the user minus the weighted sum of the semantic vectors of each paragraph of the initial content and the paragraph weights, where the sum of the paragraph weights is 1; use the semantic gap vector to perform a similarity search in the vector database, and insert the retrieved completed content into the paragraph position in the initial content that is most relevant to the semantic gap vector.

6. The method according to claim 4, characterized in that, The semantic completion of the initial content includes: Obtain a first threshold and a second threshold, wherein the first threshold is less than the second threshold, and both the first threshold and the second threshold are thresholds of the semantic relevance score; When the semantic relevance score is lower than the first threshold, global completion is performed, including: calculating a semantic gap vector, using the semantic gap vector to perform a similarity search in a vector database, and inserting the retrieved completion content into the paragraph position in the initial content that is most relevant to the semantic gap vector; When the semantic relevance score is greater than or equal to the first threshold and less than the second threshold, perform micro-completion, including: decomposing the semantic gap vector into components in multiple preset semantic topic directions, extracting the top K topic directions with the largest absolute values, retrieving the completion content from the vector database using the topic direction as the query vector, and inserting it into the paragraph position with the highest relevance to each topic direction.

7. The method according to any one of claims 3 to 6, characterized in that, The method further includes: After publication, the target content will be monitored for search engine ranking. The constraint parameters in the structured prompts are optimized by reinforcement learning using a near-end strategy optimization algorithm. A reward function is calculated based on a preset weight coefficient, which is used to balance the contribution of ranking changes, click-through rate changes, and dwell time changes to the reward value. The content generation parameters are optimized using a deep Q-network algorithm, including article length, keyword density, number of images, and number of internal links. The optimized constraint parameters will be used as constraint parameters in the next content generation, and the optimized content generation parameters will be used as configuration parameters when generating initial content in the next content generation.

8. The method according to claim 7, characterized in that, The method further includes: The fine-tuned BERT multi-label classifier is used to identify the content type of the initial content or the target content, and the semantic feature vector corresponding to the content type is extracted. Based on the semantic feature vector, the keyword density threshold in the constraint parameters and the weight allocation value in assigning different weights based on paragraph position are calculated through a preset mapping function. Specifically, for product description types, the mapping function outputs a higher keyword density threshold and a lower weight allocation value for the middle paragraphs; for operation guide types, the mapping function outputs a lower keyword density threshold and maintains the weight allocation value of the middle paragraphs unchanged.

9. A content generation system, applied to a website content management system, characterized in that, include: The acquisition module is configured to acquire user-input keywords, target article length, role definition, and style requirements. The keyword processing module is configured to perform semantic expansion of the keywords input by the user and extract long-tail keywords to obtain an expanded keyword set; The constraint parameter calculation module is configured to determine constraint parameters based on the target article length. The constraint parameters include the frequency of occurrence of each keyword in the expanded keyword set according to a preset ratio, and the set of positions where the user-input keywords must appear. The prompt word assembly and generation module is configured to dynamically assemble the constraint parameters, role definitions, style requirements, and the expanded keyword set into structured prompt words, which are then input into a large language model to generate initial content. The semantic scoring and completion module is configured to calculate the semantic relevance score between the initial content and the keywords input by the user, and when the semantic relevance score is lower than a preset threshold, perform semantic completion on the initial content to obtain the target content.

10. An electronic device, comprising: A processor, a memory, and a computer program stored in the memory, wherein the processor, when executing the computer program, implements the content generation method as described in any one of claims 1 to 9.