Text processing method and system based on artificial intelligence generated content
By combining pre-trained language model and hybrid expert model with adversarial style migration network, the logical fault and control accuracy problems of text generation in the existing technology are solved, and efficient and logically rigorous text generation is achieved. It is suitable for scenarios such as news writing and scientific and technological reports that strictly follow factual basis, and supports rapid customized content generation in multiple scenarios.
Patent Information
- Application Number
- CN202510495626.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-21
- Publication Date
- 2025-08-19
AI Technical Summary
The existing text generation methods based on artificial intelligence are prone to logical faults, theme deviations, and factual errors, making it difficult to accurately control the style and emotional intensity. The multi-model cascade architecture leads to high video memory usage and large response delays.
The pre-trained language model is used to extract semantic vectors, combine TF-TDF weights and exponential functions to calculate keyword weights, and generate style coded vectors and environmental constraint mask matrices through comparative learning. Multi-level optimization is used to use a hybrid expert model and an adversarial style transfer network, and combine dependent syntax analysis and adversarial training to generate high-quality text.
It realizes text generation with rigorous logic and consistent themes, accurately controls text style and emotions, reduces calculation redundancy, improves response efficiency, and is suitable for multi-scene applications.
Smart Images

Figure CN120508628A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of text processing, and specifically relates to a text processing method and system based on artificial intelligence content generation. Background Art
[0002] Artificial intelligence (AI) is the study of how computers can simulate certain human thought processes and intelligent behaviors (such as learning, reasoning, thinking, and planning). It encompasses both hardware and software technologies. AI hardware technologies generally include sensors, specialized AI chips, cloud computing, distributed storage, and big data processing. AI software technologies primarily encompass computer vision, speech recognition, natural language processing, machine learning / deep learning, big data processing, and knowledge graphs.
[0003] Currently, a variety of AI-based content generation methods have been proposed and applied, such as text generation methods based on recurrent neural networks (RNNs) and natural language generation methods based on transformer models. While these methods have improved the efficiency and quality of text generation to a certain extent, they still face several challenges. These include an inability to effectively understand the intent and emotions of user conversations, an inability to effectively recognize multiple types of conversations, and a lack of effective content verification and correction mechanisms, particularly for image data. Furthermore, content generation often relies too heavily on a single model, which can easily lead to ineffective content generation due to local flaws. Summary of the Invention
[0004] In response to the above-mentioned prior art, the purpose of the present invention is to provide a more stable text processing method and system based on artificial intelligence-generated content. This method aims to address the following issues: 1. Text generated by traditional methods is prone to logical discontinuities, thematic deviations, or factual errors. 2. It is difficult to accurately control the style, emotional intensity, and other attributes of the generated text. 3. Traditional methods use independent modules to process the generated results, resulting in semantic loss and style degradation. 4. The multi-model cascade architecture results in high video memory usage and large response delays.
[0005] In a first aspect, the present application provides a text processing method based on artificial intelligence-generated content, which is used to process text content input by a user, including:
[0006] receiving input text, wherein the text includes semantic constraints, style parameters, and environmental constraints;
[0007] Extracting semantic vectors of keywords in the semantic constraint using a pre-trained language model, and calculating weight coefficients of the keywords in the text based on TF-TDF weights and an exponential function;
[0008] Generating a style encoding vector from the style parameters through contrastive learning, and converting the environment constraints into an environment constraint mask matrix;
[0009] Initializing and generating an initial reply text using a hybrid expert model based on the weight coefficients of the keywords, the style encoding vector, and the environmental constraint mask matrix;
[0010] The initial reply text is first-level optimized according to dependency syntax, and then second-level optimized according to an adversarial style transfer network to obtain generated content.
[0011] Preferably, the method of extracting the semantic vector of the keyword in the semantic constraint by using a pre-trained language model and calculating the weight coefficient of the keyword in the text based on the TF-TDF weight and exponential function includes: extracting the semantic vector E of the keyword in the semantic constraint by using a pre-trained language model BERT (w k ), and then calculate the keyword weight coefficient. The calculation formula is as follows:
[0012]
[0013] Among them, α k Represents the keyword weight coefficient, TF and TDF represent term frequency and inverse document frequency respectively, and are calculated as follows:
[0014]
[0015] exp represents the exponential function, which is mathematically defined as exp(x) = e x ;β represents the importance coefficient, w k and w i Represent different words respectively;
[0016] The semantic constraint matrix is obtained by weighted summation, and the calculation formula is as follows:
[0017]
[0018] Where n is an integer greater than 1, and the output format is Serves as a semantic guidance signal for downstream generation modules.
[0019] Preferably, the step of generating a style encoding vector from the style parameters through contrastive learning and converting the environmental constraints into an environmental constraint mask matrix comprises: generating a style encoding vector from the style parameters through contrastive learning, and calculating the formula as follows:
[0020]
[0021] Among them, v tis the embedding vector of the target style sample, which is generated by encoding the input sample through the style encoder.
[0022] v t =E s (T target )
[0023] Among them, E s is the style encoder, T target Reference text representing the target style;
[0024] τ is the learning parameter, v + is a positive sample of the same style, v - is a negative sample of different style, s(·) is the cosine similarity calculation function, and this vector is used to control the stylistic features (such as formality) and emotional expression intensity of the generated text;
[0025] Converting the environmental constraints into an environmental constraint mask matrix includes: marking paragraphs that exceed character limits by truncation, generating a replacement candidate word list for banned words, and injecting platform-specific expression habits.
[0026] Preferably, converting the environmental constraints into an environmental constraint mask matrix specifically includes:
[0027] Suppose the input text is a word sequence T = [w1, w2, ..., w N ], environmental constraints include: character limit L max , banned words list Platform rule set R;
[0028] Define the environment constraint mask matrix Γ(c e )∈{0,1} N×A , where A is the number of truncation, replacement, and injection operation categories;
[0029] Split the text into paragraphs {P m}, for those exceeding L max The paragraphs are truncated and marked. The mathematical expressions of paragraph segmentation function and truncation mask mark are:
[0030]
[0031] Among them, e m and s m Respectively represent paragraphs P m The starting word position index and the ending word position index, Γ i,1 Represents the i-th row and 1st column of the mask matrix, marking word w i whether it is retained or truncated;
[0032] For each Generate candidate word list The positions to be replaced are marked with masks. The mathematical expressions of the candidate word generation function and the replacement mask marks are:
[0033]
[0034] in, is the cosine similarity, δ is the similarity threshold, E(w i ) represents the word embedding model, and the replacement operation is
[0035]
[0036] Among them, w′ i Indicates the replaced word,
[0037] Detect the location where the platform-specific expression needs to be inserted and modify the mask mark; the mathematical expression keyword detection function is
[0038]
[0039] Among them, RegexMatch(w i ,r) represents the regular expression matching function, which detects whether the word wi conforms to the rule r;
[0040] For topic tag insertion, Insert the tag hashtag(w after position i i ), generate a new sequence T′;
[0041] Inject mask marks, expand the dimension of the mask matrix Γ to N′×A, add new position marks as 1, and generate the mask matrix
[0042] Γ extended =ExpandMask(Γ,insertPosition);
[0043] Among them, Γ extended Represents the expanded mask matrix, with the newly inserted positions marked as 1.
[0044] Preferably, the generating of the initial reply text by using the hybrid expert model based on the weight coefficient of the keyword, the style encoding vector and the environmental constraint factor includes:
[0045] The hybrid expert model is called to generate the initial text, and its mathematical expression is:
[0046]
[0047] Among them, g m is the generating function of the mth domain expert model, is the indicator function, which takes the value 1 when the expert m is activated and 0 otherwise; τ is the set of activated experts, which is dynamically selected by the gating function:
[0048]
[0049] Where σ(·) is the Top-k sparse activation function, θ is the adaptive threshold, Wg is the trainable gate weight matrix, and h t is the hidden state vector at the current moment, according to the real-time generated text hidden state h t Calculate the activation probability and prioritize calling domain experts that match the current style parameters.
[0050] Preferably, performing a first-level optimization on the initial reply text according to dependency syntax, and then performing a second-level optimization according to an adversarial style transfer network to obtain generated content, includes:
[0051] Detect logical conflicts based on dependency syntactic analysis trees and correct them by minimizing semantic deviations:
[0052]
[0053] Among them, Aij is the syntactic relation weight matrix (e.g., subject-predicate relation weight = 0.9, modification relation weight = 0.5), E(·) is the semantic encoder to ensure that the revised text maintains semantic coherence, and h i , h j Represents the hidden state vector of two words with dependency relationship in the sentence, and D(G) represents the dependency set in the dependency syntax tree of the generated text G;
[0054] Use the adversarial style transfer network to adjust the text style. Its loss function includes:
[0055]
[0056] Among them, E c E s Represents content editor and style editor, s target represents the target style vector, D represents the style discriminator, and αβ represents the style alignment weight and adversarial training weight.
[0057] Content preservation item (first item): Ensure that the core semantics of the text remains unchanged before and after optimization
[0058] Style alignment term (second term): forces the output text style vector to approach the target value
[0059] Adversarial training (third item): Improving text naturalness through discriminators
[0060] In the second aspect, the present application also provides a text processing system based on artificial intelligence to generate content, including
[0061] Acquisition module: used for receiving input text, wherein the text includes semantic constraints, style parameters, and environmental constraints;
[0062] Calculation module: used to extract the semantic vector of the keyword in the semantic constraint using a pre-trained language model, and calculate the weight coefficient of the keyword in the text based on the TF-TDF weight and exponential function;
[0063] Conversion module: used for generating a style encoding vector from the style parameters through contrastive learning, and converting the environment constraints into an environment constraint mask matrix;
[0064] Initial generation module: used to generate initial reply text by initializing based on the weight coefficient of the keyword, the style encoding vector and the environmental constraint mask matrix using a hybrid expert model;
[0065] Generation module: used to perform first-level optimization on the initial reply text based on dependency syntax, and then perform second-level optimization based on the adversarial style transfer network to obtain generated content.
[0066] Secondly,
[0067] Thirdly, to solve the above technical problems, the present application also provides a text processing device based on artificial intelligence to generate content, including:
[0068] memory for storing computer programs;
[0069] A processor is configured to direct a computer program to implement the steps of a text processing method for generating content based on artificial intelligence.
[0070] To solve the above technical problems, the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements all the steps of the above-mentioned text processing method based on artificial intelligence to generate content.
[0071] The beneficial effects of this application are as follows:
[0072] 1. This method innovatively constructs a dynamic semantic constraint matrix by integrating deep semantic understanding and statistical significance analysis, effectively solving the common problems of logical faults and topic deviations in traditional AI-generated content. Compared with existing technologies, the system can intelligently identify the core elements of the text and strengthen the expression of key information to ensure that the generated content is closely centered around the user-specified topic. Combining dependency syntax analysis with semantic relationship weight calibration technology, it can automatically correct logical errors such as unclear reference and time sequence contradictions, so that the generated text reaches professional writing standards in terms of factual accuracy and logical rigor. This full-process optimization mechanism based on semantic networks significantly improves the coherence of long text generation, and is particularly suitable for scenarios such as news writing and scientific reports that require strict adherence to factual basis.
[0073] 2. To address the coarse granularity and low precision of traditional methods in controlling dimensions like stylistic style and emotional expression, this method constructs a multi-level control system. The style encoding vector generated through comparative learning decouples independent control dimensions such as "stylistic type" and "emotional intensity," enabling the precise characterization of subtle stylistic features such as humor, irony, and formality. The dynamic routing mechanism of the hybrid expert model intelligently dispatches domain expert modules based on control signals, ensuring the standardization of terminology and professional expression in specialized fields such as medicine, law, and literature. This hierarchical control architecture enables even non-technical personnel to quickly generate customized content tailored to specific scenarios through intuitive parameter configuration.
[0074] 3. An innovative multi-stage optimization pipeline deeply couples modules such as syntax alignment, style transfer, and compliance review, overcoming the information attenuation challenge caused by traditional staged processing. The adversarial style transfer network employs a strategy combining content-preserving constraints with adversarial training to adjust the language style. This strategy avoids semantic distortion during style transfer while maintaining the natural flow of the text. Combined with an intelligent resource allocation mechanism, the system automatically identifies text complexity, performs lightweight processing on simple content, and initiates deep optimization for specialized literature, significantly improving overall operational efficiency while ensuring processing effectiveness.
[0075] 4. Through the collaborative innovation of sparse activation mechanisms and dynamic resource scheduling technology, this method has achieved breakthrough progress in computational efficiency. The hybrid expert model only activates submodules that are strongly related to the current task, significantly reducing redundant computations. The text complexity grading strategy adaptively matches the optimal processing flow through intelligent analysis of features such as grammatical structure and term density. This flexible architecture design enables the system to meet the real-time requirements of social media copywriting (millisecond-level response) while also supporting the refined processing needs of complex texts such as academic papers, providing a unified intelligent solution for multi-scenario applications. BRIEF DESCRIPTION OF THE DRAWINGS
[0076] In order to more clearly illustrate the embodiments of the present application, the following is a brief introduction to the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0077] Figure 1 A flowchart provided for this application;
[0078] Figure 2 This is the structural diagram provided for this application.
[0079] Figure 3 System equipment diagram provided for this application. DETAILED DESCRIPTION
[0080] As needed, detailed embodiments of the present invention are disclosed herein, but it should be understood that the disclosed embodiments are merely exemplary of the present invention, and the present invention may be implemented in different and alternative forms. The accompanying drawings are not necessarily drawn to scale, and certain features may be exaggerated or reduced to show the details of a particular component. Therefore, the specific structural and functional details disclosed herein should not be understood as having a limiting meaning, but merely as a representative basis to teach those skilled in the art to adopt the present invention differently. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without making creative work are within the scope of protection of the present invention.
[0081] BERT is a pre-trained language model proposed by Google that implements bidirectional contextual semantic understanding through the Transformer architecture. Its core feature is the ability to simultaneously consider contextual information on both the left and right sides of a word. Its role in this application: It is used to extract deep semantic features from a set of keywords input by the user. For example, when the input keywords are ["mobile phone", "battery life", "charging"]: BERT will analyze the relationship between words (such as the correlation between "battery life" and "charging") and output a context-related vector representation of each word (such as the semantic vector of "battery life" in the context of electronic devices).
[0082] like Figure 1 As shown, the present application provides a text processing method based on artificial intelligence generated content, which is used to process text content input by users, including:
[0083] S110, receiving input text, wherein the text includes semantic constraints, style parameters, and environmental constraints;
[0084] Receive input instruction set C=(c s , c t , c e}, where c sis a semantic constraint set, at least including a keyword set, a fact data table or a raw material text; c t is a style control parameter, including the style type (such as news / advertisement / poetry) and emotional tendency (such as positive / neutral / sarcastic) selected through a drop-down menu or tags; c e is an environmental context feature, including the character count limit of the target platform, a stop word list, and an industry term library.
[0085] S120. Extract the semantic vectors of the keywords in the semantic constraints using a pre-trained language model, and calculate the weight coefficient of the keywords in the text based on the TF-TDF weight and the exponential function;
[0086] The pre-trained language model is a BERT model. Use the BERT model to analyze the input content elements, extract the core entities and their relationships, and construct a semantic network graph; which constitutes the basic elements of the semantic constraint matrix Ψ(c s ). Compared with traditional word vectors (such as Word2Vec), the semantic representations generated by BERT can better handle polysemy (such as whether "apple" refers to a fruit or a brand), and improve the semantic accuracy of the generated text.
[0087] Extract the semantic vectors of the keywords in the semantic constraints using a pre-trained language model, and calculate the weight coefficient of the keywords in the text based on the TF-TDF weight and the exponential function, including: Extract the semantic vectors E BERT (w k ) of the keywords in the semantic constraints using a pre-trained language model, and then calculate the keyword weight coefficient. The calculation formula is as follows:
[0088]
[0089] where α k represents the keyword weight coefficient, TF and TDF represent the term frequency and inverse document frequency respectively. TF is the term frequency, which is used to measure the frequency of a word in a single document. IDF is the inverse document frequency, which is used to measure the importance of a word in the entire corpus (common words have a low score, rare words have a high score). For example, if the word "battery life" appears 5 times (TF = 0.1) in the input document, and this word appears less frequently in the corpus (IDF = 3.2), then its TF-IDF weight is 0.32, which is significantly higher than that of high-frequency words (such as the TF-IDF of "mobile phone" may be 0.08). Avoid common words (such as "of", "is") from overly influencing the semantic matrix, and ensure that core keywords (such as technical terms) obtain higher weights. The calculation methods are as follows:
[0090]
[0091] exp represents the exponential function, and its mathematical definition is exp(x) = ex ;β represents the importance coefficient, w k and w i Represent different words respectively. The exponential function is used to map real numbers to the positive domain and is often used for probability normalization. In this embodiment, it is used to calculate the keyword weight coefficient: exp(β·TF-IDF) is used to amplify the weight difference of important words, significantly widening the weight gap between important words and less important words. Softmax normalization is implemented by combining the sum of the denominator to ensure that the sum of all weight coefficients is 1.
[0092] The semantic constraint matrix is obtained by weighted summation, and the calculation formula is as follows:
[0093]
[0094] Where n is an integer greater than 1, and the output format is As a semantic guidance signal for downstream generation modules, this matrix characterizes the semantic distribution of core content elements.
[0095] S130: Generate a style encoding vector from the style parameters through contrastive learning, and convert the environmental constraints into an environmental constraint mask matrix. Based on the selected style parameters, match corresponding language feature templates (e.g., news style templates containing a "time + place + event" structure) from a pre-trained contrastive learning library. Convert the environmental constraints into executable filtering rules (e.g., automatically splitting long sentences to meet character limits).
[0096] The step of generating a style encoding vector from the style parameters through contrastive learning and converting the environmental constraints into an environmental constraint mask matrix includes: generating a style encoding vector from the style parameters through contrastive learning, and the calculation formula is:
[0097]
[0098] Among them, v t is the embedding vector of the target style sample, which is generated by encoding the input sample through the style encoder.
[0099] v t =E s (T target )
[0100] Among them, E s is the style encoder, T target Reference text representing the target style;
[0101] τ is the learning parameter, v + is a positive sample of the same style, v -is a negative sample of different style, s(·) is the cosine similarity calculation function, and this vector is used to control the stylistic features (such as formality) and emotional expression intensity of the generated text;
[0102] Converting the environmental constraints into an environmental constraint mask matrix includes: marking paragraphs that exceed character limits by truncation, generating a replacement candidate word list for banned words, and injecting platform-specific expression habits.
[0103] The converting the environmental constraints into an environmental constraint mask matrix specifically includes:
[0104] Suppose the input text is a word sequence T = [w1, w2, ..., w N ], environmental constraints include: character limit L max , banned words list Platform rule set R;
[0105] Define the environment constraint mask matrix Γ(c e )∈{0,1} N×A , where A is the number of truncation, replacement, and injection operation categories;
[0106] Split the text into paragraphs {P m}, for those exceeding L max The paragraphs are truncated and marked. The mathematical expressions of paragraph segmentation function and truncation mask mark are:
[0107]
[0108] Among them, e m and s m Respectively represent paragraphs P m The starting word position index and the ending word position index, Γ i,1 Represents the i-th row and 1st column of the mask matrix, marking word w i whether it is retained or truncated;
[0109] For each Generate candidate word list The positions to be replaced are marked with masks. The mathematical expressions of the candidate word generation function and the replacement mask marks are:
[0110]
[0111] in, is the cosine similarity, δ is the similarity threshold, E(w i ) represents the word embedding model, and the replacement operation is
[0112]
[0113] Among them, w′ i Indicates the replaced word,
[0114] Detect the location where the platform-specific expression needs to be inserted and modify the mask mark; the mathematical expression keyword detection function is
[0115]
[0116] Among them, RegexMatch(w i ,r) represents the regular expression matching function, which detects whether the word wi conforms to the rule r;
[0117] For topic tag insertion, Insert the tag hashtag(w after position i i ), generate a new sequence T′;
[0118] Inject mask marks, expand the dimension of the mask matrix Γ to N′×A, add new position marks as 1, and generate the mask matrix
[0119] Γ extended =ExpandMask(Γ,insertPosition);
[0120] Among them, Γ extended Represents the expanded mask matrix, with the newly inserted positions marked as 1.
[0121] S140, generating an initial reply text by using a hybrid expert model based on the weight coefficients of the keywords, the style encoding vector, and the environmental constraint mask matrix;
[0122] The hybrid expert model is called to generate the initial text, and its mathematical expression is:
[0123]
[0124] Among them, g m is the generating function of the mth domain expert model, is the indicator function, which takes the value 1 when the expert m is activated and 0 otherwise; τ is the set of activated experts, which is dynamically selected by the gating function:
[0125]
[0126] Where σ(·) is the Top-k sparse activation function, θ is the adaptive threshold, Wg is the trainable gate weight matrix, and h t is the hidden state vector at the current moment, according to the real-time generated text hidden state h t Calculate the activation probability and prioritize calling domain experts that match the current style parameters.
[0127] This step generates candidate text paragraphs based on the Transformer architecture and automatically activates fine-tuned models for the corresponding domain based on style parameters (for example, when selecting an expert model for advertising copywriting, a preset marketing script library is prioritized). This approach dynamically selects expert models through a gating function combined with reinforcement learning gradients, rather than a fixed routing strategy (such as the static Top-k approach in the Switch Transformer). Furthermore, sub-models in various domains (such as news and social media experts) can share the parameters of the base generator, addressing the parameter redundancy issue in traditional MoE models.
[0128] S150: Perform a first-level optimization on the initial reply text based on dependency syntax, and then perform a second-level optimization based on the adversarial style transfer network to obtain generated content. Detect logical conflicts based on the dependency syntax analysis tree and correct them by minimizing semantic deviation:
[0129]
[0130] Among them, Aij is the syntactic relation weight matrix (e.g., subject-predicate relation weight = 0.9, modification relation weight = 0.5), E(·) is the semantic encoder to ensure that the revised text maintains semantic coherence, and h i , h j Represents the hidden state vector of two words with dependency relationship in the sentence, and D(G) represents the dependency set in the dependency syntax tree of the generated text G;
[0131] Use the adversarial style transfer network to adjust the text style. Its loss function includes:
[0132]
[0133] Among them, E c E s Represents content editor and style editor, s target represents the target style vector, D represents the style discriminator, and αβ represents the style alignment weight and adversarial training weight.
[0134] This step includes the content preservation item (item 1): ensuring that the core semantics of the text remain unchanged before and after optimization. The style alignment item (item 2): forcing the output text style vector to approach the target value. The adversarial training item (item 3): improving the naturalness of the text through the discriminator. Detect and repair reference errors and temporal inconsistencies through the dependency syntactic analysis tree, such as correcting "It ran out of power after turning on the phone" to "After turning on the phone, I found that the device was out of power." Then use the adversarial training network to adjust the vocabulary selection to ensure that it conforms to the target style, such as strengthening "This product is great" to "This product has excellent performance after actual testing" (formal style scenario). Finally, automatically replace banned words and add legal statement footnotes. Deeply coupling dynamic feature construction (preprocessing), hybrid expert generation (core generation), and multi-granularity post-processing (optimization) is different from the traditional separate design. Existing technologies mostly use single model generation or simple cascade structure, and do not realize the closed-loop feedback of feature-generation-optimization.
[0135] For example, in e-commerce ad generation, a product image (containing the text "Waterproof Bluetooth Headphones IPX8") is input, and the user voice command is: "Create a TikTok ad that appeals to young people." The processing process involves image parsing, optical character recognition (OCR), and extraction of "Waterproof Bluetooth Headphones IPX8" as the core selling point. Visual analysis, using the colorful lighting design, infers that the target audience is teenagers. Next, voice recognition is performed, followed by text conversion: "TikTok ad that appeals to young people." Style parameters are set to "internet buzzwords + strong interactivity." Environmental constraints are implemented by incorporating TikTok platform rules (hashtags, @challenge). Next, constraint fusion is performed: a semantic constraint matrix is created: ["waterproof," "Bluetooth 5.3," "24-hour battery life"]. A style control vector is created: comparative learning is used to match "Gen Z marketing language." Environmental adaptation is performed: the copy length is ≤ 50 characters, and the hashtag #outdoorartifact is automatically added. The final output is: "Working out in the rain? The music never stops! IPX8 waterproof headphones; 24 hours of ultra-long battery life, you can't throw them away! #sportsessential #waterproofblacktech @goodthingchallenge."
[0136] like Figure 2 As shown, this embodiment provides a text processing system based on artificial intelligence content generation, including:
[0137] Acquisition module 10: for receiving input text, wherein the text includes semantic constraints, style parameters, and environmental constraints;
[0138] Calculation module 20: used to extract the semantic vectors of the keywords in the semantic constraint using a pre-trained language model, and calculate the weight coefficients of the keywords in the text based on the TF-TDF weight and exponential function;
[0139] Conversion module 30: used to generate a style encoding vector from the style parameters through contrastive learning, and convert the environmental constraints into an environmental constraint mask matrix;
[0140] Initial generation module 40: configured to generate an initial reply text by initializing the initial reply text based on the weight coefficients of the keywords, the style encoding vector and the environmental constraint mask matrix using a hybrid expert model;
[0141] Generation module 50: used to perform a first-level optimization on the initial reply text according to dependency syntax, and then perform a second-level optimization according to an adversarial style transfer network to obtain generated content.
[0142] like Figure 3 As shown, a text processing device for generating content based on artificial intelligence includes:
[0143] Memory 30, for storing computer programs;
[0144] The processor 31 is configured to implement the steps of the text processing method based on artificial intelligence content generation as mentioned in the above embodiment when executing the computer program.
[0145] The text processing device provided in this embodiment that generates content based on artificial intelligence may include but is not limited to a smartphone, a tablet computer, a laptop computer, or a desktop computer.
[0146] Among them, the processor 31 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 31 can be implemented in at least one hardware form of digital signal processing (DSP), field-programmable gate array (FPGA), and programmable logic array (PLA). The processor 31 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a central processing unit (CPU); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 31 may be integrated with a graphics processing unit (GPU), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 31 may also include an artificial intelligence (AI) processor, which is used to process computing operations related to machine learning.
[0147] The memory 30 may include one or more computer-readable storage media, which may be non-transitory. The memory 30 may also include high-speed random access memory, and non-volatile memory, such as one or more disk storage devices, flash memory storage devices. In this embodiment, the memory 30 is at least used to store the following computer program, wherein, after the computer program is loaded and executed by the processor 31, it can implement the relevant steps of the text processing method based on artificial intelligence-generated content disclosed in any of the aforementioned embodiments. In addition, the resources stored in the memory 30 may also include an operating system and data, etc., and the storage method may be temporary storage or permanent storage. Among them, the operating system may include Windows, Unix, Linux, etc. The data may include but is not limited to the text processing method based on artificial intelligence-generated content, etc.
[0148] In some embodiments, the text processing device for generating content based on artificial intelligence may also include a display screen, an input and output interface, a communication interface, a power supply, and a communication bus.
[0149] Those skilled in the art will understand that Figure 3 The structure shown in the figure does not constitute a limitation on the text processing device for generating content based on artificial intelligence, and may include more or fewer components than those shown in the figure.
[0150] The text processing device for generating content based on artificial intelligence provided in an embodiment of the present application includes a memory 30 and a processor 31. When the processor 31 executes the program stored in the memory 30, it can implement a text processing method for generating content based on artificial intelligence.
[0151] Finally, the present application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above method embodiment.
[0152] It is understandable that if the method in the above embodiment is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium and executes all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory), ROM, random access memory (Random Access Memory, RAM), disk or optical disk, and other media that can store program code.
[0153] The above is a detailed introduction to the text processing method, device, equipment and medium for generating content based on artificial intelligence provided by the present application. The various embodiments in the specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same and similar parts between the embodiments can be referred to each other. For the device disclosed in the embodiment, since it corresponds to the method disclosed in the embodiment, the description is relatively simple, and the relevant parts can be referred to the method part description. It should be pointed out that for ordinary technicians in this technical field, without departing from the principles of this application, several improvements and modifications can be made to the present application, and these improvements and modifications also fall within the scope of protection of the claims of this application.
[0154] It should also be noted that, in this specification, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or apparatus comprising the element.
Claims
1. A text processing method based on artificial intelligence to generate content, used to process text content input by users, characterized in that: include: receiving input text, wherein the text includes semantic constraints, style parameters, and environmental constraints; Extracting semantic vectors of keywords in the semantic constraint using a pre-trained language model, and calculating weight coefficients of the keywords in the text based on TF-TDF weights and an exponential function; Generating a style encoding vector from the style parameters through contrastive learning, and converting the environment constraints into an environment constraint mask matrix; Initializing and generating an initial reply text using a hybrid expert model based on the weight coefficients of the keywords, the style encoding vector, and the environmental constraint mask matrix; The initial reply text is first-level optimized according to dependency syntax, and then second-level optimized according to an adversarial style transfer network to obtain generated content.
2. The text processing method based on artificial intelligence content generation according to claim 1 is characterized in that: The method uses a pre-trained language model to extract the semantic vector of the keyword in the semantic constraint, and calculates the weight coefficient of the keyword in the text based on the TF-TDF weight and exponential function, including: using a pre-trained language model to extract the semantic vector of the keyword in the semantic constraint , and then calculate the keyword weight coefficient. The calculation formula is as follows: , in, Represents the keyword weight coefficient, TF and TDF represent term frequency and inverse document frequency respectively, and are calculated as follows: ; ; exp represents the exponential function, which is mathematically defined as ;β represents the importance coefficient, w k and w i Represent different words respectively; The semantic constraint matrix is obtained by weighted summation, and the calculation formula is as follows: ; Where n is an integer greater than 1, and the output format is , as a semantic guidance signal for the downstream generation module.
3. The text processing method based on artificial intelligence content generation according to claim 1, characterized in that: The step of generating a style encoding vector from the style parameters through contrastive learning and converting the environmental constraints into an environmental constraint mask matrix includes: generating a style encoding vector from the style parameters through contrastive learning, and the calculation formula is: ; Among them, v t is the embedding vector of the target style sample, which is generated by encoding the input sample through the style encoder. ; Among them, E s is the style encoder, T target Reference text representing the target style; is the learning parameter, v + is a positive sample of the same style, v - is a negative sample of different style, s(·) is the cosine similarity calculation function, and this vector is used to control the stylistic features (such as formality) and emotional expression intensity of the generated text; Converting the environmental constraints into an environmental constraint mask matrix includes: marking paragraphs that exceed character limits by truncation, generating a replacement candidate word list for banned words, and injecting platform-specific expression habits.
4. The text processing method based on artificial intelligence content generation according to claim 1, characterized in that: The converting the environmental constraints into an environmental constraint mask matrix specifically includes: Let the input text be a word sequence , environmental constraints include: character limit L max , banned words list , platform rule set R; Define the environment constraint mask matrix ,in A The number of truncation, replacement, and injection operation categories; Split text into paragraphs , for those exceeding L max The paragraphs are truncated and marked. The mathematical expressions of paragraph segmentation function and truncation mask mark are: , ; in, and Represents paragraphs respectively The starting word position index and the ending word position index of Represents the i-th row and 1st column of the mask matrix, marking word w i whether it is retained or truncated; For each , generate candidate word list , and use a mask to mark the position to be replaced. The mathematical expression of the candidate word generation function and the replacement mask mark are: , ; in, is the cosine similarity, is the similarity threshold, Represents the word embedding model, and the replacement operation is ; in, Indicates the replaced word, Detect the location where the platform-specific expression needs to be inserted and modify the mask mark; the mathematical expression keyword detection function is ; in, Represents a regular expression matching function that detects whether word wi meets rule r; For topic tag insertion, , insert a label after position i , generate a new sequence , inject mask mark, expand mask matrix Dimensions to , add a new position mark as 1 and generate a mask matrix ; in, Represents the expanded mask matrix, with the newly inserted positions marked as 1.
5. The text processing method based on artificial intelligence content generation according to claim 1 is characterized in that: The generating of the initial reply text by using the hybrid expert model based on the weight coefficient of the keyword, the style coding vector and the environmental constraint factor includes: The hybrid expert model is called to generate the initial text, and its mathematical expression is: ; in, is the generating function of the mth domain expert model, is the indicator function, which takes the value 1 when the expert m is activated and 0 otherwise; is the set of activated experts, dynamically selected by the gating function: ; in, is the Top-k sparse activation function, θ is the adaptive threshold, Wg is the trainable gating weight matrix, h t is the hidden state vector at the current moment, according to the real-time generated text hidden state h t Calculate the activation probability and prioritize calling domain experts that match the current style parameters.
6. The text processing method based on artificial intelligence content generation according to claim 1 is characterized in that: The first-level optimization of the initial reply text according to the dependency syntax and the second-level optimization according to the adversarial style transfer network to obtain generated content include: Detect logical conflicts based on dependency syntactic analysis trees and correct them by minimizing semantic deviations: ; Among them, Aij is the syntactic relationship weight matrix (such as subject-verb relationship weight = 0.9, modification relationship weight = 0.5), E(·) is the semantic encoder, which ensures that the corrected text maintains semantic coherence. Represents the hidden state vector of two dependent words in a sentence, Represents the set of dependency relations in the dependency syntax tree of the generated text G; Use the adversarial style transfer network to adjust the text style. Its loss function includes: ; in, Represents content editor and style editor, represents the target style vector, represents the style discriminator, Represents style alignment weights and adversarial training weights.
7. A text processing system based on artificial intelligence to generate content, characterized in that: include Acquisition module: used for receiving input text, wherein the text includes semantic constraints, style parameters, and environmental constraints; Calculation module: used to extract the semantic vector of the keyword in the semantic constraint using a pre-trained language model, and calculate the weight coefficient of the keyword in the text based on the TF-TDF weight and exponential function; Conversion module: used for generating a style encoding vector from the style parameters through contrastive learning, and converting the environment constraints into an environment constraint mask matrix; Initial generation module: used to generate initial reply text by initializing based on the weight coefficient of the keyword, the style encoding vector and the environmental constraint mask matrix using a hybrid expert model; Generation module: used to perform first-level optimization on the initial reply text based on dependency syntax, and then perform second-level optimization based on the adversarial style transfer network to obtain generated content.
8. A text processing device based on artificial intelligence to generate content, characterized in that: include: Memory for storing computer programs; A processor, configured to implement the steps of the text processing method based on artificial intelligence-generated content as described in any one of claims 1 to 6 when executing the computer program.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the text processing method based on artificial intelligence content generation as described in any one of claims 1 to 6.
Citation Information
Cited By
Scientific and technological supply and demand matching method and equipment based on double-tower model and medium
CN120851541A
Method and system for generating intelligent insight report based on AI large model
CN121328504A