A text style quantification method based on a multi-dimensional humanistic orthogonal space
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-04-30
- Publication Date
- 2026-08-11
AI Technical Summary
该路径的缺陷在于:特征集合的完备性完全受限于专家经验,难以覆盖风格的全部表现形态,大量深层次风格要素无法被显式提取;各统计特征之间普遍存在信息冗余,例如平均句长与特定语法结构频次彼此高度关联,导致特征表示效率低下;同时,固定的特征模板面对体裁迁移时适应性差,无法捕捉风格在不同文类中的展现差异
[0059]本发明的技术贡献在于,首次将文本风格建模为由多个相互正交的可解释维度张成的向量空间,实现了风格要素的独立量化与操控。相较于现有技术将风格视为不可分整体的做法,本发明的正交空间结构使得在保持其他维度不变的前提下单独调节某一风格维度成为可能。
Smart Images

Figure CN122549417A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of natural language processing and artificial intelligence text analysis technology, specifically to a text style quantification method and system based on a multidimensional human orthogonal space. Background Technology
[0002] Text style analysis is one of the core problems in the field of natural language processing, and it has important application value in scenarios such as author identification, sentiment analysis, and content generation control.
[0003] Existing text style analysis techniques, regardless of the implementation path, all suffer from common defects that are difficult to overcome.
[0004] One type of technical solution relies on manually defined feature engineering. This approach involves domain experts pre-designing statistical indicators at the lexical, syntactic, and textual levels, such as word frequency, average sentence length, and density of specific sentiment words. The text is then converted into feature vectors and input into a classifier for style determination. The drawbacks of this approach are: the completeness of the feature set is entirely limited by expert experience, making it difficult to cover all stylistic manifestations, and many deep-level stylistic elements cannot be explicitly extracted; information redundancy is prevalent among statistical features, for example, average sentence length and the frequency of specific grammatical structures are highly correlated, leading to low feature representation efficiency; furthermore, fixed feature templates have poor adaptability to genre transfer, failing to capture stylistic differences across different text types.
[0005] Another approach utilizes pre-trained deep neural networks to encode the entire text into a fixed-length vector in the latent space, directly performing style classification or similarity calculations based on this vector. While this method can automatically learn representations, its inherent flaws are more pronounced: the output encoded vector is a black-box representation, with each dimension lacking interpretable humanistic meaning, making it impossible for users to discern the strength of specific style elements such as "emotional temperature" and "narrative distance"; because all style information is indivisibly compressed into the same vector, it is impossible to independently manipulate a single style dimension, for example, adjusting the narrative distance while maintaining emotional temperature is not feasible; furthermore, such models are extremely sensitive to genre, and models that perform well in poetry often experience a sharp decline in performance when transferred to novels or dramatic texts, demonstrating insufficient generalization ability.
[0006] The common root of both approaches lies in treating text style as an indivisible whole, failing to break it down into independent, quantifiable, and manipulable atomic dimensions. This results in existing technologies being unable to provide interpretable, fine-grained measurements of style, nor can they support sophisticated style generation control, making it difficult to meet the dual demands of style quantification and manipulation in application scenarios such as author identification and content generation guidance.
[0007] Therefore, there is an urgent need for a technical solution that can decompose style into mutually independent interpretable dimensions and can be finely quantified and controlled. Summary of the Invention
[0008] The purpose of this invention is to provide a text style quantification method based on a multidimensional humanistic orthogonal space, comprising the following steps:
[0009] Receive the text to be analyzed;
[0010] The text to be analyzed is mapped to a pre-constructed multidimensional humanistic orthogonal space; the multidimensional humanistic orthogonal space includes at least eight mutually orthogonal basic dimensions of text style; the basic dimensions of text style include: narrative distance, emotional temperature, power relations, sense of time, certainty, sense of body, time orientation, and social script.
[0011] In the multidimensional humanistic orthogonal space, the projection scores of the text to be analyzed on each basic dimension of text style are calculated to obtain a multidimensional style vector;
[0012] Based on the weighted cosine similarity between the multidimensional style vector and the target style vector, the style quantization score of the text to be analyzed is output.
[0013] Furthermore, narrative distance is the normalized difference between the frequency of first-person pronouns and the frequency of third-person pronouns in the text to be analyzed;
[0014] Emotional temperature is the normalized difference between the frequency of positive emotional words and the frequency of negative emotional words in the text to be analyzed;
[0015] The method for determining positive and negative sentiment words is as follows: the text to be analyzed is matched with a pre-stored positive and negative sentiment word library to determine the positive and negative sentiment words in the text to be analyzed.
[0016] Power relations are the normalized differences between the frequencies of high-power words and low-power words in the text to be analyzed.
[0017] The method for determining high-power words and low-power words is as follows: the text to be analyzed is matched with a pre-stored high-power word library and low-power word library to determine the high-power words and low-power words in the text to be analyzed.
[0018] The sense of time is the normalized difference between the frequency of past tense markers and the frequency of future tense markers in the text to be analyzed;
[0019] Certainty is the normalized difference between the frequency of absolute terms and the frequency of vague terms in the text to be analyzed;
[0020] Body sensation refers to the frequency multiple of words related to body parts and sensory organs in the text to be analyzed;
[0021] The time orientation includes past, present, and future orientations, which are determined by the frequency of occurrence of past, present, and future orientation words in the text to be analyzed;
[0022] The social script is the frequency multiple of social role nouns and social scene nouns in the text to be analyzed.
[0023] Furthermore, the construction steps of the multidimensional humanistic orthogonal space include:
[0024] Using a pre-trained RoBERTa-large model as an encoder, we extract the contextual hidden layer representation of a large-scale text corpus to obtain a real-valued vector of fixed length.
[0025] Perform principal component analysis on the real-valued vectors to extract the first K principal components representing the basic style dimension directions; K ≥ 8;
[0026] By orthogonalizing the principal components, a multidimensional humanistic orthogonal space is obtained.
[0027] The RoBERTa-large model is pre-trained using an unsupervised contrastive learning method. The unsupervised contrastive learning uses the SimCLR framework, with positive examples being different text paragraphs by the same author and negative examples being text paragraphs by different authors.
[0028] Furthermore, the step of calculating the projection scores of the text to be analyzed on each basic dimension of text style includes:
[0029] For each basic dimension of text style, the pre-trained scoring model corresponding to that dimension is called, and the projection score is calculated using the pre-trained scoring model.
[0030] The input to the pre-trained scoring model is the text to be analyzed, and the output is the projection score of the text to be analyzed on the corresponding basic dimension of text style.
[0031] The scoring model is trained on corpora labeled with intensity tags for that dimension;
[0032] The projection score is a continuous value, normalized to the interval [0,1].
[0033] Furthermore, the scoring model is a BERT regression model, with the input being the text to be analyzed and the output being the projected score in the [0,1] interval; the scoring models corresponding to the basic dimensions of different text styles are trained independently.
[0034] The BERT regression model consists of an input layer, an encoding layer, a regression layer, and an output layer.
[0035] The input layer is used to receive the text to be analyzed;
[0036] The encoding layer performs context-aware encoding on the text to be analyzed, resulting in a text aggregation vector representation.
[0037] The regression layer projects the text aggregation vector representation as a one-dimensional scalar;
[0038] The output layer activates a one-dimensional scalar using the sigmoid function, compresses it to the (0,1) interval, and obtains the projection score.
[0039] Furthermore, the similarity is a weighted cosine similarity, where the weight of each dimension is dynamically determined according to the genre of the text to be analyzed.
[0040] Furthermore, the target style includes at least poetry, novels, drama, and prose;
[0041] The target style vector can be obtained in the following two ways:
[0042] The first method involves the user selecting a target style from a list of candidate target styles; and then retrieving the target style vector corresponding to the selected target style from a pre-stored database of candidate target style vectors.
[0043] The second method involves users uploading text with a target style, and using a pre-trained RoBERTa-large model to extract the target style vector corresponding to the text.
[0044] Furthermore, the style quantification score is used for at least one of the following:
[0045] Determine whether the text to be analyzed conforms to the target style. If it does not conform, output a dimension deviation vector to reflect the degree of deviation of the text from the target style in each dimension; if it conforms, output the conformity determination and style quantification score.
[0046] Filter texts from multiple candidate texts to select those that match the target style;
[0047] As a constraint, it guides the large language model to generate text that conforms to the target style.
[0048] Furthermore, the constraint-guided generation of the large language model includes:
[0049] During the generation process, multidimensional style vectors of the generated text portions are calculated in real time.
[0050] Calculate the deviation between the multidimensional style vector of the generated text portion and the target style vector;
[0051] Map the bias to the sampling preference of the token;
[0052] Based on the sampling preference of the token, update the sampling probability distribution of the next token, and sample the next token until text that matches the target style is generated.
[0053] A text style quantification system using the method described above includes:
[0054] The spatial mapping module is used to map the text to be analyzed to a multidimensional human orthogonal space;
[0055] The dimension scoring module is used to calculate the projection scores of the text to be analyzed on each basic dimension.
[0056] The similarity calculation module is used to output a style quantization score based on the similarity between the multidimensional style vector and the target style vector.
[0057] An electronic device includes a processor and a memory, the memory storing a computer program, the processor executing the program to implement the method described above.
[0058] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described above.
[0059] The technical contribution of this invention lies in the fact that it is the first to model text style as a vector space spanned by multiple mutually orthogonal interpretable dimensions, thereby enabling the independent quantification and manipulation of style elements. Compared to existing technologies that treat style as an indivisible whole, the orthogonal space structure of this invention makes it possible to adjust a specific style dimension independently while keeping other dimensions unchanged. Attached Figure Description
[0060] Figure 1 This is an overall flowchart of the method of the present invention.
[0061] Figure 2 This is a module architecture diagram of the system of the present invention. Detailed Implementation
[0062] The present invention will be further described below with reference to embodiments, but it should not be construed that the scope of the present invention is limited to the following embodiments. Various substitutions and modifications made based on ordinary technical knowledge and common practices in the art without departing from the above-described technical concept of the present invention should be included within the scope of protection of the present invention.
[0063] Example 1:
[0064] A text style quantification method based on a multidimensional humanistic orthogonal space includes the following steps:
[0065] Receive the text to be analyzed;
[0066] The text to be analyzed is mapped to a pre-constructed multidimensional humanistic orthogonal space; the multidimensional humanistic orthogonal space includes at least eight mutually orthogonal basic dimensions of text style; the basic dimensions of text style include: narrative distance, emotional temperature, power relations, sense of time, certainty, sense of body, time orientation, and social script.
[0067] In the multidimensional humanistic orthogonal space, the projection scores of the text to be analyzed on each basic dimension of text style are calculated to obtain a multidimensional style vector;
[0068] Based on the weighted cosine similarity between the multidimensional style vector and the target style vector, the style quantization score of the text to be analyzed is output.
[0069] Example 2:
[0070] A text style quantification method based on multidimensional humanistic orthogonal space, with the same technical content as in Example 1, further wherein narrative distance is the frequency of first-person pronouns (I, we) in the text to be analyzed. Frequency of occurrence with third-person pronouns (he, she, it, etc.) The normalized difference, i.e. ; To prevent constants with a denominator of 0;
[0071] The normalized difference ranges from [-1, 1], with the closer it is to 1, the more the narrative leans towards a first-person close-up.
[0072] The judgment method is as follows: match the text to be analyzed with the pre-stored first-person pronoun library and third-person pronoun library to determine the first-person pronouns and third-person pronouns in the text to be analyzed;
[0073] The first-person pronoun corpus and the third-person pronoun corpus were determined by expert scoring, and the subjects were large-scale text corpora.
[0074] Emotional temperature is the frequency of positive emotional words in the text to be analyzed. With negative emotions The normalized difference in word frequency, i.e. ;
[0075] The method for determining positive and negative sentiment words is as follows: the text to be analyzed is matched with a pre-stored positive and negative sentiment word library to determine the positive and negative sentiment words in the text to be analyzed; the words in the positive and negative sentiment word libraries are determined by expert scoring, and the object is a large-scale text corpus.
[0076] Power relations are determined by the frequency of high-power words (command, must, etc.) in the text to be analyzed. Frequent occurrence of low-power words (request, yes / no, etc.) The normalized difference, i.e. ;
[0077] The method for determining high-power words and low-power words is as follows: the text to be analyzed is matched with a pre-stored high-power word library and low-power word library to determine the high-power words and low-power words in the text to be analyzed; the words in the high-power word library and low-power word library are determined by expert scoring method, and the object is a large-scale text corpus.
[0078] The sense of time refers to the frequency of past tense markers (such as "once," "in the past," etc.) in the text to be analyzed. Frequency of occurrence with future tense markers (will, future, etc.) The normalized difference, i.e. ; Present tense marker;
[0079] The determination method is as follows: match the text to be analyzed with the pre-stored past tense marker vocabulary, future tense marker vocabulary, and present tense marker vocabulary to determine the past tense marker words, future tense marker words, and present tense marker words;
[0080] The words in the past tense marker lexicon, future tense marker lexicon, and present tense marker lexicon were determined by expert scoring, and the subject was a large-scale text corpus.
[0081] Certainty refers to the frequency of absolute terms (certain, inevitable, etc.) in the text to be analyzed. Frequency of occurrence with vague expressions (perhaps, probably, etc.) The normalized difference, i.e. ;
[0082] The judgment method is as follows: match the text to be analyzed with the pre-stored absolute expression lexicon and fuzzy expression lexicon to determine the absolute expression words and fuzzy expression words;
[0083] The words in the absolute and fuzzy expression vocabularies were determined by expert scoring, and the objects were large-scale text corpora.
[0084] The frequency of body part words in the text to be analyzed. Frequency of sensory words The multiplier (k), that is ; The total number of words in the text to be analyzed; a word is an indivisible entity unit in the text.
[0085] The determination method is as follows: match the text to be analyzed with the pre-stored body part lexicon and sensory lexicon to determine the body part words and sensory words;
[0086] The body part lexicon and sensory lexicon were determined by expert scoring and were based on a large-scale text corpus.
[0087] The time pointer includes past pointer, present pointer, and future pointer, which is determined by the frequency of occurrence of past pointer words, present pointer words, and future pointer words in the text to be analyzed. The pointer corresponding to the highest frequency of occurrence is the current time pointer.
[0088] The social script is the frequency of social role nouns in the text to be analyzed. Frequency of occurrence of terms related to social scenarios The multiplier ( ),Right now .
[0089] Large-scale corpora include:
[0090] Poetry genres: no fewer than 100 poems, covering classical and modern poetry;
[0091] Novel genre: No fewer than 100 chapters or short stories, covering classical novels and modern and contemporary novels;
[0092] Theatrical scripts should consist of no fewer than 50 acts or scenes, covering both classical opera and modern spoken drama.
[0093] Example 3:
[0094] A text style quantification method based on a multidimensional humanistic orthogonal space, with the same technical content as any one of embodiments 1-2, further comprising the following steps for constructing the multidimensional humanistic orthogonal space:
[0095] Using a pre-trained RoBERTa-large model as an encoder, we extract the contextual hidden layer representation of a large-scale text corpus to obtain a real-valued vector of fixed length.
[0096] Perform principal component analysis on the real-valued vectors to extract the first K principal components representing the basic style dimension directions; K ≥ 8;
[0097] By orthogonalizing the principal components, a multidimensional humanistic orthogonal space is obtained.
[0098] The RoBERTa-large model is pre-trained using an unsupervised contrastive learning method. The unsupervised contrastive learning uses the SimCLR framework, with positive examples being different text paragraphs by the same author and negative examples being text paragraphs by different authors.
[0099] Example 4:
[0100] A text style quantification method based on a multidimensional humanistic orthogonal space, with technical content identical to any one of embodiments 1-3, further comprising the steps of calculating the projection scores of the text to be analyzed on each basic dimension of text style, including:
[0101] For each basic dimension of text style, the pre-trained scoring model corresponding to that dimension is called, and the projection score is calculated using the pre-trained scoring model.
[0102] The input to the pre-trained scoring model is the text to be analyzed, and the output is the projection score of the text to be analyzed on the corresponding basic dimension of text style.
[0103] The scoring model is trained on corpora labeled with intensity tags for that dimension;
[0104] The projection score is a continuous value, normalized to the interval [0,1].
[0105] Example 5:
[0106] A text style quantification method based on a multidimensional humanistic orthogonal space, with the same technical content as any one of embodiments 1-4. Further, the scoring model is a BERT regression model, with the input being the text to be analyzed and the output being the projected score in the interval [0,1]. The scoring models corresponding to different basic dimensions of text style are trained independently.
[0107] The BERT regression model consists of an input layer, an encoding layer, a regression layer, and an output layer.
[0108] The input layer is used to receive the text to be analyzed;
[0109] The encoding layer performs context-aware encoding on the text to be analyzed, resulting in a text aggregation vector representation.
[0110] The regression layer projects the text aggregation vector representation as a one-dimensional scalar;
[0111] The output layer activates a one-dimensional scalar using the sigmoid function, compresses it to the (0,1) interval, and obtains the projection score.
[0112] Example 6:
[0113] A text style quantification method based on multidimensional humanistic orthogonal space, with the same technical content as any one of embodiments 1-5, further wherein the similarity is a weighted cosine similarity, wherein the weight of each dimension is dynamically determined according to the genre type of the text to be analyzed.
[0114] The dynamic determination follows a preset genre-weight mapping table:
[0115] When the genre is poetry, the weight of emotional temperature, physical sensation, and sense of time increases;
[0116] When the genre is novel, the weight of narrative distance, power relations, and social script increases;
[0117] When the genre is drama, the weight of power relations and time orientation increases.
[0118] For example, when the genre is poetry, the weighting is as follows: emotional temperature 0.25, bodily sensation 0.25, temporal sensation 0.20, narrative distance 0.10, certainty 0.10, power relations 0.05, temporal orientation 0.03, and social script 0.02;
[0119] When the genre is novel, the weighting is as follows: narrative distance 0.30, power relations 0.25, social script 0.25, emotional temperature 0.05, physical sensation 0.05, sense of time 0.05, certainty 0.03, and time orientation 0.02;
[0120] When the genre is drama, the weighting is as follows: power relations 0.30, time orientation 0.25, social script 0.25, emotional temperature 0.05, physical sensation 0.05, time sensation 0.05, certainty 0.03, narrative distance 0.02.
[0121] Example 7:
[0122] A text style quantification method based on a multidimensional humanistic orthogonal space, with the same technical content as any one of embodiments 1-6, further wherein the target style includes at least poetry, novels, dramas, and essays;
[0123] The target style vector can be obtained in the following three ways:
[0124] Method 1: The system pre-collects a set of exemplary texts representing a specific target style, calculates the multidimensional style vector for each text, and takes the arithmetic mean of the style vectors of all exemplary texts as the target style vector, storing it in the system. When the user uses the system, they select the target style from the preset style list, and the system automatically retrieves the corresponding pre-stored vector. For example, the target vector for a certain poetry style is [0.32, 0.78, 0.21, 0.65, 0.45, 0.82, 0.58, 0.19], which is obtained by averaging the style vectors of 127 exemplary poems.
[0125] Method 2: Users can upload one or more representative texts that they consider "ideal." The system calculates a multidimensional style vector for each uploaded text, takes the average, and uses this average as the target style vector for the analysis. This mode allows users to dynamically define style standards based on their personal aesthetic preferences.
[0126] Method 3: The system automatically identifies the genre type of the text to be analyzed and automatically matches the target style vector corresponding to the genre type from the pre-stored target style vector database.
[0127] Example 8:
[0128] A text style quantification method based on a multidimensional humanistic orthogonal space, with the same technical content as any one of embodiments 1-7, further wherein the style quantification score is used for at least one of the following:
[0129] The system determines whether the text to be analyzed conforms to the target style. If it does not conform, a dimensional deviation vector is output to reflect the degree of deviation of the text from the target style in each dimension. Based on the dimensional deviation vector, text correction suggestions are generated, which include the names of the dimensions with significant deviations and the suggested correction directions. If the text conforms, a conformity determination and a style quantification score are output.
[0130] Filter texts from multiple candidate texts to select those that match the target style;
[0131] As a constraint, it guides the large language model to generate text that conforms to the target style.
[0132] Example 9:
[0133] A text style quantification method based on a multidimensional humanistic orthogonal space, with technical content identical to any one of embodiments 1-8, further comprising the following:
[0134] During the generation process, multidimensional style vectors of the generated text portions are calculated in real time.
[0135] Calculate the multidimensional style vector of the generated text portion With the target style vector deviation ;
[0136] Mapping style bias to token sampling preferences: The bias vector Through a mapping matrix Convert to a style impact score for each candidate token in the vocabulary: ;
[0137] in: The logit adjustment amount for the i-th candidate token in the vocabulary; To control the intensity hyperparameter, a value of 2.0 is recommended to control the strength of the style constraint. This represents the deviation value in the k-th dimension. Let be an element of the mapping matrix G, representing the i-th element. The style loading on the k-th style dimension. The G matrix is obtained by: for each style dimension in a large-scale corpus... Score the style dimension based on the context, and count each The average score of each style dimension when it appears forms The correlation matrix with style dimensions;
[0138] Adjust the token sampling probability distribution:
[0139] The original output of the large language model vector is Where V is the vocabulary size. (Adjusted) The vector is: The adjusted Convert to a sampling probability distribution using the Softmax function:
[0140]
[0141] Based on P(token), the next token is sampled, increasing the sampling probability of tokens that can reduce the deviation from the target style and decreasing the probability of tokens that may amplify the deviation.
[0142] The process iterates token by token, repeating the above steps for each newly generated token until all tokens are generated. Through this closed-loop feedback control, the final generated text style vector will stably approximate the target style vector.
[0143] Example 10:
[0144] A text style quantization system using the method described in any one of Examples 1-9, comprising:
[0145] The spatial mapping module is used to map the text to be analyzed to a multidimensional human orthogonal space;
[0146] The dimension scoring module is used to calculate the projection scores of the text to be analyzed on each basic dimension.
[0147] The similarity calculation module is used to output a style quantization score based on the similarity between the multidimensional style vector and the target style vector.
[0148] Example 11:
[0149] An electronic device includes a processor and a memory, the memory storing a computer program, the processor executing the program to implement the method as described in Examples 1-9.
[0150] Example 12:
[0151] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in Examples 1-9.
[0152] Example 13:
[0153] A computer system for text style quantization, comprising a user terminal, an edge computing terminal, and a server terminal;
[0154] The user terminal is a mobile or fixed terminal such as a mobile phone or computer;
[0155] The user terminal obtains the text to be analyzed from the user;
[0156] The edge computing terminal executes the method described in Examples 1-9; during execution, the edge computing terminal calls the database and model stored on the server.
[0157] Example 14:
[0158] A text style quantification method based on a multidimensional humanistic orthogonal space is provided. The technical content is the same as any one of embodiments 1-9. Furthermore, this embodiment describes in detail how to construct a usable eight-dimensional humanistic orthogonal space.
[0159] S1 Corpus Preparation
[0160] Chinese text corpora were collected from publicly available data sources to ensure genre diversity: poetry (20GB, including classical and modern poetry), novels (30GB, including classical novels, contemporary novels, and online novels), essays (15GB), drama scripts (5GB), news articles (20GB), and academic papers (10GB). The total size is approximately 100GB.
[0161] The corpus is preprocessed as follows: it is uniformly encoded as UTF-8, HTML tags and garbled characters are removed, and the text is segmented into paragraphs with no more than 512 tokens (to adapt to the input length limit of BERT).
[0162] S2 Comparative Learning Training
[0163] Encoder: Using the Chinese version of RoBERTa-large, a two-layer fully connected network (1024→512→1024) is added after the output marked [CLS] as a projection head. The final output is a 1024-dimensional latent factor vector.
[0164] Training framework: SimCLR. Each batch contains N text segments. For each segment, two augmented views are generated using different dropout masks, forming a positive pair. The other 2(N-1) views within the same batch are used as negative examples. The loss function is NT-Xent, with the temperature parameter set to 0.1.
[0165] Training configuration: batch size 512, learning rate 3e-4, optimizer AdamW, trained for 3 epochs on 8 V100 GPUs.
[0166] S3 Orthogonalization
[0167] After training, the encoder (excluding the projector head) extracts the [CLS] output for each paragraph of the entire corpus, resulting in a 1024-dimensional vector. One million vectors are then randomly sampled for PCA analysis.
[0168] PCA results: The first 8 principal components explained a cumulative variance of 68.7%. The loading matrix of these 8 principal components is taken as (1024×8).
[0169] Apply a Varimax rotation to the loading matrix. In the rotated loading matrix, each of the original dimensions (one of the 1024 dimensions) has a high loading (absolute value > 0.5) on one principal component, while the loading on other principal components is close to 0.
[0170] Verifying orthogonality: Calculate the scores of 1 million samples on the principal components after 8 rotations, and calculate the Pearson correlation coefficients between each pair of samples. The maximum correlation coefficient is 0.08 (between emotional temperature and physical sensation), satisfying the orthogonality requirement of <0.1.
[0171] S4 Dimension Naming
[0172] Observe the text paragraphs with the highest scores and high-load words for each principal component:
[0173] Component 1: High-scoring texts are mostly narrated in the first person, with high-loaded words being "I," "we," and "myself." This is termed "narrative distance," with high scores indicating close-up / first-person perspective.
[0174] Component 2, high-scoring texts, contain a large number of positive words, with "happiness," "beauty," and "joy" being the most loaded words. This is termed "emotional temperature," with a high score indicating a positive outlook.
[0175] Component 3 high-scoring texts often contain superior-subordinate dialogues, with high-loaded words being "command," "request," and "permission." Named "Power Relationship," high scores indicate unequal power dynamics.
[0176] Component 4, high-scoring texts, frequently use the past tense, with high-loaded words being "once," "at that time," and "memory." Named "Sense of Time," high scores indicate a return to the past.
[0177] Component 5, high-scoring texts, contain numerous absolute statements, with high-loaded words such as "certain," "inevitable," and "absolute." Named "certainty," a high score indicates absolute certainty.
[0178] Component 6, a high-scoring text, features multi-sensory descriptions, with high-loaded words being "pain," "warmth," and "fragrance." Named "body sensation," the high score indicates a prominent emphasis on bodily perception.
[0179] Component 7, a high-scoring text, covers a large time span, with high-loaded words including "years," "many years," and "long." Named "Time-Oriented," a high score indicates a large time span.
[0180] Component 8, a high-scoring text, features numerous social scenarios, with high-loaded words including "gathering," "meeting," and "visit." Named "Social Script," a high score indicates strong social interaction.
[0181] S1.5 scoring model training
[0182] For each dimension, a separate scoring model is trained. The model structure is BERT-base-Chinese with a linear output layer, outputting scores in the [0,1] interval.
[0183] Training data: 20,000 paragraphs were extracted from the corpus, and 5 annotators scored 8 dimensions (1-5 points). The average value was taken and normalized to [0,1] as the label.
[0184] Training configuration: learning rate 2e-5, batch size 32, training for 3 epochs. The mean absolute error (MAE) of the model on the validation set for each dimension is between 0.08 and 0.12.
[0185] At this point, the multidimensional humanistic orthogonal space has been constructed and can be used for style quantification of any text.
[0186] Example 15:
[0187] A text style quantification method based on multidimensional humanistic orthogonal space, with technical content the same as any one of embodiments 1-9. Furthermore, this embodiment provides a method for quantifying and screening poetic styles, taking the target style "Zhao Jiayin Iris Poems" as an example.
[0188] S1 Obtain the target style vector
[0189] 127 representative poems by Zhao Jiayin were collected. Each poem was input into the system constructed in Example 1 to obtain 127 eight-dimensional style vectors. The mean vector V_target = [0.32, 0.78, 0.21, 0.65, 0.45, 0.82, 0.58, 0.19] was calculated.
[0190] S2 Candidate Poetry Evaluation
[0191] 1000 modern poems were collected from the internet as a candidate set. A style vector V_candidate was calculated for each poem.
[0192] According to Quan8's genre-weight mapping table, the dimensional weights for poetry genres are as follows: emotional temperature 0.25, bodily sensation 0.25, temporal sensation 0.20, narrative distance 0.10, certainty 0.10, power relations 0.05, temporal orientation 0.03, and social script 0.02.
[0193] Calculate the weighted cosine similarity between V_candidate and V_target, and map it to the style quantization score p∈[0,1].
[0194] S3 Filtering Results
[0195] A threshold of 0.7 was set, and 47 poems with p ≥ 0.7 were selected. After manual review, 41 of these poems were found to indeed exhibit Iris-style characteristics (accuracy rate 87.2%). The selected poems were close to the target values in terms of emotional temperature, physical sensation, and temporal sensation.
[0196] Example 16:
[0197] A text style quantification method based on multidimensional humanistic orthogonal space, with the same technical content as any one of embodiments 1-9. Furthermore, this embodiment provides a method for guiding text generation using style vectors, taking the generation of a new poem with an iris poem style as an example.
[0198] S1 initialization
[0199] GPT-3 was used as the generative model. The V_target obtained in Example 2 was used as the target style vector. The control intensity hyperparameter λ was set to 2.0.
[0200] S2 token generation control
[0201] Input prompt: "Write a poem about autumn:"
[0202] When generating the first token, the already generated portion is empty, and the first token is generated directly by sampling from the original probability distribution of GPT-3. From the second token onwards, control is performed according to the following deviation adjustment logic.
[0203] After generating the 10th token, the generated text is "Autumn wind rises, leaves fall". Calculate V_current=[0.30,0.65, 0.20, 0.70, 0.40, 0.55, 0.60, 0.15].
[0204] Calculate the deviation ΔV = V_target - V_current = [0.02, 0.13, 0.01, -0.05, 0.05, 0.27, -0.02, 0.04].
[0205] The dimensions with the largest deviations are "physical sensation" (0.27) and "emotional temperature" (0.13), indicating that the currently generated text is insufficient in these two dimensions.
[0206] Calculate logit_bias = λ·ΔV·G, where G is the word embedding matrix. This operation increases the logit value of words that enhance physical sensation and emotional temperature (such as sensory words and positive emotion words).
[0207] The next token is generated. During sampling, the logit_bias influences the selection of words that have both physical and emotional connotations, such as "chill", "desolate", and "golden".
[0208] S3 generation results
[0209] The final generated poem is as follows:
[0210] "The autumn wind brings a chill, / Fallen leaves tremble in my palm. / Golden silence, / Spreads across the hillside, / Like that farewell many years ago. / I stand here, / Waiting for a snow that will never come."
[0211] The final style vector is calculated to be [0.33, 0.76, 0.22, 0.63, 0.46, 0.80, 0.56, 0.18], which has a similarity of 0.89 with V_target, and is therefore determined to be a compliant iris poem.
[0212] Example 17:
[0213] This embodiment provides a specific implementation architecture for a text style quantification system, such as... Figure 2 As shown.
[0214] Space construction module: Executed offline, it completes the orthogonal space construction process described in Example 1 and outputs dimensional scoring model files (8) and orthogonalization parameter files.
[0215] Spatial Mapping Module: Loads dimensional scoring model files, receives the text to be analyzed, calls 8 scoring models, outputs 8 projected scores, and forms a multidimensional style vector.
[0216] Genre Recognition Module: Uses a pre-trained text classification model to identify the genre (poetry / novel / drama / other) of the text to be analyzed.
[0217] Weight adjustment module: Stores the genre-weight mapping table, and calculates the weights based on the similarity of each dimension output by the genre recognition results.
[0218] Similarity calculation module: Loads the target style vector, receives the multi-dimensional style vector and dimensional weights, calculates the weighted cosine similarity, maps and outputs the style quantization score.
[0219] Application Interface Module: Provides a RESTful API, accepts text input, and returns style quantification scores and scores for each dimension. It supports three modes: style judgment, filtering, and generation control.
[0220] The system is deployed on a cloud server, containerized using Docker, and supports horizontal scaling.
Claims
1. A method for quantifying text style based on a multi-dimensional humanistic orthogonal space, characterized in that, Including the following steps: Receive the text to be analyzed; The text to be analyzed is mapped to a pre-constructed multidimensional humanistic orthogonal space; The multidimensional humanistic orthogonal space includes at least eight mutually orthogonal basic dimensions of text style; The basic dimensions of text style include: narrative distance, emotional temperature, power relations, sense of time, certainty, sense of body, time orientation, and social script. In the multidimensional humanistic orthogonal space, the projection scores of the text to be analyzed on each basic dimension of text style are calculated to obtain a multidimensional style vector; Based on the weighted cosine similarity between the multidimensional style vector and the target style vector, the style quantization score of the text to be analyzed is output. 2.The method of claim 1, wherein, Narrative distance is the normalized difference between the frequency of first-person pronouns and the frequency of third-person pronouns in the text to be analyzed. Emotional temperature is the normalized difference between the frequency of positive emotional words and the frequency of negative emotional words in the text to be analyzed; The method for determining positive and negative sentiment words is as follows: the text to be analyzed is matched with a pre-stored positive and negative sentiment word library to determine the positive and negative sentiment words in the text to be analyzed. Power relations are the normalized differences between the frequencies of high-power words and low-power words in the text to be analyzed. The method for determining high-power words and low-power words is as follows: the text to be analyzed is matched with a pre-stored high-power word library and low-power word library to determine the high-power words and low-power words in the text to be analyzed. The sense of time is the normalized difference between the frequency of past tense markers and the frequency of future tense markers in the text to be analyzed; Certainty is the normalized difference between the frequency of absolute terms and the frequency of vague terms in the text to be analyzed; Body sensation refers to the frequency multiple of words related to body parts and sensory organs in the text to be analyzed; The time orientation includes past, present, and future orientations, which are determined by the frequency of occurrence of past, present, and future orientation words in the text to be analyzed; The social script is the frequency multiple of social role nouns and social scene nouns in the text to be analyzed. 3.The method of claim 1, wherein, The steps for constructing the multidimensional human orthogonal space include: Using a pre-trained RoBERTa-large model as an encoder, we extract the contextual hidden layer representation of a large-scale text corpus to obtain a real-valued vector of fixed length. Perform principal component analysis on the real-valued vectors to extract the first K principal components representing the basic style dimension directions; K ≥ 8; By orthogonalizing the principal components, a multidimensional humanistic orthogonal space is obtained. The RoBERTa-large model is pre-trained using an unsupervised contrastive learning method. The unsupervised contrastive learning uses the SimCLR framework, with positive examples being different text paragraphs by the same author and negative examples being text paragraphs by different authors.
4. The method of claim 1, wherein, The steps for calculating the projection scores of the text to be analyzed on each basic dimension of text style include: For each basic dimension of text style, the pre-trained scoring model corresponding to that dimension is called, and the projection score is calculated using the pre-trained scoring model. The input to the pre-trained scoring model is the text to be analyzed, and the output is the projection score of the text to be analyzed on the corresponding basic dimension of text style. The scoring model is trained on corpora labeled with intensity tags for that dimension; The projection score is a continuous value, normalized to the interval [0,1].
5. The method of claim 1, wherein, The scoring model is a BERT regression model, with the input being the text to be analyzed and the output being the projected score in the interval [0,1]. The scoring models corresponding to the basic dimensions of different text styles are trained independently. The BERT regression model consists of an input layer, an encoding layer, a regression layer, and an output layer. The input layer is used to receive the text to be analyzed; The encoding layer performs context-aware encoding on the text to be analyzed, resulting in a text aggregation vector representation. The regression layer projects the text aggregation vector representation as a one-dimensional scalar; The output layer activates a one-dimensional scalar using the sigmoid function, compresses it to the (0,1) interval, and obtains the projection score.
6. The method of claim 1, wherein, The similarity is a weighted cosine similarity, where the weight of each dimension is dynamically determined according to the genre of the text to be analyzed.
7. The method of claim 1, wherein, The target styles include at least poetry, novels, and drama; The target style vector can be obtained in the following two ways: The first method involves the user selecting a target style from a list of candidate target styles; and then retrieving the target style vector corresponding to the selected target style from a pre-stored database of candidate target style vectors. The second method involves users uploading text with a target style, and using a pre-trained RoBERTa-large model to extract the target style vector corresponding to the text. 8.The method of claim 1, wherein, The style quantification score is used for at least one of the following: Determine whether the text to be analyzed conforms to the target style. If it does not conform, output a dimension deviation vector to reflect the degree of deviation of the text from the target style in each dimension; if it conforms, output the conformity determination and style quantification score. Filter texts from multiple candidate texts to select those that match the target style; As a constraint, it guides the large language model to generate text that conforms to the target style.
9. The method of claim 1, wherein, The constraints used to guide the generation of the large language model include: During the generation process, multidimensional style vectors of the generated text portions are calculated in real time. Calculate the deviation between the multidimensional style vector of the generated text portion and the target style vector; Map the bias to the sampling preference of the token; Based on the sampling preference of the token, update the sampling probability distribution of the next token, and sample the next token until text that matches the target style is generated.
10. A text style quantification system using the method of any one of claims 1-9, characterized by, include: The spatial mapping module is used to map the text to be analyzed to a multidimensional human orthogonal space; The dimension scoring module is used to calculate the projection scores of the text to be analyzed on each basic dimension. The similarity calculation module is used to output a style quantization score based on the similarity between the multidimensional style vector and the target style vector.