A mental state text classification method based on large model generative data enhancement

By employing large-scale generative data augmentation techniques and utilizing the BERT model for psychosemantic clustering and sentiment theme guidance, diverse psychological state texts are generated. This addresses the scarcity of high-quality labeled data and improves the accuracy and generalization ability of psychological state text classification.

CN121935378BActive Publication Date: 2026-07-03JIANGNAN UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
JIANGNAN UNIV
Filing Date
2026-03-30
Publication Date
2026-07-03

AI Technical Summary

Technical Problem

Due to medical privacy protection and ethical restrictions, high-quality labeled patient psychological state text data is scarce. Existing data augmentation methods lack precise control over patient psychological semantics, resulting in insufficient training samples for classification models, poor generalization ability, and the generated text is prone to homogenization, insufficient medical accuracy, or distribution bias, affecting the accuracy of psychological state text classification.

Method used

By employing a generative data augmentation method based on large models, we utilize the BERT model for psycho-semantic clustering to generate natural language semantic templates. Combined with sentiment polarity and psychological themes, we generate diverse psychological state texts as augmentation samples to construct a psychological state text classification model.

Benefits of technology

It improves the classification accuracy and generalization ability of the mental state text classification model, enhances the authenticity and diversity of the generated enhanced samples, improves the quality of the model training samples, and improves the classification performance in small sample and high noise scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121935378B_ABST
    Figure CN121935378B_ABST
Patent Text Reader

Abstract

This application discloses a method for classifying psychological state texts based on large-scale generative data augmentation, relating to the field of natural language processing technology. This method automatically discovers patient psychological semantic clusters by clustering a limited number of original samples, then extracts the natural language semantic template for each patient's psychological semantic cluster. Subsequently, under the dual control of emotional polarity and psychological theme, a large-scale language model is used to generate psychological state texts with consistent themes and diverse expressions according to these natural language semantic templates as augmented samples. This method utilizes the large-scale language model to generate high-quality samples based on the natural language semantic templates obtained from clustering to expand the model's training samples. This large-scale generative data augmentation method can ensure the authenticity and diversity of the generated augmented samples, thereby improving the classification accuracy and generalization ability of the trained psychological state text classification model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of natural language processing technology, and in particular to a method for classifying mental state texts based on large-model generative data augmentation. Background Technology

[0002] In the fields of clinical psychology and mental health, a patient's psychological state is a key indicator for assessing their subjective distress, treatment adherence, and recovery potential. Classifying the psychological state texts generated from spontaneous or semi-structured patient interviews is not only an important means of quantifying psychological assessment but also a semantic window into deeply understanding patients' implicit cognition and emotional experiences. Psychological state text classification technology can decode psychological semantics from natural language that patients find difficult to express directly or are not yet fully aware of, such as potential anxiety, depression, trauma reactions, or defense mechanisms. This text-based semantic psychological assessment method can not only compensate for the time lag and social desirability bias present in traditional scale assessments but also capture subtle changes in patients' psychological states through continuous dynamic monitoring, providing an objective basis for developing precise, personalized, and humane psychological intervention programs.

[0003] However, due to medical privacy protection and ethical restrictions, high-quality labeled textual data on patients' psychological states is extremely scarce, resulting in insufficient training samples for classification models and poor generalization ability. Furthermore, patients' psychological expressions are highly contextualized and implicit; they often express their psychological states indirectly through metaphors, somatization, denial, or concealment. Existing data augmentation methods lack precise control over the semantics of patients' psychological states, leading to issues such as homogenization, insufficient medical accuracy, or distributional bias in the generated text. These problems make it difficult for existing text classification methods to accurately classify psychological state texts, affecting the assessment of patients' psychological states. Summary of the Invention

[0004] This application addresses the aforementioned problems and technical requirements by proposing a text classification method for mental states based on large-model generative data augmentation. The technical solution of this application is as follows:

[0005] A text classification method for mental states based on large-model generative data augmentation, comprising:

[0006] Get Using texts of mental states labeled with mental state categories as the original samples, and based on psychological semantic perception... Clustering is performed on the original samples to obtain several patient psychosemantic clusters, with integer parameters. ;

[0007] For any patient psychosemantic cluster, calculate the cluster center of the patient psychosemantic cluster, and select the original sample within the patient psychosemantic cluster that is closest to the cluster center to construct a natural language semantic template;

[0008] Using a large language model, guided by sentiment polarity and psychological themes, multiple psychological state texts are generated as augmented samples according to each constructed natural language semantic template;

[0009] After labeling the augmented samples with psychological state category labels, the psychological state text classification model is trained using the total sample set consisting of the original samples and the augmented samples.

[0010] The trained psychological state text classification model is used to classify the patient's psychological state text.

[0011] Its further technical solution is based on psycho-semantic perception. The original samples were clustered to obtain several patient psychosemantic clusters, and the cluster center of each patient psychosemantic cluster was determined, including:

[0012] The BERT model is used to obtain the text embedding vector for each original sample. Each text embedding vector includes... Feature values ​​of psycho-semantic features, integer parameters ;

