Text style conversion control method and device, equipment and medium

By performing word segmentation, style feature extraction and neural network processing on text, the problems of coarse style control granularity and poor coherence in text style conversion are solved, and efficient and accurate text style conversion is achieved, which is suitable for a variety of application scenarios.

CN120805854APending Publication Date: 2025-10-17PING AN TECH (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510952776.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-10
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

The existing technology in text style conversion has the problems of coarse style control granularity, poor coherence of generated text, and difficulty in adapting to different business styles, resulting in low efficiency and poor accuracy of text style conversion.

Method used

By performing text segmentation and style feature extraction on the source text and target style description text, using multiple neural network convolution kernels to perform convolution feature enhancement and pooling dimensionality reduction, constructing a word-meta node graph, generating style feature conversion parameters, performing affine transformation and context consistency verification, the accuracy and naturalness of text style conversion are ensured.

Benefits of technology

It improves the accuracy, diversity, and content integrity of text style conversion, enhances the naturalness and efficiency of style conversion, and is suitable for scenarios such as text style transfer, creative writing, and cross-language style adaptation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120805854A_ABST
    Figure CN120805854A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of natural language processing, can be applied to business system platforms of financial science and technology, medical health and the like, and discloses a text style conversion control method, device and equipment and a medium. Performing text word segmentation on the source text and the target style description text to obtain a corresponding source text sequence and a corresponding target style sequence; performing style feature extraction on the source text sequence and the target style sequence to obtain corresponding source text style features and target style features; determining a target style feature conversion parameter according to the source text style feature and the target style feature; performing text coding on the source text sequence to obtain a source coded text sequence; and performing style conversion on the source coding text sequence according to the target style feature conversion parameter to obtain a target style text. The text style conversion efficiency and style control granularity can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of natural language processing, and in particular to a text style conversion control method, device, equipment and medium. BACKGROUND

[0002] Text style conversion is an important research direction in the field of natural language generation, which aims to adjust the style attributes (such as emotion, formality, rhetoric, etc.) of the text while keeping the content unchanged. Traditional methods mainly rely on explicit style annotation data to train style classifiers or style embedding models through supervised learning, however, such methods require a large amount of labeled data and are difficult to generalize to unseen style categories. In recent years, unsupervised style conversion technology has achieved the decoupling of style and content through adversarial training or variational autoencoder, but still faces problems such as coarse style control granularity and poor coherence of generated text.

[0003] For example, in the medical health field, text style conversion technology converts professional and obscure medical reports into plain language that patients can easily understand. The diagnosis report written by the doctor often contains a large number of professional terms that ordinary patients cannot understand. Through text style conversion technology, these terms can be automatically identified and replaced with more straightforward expressions to explain the disease and treatment plan, improving the patient's medical experience, but existing technologies often fail to accurately preserve medical details and have poor naturalness of style conversion, affecting accurate information transmission.

[0004] For example, in the financial technology field, different business lines (such as customer service, claims, marketing, etc.) have highly differentiated needs for text style expression, such as customer service scenarios emphasizing politeness and norms, marketing scenarios emphasizing affinity and emotional appeal, and claims documents requiring formality and accuracy. However, existing technologies often use uniformly trained writing models that are difficult to quickly adapt to different business styles, resulting in poor style control interpretability.

[0005] Therefore, how to improve the conversion efficiency and style control granularity of text style has become a problem to be solved. SUMMARY

[0006] The present application provides a text style conversion control method, device, equipment and medium, which mainly aims to solve the problem of mismatch between user personal data and function push information.

[0007] In a first aspect, to achieve the above-mentioned purpose, the present application provides a text style conversion control method, comprising: obtaining a source text and a target style description text, performing text segmentation on the source text and the target style description text respectively to obtain corresponding source text sequences and target style sequences; extracting style features from the source text sequence and the target style sequence respectively to obtain corresponding source text style features and target style features; determining target style feature conversion parameters according to the source text style features and the target style features; encoding the source text sequence to obtain a source encoded text sequence; converting the source encoded text sequence according to the target style feature conversion parameters to obtain a target style text.

[0008] In a second aspect, the present application further provides a text style conversion control device, comprising: a text segmentation module configured to obtain a source text and a target style description text, and perform text segmentation on the source text and the target style description text respectively to obtain a source text sequence and a target style sequence; a style feature extraction module configured to extract style features from the source text sequence and the target style sequence respectively to obtain corresponding source text style features and target style features; a conversion parameter generation module configured to determine target style feature conversion parameters according to the source text style features and the target style features; a text encoding module configured to encode the source text sequence to obtain a source encoded text sequence; a style conversion module configured to convert the source encoded text sequence according to the target style feature conversion parameters to obtain a target style text.

[0009] In a third aspect, the present application further provides an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the text style conversion control method described above.

[0010] In a fourth aspect, the present application further provides a computer readable storage medium, which stores at least one computer program, and the at least one computer program is executed by a processor in an electronic device to implement the text style conversion control method described above.

[0011] In the embodiment of the present application, the source text and the target style description text are divided into word units, which can decompose the text into smaller semantic units to remove irrelevant word units, ensure the uniformity of sequence length, avoid calculation errors caused by different lengths, significantly improve the accuracy of text processing, and make the generated text more consistent with the expected style and requirements; multiple neural network convolution kernels are used for convolution feature enhancement, which can capture local features of different scales in the text sequence, enrich feature information, and effectively compress the feature dimension through pooling dimension reduction processing to remove redundancy and retain key features, making the features more comprehensive and representative; the difference between the source text and the target style features is accurately captured to generate conversion parameters that better fit the target style, which maximizes the preservation of the source text content and improves the accuracy, diversity and content integrity of the text style conversion; by determining the dependency relationship and constructing a source word node graph, the grammatical association between word units can be accurately captured, the semantic and structural information of the word units can be fully mined, and the feature expression capability can be enhanced; the encoding features are aggregated, which can integrate the dispersed word unit features into a unified source encoding text sequence, effectively preserving the overall semantics and structure of the text, and helping to improve the accuracy and efficiency of text processing; the source encoding text sequence is subjected to affine transformation through the style feature conversion parameters, which can quickly adjust the text feature distribution, preliminarily realize style migration, and context consistency verification ensures that the intermediate encoding text sequence maintains semantic and grammatical coherence during style conversion, enhances the naturalness of style conversion, and sequence decoding converts the style enhanced encoding text sequence into a readable text form, making the model output conform to the language specification and accurately presenting the target style. In the scenes of text style migration, creative writing assistance, cross-language style adaptation, etc., the quality and efficiency of text conversion are improved. BRIEF DESCRIPTION OF DRAWINGS

[0012] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following will briefly introduce the drawings needed to be used in the description of the embodiments of the present application. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.

[0013] Figure 1 An application environment schematic diagram of a text style conversion control method in an embodiment of the present application; Figure 2 A flowchart of a text style conversion control method provided by an embodiment of the present application; Figure 3 Flowcharts of style feature extraction on source text sequences and target style sequences respectively provided by an embodiment of the present application; Figure 4 A module schematic diagram of a text style conversion control device provided by an embodiment of the present application; Figure 5A structural schematic diagram of an electronic device for implementing a text style conversion control method according to an embodiment of the present application is provided. Figure 6 Another structural schematic diagram of an electronic device for implementing a text style conversion control method according to an embodiment of the present application is provided.

[0014] The purposes, functional characteristics and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION

[0015] In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, and to achieve the implementation process of the corresponding technical effects by applying technical means to solve the technical problems, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all the embodiments. The embodiments of the present disclosure and various features in the embodiments can be combined with each other without conflict, and the technical solutions formed thereby are all within the protection scope of the present disclosure. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative labor should be within the protection scope of the present disclosure.

[0016] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily mean a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, device, product or apparatus including a series of steps or units does not have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or apparatus.

[0017] The embodiment of the present application provides a text style conversion control method. The execution subject of the text style conversion control method includes, but is not limited to, at least one of electronic devices such as a server, a terminal and the like which can be configured to execute the device provided by the embodiment of the present application. In other words, the text style conversion control method can be executed by software or hardware installed in a terminal device or a server device. The server includes, but is not limited to, a single server, a server cluster, a cloud server or a cloud server cluster and the like. The server can be a stand-alone server, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, content distribution networks (CDN), and basic cloud computing services such as big data and artificial intelligence platforms.

[0018] The text style conversion control method can be applied to, for example Figure 1In the application environment, the client communicates with the server through the network. The server can obtain the source text and the target style description text through the client, divide the source text and the target style description text into word units, disassemble the text into smaller semantic units to remove irrelevant word units, ensure the uniformity of the sequence length, avoid calculation errors caused by different lengths, significantly improve the accuracy of text processing, and make the generated text more consistent with the expected style and requirements. A plurality of neural network convolution kernels are used for convolution feature enhancement, which can capture local features of different scales in the text sequence, enrich feature information, effectively compress the feature dimension through pooling dimension reduction processing, remove redundancy, retain key features, and make the features more comprehensive and representative. The difference between the source text and the target style features is accurately captured, and conversion parameters that conform to the target style are generated, which maximizes the preservation of the source text content and improves the accuracy, diversity and content integrity of the text style conversion. By determining the dependency relationship and constructing a source word unit node graph, the grammatical association between word units can be accurately captured, the semantic and structural information of the word units can be fully mined, the feature expression capability can be enhanced, the coding features can be aggregated, the dispersed word unit features can be integrated into a unified source coding text sequence, the overall semantic and structural information of the text can be effectively preserved, and the accuracy and efficiency of the text processing can be improved. The source coding text sequence is subjected to affine transformation through the style feature conversion parameters, which can quickly adjust the text feature distribution, preliminarily realize style migration, and ensure the semantic and grammatical coherence of the intermediate coding text sequence in the style conversion process through context consistency verification, enhance the naturalness of style conversion, and convert the style-enhanced coding text sequence into a readable text form through sequence decoding, so that the model output conforms to the language specification and accurately presents the target style. In the scenes of text style migration, creative writing assistance, cross-language style adaptation, etc., the quality and efficiency of text conversion are improved, and finally the target style text is output and fed back to the client. The client can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers and portable wearable devices. The server can be implemented by an independent server or a server cluster composed of multiple servers. The application will be described in detail through specific embodiments.

[0019] Referring to Figure 2 Fig. 1 is a flowchart of a text style conversion control method provided by an embodiment of the application. In this embodiment, the text style conversion control method comprises the following steps. S1, obtain a source text and a target style description text, and perform text segmentation on the source text and the target style description text respectively to obtain a corresponding source text sequence and a target style sequence.

[0020] In the embodiments of the present application, the source text refers to the original text material that needs to be converted in style, processed or analyzed in content; for example, if a formal news report is to be converted into a more colloquial style, then this news report is the source text; the target style description text refers to a specific description of the style that the source text is expected to achieve after conversion, which details what features the converted text should have, such as language style (formal, colloquial, humorous, etc.), tone (serious, light, satirical, etc.), word preference, etc.

[0021] For example, if a news report is to be converted into a colloquial style, the target style description text can be "use everyday language, avoid overly formal vocabulary and sentence patterns, maintain a light and friendly tone".

[0022] In detail, the source text can be obtained by manual input, and the user can directly input the source text in the corresponding text processing tool or system, or import it from a local file (such as TXT, DOCX, PDF, etc.).

[0023] Specifically, for cases that require a large amount of text data, web crawler technology can be used to capture relevant text from web pages, but it is necessary to comply with relevant laws and regulations and the terms of use of the website. If the source text is stored in a database, it can be obtained by querying the database.

[0024] In detail, the target style description text can be obtained by user definition, and the user can directly define the target style description text according to his own needs; for example, the user can explicitly indicate that the text is converted into a humorous style and give some specific humorous elements or expressions. Some preset style options can be provided in the text processing tool for the user to choose, such as "formal", "colloquial", "humorous", etc. After the user selects, the system can automatically generate the corresponding target style description text or provide guidance for style conversion.

[0025] Illustratively, in the medical health scenario, the source text can be patient medical record, medical research report and health popular science article, etc. The hospital electronic medical record system stores a large amount of patient medical records, which record the patient's basic information (name, age, gender, etc.), symptom description (such as "the patient reported that he had persistent headache, accompanied by nausea and vomiting symptoms"), past medical history, etc. The patient medical record is a typical source text in the medical health scenario, which can be obtained through the hospital information system interface or authorized access.

[0026] The medical research report is a report on disease research, drug efficacy evaluation, etc. published by a medical research institution or an academic journal, which can be retrieved from a medical database (such as PubMed, Wanfang Medical Network); the health popular science article is an article on disease prevention, healthy lifestyle, etc. published by a health popular science website, public number, etc. It can be obtained through web crawler technology (within the legal and compliant premise) or direct access to the relevant website.

[0027] Specifically, when professional medical knowledge needs to be conveyed to ordinary patients, the target style description text can be "use simple and easy-to-understand language, avoid professional terms, and explain the disease, treatment plan and precautions to the patient in a kind and patient tone; for example, express 'coronary atherosclerotic heart disease' as 'heart vessel blockage disease', and express 'take medicine on time according to doctor's advice' as 'take medicine according to doctor's advice'”.

[0028] Among them, if it is an academic exchange or case discussion among medical professionals, the target style description text is "use professional medical terminology, express accurately and rigorously, logically clearly, and elaborate on the diagnosis basis, differential diagnosis and treatment ideas; for example, when describing the diagnosis of the disease, list all related symptoms, signs and examination results, and make a comprehensive analysis".

[0029] Exemplarily, in the financial technology scene, the source text can be financial news reports, financial product brochures, etc. The financial news report refers to the news published by financial media on financial market dynamics, enterprise financial situation, macroeconomic policy, etc. For example, a news report on the quarterly financial report of a certain bank contains financial data such as the bank's revenue, profit growth, and non-performing loan ratio, as well as market analysts' evaluation of the bank's future development, which can be obtained from financial news websites (such as Sina Finance, East Money).

[0030] The financial product brochure is a brochure of various financial products (such as funds, financial products, insurance, etc.) published by financial institutions such as banks and securities companies, for example, a brochure of a fund will explain the investment strategy (such as mainly investing in the stock market or the bond market), historical performance, and redemption rules of the fund, which can be obtained from the official website of the financial institution or the sales channel.

[0031] Specifically, when recommending financial products to investors or analyzing financial market trends, the target style description text can be "use vivid and vivid language, highlight product advantages and investment opportunities, and attract the interest of investors; for example, when introducing a fund, you can say 'this fund is like an investment expert, good at capturing quality stocks in a complex market, bringing you rich returns'”.

[0032] If it is to report business to the financial regulatory authority or submit application materials, the target style description text is "to follow strict format and specification, the content is true, accurate and complete, and to specify business operation process, risk control measures; for example, when applying for a financial license, detailed business plan, risk management plan and internal control system shall be provided in accordance with the regulatory requirements".

[0033] In the embodiment of the application, the source text and the target style description text are respectively subjected to text segmentation to obtain corresponding source text sequences and target style sequences, which comprises: The source text and the target style description text are respectively subjected to token division to obtain corresponding source token sequences and target token sequences; The source token sequences and the target token sequences are subjected to style-related word screening to obtain source style token sequences and target style token sequences; The source style token sequences and the target style token sequences are subjected to truncation and padding according to a preset sequence length limit to generate corresponding source standard token sequences and target standard style token sequences with fixed lengths; The source standard token sequences and the target standard style token sequences are respectively subjected to vector conversion to obtain corresponding source text sequences and target style sequences.

[0034] In detail, the token division can be achieved by a dictionary-based segmentation method, in which a dictionary containing a large number of words is constructed in advance, and the text sequences in the text are matched with the words in the dictionary according to certain rules such as forward maximum matching, so as to divide the text into tokens; for example, in Chinese text, the dictionary can contain words such as "finance", "technology" and "development", and through matching, "financial technology development" can be divided into three tokens "finance", "technology" and "development".

[0035] A statistical model (such as a hidden Markov model, a conditional random field, etc.) can also be used to learn a large number of annotated texts, and the probability of the simultaneous occurrence of adjacent tokens and other information can be counted, so that new texts can be segmented according to the statistical information, which can better handle unregistered words (words not included in the dictionary) and ambiguity segmentation problems; for example, for the sentence "combination of components", there can be two segmentation methods "combination / component / sub" and "combination / combination / sub", and the statistical segmentation method can select a more reasonable segmentation according to the context and statistical probability.

[0036] The style-related word screening can pre-construct a style dictionary containing words related to different styles. For example, the formal style dictionary can contain words such as “zhi”, “jianyu” and “yijing”, and the colloquial style dictionary can contain words such as “zhan”, “yebang” and “ma”. The word sequence is matched with the style dictionary to screen out the word belonging to the target style.

[0037] The semantic analysis technology (such as word vector representation, semantic role labeling, etc.) can also be used to determine the semantic features of the word, so as to screen out the word related to the semantic of the target style. For example, in the formal style text, the semantic of the word can be more rigorous and standard, and the semantic analysis can identify the word with formal semantic features.

[0038] Specifically, the truncation padding refers to processing in a truncated manner when the length of the word sequence exceeds the preset sequence length limit. Common truncation strategies include head truncation, tail truncation and random truncation. The head truncation directly removes part of the word at the beginning of the sequence, the tail truncation removes part of the word at the end of the sequence, and the random truncation randomly selects part of the word in the sequence for deletion.

[0039] For example, if the preset sequence length is 100 and the length of the word sequence is 120, the tail truncation is to remove the last 20 words of the sequence.

[0040] When the length of the word sequence is less than the preset sequence length limit, the padding method is used for processing. Common padding symbols include special markers (such as <pad>) or zero vectors; for example, if the preset sequence length is 100 and the token sequence length is 80, 20 <pad>Symbol, so that its length reaches 100.

[0041] In detail, the vector conversion is to convert each word into a fixed-dimensional vector representation, and common word embedding models include Word2Vec, GloVe, etc. By learning the semantic relationship between word units in a large amount of text data, the word units are mapped to a low-dimensional vector space, so that the distance between word units with similar semantics in the vector space is closer.

[0042] For example, in the Word2Vec model, the two word units "finance" and "economy" may be closer in the vector space because they have certain relevance in semantics; the same word unit may have different vector representations in different contexts, thereby better capturing the semantic changes of the word unit.

[0043] In the embodiment of the application, the source text and the target style description text are divided into word units, which can decompose the text into smaller semantic units to remove irrelevant word units, ensure the uniformity of the sequence length, avoid calculation errors caused by different lengths, significantly improve the accuracy of text processing, and make the generated text more consistent with the expected style and requirements.

[0044] S2, respectively, style feature extraction is performed on the source text sequence and the target style sequence to obtain corresponding source text style features and target style features.

[0045] In the embodiment of the application, through steps such as convolution enhancement, pooling dimension reduction, nonlinear activation, multi-layer fusion, attention weighting and full connection dimension reduction, corresponding source text style features and target style features are extracted from the source text sequence and the target style sequence.

[0046] As shown in Figure 3 In the embodiment of the application, the source text sequence and the target style sequence are respectively subjected to style feature extraction to obtain corresponding source text style features and target style features, which include: A plurality of neural network convolution kernels are obtained, and the source text sequence and the target style sequence are respectively subjected to convolution feature enhancement according to the plurality of neural network convolution kernels to obtain corresponding source text enhanced feature maps and target style enhanced feature maps; The source text enhanced feature maps and the target style enhanced feature maps are subjected to pooling dimension reduction processing to obtain source text pooling feature representations and target style pooling feature representations; The source text pooling feature representations and the target style pooling feature representations are subjected to nonlinear activation function transformation to obtain source text activation feature maps and target style activation feature maps; The source text activation feature map and the target style activation feature map are subjected to multi-layer feature fusion to obtain a source text fusion feature representation and a target style fusion feature representation. The source text fusion feature representation and the target style fusion feature representation are subjected to attention weighting processing to obtain a source text attention weighted feature and a target style attention weighted feature. The source text attention weighted feature and the target style attention weighted feature are subjected to feature dimension reduction processing according to a preset full connection layer to obtain corresponding source text style features and target style features.

[0047] In detail, different sizes of convolution kernels (such as 3x3, 5x5, etc.) are used for convolution operation on the text sequence. Smaller convolution kernels can capture local subtle features, and larger convolution kernels can obtain more extensive context information; for example, when processing text, a 3x3 convolution kernel may focus on the relationship between adjacent word units, and a 5x5 convolution kernel can capture longer phrase or sentence structures.

[0048] Among them, in order to reduce the amount of calculation, the depth separable convolution technology is adopted, which decomposes the standard convolution into two steps of depth convolution and point-by-point convolution, reduces the number of parameters and the complexity of calculation while maintaining the feature extraction ability; for example, for each word unit in the text sequence, the depth convolution processes the features of each channel respectively, and the point-by-point convolution combines the information between channels.

[0049] Among them, a window is slid on the feature map, and the maximum feature value in the window is selected as the output, which can retain the most significant features and suppress unimportant information, thereby reducing the feature dimension; for example, for multiple numerical values in a feature map window, the maximum pooling selects the maximum value among them, reducing redundant data, or the average value of the feature values in the window is calculated as the output, and the average pooling can reflect the average level of the features in a certain area, which helps to reduce the influence of noise.

[0050] Specifically, the feature values are subjected to nonlinear transformation, all negative values are set to zero, and positive values remain unchanged. The ReLU activation function is simple and efficient, which can effectively solve the gradient disappearance problem and enhance the nonlinear expression ability of the model; the feature maps at different levels are spliced in the channel dimension to integrate multi-scale feature information; for example, the local features extracted by the shallow network and the global features extracted by the deep network are spliced together, so that the model has both detailed and overall understanding ability. Improve the robustness of the model.

[0051] In detail, the correlation weight of each position in the feature map with other positions is calculated, and the features are weighted and summed according to the weight, so that the long-distance dependence relationship can be captured, and important features can be highlighted; for example, in text processing, the self-attention mechanism can identify the contribution degree of key words to the overall semantics, and give a higher weight, and the self-attention mechanism is extended to multiple "heads", each head independently learns different attention weights, and finally the outputs of multiple heads are spliced.

[0052] Among them, the high-dimensional features are linearly combined through the full connection layer to map the features to a low-dimensional space, each neuron of the full connection layer is connected with all the neurons of the previous layer, and can learn complex nonlinear relationships, for example, hundreds of dimensions of features are compressed to tens of dimensions, which is convenient for subsequent task processing.

[0053] In the embodiment of the application, the multiple neural network convolution kernels perform convolution feature enhancement, can capture different scale local features in the text sequence, enrich feature information, and effectively compress feature dimensions through pooling dimension reduction processing, remove redundancy, retain key features, introduce nonlinear factors through nonlinear activation function transformation, enhance the expression ability of the model to complex features, integrate different levels of features through multi-layer feature fusion, make the features more comprehensive and representative, highlight important features through attention weighting processing, suppress irrelevant information, and obtain refined features that can accurately represent the style through full connection layer feature dimension reduction, provide high-quality input for subsequent tasks, and improve the performance and efficiency of the model in text style related tasks.

[0054] S3, determining a target style feature conversion parameter according to the source text style feature and the target style feature.

[0055] In the embodiment of the application, the initial conversion parameter is generated by calculating the feature difference vector of the source text style feature and the target style feature, and the parameter is optimized based on the contrast learning mechanism (constructing positive and negative samples and loss function), and finally the target style feature conversion parameter is obtained by combining the style similarity, diversity and content reservation loss term.

[0056] In the embodiment of the application, the target style feature conversion parameter is determined according to the source text style feature and the target style feature, comprising: performing feature difference calculation on the source text style feature and the target style feature to obtain a feature difference vector; performing parameter mapping on the feature difference vector to obtain an initial style feature conversion parameter; performing parameter optimization on the initial style feature conversion parameter to obtain a target style feature conversion parameter.

[0057] In detail, various methods are used to measure the difference between the source text style features and the target style features, such as a measure based on semantic similarity, which regards the style features as points in the semantic space and calculates the distance between the two points. The larger the distance, the more obvious the difference.

[0058] For example, if the style features involve aspects such as vocabulary frequency and grammatical structure, by comparing the feature values ​​of the source text and the target style in these aspects, the degree of deviation between them can be calculated. This degree of deviation can be regarded as a manifestation of feature differences.

[0059] The present invention can also compare each dimension of the source text style features and the target style features one by one, and analyze the difference in the size and direction of the characteristic values ​​in each dimension. For example, in a certain dimension, the source text style characteristic value is A and the target style characteristic value is B. By comparing the size and change trend of A and B, the difference in this dimension is determined, and the differences in all dimensions are combined to form a characteristic difference vector, which can comprehensively reflect the difference between the source text style and the target style.

[0060] Specifically, assuming that there is a linear relationship between the feature difference vector and the style feature conversion parameter, each element in the feature difference vector is converted according to a certain ratio and offset through a pre-set mapping rule to obtain the initial style feature conversion parameter.

[0061] For example, for a certain element in the feature difference vector, multiply it by a fixed coefficient and add a constant to obtain the corresponding initial conversion parameter value. This linear mapping method is simple and direct and is suitable for situations where the relationship between feature differences and conversion parameters is relatively simple.

[0062] The present invention also considers the complex nonlinear relationship between feature differences and conversion parameters and employs nonlinear mapping methods. For example, this mapping is achieved using a neural network model. The feature difference vector is used as the neural network input. After nonlinear transformation through multiple layers of neurons, the initial style feature conversion parameters are output. The neural network can learn the complex mapping relationship between feature differences and conversion parameters, improving the accuracy and flexibility of the mapping.

[0063] In the embodiment of the present invention, the step of optimizing the initial style feature conversion parameters to obtain target style feature conversion parameters includes: Generating positive sample parameters and negative sample parameters according to the initial style feature conversion parameters; Generate a style conversion loss function according to the positive sample parameters, the negative sample parameters, and a preset contrast factor; Minimizing the style conversion loss function to obtain a minimum style conversion loss function; The style similarity loss term, the style diversity loss term, and the content preservation loss term of the minimum style conversion loss function are obtained, and the initial style feature conversion parameter is optimized according to the style similarity loss term, the style diversity loss term, and the content preservation loss term to obtain a target style feature conversion parameter.

[0064] In detail, by perturbing or transforming the initial style feature conversion parameter, a positive sample parameter and a negative sample parameter are generated. For example, random noise is added to the initial parameter, or the parameter value is adjusted according to certain rules (such as scaling, offsetting, etc.) to generate a parameter similar to but not identical to the initial parameter as a positive sample parameter. The negative sample parameter may be a parameter with a large difference from the initial parameter, for example, by inversely adjusting the parameter value or introducing an adversarial disturbance to enhance the diversity and contrast of the parameter.

[0065] Specifically, based on the positive sample parameter and the negative sample parameter, a contrast loss function is constructed, and the idea of triplet loss is used to make the distance between the positive sample parameter and the initial parameter smaller than the distance between the negative sample parameter and the initial parameter. The weight of the distance difference is adjusted by a contrast factor. The contrast factor can be a hyperparameter for controlling the contribution proportion of the positive and negative samples to the loss function.

[0066] In which, multiple targets such as style similarity, style diversity and content preservation are integrated into a loss function, for example, by weighted summation, the loss terms of each target are combined into a comprehensive style conversion loss function. The contrast factor here can be used to adjust the balance relationship between different loss terms to ensure that the model considers the performance of each aspect during the optimization process.

[0067] In detail, the gradient descent algorithm is used to minimize the style conversion loss function. The gradient of the loss function with respect to the initial style feature conversion parameter is calculated, and the parameter is updated in the opposite direction of the gradient to gradually reduce the value of the loss function. In each iteration, the step size of the parameter update is adjusted according to the learning rate, until the loss function converges to a minimum value or reaches a preset number of iterations. The initial style feature conversion parameter is optimized according to the style similarity loss term, the style diversity loss term, and the content preservation loss term.

[0068] For example, the style similarity loss term requires the converted text to be as close as possible to the target style; the style diversity loss term encourages the generation of diverse style expressions; and the content preservation loss term ensures that the converted text is consistent with the source text in terms of content. By coordinating these three loss terms, a balance point is found, so that the final conversion parameter performs well in terms of style, diversity, and content preservation.

[0069] In the embodiment of the present application, the differences between the source text and the target style characteristics can be accurately captured, the conversion parameters more suitable for the target style can be generated, and the multi-loss item cooperative optimization ensures that the converted text not only highly matches the target style, but also retains rich style diversity, while the source text content is maximally retained, thereby improving the accuracy, diversity and content integrity of the text style conversion.

[0070] S4, text encoding is performed on the source text sequence to obtain a source encoded text sequence.

[0071] In the embodiment of the present application, the dependency relation graph of the source text (word element as vertex and dependency relation as edge) is constructed, the initial features of the word element nodes are extracted, and the source encoded text sequence is generated after feature encoding and aggregation processing.

[0072] In the embodiment of the present application, the text encoding on the source text sequence to obtain the source encoded text sequence comprises: determining the dependency relation of the source text according to the source text sequence; taking each source word element in the source text sequence as a vertex and taking the dependency relation as an edge between the vertices; constructing a source word element node graph according to the vertices and the edges and extracting the initial features of each word element node in the source word element node graph; performing feature encoding on the initial features of the word elements to obtain the encoded features of each word element node; performing aggregation processing on the encoded features to obtain the source encoded text sequence.

[0073] In detail, the dependency syntax analysis technology is used to perform syntax analysis on the source text sequence and identify the dependency relation between the words; for example, a rule-based dependency analysis method or a statistical-based machine learning model (such as a maximum entropy Markov model, a conditional random field, etc.) or a deep learning model (such as a neural network-based dependency analysis model) is used to determine the syntax role of each word element in the sentence and the dependency relation (such as subject-predicate relation, verb-object relation, etc.) between the word element and other word elements.

[0074] In the embodiment of the present application, the dependency relation between the source text sequence and the target style characteristics can be accurately captured, the conversion parameters more suitable for the target style can be generated, and the multi-loss item cooperative optimization ensures that the converted text not only highly matches the target style, but also retains rich style diversity, while the source text content is maximally retained, thereby improving the accuracy, diversity and content integrity of the text style conversion.

[0075] Specifically, the initial features of each wordpiece node are extracted from the source wordpiece node graph, for example, in addition to word vectors, local context features (such as information of surrounding wordpieces), global context features (such as topic information of the entire sentence), and dependency relationship related features (such as dependency distance, dependency direction, etc.) of the wordpiece can also be extracted, which can be integrated by concatenation, weighted summation or other feature fusion methods.

[0076] In detail, the initial features of the wordpiece nodes are encoded using a graph neural network (GNN), and a graph convolution network (GCN), a graph attention network (GAT) or a graph isomorphism network (GIN) model is adopted to update the feature representation of the current node by aggregating the information of the neighbor nodes. In each layer of the network, the node features are updated according to the structure of the graph and the information of the neighbor nodes, so as to capture the complex relationships between the wordpieces.

[0077] Among them, the encoded graph structure is aggregated to generate a source encoded text sequence. A global pooling operation (such as global average pooling or global maximum pooling) can be used to aggregate the features of all nodes in the graph into a fixed-dimensional vector representing the encoding representation of the entire text. Alternatively, a hierarchical aggregation method can be used to gradually merge node features to finally obtain the encoding sequence of the entire text, which is convenient for subsequent text generation or processing tasks.

[0078] In the embodiments of the present application, by determining the dependency relationship and constructing the source wordpiece node graph, the grammatical association between the wordpieces can be accurately captured to provide structured information for subsequent processing. By extracting the initial features of the wordpieces and encoding, the semantic and structural information of the wordpieces can be fully mined to enhance the feature expression capability. By aggregating the encoded features, the dispersed wordpiece features can be integrated into a unified source encoded text sequence, effectively preserving the overall semantic and structural information of the text, which helps to improve the accuracy and efficiency of text processing.

[0079] S5, style conversion is performed on the source encoded text sequence according to the target style feature conversion parameter to obtain a target style text.

[0080] In the embodiments of the present application, the style feature conversion parameter is applied to the source encoded sequence to generate an intermediate sequence through affine transformation, and then the style feature is enhanced through context consistency verification, and finally the target style text is decoded.

[0081] In the embodiments of the present application, the style conversion is performed on the source encoded text sequence according to the target style feature conversion parameter to obtain a target style text, comprising: affine transformation is performed on the source encoded text sequence according to the target style feature conversion parameter to obtain an intermediate encoded text sequence; context consistency verification is performed on the intermediate encoded text sequence to obtain a style enhanced encoded text sequence; Sequentially decoding the style-enhanced encoded text sequence to obtain a style-enhanced decoded text sequence; Generate corresponding target style text according to the style enhanced decoded text sequence.

[0082] In detail, the affine transformation usually includes two steps: linear transformation (such as matrix multiplication) and translation (such as vector addition). The style feature conversion parameters serve as the transformation matrix and bias vector in this process to adjust the feature representation of the source encoded text sequence to make it closer to the target style.

[0083] For example, each feature vector of the source encoded text sequence is multiplied by the transformation matrix and then added with the bias vector to obtain the intermediate encoded text sequence. This process changes the spatial distribution of the features and initially realizes style conversion.

[0084] Among them, the context consistency check is performed on the intermediate encoded text sequence to ensure that the converted features remain reasonable and coherent in the context. By analyzing the semantic and grammatical relationships between adjacent words or phrases, it is checked whether the converted features are consistent with the surrounding context. The self-attention mechanism or context-related verification model can be used to perform local and global context consistency evaluation on the intermediate encoded text sequence to enhance the coherence and naturalness of the style.

[0085] Specifically, the style-enhanced encoded text sequence is sequentially decoded, usually using a decoder model based on a recurrent neural network (RNN), a long short-term memory network (LSTM), or a Transformer. The decoder gradually generates a text sequence in the target style based on the characteristics of the encoded text sequence. During the autoregressive decoding process, the decoder predicts the probability distribution of the next word based on the generated partial text and the encoded features, and gradually constructs a complete text sequence.

[0086] In detail, the final target style text is generated based on the style-enhanced decoded text sequence. Generation strategies such as greedy search and beam search can be used to select the most likely word sequence from the probability distribution of the decoder output. Beam search retains multiple candidate sequences at each step and selects the optimal text output based on the overall probability. In addition, the generated text can be post-processed in combination with a language model or style evaluation model to ensure that it meets the requirements of the target style and is fluent and readable.

[0087] In the embodiment of the present application, the source coded text sequence is subjected to affine transformation through style feature conversion parameters, which can quickly adjust the text feature distribution and preliminarily realize style migration. Context consistency verification ensures that the intermediate coded text sequence maintains semantic and grammatical coherence in the style conversion process, enhances the naturalness of style conversion, and sequence decoding converts the style enhanced coded text sequence into a readable text form, so that the model output conforms to the language specification and accurately presents the target style. In the scenarios of text style migration, creative writing assistance, cross-language style adaptation, etc., the quality and efficiency of text conversion are improved.

[0088] In the embodiment of the present application, the intelligent matching mechanism of user classification and function pushing significantly improves the efficiency of computer systems in precise marketing and user experience optimization. The weight allocation quantifies the importance of user classification, dynamically adjusts the priority in combination with business targets, ensures that high-value users receive more accurate services, realizes personalized association of users and functions, and improves the relevance of pushing.

[0089] It should be understood that the size of the serial number of each step in the above embodiment does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present application.

[0090] As shown in Figure 4 , it is a functional module diagram of a text style conversion control device provided by an embodiment of the present application.

[0091] In the embodiment of the present application, a text style conversion control device is provided, which corresponds one-to-one to the text style conversion control method of the above embodiment. As shown in Figure 4 , the text style conversion control device 100 can be installed in an electronic device. According to the implemented functions, the text style conversion control device 100 includes a text segmentation module 101, a style feature extraction module 102, a conversion parameter generation module 103, a text encoding module 104, and a style conversion module 105. The detailed description of each functional module is as follows: The text segmentation module 101 is used to obtain a source text and a target style description text, and performs text segmentation on the source text and the target style description text respectively to obtain a corresponding source text sequence and a target style sequence; The style feature extraction module 102 is used to extract style features from the source text sequence and the target style sequence respectively to obtain corresponding source text style features and target style features; The conversion parameter generation module 103 is used to determine target style feature conversion parameters according to the source text style features and the target style features; the text encoding module 104 is configured to perform text encoding on the source text to obtain a source encoded text sequence; the style conversion module 105 is configured to perform style conversion on the source encoded text sequence according to the target style feature conversion parameter to obtain a target style text.

[0092] In an embodiment, the text segmentation module 101 is configured to perform text segmentation on the source text and the target style description text respectively to obtain a source text sequence and a target style sequence when performing text segmentation on the source text and the target style description text respectively. In an embodiment, the text segmentation module 101 is configured to perform text segmentation on the source text and the target style description text respectively to obtain a source text sequence and a target style sequence when performing text segmentation on the source text and the target style description text respectively. In an embodiment, the text segmentation module 101 is configured to perform text segmentation on the source text and the target style description text respectively to obtain a source text sequence and a target style sequence when performing text segmentation on the source text and the target style description text respectively. In an embodiment, the text segmentation module 101 is configured to perform text segmentation on the source text and the target style description text respectively to obtain a source text sequence and a target style sequence when performing text segmentation on the source text and the target style description text respectively. In an embodiment, the text segmentation module 101 is configured to perform text segmentation on the source text and the target style description text respectively to obtain a source text sequence and a target style sequence when performing text segmentation on the source text and the target style description text respectively.

[0093] In an embodiment, the style feature extraction module 102 is configured to perform style feature extraction on the source text sequence and the target style sequence respectively to obtain a source text style feature and a target style feature when performing style feature extraction on the source text sequence and the target style sequence respectively. In an embodiment, the style feature extraction module 102 is configured to perform style feature extraction on the source text sequence and the target style sequence respectively to obtain a source text style feature and a target style feature when performing style feature extraction on the source text sequence and the target style sequence respectively. In an embodiment, the style feature extraction module 102 is configured to perform style feature extraction on the source text sequence and the target style sequence respectively to obtain a source text style feature and a target style feature when performing style feature extraction on the source text sequence and the target style sequence respectively. In an embodiment, the style feature extraction module 102 is configured to perform style feature extraction on the source text sequence and the target style sequence respectively to obtain a source text style feature and a target style feature when performing style feature extraction on the source text sequence and the target style sequence respectively. In an embodiment, the style feature extraction module 102 is configured to perform style feature extraction on the source text sequence and the target style sequence respectively to obtain a source text style feature and a target style feature when performing style feature extraction on the source text sequence and the target style sequence respectively. In an embodiment, the style feature extraction module 102 is configured to perform style feature extraction on the source text sequence and the target style sequence respectively to obtain a source text style feature and a target style feature when performing style feature extraction on the source text sequence and the target style sequence respectively. According to the preset full connection layer, the source text attention weighted feature and the target style attention weighted feature are respectively subjected to feature dimension reduction processing to obtain corresponding source text style features and target style features.

[0094] In an embodiment, the conversion parameter generation module 103 is configured to, when determining the target style feature conversion parameter according to the source text style feature and the target style feature: perform feature difference calculation on the source text style feature and the target style feature to obtain a feature difference vector; perform parameter mapping on the feature difference vector to obtain an initial style feature conversion parameter; perform parameter optimization on the initial style feature conversion parameter to obtain the target style feature conversion parameter.

[0095] In an embodiment, the conversion parameter generation module 103 is configured to, when performing parameter optimization on the initial style feature conversion parameter to obtain the target style feature conversion parameter: generate a positive sample parameter and a negative sample parameter according to the initial style feature conversion parameter; generate a style conversion loss function according to the positive sample parameter, the negative sample parameter, and a preset contrast factor; perform function minimization on the style conversion loss function to obtain a minimum style conversion loss function; obtain a style similarity loss term, a style diversity loss term, and a content preservation loss term of the minimum style conversion loss function, and perform parameter optimization on the initial style feature conversion parameter according to the style similarity loss term, the style diversity loss term, and the content preservation loss term to obtain the target style feature conversion parameter.

[0096] In an embodiment, the text encoding module 104 is configured to, when performing text encoding on the source text sequence to obtain a source encoded text sequence: determine a dependency relationship of the source text according to the source text sequence; take each source token in the source text sequence as a vertex and take the dependency relationship as an edge between the vertices; construct a source token node graph according to the vertices and the edges, and extract token initial features of each token node in the source token node graph; perform feature encoding on the token initial features to obtain encoded features of each token node; perform aggregation processing on the encoded features to obtain the source encoded text sequence.

[0097] In an embodiment, the style conversion module 105, when performing style conversion on the source encoded text sequence according to the target style feature conversion parameter to obtain target style text, is configured to: perform affine transformation on the source encoded text sequence according to the target style feature conversion parameter to obtain an intermediate encoded text sequence; perform context consistency verification on the intermediate encoded text sequence to obtain a style enhanced encoded text sequence; perform sequence decoding on the style enhanced encoded text sequence to obtain a style enhanced decoded text sequence; generate corresponding target style text according to the style enhanced decoded text sequence.

[0098] In the present application, the specific limitations of the text style conversion control device can be referred to the limitations of the text style conversion control method in the above, which will not be repeated here. Each module in the above text style conversion control device can be realized by software, hardware and their combinations in whole or in part. The above modules can be embedded in or independent of the processor in the computer device in hardware form, or can be stored in the memory in the computer device in software form, so as to be called and executed by the processor to perform the operations corresponding to each module.

[0099] In an embodiment, a computer device is provided, which can be a server, and an internal structure diagram thereof can be as shown in Figure 5 The computer device includes a processor, a memory, a network interface and a database connected through a system bus. The processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile and / or volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is configured to communicate with the external client through the network connection. The computer program is executed by the processor to implement the functions or steps of the text style conversion control method server side.

[0100] In an embodiment, a computer device is provided, which can be a client, and an internal structure diagram thereof can be as shown in Figure 6 As shown in the figure. The computer device includes a processor, a memory, a network interface, a display screen and an input device connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capability. The memory of the computer device includes a non-volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operating system and the computer program in the non-volatile storage medium to run. The network interface of the computer device is used to communicate with the external server through the network connection. The computer program is executed by the processor to realize the function or step of the client side of the text style conversion control method.

[0101] In one embodiment, a computer device is provided, comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor executing the computer program to implement the following steps: Obtain a source text and a target style description text, and perform text segmentation on the source text and the target style description text respectively to obtain corresponding source text sequences and target style sequences; Perform style feature extraction on the source text sequences and the target style sequences respectively to obtain corresponding source text style features and target style features; Determine target style feature conversion parameters according to the source text style features and the target style features; Perform text encoding on the source text sequences to obtain source encoded text sequences; Perform style conversion on the source encoded text sequences according to the target style feature conversion parameters to obtain target style text.

[0102] In several embodiments provided by the present application, it should be understood that the disclosed devices, apparatuses can be implemented in other ways. For example, the above-mentioned system embodiments are merely schematic. For example, the division of the modules is merely a logical function division. In actual implementation, another division mode can be adopted.

[0103] In addition, each function module in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically independently, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be realized in the form of hardware, or in the form of hardware plus software function module.

[0104] Therefore, from any point of view, the embodiments should be regarded as exemplary and non-limiting, and the scope of the present application is defined by the appended claims rather than the above description, and therefore all changes falling within the meaning and scope of the equivalent elements of the claims are intended to be included in the present application. Any additional reference signs in the claims should not be regarded as limiting the claims involved.

[0105] In some embodiments of the present embodiment, a computer readable storage medium is provided, and a computer program is stored on the computer readable storage medium, wherein the computer program is executed by a processor to implement the steps of the method of the above-mentioned embodiments.

[0106] The readable storage medium of the present application stores a computer program, and the computer program can implement the following when executed by a processor of an electronic device: obtain a source text and a target style description text, perform text segmentation on the source text and the target style description text respectively to obtain a corresponding source text sequence and a target style sequence; perform style feature extraction on the source text sequence and the target style sequence respectively to obtain corresponding source text style features and target style features; determine target style feature conversion parameters according to the source text style features and the target style features; perform text encoding on the source text sequence to obtain a source encoded text sequence; perform style conversion on the source encoded text sequence according to the target style feature conversion parameters to obtain a target style text.

[0107] It should be noted that the functions or steps that the computer readable storage medium or the computer device can implement correspond to the related descriptions of the server side and the client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.

[0108] The computer readable storage medium can also store at least one computer executable program / instruction, such as computer readable instructions. The computer readable storage medium includes, but is not limited to, for example, volatile memory and / or non-volatile memory. The volatile memory may, for example, include random access memory (RAM) and / or cache memory, etc. The computer readable storage medium may, for example, include read-only memory (ROM), hard disk, flash memory, etc. For example, the non-transitory computer readable storage medium can be connected to a computing device such as a computer, and then when the computing device runs the computer readable instructions stored on the computer readable storage medium, the various methods described above can be performed.

[0109] In addition, the computer device can also include (but is not limited to) a data bus, an input / output (I / O) bus, a display, and an input / output device (such as a keyboard, a mouse, a speaker, etc.), etc.

[0110] In one embodiment, the at least one computer-executable instruction can also be compiled or composed into a software product / computer program product, wherein one or more computer-executable instructions are executed by a processor to perform the steps of the various functions and / or methods described in the embodiments of the present technology.

[0111] Those skilled in the art can understand that all or part of the processes in the above- described embodiments can be completed by computer programs instructing relevant hardware, and the computer programs can be stored in a non-volatile computer readable storage medium. When the computer programs are executed, the processes of the above-described embodiments of the methods can be included. Any reference to memory, storage, database, or other medium used in the embodiments provided in the present application can include non-volatile and / or volatile memory.

[0112] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above-mentioned functional units and modules is exemplified, and in actual application, the above-mentioned functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above.

[0113] In the embodiments provided in the present disclosure, it should be understood that the disclosed devices and methods can also be implemented by other means. The device embodiments described above are only illustrative. For example, the flowcharts and block diagrams in the drawings show possible implementation architectures, functions, and operations of the devices, methods, and computer program products according to the embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment, or a part of code, which includes one or more executable instructions for implementing the specified logical functions. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different orders from those noted in the drawings. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or actions, or can be implemented by a combination of dedicated hardware and computer instructions.

[0114] The above-described embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacements for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application.

[0115] It should be noted that if software tools or components other than those of our company appear in the embodiments of this application, they are only used for illustration and do not represent actual use.< / pad> < / pad>

Claims

1. A text style conversion control method, characterized in that: The method comprises: Obtaining a source text and a target style description text, and performing text segmentation on the source text and the target style description text respectively to obtain a corresponding source text sequence and target style sequence; Extracting style features from the source text sequence and the target style sequence respectively to obtain corresponding source text style features and target style features; Determining a target style feature conversion parameter according to the source text style feature and the target style feature; Performing text encoding on the source text sequence to obtain a source encoded text sequence; The style of the source encoded text sequence is converted according to the target style feature conversion parameters to obtain a target style text.

2. The text style conversion control method according to claim 1, wherein: The performing text segmentation on the source text and the target style description text respectively to obtain corresponding source text sequences and target style sequences includes: Performing word-gram division on the source text and the target style description text respectively to obtain corresponding source word-gram sequences and target word-gram sequences; Screening the source word-gram sequence and the target word-gram sequence for style-related words to obtain a source style word-gram sequence and a target style word-gram sequence; According to a preset sequence length limit, the source style word unit sequence and the target style word unit sequence are truncated and padded to generate a source standard word unit sequence and a target standard style word unit sequence of corresponding fixed lengths; Vector conversion is performed on the source standard word sequence and the target standard style word sequence respectively to obtain a corresponding source text sequence and target style sequence.

3. The text style conversion control method according to claim 1, wherein: The extracting style features from the source text sequence and the target style sequence to obtain corresponding source text style features and target style features includes: Obtaining a plurality of neural network convolution kernels, and performing convolution feature enhancement on the source text sequence and the target style sequence according to the plurality of neural network convolution kernels, respectively, to obtain corresponding source text enhancement feature maps and target style enhancement feature maps; Performing pooling dimensionality reduction processing on the source text enhancement feature map and the target style enhancement feature map to obtain a source text pooling feature representation and a target style pooling feature representation; Performing a nonlinear activation function transformation on the source text pooling feature representation and the target style pooling feature representation to obtain a source text activation feature map and a target style activation feature map; Performing multi-layer feature fusion on the source text activation feature map and the target style activation feature map to obtain a source text fusion feature representation and a target style fusion feature representation; Performing attention weighting processing on the source text fusion feature representation and the target style fusion feature representation to obtain source text attention weighted features and target style attention weighted features; According to the preset fully connected layer, feature dimensionality reduction processing is performed on the source text attention weighted features and the target style attention weighted features respectively to obtain corresponding source text style features and target style features.

4. The text style conversion control method according to claim 1, wherein: The determining of the target style feature conversion parameter according to the source text style feature and the target style feature includes: Calculating feature differences between the source text style feature and the target style feature to obtain a feature difference vector; Performing parameter mapping on the feature difference vector to obtain initial style feature conversion parameters; Parameter optimization is performed on the initial style feature conversion parameters to obtain target style feature conversion parameters.

5. The text style conversion control method according to claim 4, wherein: Optimizing the initial style feature conversion parameters to obtain target style feature conversion parameters includes: Generating positive sample parameters and negative sample parameters according to the initial style feature conversion parameters; Generate a style conversion loss function according to the positive sample parameters, the negative sample parameters, and a preset contrast factor; Minimizing the style conversion loss function to obtain a minimum style conversion loss function; A style similarity loss term, a style diversity loss term, and a content preservation loss term of the minimum style conversion loss function are obtained, and the initial style feature conversion parameters are optimized according to the style similarity loss term, the style diversity loss term, and the content preservation loss term to obtain target style feature conversion parameters.

6. The text style conversion control method according to claim 1, wherein: The step of performing text encoding on the source text sequence to obtain a source encoded text sequence includes: Determining the dependency relationship of the source text according to the source text sequence; Taking each source word in the source text sequence as a vertex and the dependency relationship as an edge between the vertices; Constructing a source word-meta node graph according to the vertices and the edges, and extracting word-meta initial features of each word-meta node in the source word-meta node graph; Performing feature encoding on the initial features of the word unit to obtain encoding features of each word unit node; Aggregation processing is performed on the encoding features to obtain a source encoding text sequence.

7. The text style conversion control method according to claim 1, wherein: The performing style conversion on the source encoded text sequence according to the target style feature conversion parameter to obtain the target style text includes: Performing an affine transformation on the source coded text sequence according to the target style feature conversion parameters to obtain an intermediate coded text sequence; Performing context consistency check on the intermediate encoded text sequence to obtain a style-enhanced encoded text sequence; Sequentially decoding the style-enhanced encoded text sequence to obtain a style-enhanced decoded text sequence; Generate corresponding target style text according to the style enhanced decoded text sequence.

8. A text style conversion control device, characterized in that: The device comprises: A text segmentation module is used to obtain a source text and a target style description text, and perform text segmentation on the source text and the target style description text respectively to obtain a corresponding source text sequence and a target style sequence; A style feature extraction module, configured to extract style features from the source text sequence and the target style sequence respectively, to obtain corresponding source text style features and target style features; A conversion parameter generation module, configured to determine a target style feature conversion parameter based on the source text style feature and the target style feature; A text encoding module, configured to perform text encoding on the source text sequence to obtain a source encoded text sequence; The style conversion module is used to perform style conversion on the source encoded text sequence according to the target style feature conversion parameters to obtain a target style text.

9. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the text style conversion control method according to any one of claims 1 to 7.

10. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the text style conversion control method according to any one of claims 1 to 7 is implemented.