Automatic text summarization method and system for online psychological support
By introducing distraction mechanisms and multi-task joint training in the BART model, the problem of inaccurate generation of online psychological support text summary in the existing technology is solved, and a more relevant, accurate and innovative text summary generation is achieved.
Patent Information
- Application Number
- CN202411436061.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-15
- Publication Date
- 2025-03-25
- Estimated Expiration
- 2044-10-15
AI Technical Summary
The existing pre-trained language model fails to fully consider the theme, structure and abstraction of the text when generating text summary online psychological support, resulting in inaccurate results of the summary generation.
An automatic text summary method for online psychological support is proposed. By introducing a distraction mechanism in the BART model, and adding language model headers and classification heads to the output part of the decoder, combined with multi-task joint training, the joint training of topic classification and text summary generation is realized.
Through multi-task joint training and distraction mechanisms, the model can more effectively identify and utilize key topic words in the text, improve the relevance and information accuracy of the abstract, and reduce direct copying of the original text, improving the innovation and overall quality of the abstract.
Smart Images

Figure CN118939796B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural language processing, and in particular to an automatic text summarization method and system for online psychological support. Background Art
[0002] At present, the Facebook team has proposed the BART pre-trained language model, which combines the bidirectional encoding characteristics of BERT and the autoregressive characteristics of GPT, and has demonstrated excellent performance in multiple natural language processing tasks. On the other hand, the PEGASUS model proposed by Zhang et al., a pre-trained language model designed specifically for automatic text summarization tasks, has shown better performance than other models. However, when dealing with specific tasks, pre-trained language models fail to fully consider information such as the topic, structure, and abstractness of the text, so there are certain limitations in using these models to directly generate online psychological support texts.
[0003] In order to improve the adaptability and efficiency of pre-trained language models in different fields, especially in the field of online psychological support text summarization, many researchers are actively exploring the application of multi-task learning. For example, Magooda et al. explored the impact of multi-task learning on generative automatic text summarization on small sample datasets. They selected extractive automatic text summarization, concept detection, paraphrase detection and language models as auxiliary tasks, and conducted experiments on a variety of pre-trained language models (such as BERT and T5) and different datasets to evaluate the effect of multi-task learning on different models and datasets.
[0004] The multi-task learning method enables the model to obtain more effective information from different tasks, which is particularly suitable for processing text in the field of online psychological support. At present, there is a problem in the multi-task language model that the text is copied from the original text to generate a summary, which fails to pay more attention to the overall content of the text, resulting in inaccurate summary generation results. Summary of the invention
[0005] In view of the above situation, the main purpose of the present invention is to propose an automatic text summarization method and system for online psychological support to solve the above technical problems.
[0006] The present invention proposes an automatic text summarization method for online psychological support, which comprises the following steps:
[0007] Step 1: Based on the BART model, the attention mechanism of the bidirectional encoder and autoregressive decoder in the BART model is replaced with a distributed attention mechanism, and the language model head and the classification head are added in parallel to the output part of the decoder to obtain an automatic text summarization model;
[0008] Step 2: Input the text into the automatic text summarization model. The bidirectional encoder captures the global dependency of the input based on the distributed attention mechanism. During the distributed attention mechanism calculation process, the distribution of attention is adjusted to increase uncertainty to achieve distributed attention calculation and obtain the encoding result.
[0009] The encoding result is input into the autoregressive decoder, which obtains information from more context positions based on the distraction attention mechanism to obtain the encoding result;
[0010] Step 3: Input the encoding result into the language model header to obtain the answer text;
[0011] Step 4: Repeat steps 2 and 3 to gradually obtain the answer text through autoregression to obtain the text summary, thus realizing the automatic text summary generation subtask;
[0012] The final encoding result of the autoregressive decoder in the autoregressive process is sent to the classification result to obtain the classification result and realize the topic classification subtask;
[0013] Step 5: Obtain a data set, and train the automatic text summarization model by performing the topic classification task and the text summary generation task simultaneously through multi-task joint training to obtain a trained automatic text summarization model, and use the trained automatic text summarization model to realize automatic text summary generation.
[0014] The present invention also proposes an automatic text summarization system for online psychological support, wherein the system applies the automatic text summarization method for online psychological support as described above, and the system comprises:
[0015] Model building modules for:
[0016] Based on the BART model, the attention mechanism of the bidirectional encoder and autoregressive decoder in the BART model is replaced with a distributed attention mechanism, and the language model head and classification head are added in parallel to the output of the decoder to obtain an automatic text summarization model.
[0017] Bidirectional encoding module for:
[0018] The text is input into the automatic text summarization model. The bidirectional encoder captures the global dependency of the input based on the distributed attention mechanism. During the distributed attention mechanism calculation process, the distribution of attention is adjusted to increase uncertainty to achieve distributed attention calculation and obtain the encoding result.
[0019] Autoregressive decoding module, used to:
[0020] The encoding result is input into the autoregressive decoder, which obtains information from more context positions based on the distraction attention mechanism to obtain the encoding result;
[0021] Automatic text summarization subtask module, used to:
[0022] Input the encoding result into the language model header to obtain the answer text;
[0023] Repeat the operations of the bidirectional encoding module and the autoregressive decoding module in an autoregressive manner to gradually obtain the answer text and obtain the text summary, thus realizing the automatic text summary generation subtask;
[0024] The topic classification subtask module is used to:
[0025] The final encoding result of the autoregressive decoder in the autoregressive process is sent to the classification result to obtain the classification result and realize the topic classification subtask.
[0026] Multi-task joint training module for:
[0027] Obtain a data set, and train the automatic text summarization model by performing the topic classification task and the text summary generation task simultaneously through multi-task joint training to obtain a trained automatic text summarization model;
[0028] Automatic text summarization module for:
[0029] Automatic text summary generation is achieved using the trained automatic text summarization model.
[0030] Compared with the prior art, the present invention has the following beneficial effects:
[0031] The present invention simultaneously performs the topic classification task and the text summary generation task by means of multi-task joint training. This enables the model to effectively identify and utilize key subject words in the text when generating the summary, thereby improving the relevance and information accuracy of the summary. In addition, the distraction mechanism adopted by the present invention optimizes the distribution of the model's attention to the full text content, reduces the reliance on direct copying from the original text, and prompts the model to generate more new words to form the summary. This method not only improves the innovation of the summary, but also improves the overall quality of the summary. Through this technical solution, the present invention aims to provide a more effective, flexible and efficient solution for automatic text summarization.
[0032] Additional aspects and advantages of the present invention will be given in part in the following description and in part will be obvious from the following description or learned through embodiments of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 A flowchart of the automatic text summarization method for online psychological support proposed by the present invention;
[0034] Figure 2This is a diagram of the automatic text summarization model architecture of the present invention;
[0035] Figure 3 This is a schematic diagram of the structure of the automatic text summarization system for online psychological support proposed by the present invention;
[0036] Figure 4 This is a schematic diagram of the existing BART model structure. DETAILED DESCRIPTION
[0037] Embodiments of the present invention are described in detail below, examples of which are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present invention, and cannot be understood as limiting the present invention.
[0038] These and other aspects of the embodiments of the present invention will be apparent with reference to the following description and accompanying drawings. In these descriptions and accompanying drawings, some specific implementations of the embodiments of the present invention are specifically disclosed to represent some ways of implementing the principles of the embodiments of the present invention, but it should be understood that the scope of the embodiments of the present invention is not limited thereto.
[0039] In the technical solution of the present invention, the BART model is significantly improved by introducing a distributed attention mechanism. BART is based on the Transformer architecture, which includes two main parts: an encoder and a decoder. The encoder is responsible for encoding the input sequence into a high-dimensional feature vector, while the decoder decodes these vectors into a target sequence. The encoder is composed of 6 identical layers stacked together, each of which contains a multi-head self-attention mechanism and a feedforward neural network.
[0040] The multi-head attention mechanism is an extension of the self-attention mechanism and is built on top of the self-attention mechanism. The input matrices of the self-attention mechanism are Q , K and V , first calculate Q and The dot product matrix, then The scaled result is processed by the softmax function to obtain Q and The correlation coefficient between Multiply them together to get the result of the attention mechanism. The calculation formula is shown below.
[0041] ;
[0042] ;
[0043] in, Q , K , V From the same input Three different vector matrices obtained through linear mapping, , , is the mapping parameter. It is a scaling factor to prevent the gradient explosion problem caused by excessive dimensions during softmax calculation.
[0044] See also Figure 1 and Figure 2 This embodiment provides an automatic text summarization method for online psychological support, the method comprising the following steps:
[0045] Step 1: Based on the BART model, the attention mechanism of the bidirectional encoder and autoregressive decoder in the BART model is replaced with a distributed attention mechanism, and the language model head and the classification head are added in parallel to the output part of the decoder to obtain an automatic text summarization model;
[0046] In step 1, the optimization target of the automatic text summarization model has the following relationship:
[0047] ;
[0048] in, Indicates The input data of each task, Indicates The output of a task, Indicates The weight of the task, Indicates the loss calculation result, Represents the optimal weight of the automatic text summarization model.
[0049] Step 2: Input the text into the automatic text summarization model. The bidirectional encoder captures the global dependency of the input based on the distributed attention mechanism. During the distributed attention mechanism calculation process, the distribution of attention is adjusted to increase uncertainty to achieve distributed attention calculation and obtain the encoding result.
[0050] The encoding result is input into the autoregressive decoder, which obtains information from more context positions based on the distraction attention mechanism to obtain the encoding result;
[0051] The core of the attention-distribution mechanism of the present invention is to introduce an additional weight parameter into the attention mechanism of the model, which is designed to adjust the distribution of attention. In this way, the model can not only pay more attention to the overall content of the text, but also reduce the direct copying of the original text and generate summaries more creatively by using vocabulary. The improved formula is described as follows:
[0052] ;
[0053] in, Q , K and V represents the linear representation of the hidden layer, d is the dimension size of the hidden layer, D is the distraction weight parameter.
[0054] Step 3: Input the encoding result into the language model header to obtain the answer text;
[0055] Step 4: Repeat steps 2 and 3 to gradually obtain the answer text through autoregression to obtain the text summary, thus realizing the automatic text summary generation subtask;
[0056] The final encoding result of the autoregressive decoder in the autoregressive process is sent to the classification result to obtain the classification result and realize the topic classification subtask.
[0057] In step 4, the conditional probability of the automatic text summarization subtask has the following relationship:
[0058] ;
[0059] in, Indicated in t The output of the task generated at the moment, Represents input data, , Indicates the length of the input data. denotes the corresponding reference abstract, , indicates the length of the corresponding reference abstract, represents the parameters of the model, Indicated in t The output of the task generated before time .
[0060] Step 5: Obtain a data set, and train the automatic text summarization model by performing the topic classification task and the text summary generation task simultaneously through multi-task joint training to obtain the trained automatic text summarization model, and use the trained automatic text summarization model to realize automatic text summary generation. The specific steps are as follows:
[0061] The text data is obtained through data crawling, and the obtained text data is preprocessed to construct a data set, which includes reference abstracts, subject terms and help posts;
[0062] The help post is input into the automatic text summarization model to obtain the text summary. The reference summary and the text summary are used to construct the automatic text summarization generation subtask loss function. The corresponding process has the following relationship:
[0063] ;
[0064] in, represents the loss of automatic text summarization task;
[0065] The help post is input into the automatic text summarization model to obtain the classification result, and the classification result and the keyword are used to construct the topic classification subtask loss function. The corresponding process has the following relationship:
[0066] ;
[0067] in, represents the topic classification subtask loss, Indicates subject terms;
[0068] The automatic text summarization subtask loss and the topic classification subtask loss are weighted to calculate the final target loss. The corresponding process has the following relationship:
[0069] ;
[0070] in, represents the loss weight parameter, represents the final target loss;
[0071] The automatic text summarization model parameters are optimized by minimizing the final target loss to train the automatic text summarization model.
[0072] Further preferably, the text data is obtained by data crawling, and the obtained text data is preprocessed. The method for constructing the data set specifically includes the following steps:
[0073] First, we need to analyze the web page structure and obtain the topic tags of the posts;
[0074] When crawling Q&A data, categorize questions based on topic tags;
[0075] Use Python's Xpath tool to extract the title and description of the question from the web page. The crawled data will be saved in CSV format.
[0076] Clean the data and get the data set.
[0077] Please refer to Figure 3 This embodiment further provides an automatic text summarization system for online psychological support, wherein the system applies the automatic text summarization method for online psychological support as described above, and the system includes:
[0078] Model building modules for:
[0079] Based on the BART model, the attention mechanism of the bidirectional encoder and autoregressive decoder in the BART model is replaced with a distributed attention mechanism, and the language model head and classification head are added in parallel to the output of the decoder to obtain an automatic text summarization model.
[0080] Bidirectional encoding module for:
[0081] The text is input into the automatic text summarization model. The bidirectional encoder captures the global dependency of the input based on the distributed attention mechanism. During the distributed attention mechanism calculation process, the distribution of attention is adjusted to increase uncertainty to achieve distributed attention calculation and obtain the encoding result.
[0082] Autoregressive decoding module, used to:
[0083] The encoding result is input into the autoregressive decoder, which obtains information from more context positions based on the distraction attention mechanism to obtain the encoding result;
[0084] Automatic text summarization subtask module, used to:
[0085] Input the encoding result into the language model header to obtain the answer text;
[0086] Repeat the operations of the bidirectional encoding module and the autoregressive decoding module in an autoregressive manner to gradually obtain the answer text and obtain the text summary, thus realizing the automatic text summary generation subtask;
[0087] The topic classification subtask module is used to:
[0088] The final encoding result of the autoregressive decoder in the autoregressive process is sent to the classification result to obtain the classification result and realize the topic classification subtask.
[0089] Multi-task joint training module for:
[0090] Obtain a data set, and train the automatic text summarization model by performing the topic classification task and the text summary generation task simultaneously through multi-task joint training to obtain a trained automatic text summarization model;
[0091] Automatic text summarization module for:
[0092] Automatic text summary generation is achieved using the trained automatic text summarization model.
[0093] In order to verify the effectiveness of the present invention, taking a certain platform data as an example, the verification process is as follows:
[0094] A platform is selected to construct a data set. The data set constructed by the present invention is recorded as PsySD. The platform has more than 20 million registered users and more than 600 professional psychological counselors. Users will post help posts related to mental health on the platform, and usually refine the problem description into a problem title, which can be regarded as an artificial summary of the problem description. By extracting these naturally generated <problem title, problem description> pairs, a data set is constructed. This method effectively utilizes existing user interaction data, increases the practicality and richness of the data set, and improves the accessibility and analyzability of the data.
[0095] When crawling the Q&A data of a platform, the first thing to do is to analyze the structure of the web page. The analysis found that each post has a specific topic tag, such as "family", "growth" and "love". When crawling the Q&A section data, the questions are classified according to these tags to crawl the data efficiently. The Xpath tool of Python can accurately extract the title and description of the question from the web page. The crawled data will be saved in CSV format for building the PsySD dataset.
[0096] When help seekers post questions on a platform, they must strictly abide by the posting rules shown in Table 1.
[0097] Table 1 Posting rules on the platform
[0098]
[0099] When help seekers post on the platform, they need to select a keyword that best reflects the content of the post. These keywords cover multiple aspects such as behavior, treatment, interpersonal relationships, growth, emotions, love, marriage, family, career, science education, and hot events. Through these keywords, the core topics of the posts posted by help seekers can be clearly identified.
[0100] In this embodiment, the data is cleaned according to the rules of Table 1. First, posts with question titles less than 5 characters or more than 25 characters are deleted to ensure that the title length is moderate. Secondly, posts with question descriptions less than 40 characters or more than 400 characters are removed to ensure the appropriate length of the description content. Next, the posts are filtered by the keywords selected by the help seeker to eliminate those that are not seeking mental health support, such as posts that only ask about the meaning of psychological terms (the keyword is "popular science") or discuss the latest news events (the keyword is "hot spots"). Finally, only posts involving nine subject categories such as behavior, treatment, interpersonal relationships, personal growth, emotions, love, marriage, family and career are retained.
[0101] The data acquisition and preprocessing results of the present invention are analyzed, and the specific steps are as follows:
[0102] 1. Text Theme Analysis
[0103] First, analyze the text topics and visualize the reference abstracts through word cloud diagrams. Word cloud is a technology that visually displays keywords in text. It highlights keywords by analyzing text data. After removing a large number of low-frequency words and stop words, the size of the word is used to represent its frequency of occurrence. This can intuitively show the importance of different phrases and highlight key information. In the specific operation, first use jieba to perform text segmentation, then count the frequency of each word, and finally use Python's WordCloud library to generate a word cloud diagram based on these frequencies.
[0104] The word cloud diagram highlights the keywords that describe the topics of the help posts, such as "emotion", "love", "interpersonal", "treatment", "family", "behavior", "marriage", "career" and "growth". These words appear frequently in the reference abstracts, marking them as core words in the abstracts. Therefore, in the process of generating abstracts, special attention should be paid to the use of these subject words.
[0105] Table 2 shows the experimental results of the Lead-3 model on multiple automatic text summarization datasets, indicating that the datasets exhibit weak structural characteristics. The Lead model assumes that the beginning of the text contains the core information, so it uses a simple method of extracting the first few sentences from the beginning of the text as a summary. From the data in Table 2, it can be seen that the CNN / DM, NYTAC, and LCSTS datasets constructed based on news texts perform well in the ROUGE evaluation index, while the datasets composed of posts from online platforms and the Reddit TIFU dataset have lower ROUGE values.
[0106] Table 2 Lead-3 model ROUGE values
[0107]
[0108] 2. Text Abstractness Analysis
[0109] In addition to strong topicality and weak structure, the dataset also exhibits significant abstractness. Table 3 shows the percentage of content (n-grams) in the summary that does not appear in the original text. An n-gram refers to a combination of n consecutive words, and this statistic can be used to measure the level of abstractness of the summary. In the dataset, about 39% of 1-grams do not appear in the original text, while this proportion is only 10% and 11% in the CNN / DM and NYTAC datasets. For larger n-grams, the proportion of 2-grams, 3-grams, and 4-grams that do not appear in the original text in the dataset is 67%, 79%, and 85%, respectively, which is significantly higher than 45%~49%, 67%~70%, and 77%~80% in the news summary dataset.
[0110] In addition, the abstractness of PsySD was further explored by using the EXT-ORACLE method. EXT-ORACLE constructs an ORACLE summary by selecting sentences from the original text that best match the summary in terms of ROUGE score, which is considered as the theoretical upper limit of the extractive summarization model. In Table 3, the ROUGE-1, ROUGE-2, and ROUGE-L scores of the dataset obtained using the EXT-ORACLE method are 38.44%, 23.63%, and 34.45%, respectively, which are significantly lower than the corresponding scores of the CNN / DM and NYTAC news summary datasets. This is because news articles usually contain sentences that summarize the full text, which are often very similar to the reference summary. In contrast, the lack of such summary sentences in the dataset results in the almost non-existence of sentences similar to the reference summary, thus reflecting a higher abstractness.
[0111] Table 3 Statistics of noval n-gram and EXT-ROACL
[0112]
[0113] In the automatic text summarization task, commonly used evaluation indicators include ROUGE-N and ROUGE-L. ROUGE-N measures the recall rate of n-grams in the summary to evaluate the quality of the summary, including ROUGE-1, ROUGE-2, ROUGE-3 and ROUGE-4 levels, where numbers 1 to 4 represent n-gram models from 1-gram to 4-gram. The calculation method is shown in the following formula.
[0114] ;
[0115] in, represents a sentence in a reference abstract, Indicates a reference summary. Indicates the number of n-gram matches between the summary generated by the model and the reference summary. Indicates the number of n-grams in the reference summary. Usually, Select 1 or 2, namely ROUGE-1 and ROUGE-2.
[0116] In addition to ROUGE-N, the ROUGE-L indicator is also widely used for evaluating automatic text summarization models. ROUGE-L is calculated based on the Longest Common Subsequence (LCS), and its formula is as follows.
[0117] ;
[0118] ;
[0119] Among them, LCS (Extra Summary, Ref Summaries) represents the longest common subsequence length between the model-generated summary and the reference summary. Indicates the number of words contained in the reference abstract. Indicates the number of words contained in the generated summary. represents the equilibrium parameter, Indicates the F value of ROUGE-L. and They represent the recall rate and prediction accuracy of the model-generated summary for the reference summary, .
[0120] In this example, ROUGE-1, ROUGE-2, and ROUGE-L indicators are used to evaluate the summary generated by the model, and the indicator score of the summary is calculated using the rouge package in the official Rouge tool.
[0121] 3. Model training parameter setting
[0122] There are two versions of the BART model: BART-base and BART-large. BART-base is configured with 6 layers of encoders and decoders, while BART-large is equipped with 12 layers of encoders and decoders. Figure 4. The model used in this embodiment is built based on the pre-trained language model BART, and experiments are carried out using the Pytorch deep learning framework and CUDA acceleration. The BART model version used is fnlp / bart-base-chinese, and its encoder and decoder are both 6-layer structures. The detailed implementation and parameter configuration of this pre-trained version are optimized based on a large-scale Chinese corpus. This embodiment modifies the source code of fnlp / bart-base-chinese to implement multi-task joint training and distraction mechanism, thereby improving the performance and efficiency of the model. The fnlp / bart-base-chinese model parameters are shown in Table 4 below.
[0123] Table 4 Parameters of BART model
[0124]
[0125] The Adam optimizer was used for model training. Different learning rates (learning rate) of 1e-5, 2e-5, and 1e-4 were tried, and the initial learning rate was finally set to 1e-4. To prevent overfitting, the Dropout mechanism was introduced, and the dropout rate was set to 0.1. During the training process, the data was trained in batches, and the batch size (batch size) was 16. Multi-task learning weights ( ) is set to 0.9, distracting attention weight ( D ) is set to 0.8. The specific parameter settings used in the experiment are shown in Table 5 below.
[0126] Table 5 Experimental parameter settings
[0127]
[0128] Table 6 Beneficial Effects
[0129]
[0130] The present invention adds multi-task joint training and distributed attention mechanism on the basis of BART to better adapt to the subject information, text structure and abstractness, thereby significantly improving the performance of the model on ROUGE-1, ROUGE-2 and ROUGE-L evaluation indicators by 0.44%, 0.40% and 0.52% respectively. The results show that the present invention not only exceeds BART, but also outperforms mT5 proposed by PEGASUS and Google, proving the effectiveness of the present invention.
[0131] It should be understood that the various parts of the present invention can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0132] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0133] The above-mentioned embodiments only express several implementation methods of the present invention, and the description thereof is relatively specific and detailed, but it cannot be understood as limiting the scope of the patent of the present invention. It should be pointed out that, for ordinary technicians in this field, several variations and improvements can be made without departing from the concept of the present invention, which all belong to the protection scope of the present invention. Therefore, the protection scope of the patent of the present invention shall be subject to the attached claims.
Claims
1. An automatic text summarization method for online psychological support, characterized in that: The method comprises the following steps: Step 1: Based on the BART model, the attention mechanism of the bidirectional encoder and autoregressive decoder in the BART model is replaced with a distributed attention mechanism, and the language model head and the classification head are added in parallel to the output part of the decoder to obtain an automatic text summarization model; Step 2: Input the text into the automatic text summarization model. The bidirectional encoder captures the global dependency of the input based on the distributed attention mechanism. During the distributed attention mechanism calculation process, the distribution of attention is adjusted to increase uncertainty to achieve distributed attention calculation and obtain the encoding result. The encoding result is input into the autoregressive decoder, which obtains information from more context positions based on the distraction attention mechanism to obtain the encoding result; Step 3: Input the encoding result into the language model header to obtain the answer text; Step 4: Repeat steps 2 and 3 to gradually obtain the answer text through autoregression to obtain the text summary, thus realizing the automatic text summary generation subtask; The final encoding result of the autoregressive decoder in the autoregressive process is sent to the classification result to obtain the classification result and realize the topic classification subtask; Step 5: Obtain a data set, and train the automatic text summarization model by performing the topic classification task and the text summary generation task simultaneously through a multi-task joint training method to obtain a trained automatic text summarization model, and use the trained automatic text summarization model to realize automatic text summary generation; In step 5, a data set is obtained, and the automatic text summarization model is trained by performing the topic classification task and the text summary generation task simultaneously through a multi-task joint training method. The method for obtaining the trained automatic text summarization model specifically includes the following steps: The text data is obtained through data crawling, and the obtained text data is preprocessed to construct a data set, which includes reference abstracts, subject terms and help posts; The help post is input into the automatic text summarization model to obtain the text summary. The reference summary and the text summary are used to construct the automatic text summarization generation subtask loss function. The corresponding process has the following relationship: ; in, represents the loss of automatic text summarization task; The help post is input into the automatic text summarization model to obtain the classification result, and the classification result and the keyword are used to construct the topic classification subtask loss function. The corresponding process has the following relationship: ; in, represents the topic classification subtask loss, Indicates subject terms; The automatic text summarization subtask loss and the topic classification subtask loss are weighted to calculate the final target loss. The corresponding process has the following relationship: ; in, represents the loss weight parameter, represents the final target loss; Optimize the automatic text summarization model parameters by minimizing the final target loss to train the automatic text summarization model; The method of obtaining text data by crawling data and preprocessing the obtained text data to construct a data set specifically includes the following steps: First, we need to analyze the web page structure and obtain the topic tags of the posts; When crawling Q&A data, categorize questions based on topic tags; Use Python's Xpath tool to extract the title and description of the question from the web page. The crawled data will be saved in CSV format. Clean the data and get the data set.
2. The automatic text summarization method for online psychological support according to claim 1, characterized in that: In step 1, the optimization target of the automatic text summarization model has the following relationship: ; in, Indicates The input data of a task, Indicates The output of a task, Indicates The weight of the task, Indicates the loss calculation result, Represents the optimal weight of the automatic text summarization model.
3. The automatic text summarization method for online psychological support according to claim 2, characterized in that: In step 3, in the process of calculating the distraction mechanism, the distribution of attention is adjusted to increase uncertainty, so that the distraction calculation is achieved by introducing an additional weight parameter in the self-attention calculation process. The corresponding process has the following relationship: ; in, Q , K and V represents the linear representation of the hidden layer, d is the dimension size of the hidden layer, D is the distraction weight parameter.
4. The automatic text summarization method for online psychological support according to claim 3, characterized in that: In step 4, the conditional probability of the automatic text summarization subtask has the following relationship: ; in, Indicated in t The output of the task generated at the moment, Represents input data, , Indicates the length of the input data. denotes the corresponding reference abstract, , indicates the length of the corresponding reference abstract, represents the parameters of the model, Indicated in t The output of the task generated before time .
5. An automatic text summarization system for online psychological support, characterized in that: The system applies the automatic text summarization method for online psychological support according to any one of claims 1 to 4, and the system comprises: Model building modules for: Based on the BART model, the attention mechanism of the bidirectional encoder and autoregressive decoder in the BART model is replaced with a distributed attention mechanism, and the language model head and classification head are added in parallel to the output of the decoder to obtain an automatic text summarization model. Bidirectional encoding module for: The text is input into the automatic text summarization model. The bidirectional encoder captures the global dependency of the input based on the distributed attention mechanism. During the distributed attention mechanism calculation process, the distribution of attention is adjusted to increase uncertainty to achieve distributed attention calculation and obtain the encoding result. Autoregressive decoding module, used to: The encoding result is input into the autoregressive decoder, which obtains information from more context positions based on the distraction attention mechanism to obtain the encoding result; Automatic text summarization subtask module, used to: Input the encoding result into the language model header to obtain the answer text; Repeat the operations of the bidirectional encoding module and the autoregressive decoding module in an autoregressive manner to gradually obtain the answer text and obtain the text summary, thus realizing the automatic text summary generation subtask; The topic classification subtask module is used to: The final encoding result of the autoregressive decoder in the autoregressive process is sent to the classification result to obtain the classification result and realize the topic classification subtask.
6. Multi-task joint training module, used for: Obtain a data set, and train the automatic text summarization model by performing the topic classification task and the text summary generation task simultaneously through multi-task joint training to obtain a trained automatic text summarization model; Automatic text summarization module for: Automatic text summary generation is achieved using the trained automatic text summarization model.
Citation Information
Patent Citations
Text abstract generation method based on keyword information and multi-head attention mechanism
CN116010590A
Multi-document abstract generation method based on key events
CN117874220A