[0013] Calculate arbitrary text embedding vectors and text embedding vectors Weighted cosine distance between By combining the local density of each text embedding vector, an arbitrary text embedding vector is calculated. and text embedding vectors The psycho-semantic weighted interoperability distance between , This indicates taking the maximum value. It is a text embedding vector The core distance is the text embedding vector. The closest The weighted cosine distance between the text embedding vectors; It is a text embedding vector The core distance is the text embedding vector. The closest The weighted cosine distance between text embedding vectors It is the minimum number of patient psychosemantic clusters, an integer parameter. Integer parameters ;

[0014] The HDBSCAN algorithm was used to cluster patients based on the psychosemantic weighted cross-access distance between text embedding vectors of different original samples, resulting in several patient psychosemantic clusters. The psychosemantic distance of each patient cluster was then calculated. semantic prototype vector As the cluster center, It is the patient's psychosemantic cluster The number of original samples included. It is the patient's psychosemantic cluster The text embedding vector of any original sample.

[0015] A further technical solution involves calculating arbitrary text embedding vectors. and text embedding vectors Weighted cosine distance between include:

[0016] Calculate any number of Contribution of psychosemantic features , Indicates all The first original sample The variance of the eigenvalues ​​of the psycho-semantic features It is the first The strength of the association between dimensional psychosemantic features and the gold standard psychoemotional semantics, using integer parameters. ;

[0017] The text embedding vector is obtained by weighting the contributions of each dimension of psychosemantic features. and text embedding vectors Weighted cosine distance between ;in, It is a text embedding vector The Middle eigenvalues ​​of psycho-semantic features It is a text embedding vector The Middle The eigenvalues ​​of psycho-semantic features.

[0018] Its further technical solution is, the first The strength of the correlation between psychosemantic features and the gold standard psychoemotional semantics The calculation formula is:

[0019]

[0020] in, This is a standard psychological dictionary containing multiple mental health terms, each with an emotional polarity label. It refers to the number of mental health terms included in a standard mental health dictionary; It is a psychological dictionary Vocabulary for Mental Health BERT embedding representation, Represents text embedding vectors The Middle eigenvalues ​​of psycho-semantic features Vocabulary related to mental health BERT embedding representation Cosine similarity between them; It is a psychological dictionary Vocabulary for Mental Health The emotional polarity labeling , A positive value indicates a positive emotion. A negative value indicates negative emotion. Indicates neutral emotion; This is the sigmoid function.

[0021] A further technical solution involves using a large language model to generate multiple psychological state texts as augmented samples, guided by sentiment polarity and psychological themes, according to each constructed natural language semantic template.

[0022] Construct an emotional intensity set and a dialogue role set. The emotional intensity set includes multiple emotional intensity labels with different emotional polarities, and the dialogue role set includes multiple different dialogue role labels for talking to patients.

[0023] Randomly sample emotional intensity labels from the emotional intensity set and randomly sample dialogue character labels from the dialogue character set, and construct prompt words based on the sampled emotional intensity labels and dialogue character labels;

[0024] Using a large language model, based on constructed prompt words and natural language semantic templates, augmented samples are generated when patients engage in dialogue with corresponding emotional intensity labels and corresponding dialogue role labels.

[0025] A further technical solution involves using a large language model to generate multiple psychological state texts as augmented samples, guided by sentiment polarity and psychological themes, according to each constructed natural language semantic template.

[0026] The perplexity index (PPL), the type-to-type ratio (TTR), and the distribution consistency index (HDD) between the augmented samples generated by the large language model and the distribution of the reference mental state text corpus were calculated respectively.

[0027] If at least one metric of the generated augmented sample fails to meet the corresponding threshold, discard the currently generated augmented sample and regenerate an augmented sample using the large language model.

[0028] When the perplexity PPL, type-to-type ratio (TTR), and distribution consistency HDD of the generated augmented sample all reach the corresponding threshold, the generated augmented sample is retained and added to the total sample set.

[0029] Its further technical solution involves training a text classification model for mental states using a total sample set consisting of original samples and augmented samples, including:

[0030] Each text sample in the total sample set is input into the mental state text classification model. The feature extraction module in the mental state text classification model extracts the sentence-level discourse pattern features of all sentences in the current text sample and the word-level semantic distribution features of all words in the current text sample. It calculates multiple semantic similarity statistical features between the word-level semantic distribution features and the sentence-level discourse pattern features and obtains the multidimensional fusion features of the current text sample, which are then input into the classifier. The model is trained based on the mental state category label of the current text sample and the predicted mental state category output by the classifier.

[0031] The further technical solution involves extracting sentence-level discourse pattern features of all statements in the current text sample and word-level semantic distribution features of all words in the current text sample, including:

[0032] The sentence vector of each sentence in the current text sample is obtained by using the BERT model. K-Means clustering is performed on all sentence vectors to obtain multiple sentence-level clusters and the cluster center of each sentence-level cluster is determined to obtain sentence-level discourse pattern features.

[0033] The word segmentation operation is performed on all sentences in the current text sample to obtain multiple words. The word vector of each word in the current text sample is obtained by using the BERT model. K-Means clustering is performed on all word vectors to obtain multiple word-level clusters and the cluster center of each word-level cluster is determined to obtain word-level semantic distribution features.

[0034] A further technical solution involves calculating multiple semantic similarity statistical features between word-level semantic distribution features and sentence-level discourse pattern features to obtain multi-dimensional fusion features of the current text sample, including:

[0035] Calculate the cosine similarity matrix between word-level semantic distribution features and sentence-level discourse pattern features. cosine similarity matrix Any number in the middle Line 1 Column elements Indicates the first Cluster center of word-level clusters and the Cluster center of sentence-level clusters Cosine similarity between , and All parameters are integers;

[0036] Based on cosine similarity matrix Calculate multiple semantic similarity statistical features between sentence-level clusters and word-level clusters;

[0037] Extract the term frequency-inverse document frequency (TF-IDF) statistical features of the current text sample, and concatenate the obtained multiple semantic similarity statistical features with the TF-IDF statistical features to obtain the multidimensional fusion features of the current text sample.

[0038] Its further technical solution is based on the cosine similarity matrix. Calculating multiple semantic similarity statistical features between sentence-level and word-level clusters includes:

[0039] Extracting the cosine similarity matrix The maximum value of all elements in the set is used as the maximum semantic alignment strength feature;

[0040] And, extract the cosine similarity matrix. The average value of all elements in the matrix is ​​used as the average semantic alignment strength feature;

[0041] And, extract the cosine similarity matrix. The standard deviation of all elements in the matrix is ​​used as the semantic alignment dispersion feature.

[0042] The beneficial technical effects of this application are:

[0043] This application discloses a method for classifying psychological state texts based on large-scale generative data augmentation. This method automatically discovers patient psychological semantic clusters by clustering a limited number of original samples, and then extracts the natural language semantic templates for each patient psychological semantic cluster. Subsequently, under the dual control of emotional polarity and psychological theme, a large language model is used to generate psychological state texts with consistent themes and diverse expressions according to these natural language semantic templates as augmented samples. This method uses the large language model to generate high-quality samples based on the natural language semantic templates obtained from clustering to expand the model training samples. This large-scale generative data augmentation method can ensure the authenticity and diversity of the generated augmented samples, thereby improving the classification accuracy and generalization ability of the trained psychological state text classification model.

[0044] This method employs multi-granularity fusion features in the feature extraction part, including semantic distribution features based on word clustering, discourse pattern features based on sentence clustering, semantic similarity statistics between word-sentence cluster centers, and TF-IDF statistical features, which together characterize the implicit semantic structure of psychological text. The extracted multi-dimensional fusion features can more effectively capture word-level, sentence-level, and cross-level semantic associations, and improve classification performance in small sample and high-noise scenarios.

[0045] This method constructs a weighted distance metric by integrating emotional polarity and mental lexicon knowledge to measure the contribution of different dimensions of psychosemantic features to the perception of mental states. This allows semantic dimension features with high mental state discrimination and emotional polarity recognition to make a greater contribution, thereby making clustering more accurate in recognizing psychosemantic patterns.

[0046] This method guides a large language model to rewrite diverse psychological texts based on natural language semantic templates and perform self-optimization. To ensure the quality of the generated text, an automatic filtering mechanism based on perplexity level (PPL), lexical diversity (TTR), and distribution consistency (HDD) is further introduced to filter out low-quality augmented texts, thus ensuring the quality and authenticity of the augmented texts. Attached Figure Description

[0047] Figure 1 This is a flowchart of a method for classifying textual states of mental states according to an embodiment of this application.

[0048] Figure 2 This is a flowchart of a method for multi-feature fusion extraction of text samples by a feature extraction module in one embodiment of this application. Detailed Implementation

[0049] The specific embodiments of this application will be further described below with reference to the accompanying drawings.

[0050] This application discloses a text classification method for mental states based on large-model generative data augmentation. Please refer to [link / reference]. Figure 1 The flowchart shown illustrates the method for classifying mental states in text, which includes the following steps:

[0051] Step 110, obtain The original sample consists of mental state texts labeled with mental state categories, with integer parameters. The raw samples obtained in this step are high-quality, annotated natural language texts that accurately depict the patient's psychology. These raw samples cover multiple psychological state category labels, with each category containing multiple raw samples. Specific psychological state category labels are assigned as needed. Due to medical privacy protection and ethical restrictions, high-quality annotated patient psychological state text data is extremely scarce. Therefore, the number of raw samples obtained is usually limited, exhibiting small sample characteristics. For example, in one instance, each psychological state category contained 120 raw samples.

[0052] Step 120, based on psycho-semantic perception... Clustering the original samples to obtain several patient psychosemantic clusters includes the following steps:

[0053] 1. Use the BERT model to obtain the text embedding vector for each original sample. Each text embedding vector includes... Feature values ​​of psycho-semantic features, integer parameters .

[0054] 2. Calculate any original sample Text embedding vector and any original sample Text embedding vector Weighted cosine distance between Integer parameters Integer parameters .

[0055] Each text embedding vector includes Psychosomatic features of different dimensions contribute differently to the perception of mental states. The contribution of each of the psycho-semantic features is In this embodiment, an integer parameter is defined. , any number Contribution of psychosemantic features The calculation formula is:

[0056] (1)

[0057] in, Indicates all The first original sample The variance of the eigenvalues ​​of the psycho-semantic features. It is the first The emotional polarity of psychosemantic features, measuring the first The strength of the association between psychosemantic features and the gold standard psychoemotional semantics. In one embodiment, by... The first original sample The feature values ​​of the psycho-semantic features are projected onto a standard mental dictionary for calculation, using the following formula:

[0058] (2)

[0059] in, It is a standard mental health dictionary containing multiple mental health terms, each with an emotional polarity label, and is obtained from existing resources of the LIWC Mental Category Thesaurus. It is the number of mental health terms included in a standard mental health dictionary. It is a psychological dictionary mental health vocabulary in China It is a psychological dictionary Vocabulary for Mental Health The emotional polarity labeling , A positive value indicates a positive emotion. A negative value indicates negative emotion. It indicates a neutral emotion. For example, the standard psychological dictionary. Mental health vocabulary includes depression ( (Values ​​are negative), anxiety ( (Values ​​can be negative), happiness ( Values ​​are positive), sadness ( (e.g., negative values).

[0060] It is a psychological dictionary Vocabulary for Mental Health The BERT embedding representation. Represents text embedding vectors The Middle eigenvalues ​​of psycho-semantic features Vocabulary related to mental health BERT embedding representation Cosine similarity between them. This is the sigmoid function, used to normalize the score to the (0,1) interval.

[0061] From equations (1) and (2), it can be seen that any number of... Contribution of psychosemantic features The contribution of each dimension's semantic features is influenced by two factors: First, the variance of the feature vectors in each dimension. A larger variance indicates more significant differences in the values ​​of that dimension among samples, resulting in stronger discriminative power for psychological categories and a greater contribution. Second, the correlation strength between the semantic features of each dimension and the gold standard psychological emotional intensity. A stronger correlation indicates greater sensitivity to the expression of psychological states, more pronounced emotional polarity, and a greater contribution. This embodiment combines both factors to calculate the contribution of each dimension's semantic features, allowing semantic dimensions with high psychological state discriminative power and emotional polarity recognition to contribute more significantly, thereby making subsequent clustering more accurate in identifying semantic patterns.

[0062] After calculating the contribution of each dimension of psychosemantic features, the text embedding vector is obtained by weighting the contributions of each dimension of psychosemantic features. and text embedding vectors Weighted cosine distance between As shown in equation (3):

[0063] (3)

[0064] 3. Based on the weighted cosine distance By combining the local density of each text embedding vector, an arbitrary text embedding vector is calculated. and text embedding vectors The psycho-semantic weighted interoperability distance between The calculation formula is:

[0065] (4)

[0066] in, This indicates taking the maximum value. It is a text embedding vector The core distance is the text embedding vector. The closest The weighted cosine distance between the text embedding vectors. It is a text embedding vector The core distance is the text embedding vector. The closest The weighted cosine distance between the text embedding vectors.

[0067] This is the pre-defined minimum number of patient psychosemantic clusters. To ensure the stability of the results and their applicability to psychological state text data, in one instance, referring to existing empirical experience in high-dimensional text embedding clustering, the minimum number is taken. .

[0068] 4. Using the HDBSCAN algorithm, clustering was performed based on the psychosemantic weighted cross-access distance between the text embedding vectors of different original samples to obtain several patient psychosemantic clusters.

[0069] The HDBSCAN algorithm requires no pre-defined cluster number and automatically extracts flat cluster structures through built-in cluster stability analysis. Compared to clustering directly based on weighted cosine distance, this embodiment further combines the local density of each text embedding vector to calculate the psychosemantic weighted cross-accessibility distance and clusters according to this distance. This means that two original samples are considered close only when they are both located in relatively high-density regions and are close to each other; if either original sample is located in a low-density region, the distance between them increases. Adhering to the principle that both can easily reach each other, isolated or marginal points are naturally pushed further away, achieving a density-adaptive distance transformation. This transformation preserves the original distance in high-density regions while increasing the distance between samples in low-density regions, thereby effectively avoiding chain-like connections and achieving accurate separation of variable-density clusters.

[0070] Step 130, for any patient's psychosemantic cluster Calculate the patient's psycho-semantic cluster cluster center And select patient psycho-semantic clusters Inside and cluster center The natural language semantic template is constructed from the nearest original sample.

[0071] For any patient's psycho-semantic cluster Calculate the patient's psycho-semantic cluster semantic prototype vector As the cluster center, the calculation formula is:

[0072] (5)

[0073] in, It is the patient's psychosemantic cluster The number of original samples included. It is the patient's psychosemantic cluster The text embedding vector of any original sample.

[0074] Then, the patient's psycho-semantic clusters are calculated according to equation (3). Text embedding vectors and semantic prototype vectors of each original sample The weighted cosine distance between them, and the patient's psychosemantic clusters In semantic prototype vector The original sample with the smallest weighted cosine distance between them is used as the natural language semantic template.

[0075] Step 140: Using a large language model, guided by emotional polarity and psychological themes, generate multiple psychological state texts as augmented samples according to each constructed natural language semantic template.

[0076] When using a large language model, prompt words directly affect the quality of the generated text data. If the large language model is directly instructed to imitate natural language semantic templates to generate new psychological state texts, it is easy to produce repetitive content that deviates from the topic, seriously affecting the authenticity and diversity of the generated text. Based on this, in one embodiment, dual control signals of sentiment polarity and psychological topic are embedded in the prompt words of the large language model. Based on the natural language semantic template, the large language model is guided to rewrite the text into psychological state texts with diverse expressions as enhancement samples, so as to guide the large language model to generate psychological state texts with consistent topics and diverse expressions, including:

[0077] First, we construct a set of emotional intensity labels and a set of dialogue roles. The emotional intensity set includes multiple emotional intensity labels with different emotional polarities, and the dialogue role set includes multiple different dialogue role labels for talking to the patient. The specific emotional intensity labels and dialogue role labels can be customized. For example, in one instance, the emotional intensity set includes 8 emotional intensity labels, written as {“Happy,” “Fear,” “Anger,” “Despair,” “Numbness,” “Helplessness,” “Open-mindedness,” “Cheerful”}, and the dialogue role set contains 5 dialogue role labels, written as {“Friend,” “Relative,” “Lover,” “Doctor,” “Online Friend”}.

[0078] Then, emotion intensity labels are randomly sampled from the emotion intensity set, and dialogue role labels are randomly sampled from the dialogue role set. Based on the sampled emotion intensity labels and dialogue role labels, cue words are constructed. These cue words are used to prompt the large language model to express the patient's psychological feelings in the target scene according to the emotion intensity labels and the sampled dialogue role labels, mimicking the style of a natural language semantic template. The specific content of the cue words is not limited in this application. Finally, the large language model is used to generate augmented samples of the patient's dialogue with the corresponding emotion intensity labels and dialogue role labels according to the natural language semantic template, based on the constructed cue words.

[0079] For example, in one instance, the natural language semantic template is: "Life is ultimately a matter of mindset; you have to face everything head-on, without running away or complaining, but embracing it with a positive attitude. Even if everything eventually comes to an end, this journey can still be uniquely yours." The emotional intensity label randomly sampled from the emotional intensity set is "open-minded," and the dialogue role label randomly sampled from the dialogue role set is "lover." Then, the large language model will, based on the prompt words, mimic the text style of the natural language semantic template to generate text describing the patient's psychological state when facing their lover with an open-minded attitude, such as: "I have seen through everything. I choose to face it bravely, without blaming others or regretting the course of my life. Even if I cannot accompany you to the end of the road, the time we spent together is already the most precious gift life has given us, and that is enough."

[0080] like Figure 1 As shown, multiple patient psychosemantic clusters are obtained by clustering the original samples, and a natural language semantic template is generated based on each patient psychosemantic cluster. Figure 1 To utilize large language models according to arbitrary patient psychosemantic clusters Generated Natural Language Semantic Templates Taking the generation of enhanced samples as an example, and utilizing a large language model according to natural language semantic templates... When generating enhanced samples, multiple rounds of random sampling are performed on the sentiment intensity labels and dialogue role labels to construct multiple different cue words. Then, a large language model is used to guide the samples according to natural language semantic templates under the guidance of different cue words. Generate enhanced samples, thereby generating natural language semantic templates This resulted in a large number of enhanced samples under different emotional polarities and psychological themes.

[0081] To further improve the text quality of the generated augmented samples, text quality control is performed on each augmented sample generated by the large language model. If the text quality control of an augmented sample passes, it is retained. If the text quality control of an augmented sample fails, it is discarded. The text quality control of the augmented samples includes two parts:

[0082] The first part of the text quality inspection utilizes the self-optimization mechanism of the large language model. The large language model defines optimization goals for topic relevance, sentiment authenticity, and content coherence, and performs self-iterative optimization to obtain high-quality enhanced samples.

[0083] The second part of the text quality inspection further introduces several evaluation metrics to assess the quality of the augmented samples generated by the large language model, including: calculating the perplexity (PPL), type-to-type ratio (TTR), and distribution consistency (HDD) between the augmented samples generated by the large language model and the distribution of the reference mental state text corpus.

[0084] The Probability of Probability (PPL) metric is a standard indicator in language model evaluation, used to measure the predictive uncertainty of a predictive model for a given augmented sample. A lower PPL value indicates that the augmented sample better matches the language distribution learned by the predictive model, i.e., it is more fluent and natural. In this embodiment, the PPL metric of the augmented sample is calculated based on a pre-trained predictive model, and it is defined as the geometric mean inverse probability of the text sequence of the augmented sample.

[0085] The TTR metric measures the lexical diversity of augmented samples by calculating the ratio of unique words to total words. A higher TTR value indicates richer vocabulary usage.

[0086] The HDD metric measures the statistical difference between the distribution of the augmented sample's text and the distribution of the reference mental text corpus, and can be obtained by calculating the Herringer distance. A lower HDD metric indicates better consistency between the augmented sample and the actual mental discourse pattern.

[0087] If at least one metric of the generated augmented sample fails to meet the corresponding threshold, the currently generated augmented sample is discarded, and a new augmented sample is generated using the large language model. If the perplexity (PPL), type-to-type ratio (TTR), and distribution consistency (HDD) of the generated augmented sample all meet the corresponding thresholds, the generated augmented sample is retained and added to the total sample set.

[0088] Step 150: After labeling the augmented samples with psychological state category labels, train the psychological state text classification model using the total sample set consisting of the original samples and the augmented samples.

[0089] like Figure 1 As shown, the psychological state text classification model includes a feature extraction module and a classifier. During the training phase, each text sample in the total sample set is input into the psychological state text classification model. The feature extraction module in the psychological state text classification model extracts multi-dimensional fusion features from the text samples. Because psychological state texts are highly contextualized and implicit, the literal meaning often deviates from the actual psychological state. Traditional feature extraction methods struggle to capture deep semantics. Existing feature fusion methods often employ shallow concatenation or single-granularity representation, making it difficult to effectively capture word-level, sentence-level, and cross-level semantic relationships. Therefore, to improve classification performance in small-sample, high-noise scenarios, the feature extraction module in the psychological state text classification model performs feature extraction on each text sample using the following steps (please refer to...). Figure 2 :

[0090] (1) Extract sentence-level discourse pattern features and word-level semantic distribution features of all sentences in the current text sample, respectively, including:

[0091] The BERT model is used to obtain the sentence vector of each sentence in the current text sample. K-Means clustering is performed on all sentence vectors to obtain multiple sentence-level clusters, and the cluster center of each sentence-level cluster is determined. The sentence-level discourse pattern features contain the cluster centers of all sentence-level clusters. Let any nth... The cluster center of each sentence-level cluster is .

[0092] To obtain multiple words, perform word segmentation on all sentences in the current text sample. This can be done directly using the jieba word segmentation tool. Then, use the BERT model to obtain the word vector for each word in the current text sample. Perform K-Means clustering on all word vectors to obtain multiple word-level clusters and determine the cluster center of each word-level cluster. Finally, obtain the cluster center of all word-level clusters containing the word-level semantic distribution features. Let any word be denoted as... The cluster center of each word-level cluster is .

[0093] (2) Calculate multiple semantic similarity statistical features between word-level semantic distribution features and sentence-level discourse pattern features, and obtain the multidimensional fusion features of the current text sample, including:

[0094] There is a stable correspondence between local lexical themes and overall sentence patterns. For example, sentences containing word clusters of negative emotions such as "despair" and "helplessness" often also belong to sentence clusters of negative emotion expression types. Therefore, we first calculate the cosine similarity matrix between word-level semantic distribution features and sentence-level discourse pattern features. The resulting cosine similarity matrix Any number in the middle Line 1 Column elements Indicates the first Cluster center of word-level clusters and the Cluster center of sentence-level clusters Cosine similarity between , and All parameters are integers.

[0095] Then based on the cosine similarity matrix Multiple semantic similarity statistical features are calculated between sentence-level and word-level clusters to quantify whether the local lexical topics within a sentence are consistent with the overall sentence semantics. In one embodiment, three semantic similarity statistical features are designed, including the maximum semantic alignment strength feature, the average semantic alignment strength feature, and the semantic alignment dispersion feature:

[0096] Extracting the cosine similarity matrix The maximum value of all elements is taken as the maximum semantic alignment strength feature. This feature reflects the matching strength between the core vocabulary topic and the overall semantics of the sentence. The higher the value of the maximum semantic alignment strength feature, the more significant the local-global semantic resonance.

[0097] Extracting the cosine similarity matrix The average value of all elements is used as the average semantic alignment strength feature, which measures the overall consistency between all lexical topics and sentence patterns, characterizing the average level of semantics with cross-granularity consistency.

[0098] Extracting the cosine similarity matrix The standard deviation of all elements in the text is used as a semantic alignment dispersion feature. This feature quantifies the volatility of the alignment degree. A low standard deviation means that the matching degree between the topic of each word in the sentence and the overall semantics is relatively balanced and stable, while a high standard deviation suggests the existence of semantic conflict or noise.

[0099] To preserve fine-grained term information, TF-IDF (Term Frequency-Inverse Document Frequency) statistical features of the current text sample are further extracted as a supplement.

[0100] Finally, the obtained multiple semantic similarity statistical features and TF-IDF statistical features are concatenated sequentially to obtain the multidimensional fusion features of the current text sample.

[0101] The multidimensional fusion features extracted by the feature extraction module are input into the classifier. The classifier outputs the predicted mental state category for the current text sample. The model is iteratively trained by combining the mental state category label of the current text sample until training is complete. In one embodiment, the classifier used is the Naive Bayes classifier, which exhibits excellent robustness and discriminative ability in small-sample, high-dimensional sparse text scenarios, outperforming other classifiers. For each mental state category, 120 mental state texts are selected as original samples from three different mental state text datasets. SVM, Random Forest, and Naive Bayes are used as classifiers in the mental state text classification models, respectively. The rest of the method remains unchanged. The accuracy and F1 score of the mental state text classification models obtained under the three classifiers are shown in the table below. The data in the table shows that the Naive Bayes classifier has the best performance.

[0102]

[0103] After training, the trained psychological state text classification model can be used to classify the patient's psychological state text. After the patient's psychological state text is input into the psychological state text classification model, similar to the model training stage, the feature extraction module in the psychological state text classification model will extract the multi-dimensional fusion features of the psychological state text to be classified and then input them into the classifier, thereby obtaining the predicted psychological state category of the psychological state text to be classified, and realizing psychological state text classification.

[0104] To verify the effectiveness of the method in this application, a baseline experiment was conducted in the same scenario with the following comparative methods for classifying mental state texts in an example: (1) Using traditional models, including the TF-IDF+SVM method and the LDA+SVM method. The TF-IDF+SVM method extracts the TF-IDF features of the mental state text and then trains the SVM model for classification. The LDA+SVM method extracts the LDA (Latent Dirichlet Allocation) features of the mental state text and then trains the SVM (Support Vector Machine) model for classification. (2) Using a deep learning model, denoted as TextCNN, this method uses pre-trained word vectors for initialization and extracts local n-gram features through a convolutional neural network. (4) Using pre-trained language models, including Opinion-BERT and MentalLLaMA (Enhancing Mental Health Detection with Instruction-Tuned LLMs). MentalLLaMA is a Chinese LLaMA (Large Language Model MetaAI, Meta AI) model fine-tuned for the mental health domain, representing the most powerful domain-specific pre-trained model currently available.

[0105] For each of the three different mental state text datasets, 120 mental state texts were selected as original samples for each mental state category. The proposed mental state text classification method and the methods described in the comparative examples were then used to train models based on these original samples. The accuracy and F1 score of the models trained using each method are shown in the table below. As can be seen from the table, the proposed mental state text classification method achieved the best performance on all three datasets.

[0106]

[0107] For each mental state category, 40 mental state texts were selected as original samples from three different mental state text datasets to simulate a scenario with fewer resources. The mental state text classification method proposed in this application and the methods mentioned above in the comparative examples were used to train models based on the original samples. The accuracy and F1 score of the models trained by each method are shown in the table below.

[0108]

[0109] The above descriptions are merely preferred embodiments of this application, and this application is not limited to the above embodiments. It is understood that other improvements and variations that can be directly derived or conceived by those skilled in the art without departing from the spirit and concept of this application should be considered to be included within the protection scope of this application.

Claims

1. A text classification method for mental states based on large-model generative data augmentation, characterized in that, The psychological state text classification method includes: Get Using texts of mental states labeled with mental state categories as the original samples, and based on psychological semantic perception... Clustering is performed on the original samples to obtain several patient psychosemantic clusters, with integer parameters. ; For any patient psychosemantic cluster, calculate the cluster center of the patient psychosemantic cluster, and select the original sample within the patient psychosemantic cluster that is closest to the cluster center as the natural language semantic template; Guided by emotional polarity and psychological themes, a large language model is used to generate multiple psychological state texts as augmented samples according to each constructed natural language semantic template. This includes: constructing an emotional intensity set and a dialogue role set, where the emotional intensity set includes multiple emotional intensity labels with different emotional polarities, and the dialogue role set includes multiple different dialogue role labels for dialogue with the patient; randomly sampling emotional intensity labels from the emotional intensity set and dialogue role labels from the dialogue role set; constructing cue words based on the extracted emotional intensity labels and dialogue role labels; and using the large language model, based on the constructed cue words and the natural language semantic template, generating augmented samples of the patient's dialogue with the corresponding emotional intensity label and dialogue role label. After labeling the augmented samples with psychological state category labels, the psychological state text classification model is trained using the total sample set consisting of the original samples and the augmented samples. The trained psychological state text classification model is used to classify the patient's psychological state text.

2. The method for classifying mental state texts based on large-model generative data augmentation according to claim 1, characterized in that, Based on psycho-semantic perception The original samples were clustered to obtain several patient psychosemantic clusters, and the cluster center of each patient psychosemantic cluster was determined, including: The BERT model is used to obtain the text embedding vector for each original sample. Each text embedding vector includes... Feature values ​​of psycho-semantic features, integer parameters ; Calculate arbitrary text embedding vectors and text embedding vectors Weighted cosine distance between By combining the local density of each text embedding vector, an arbitrary text embedding vector is calculated. and text embedding vectors The psycho-semantic weighted interoperability distance between , This indicates taking the maximum value. It is a text embedding vector The core distance is the text embedding vector. The closest The weighted cosine distance between the text embedding vectors; It is a text embedding vector The core distance is the text embedding vector. The closest The weighted cosine distance between text embedding vectors It is the minimum number of patient psychosemantic clusters, an integer parameter. Integer parameters ; The HDBSCAN algorithm was used to cluster patients based on the psychosemantic weighted cross-access distance between text embedding vectors of different original samples, resulting in several patient psychosemantic clusters. The psychosemantic distance of each patient cluster was then calculated. semantic prototype vector As the cluster center, It is the patient's psychosemantic cluster The number of original samples included. It is the patient's psychosemantic cluster The text embedding vector of any original sample.

3. The method for classifying mental state texts based on large-model generative data augmentation according to claim 2, characterized in that, Calculate arbitrary text embedding vectors and text embedding vectors Weighted cosine distance between include: Calculate any number of Contribution of psychosemantic features , Indicates all The first original sample The variance of the eigenvalues ​​of the psycho-semantic features It is the first The strength of the association between dimensional psychosemantic features and the gold standard psychoemotional semantics, using integer parameters. ; The text embedding vector is obtained by weighting the contributions of each dimension of psychosemantic features. and text embedding vectors Weighted cosine distance between ;in, It is a text embedding vector The Middle eigenvalues ​​of psycho-semantic features It is a text embedding vector The Middle The eigenvalues ​​of psycho-semantic features.

4. The method for classifying mental state texts based on large-model generative data augmentation according to claim 3, characterized in that, No. The strength of the correlation between psychosemantic features and the gold standard psychoemotional semantics The calculation formula is: in, This is a standard psychological dictionary containing multiple mental health terms, each with an emotional polarity label. It refers to the number of mental health terms included in a standard mental health dictionary; It is a psychological dictionary Vocabulary for Mental Health BERT embedding representation, Represents text embedding vectors The Middle eigenvalues ​​of psycho-semantic features Vocabulary related to mental health BERT embedding representation Cosine similarity between them; It is a psychological dictionary Vocabulary for Mental Health The emotional polarity labeling , A positive value indicates a positive emotion. A negative value indicates negative emotion. Indicates neutral emotion; This is the sigmoid function.

5. A text classification method for mental states based on large-model generative data augmentation according to claim 1, characterized in that, Using a large language model, guided by sentiment polarity and psychological themes, multiple psychological state texts are generated as augmented samples according to each constructed natural language semantic template, including: The perplexity index (PPL), the type-to-type ratio (TTR), and the distribution consistency index (HDD) between the augmented samples generated by the large language model and the distribution of the reference mental state text corpus were calculated respectively. If at least one metric of the generated augmented sample fails to meet the corresponding threshold, discard the currently generated augmented sample and regenerate an augmented sample using the large language model. When the perplexity PPL, type-to-type ratio (TTR), and distribution consistency HDD of the generated augmented sample all reach the corresponding threshold, the generated augmented sample is retained and added to the total sample set.

6. The method for classifying mental state texts based on large-model generative data augmentation according to claim 1, characterized in that, Training a text classification model for mental states using a total sample set consisting of original samples and augmented samples includes: Each text sample in the total sample set is input into the mental state text classification model. The feature extraction module in the mental state text classification model extracts the sentence-level discourse pattern features of all sentences in the current text sample and the word-level semantic distribution features of all words in the current text sample. It calculates multiple semantic similarity statistical features between the word-level semantic distribution features and the sentence-level discourse pattern features and obtains the multidimensional fusion features of the current text sample, which are then input into the classifier. The model is trained based on the mental state category label of the current text sample and the predicted mental state category output by the classifier.

7. A text classification method for mental states based on large-model generative data augmentation according to claim 6, characterized in that, Extract sentence-level discourse pattern features and word-level semantic distribution features of all words in the current text sample, respectively: The sentence vector of each sentence in the current text sample is obtained by using the BERT model. K-Means clustering is performed on all sentence vectors to obtain multiple sentence-level clusters and the cluster center of each sentence-level cluster is determined to obtain sentence-level discourse pattern features. The word segmentation operation is performed on all sentences in the current text sample to obtain multiple words. The word vector of each word in the current text sample is obtained by using the BERT model. K-Means clustering is performed on all word vectors to obtain multiple word-level clusters and the cluster center of each word-level cluster is determined to obtain word-level semantic distribution features.

8. A text classification method for mental states based on large-model generative data augmentation according to claim 7, characterized in that, Calculating multiple semantic similarity statistical features between word-level semantic distribution features and sentence-level discourse pattern features to obtain multidimensional fusion features of the current text sample includes: Calculate the cosine similarity matrix between word-level semantic distribution features and sentence-level discourse pattern features. cosine similarity matrix Any of the following Line number Column elements Indicates the first Cluster center of word-level clusters and the Cluster center of sentence-level clusters Cosine similarity between , and All parameters are integers; Based on cosine similarity matrix Calculate multiple semantic similarity statistical features between sentence-level clusters and word-level clusters; Extract the term frequency-inverse document frequency (TF-IDF) statistical features of the current text sample, and concatenate the obtained multiple semantic similarity statistical features with the TF-IDF statistical features to obtain the multidimensional fusion features of the current text sample.

9. A text classification method for mental states based on large-model generative data augmentation according to claim 8, characterized in that, Based on cosine similarity matrix Calculating multiple semantic similarity statistical features between sentence-level and word-level clusters includes: Extracting the cosine similarity matrix The maximum value of all elements in the set is used as the maximum semantic alignment strength feature; And, extract the cosine similarity matrix. The average value of all elements in the matrix is ​​used as the average semantic alignment strength feature; And, extract the cosine similarity matrix. The standard deviation of all elements in the matrix is ​​used as the semantic alignment dispersion feature.