Campus bullying risk detection method and system based on large language model and sentiment analysis

By combining large language models and sentiment analysis technology, and using the Faster-Whisper model and CNN-Transformer hybrid model, we have achieved high-precision and robust detection of campus bullying risks, solving the problem of low recognition accuracy of existing systems in complex environments and improving the real-time and accuracy of detection.

CN120673785APending Publication Date: 2025-09-19NORTH CHINA UNIVERSITY OF TECHNOLOGY

Patent Information

Application Number
CN202510775278.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-11
Publication Date
2025-09-19

AI Technical Summary

Technical Problem

Existing campus bullying risk detection systems have low recognition accuracy in complex environments, making it difficult to accurately assess the urgency of speech. Traditional methods are also limited in capturing subtle differences in speech emotions.

Method used

A detection method based on a large language model and sentiment analysis is adopted. By obtaining preprocessed audio data, the Faster-Whisper model is used for speech recognition. Combined with the bullying detection large language model and the sentiment recognition of the CNN-Transformer hybrid model, the audio data's keywords, bullying content probability, and sentiment categories are comprehensively analyzed to predict campus bullying risks.

Benefits of technology

The accuracy and robustness of campus bullying risk detection have been improved, and it can accurately identify bullying behaviors and voice emotions in complex environments, enhancing the system's real-time response capabilities and stability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120673785A_ABST
    Figure CN120673785A_ABST
Patent Text Reader

Abstract

The invention discloses a campus bullying risk detection method and system based on a large language model and sentiment analysis, and relates to the technical field of voice processing and artificial intelligence, and the method comprises the steps: inputting preprocessed audio data into a voice recognition model, and generating a recognition result text of the audio data; performing keyword detection on the recognition result text based on a preset campus bullying keyword to obtain a keyword detection result; the recognition result text is input into a bullying detection large language model, and the probability of bullying content in the recognition result text is obtained; converting the preprocessed audio data into a Mel spectrogram, and analyzing the Mel spectrogram based on an emotion recognition model to obtain an emotion category of the preprocessed audio data; and predicting the campus bullying risk in the audio data according to the recognition result text of the audio data, the keyword detection result, the probability of the bullying content and the emotion category of the audio data. According to the invention, the detection precision and robustness of the campus bullying risk can be improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the fields of speech processing and artificial intelligence technology, and in particular to a method and system for detecting campus bullying risks based on a large language model and sentiment analysis. Background Art

[0002] The intelligent campus bullying risk detection system extracts key information from voice streams and identifies potential red flags. This system plays an important role in a variety of fields, including intelligent customer service, security monitoring, and emergency response. With the continuous development of artificial intelligence technology, speech recognition systems that combine large language models and sentiment analysis have become a research focus and are widely used in various industries.

[0003] However, in the complex and volatile real-world environments, existing systems often suffer from reduced recognition accuracy due to factors such as poor speech quality, background noise, and fluctuations in the speaker's speaking rate or intonation. Furthermore, traditional methods are limited in capturing the nuances of emotional expression in speech, making it difficult to accurately assess the urgency of speech. Therefore, a high-performance recognition solution that integrates speech emotion analysis and semantic understanding is urgently needed. Summary of the Invention

[0004] The purpose of this application is to provide a campus bullying risk detection method and system based on a large language model and sentiment analysis, which can improve the detection accuracy and robustness of campus bullying risks.

[0005] To achieve the above objectives, this application provides the following solutions:

[0006] In the first aspect, this application provides a method for detecting campus bullying risks based on a large language model and sentiment analysis, including:

[0007] Acquiring pre-processed audio data; the pre-processing includes noise reduction processing;

[0008] Inputting the preprocessed audio data into a speech recognition model to generate a recognition result text of the audio data; the speech recognition model is a Faster-Whisper-based recognition model;

[0009] Based on pre-set campus bullying keywords, keyword detection is performed on the recognition result text to obtain a keyword detection result of the recognition result text;

[0010] Inputting the recognition result text into a bullying detection language model to obtain the probability of bullying content in the recognition result text;

[0011] Converting the preprocessed audio data into a mel-spectrogram, and analyzing the mel-spectrogram based on an emotion recognition model to obtain an emotion category of the preprocessed audio data; the emotion recognition model adopts a CNN-Transformer hybrid model;

[0012] The school bullying risk in the audio data is predicted based on the recognition result text of the audio data, the keyword detection result, the probability of the bullying content, and the emotion category of the audio data.

[0013] Optionally, before obtaining the preprocessed audio data, the method further includes:

[0014] The audio data is collected in real time through the microphone and stored in a queue; the audio data is sampled in float32 format with a sampling rate of 16000 Hz;

[0015] Use the reduce_noise function in the noisereduce library to perform noise reduction on the collected audio data to obtain preprocessed audio data.

[0016] Optionally, the keyword detection includes: exact matching, context consistency check and fuzzy matching.

[0017] Optionally, the similarity calculation formula of the fuzzy matching is:

[0018]

[0019] Among them, Number of matching characters is the number of matching characters, and Total number of characters is the total number of characters.

[0020] Optionally, the recognition result text is input into a large language model for bullying detection to obtain the probability of bullying content in the recognition result text, specifically including:

[0021] Based on the word segmenter, the recognition result text is converted into a token sequence {t1, t2, ..., t n};

[0022] Through the embedding layer, the token sequence {t1,t2,...,t n}Convert to embedding vector;

[0023] The Transformer encoder based on the large language model for bullying detection encodes the embedding vector and generates the context representation {h1,h2,...,h n};

[0024] According to the context, {h1,h2,...,hn}, determine the probability of bullying content in the recognition result text. Optionally, the embedding vector e i The calculation formula is:

[0025] e i =Embed(t i )=W emb ·t i +b emb ;

[0026] Among them, W emb is the embedding matrix, b emb is the bias term.

[0027] Alternatively, the self-attention mechanism calculation formula of the Transformer encoder of the bullying detection large language model is:

[0028]

[0029] Among them, Q, K, V are query, key and value matrices respectively, d k is the dimension of the key.

[0030] Optionally, depending on the context, {h1,h2,...,h n}, determining the probability of bullying content in the recognition result text, specifically including:

[0031] According to the formula P(bully|T)=σ(W·Pool(h1,h2,...,h n )+b), determining the probability of bullying content in the recognition result text;

[0032] Among them, Pool represents the pooling operation (such as taking the average or maximum value), W and b are the trainable parameters of the model, and σ is the Sigmoid activation function.

[0033] Secondly, this application provides a school bullying risk detection system based on a large language model and sentiment analysis, including:

[0034] A data acquisition module, configured to acquire pre-processed audio data; the pre-processing includes noise reduction processing;

[0035] A speech recognition and text generation module, configured to input the pre-processed audio data into a speech recognition model and generate a text of the recognition result of the audio data; the speech recognition model is a Faster-Whisper-based recognition model;

[0036] A keyword detection module, configured to perform keyword detection on the recognition result text based on pre-set campus bullying keywords to obtain a keyword detection result of the recognition result text;

[0037] A large language model bullying detection module, configured to input the recognition result text into a large language model for bullying detection to obtain a probability of bullying content in the recognition result text;

[0038] An emotion analysis module is used to convert the preprocessed audio data into a mel-spectrogram and analyze the mel-spectrogram based on an emotion recognition model to obtain the emotion category of the preprocessed audio data; the emotion recognition model adopts a CNN-Transformer hybrid model;

[0039] A result output module is used to predict the school bullying risk in the audio data based on the recognition result text of the audio data, the keyword detection result, the probability of the bullying content, and the emotional category of the audio data.

[0040] Optionally, it also includes:

[0041] Real-time audio acquisition and preprocessing module, used to collect audio data in real time through a microphone and store the data in a queue; the audio data is sampled in float32 format with a sampling rate of 16000 Hz;

[0042] It is also used to use the reduce_noise function in the noisereduce library to perform noise reduction on the collected audio data to obtain preprocessed audio data.

[0043] According to the specific embodiments provided in this application, this application discloses the following technical effects:

[0044] The present application provides a campus bullying risk detection method and system based on a large language model and sentiment analysis. First, the pre-processed audio data is obtained: the interference of background noise on subsequent analysis is reduced through noise reduction processing, thereby improving the accuracy of keyword detection and sentiment recognition. The pre-processed audio data is input into the speech recognition model to generate the recognition result text: the recognition model based on Faster-Whisper has high recognition accuracy and speed, and can accurately convert audio data into text, providing a reliable foundation for subsequent steps. Keyword detection is performed on the recognition result text: through the pre-set campus bullying keywords, the text content related to bullying can be quickly screened out, which narrows the scope of subsequent analysis and improves the detection efficiency. The recognition result text is input into the bullying detection large language model: the large language model can deeply understand the text content, and by calculating the probability of bullying content, it can more accurately determine whether the text contains campus bullying behavior, thereby improving the detection accuracy. The preprocessed audio data is converted into a Mel-spectrogram and emotion recognition is performed: The Mel-spectrogram can reflect the spectral characteristics of the audio data. Combined with the emotion recognition capabilities of the CNN-Transformer hybrid model, it can accurately determine the emotion categories in the audio data. These emotion categories are closely related to school bullying behavior, thereby enhancing the robustness of detection. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0046] Figure 1 A schematic diagram of a method for detecting campus bullying risks based on a large language model and sentiment analysis provided in one embodiment of the present application;

[0047] Figure 2 A schematic diagram of the architecture of a CNN-Transformer network provided in one embodiment of the present application;

[0048] Figure 3 A structural block diagram of a campus bullying risk detection system based on a large language model and sentiment analysis is provided in one embodiment of the present application. DETAILED DESCRIPTION

[0049] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0050] In order to make the above-mentioned purposes, features and advantages of the present application more obvious and easy to understand, the present application is further described in detail below with reference to the accompanying drawings and specific implementation methods.

[0051] Example 1

[0052] like Figure 1 As shown, this embodiment provides a campus bullying risk detection method based on a large language model and sentiment analysis, including:

[0053] Step 101: Acquire pre-processed audio data; the pre-processing includes noise reduction processing;

[0054] Step 102: Input the pre-processed audio data into a speech recognition model to generate a recognition result text of the audio data; the speech recognition model is a Faster-Whisper-based recognition model;

[0055] Step 103: Based on pre-set campus bullying keywords, keyword detection is performed on the recognition result text to obtain a keyword detection result of the recognition result text;

[0056] Step 104: Input the recognition result text into a bullying detection language model to obtain the probability of bullying content in the recognition result text;

[0057] Step 105: converting the preprocessed audio data into a mel-spectrogram, and analyzing the mel-spectrogram based on an emotion recognition model to obtain an emotion category of the preprocessed audio data; the emotion recognition model adopts a CNN-Transformer hybrid model;

[0058] Step 106: Predict the school bullying risk in the audio data based on the recognition result text of the audio data, the keyword detection result, the probability of the bullying content, and the emotion category of the audio data.

[0059] Before executing step 101, the method further includes:

[0060] The audio data is collected in real time through the microphone and stored in a queue; the audio data is sampled in float32 format with a sampling rate of 16000 Hz;

[0061] Use the reduce_noise function in the noisereduce library to perform noise reduction on the collected audio data to obtain preprocessed audio data.

[0062] Specifically, the collected audio data is subjected to noise reduction processing to reduce the interference of background noise and improve the accuracy of speech recognition. The formula for improving the signal-to-noise ratio after noise reduction processing is:

[0063]

[0064] Among them, Var(clean audio) is the variance of the audio after noise reduction, and Var(noise) is the variance of the background noise.

[0065] Before executing step 101, data collection and initialization are also included, including initializing the speech recognition model, configuring keyword detection parameters, setting the alarm sound effect file, and configuring audio collection parameters, specifically including:

[0066] Loads a Faster-Whisper-based speech recognition model that converts audio data into text in real time. It uses GPU-accelerated computation (device="cuda"), uses the float16 computation type for improved performance, and uses only local files (local_files_only="True").

[0067] Define a list of keywords and their corresponding cooldown times to avoid repeated alarm triggering within a short period of time. For example, keywords and their cooldown times (in seconds): "attack" (2 seconds), "danger" (3 seconds), "help" (5 seconds), "help" (5 seconds), and "fire" (10 seconds).

[0068] Configure the alarm sound file path to "alarm.wav" to alert the user when a keyword is detected.

[0069] Set the audio input stream's sampling rate to 16000 Hz, the number of channels to 1, the data type to float32, the callback function to audio_callback, and the block size to 1024 samples. These parameters ensure that audio data can be captured and processed correctly.

[0070] In some embodiments, when executing steps 102-106, the specific steps may be as follows:

[0071] When executing step 102, it specifically includes:

[0072] The preprocessed audio data was fed into the speech recognition model, generating text and timestamps for the recognition results. The model used the following parameters for transcription: The language was set to Chinese (language="zh"). Beam search decoding (beam_size=3) was used to balance recognition speed and accuracy. Voice activity detection was enabled (vad_filter=True), and long periods of silence were filtered out with a min_silence_duration_ms=1500 milliseconds filter duration and a speech padding time of 500 milliseconds (speech_pad_ms=500).

[0073] The most recent recognition result text is saved as context for subsequent keyword detection and consistency checks to ensure the accuracy of the detection results. The context history records the most recent 5 recognition results.

[0074] In step 103, keyword detection includes exact matching, context consistency check, and fuzzy matching, specifically including:

[0075] Checks whether the recognized text contains predefined keywords. If a keyword is detected, checks the cooldown time for the keyword to avoid repeated alarm triggering within a short period of time.

[0076] Ensure that the keyword is relevant to the recent context to avoid false positives. Check the three most recent context records. If the keyword appears in the context, the detection result is considered consistent.

[0077] Fuzzy matching is performed on undetected keywords to identify potentially dangerous words. For example, if the text contains words such as "run" or "evacuate", the system will conduct further inspection and may trigger an alarm.

[0078] Among them, the similarity calculation formula of fuzzy matching is:

[0079]

[0080] Where Number of matching characters is the number of matching characters, and Total number of characters is the total number of characters.

[0081] When executing step 104, the recognition result text generated by the speech recognition is input into the bullying detection language model to determine whether the text contains bullying content, specifically including:

[0082] The recognition result text T generated by speech recognition is input into the pre-trained large language model (such as GPT, BERT, etc.). The text T is first converted into a token sequence {t1, t2, ..., t n}, and then converted into a vector representation {e1,e2,...,e n}. The embedding vector is calculated as:

[0083] e i =Embed(t i )=W emb ·t i +b emb .

[0084] Among them, W emb is the embedding matrix, b emb is the bias term.

[0085] The embedding vector is encoded using the encoder of a large language model (such as Transformer) to generate the context representation {h1,h2,...,h n ,}. The calculation formula of the Transformer self-attention mechanism in the large language model is as follows:

[0086]

[0087] Among them, Q, K, V are query, key and value matrices respectively, d k is the dimension of the key.

[0088] The model outputs the probability that the text contains bullying content, using the following formula:

[0089] P(bully|T)=σ(W·Pool(h1,h2,...,h n )+b).

[0090] Among them, Pool represents the pooling operation (such as taking the average or maximum value), W and b are the trainable parameters of the model, and σ is the Sigmoid activation function.

[0091] If P(bully|T) is greater than a preset threshold θ (e.g., θ=0.5), the text T is marked as bullying content and passed to the subsequent sentiment analysis module.

[0092] In step 105, sentiment analysis includes converting the audio clip into a mel-spectrogram, sentiment prediction, and combining sentiment with keywords, specifically including:

[0093] Convert the audio clip into a Mel-spectrogram. The Mel-spectrogram is calculated using the following formula:

[0094] M=Mel(S)=MelFilterBank·S.

[0095] Among them, S is the short-time Fourier transform (STFT) result of the audio, and MelFilterBank is the Mel filter bank.

[0096] Load a pre-trained emotion recognition model, analyze the mel-spectrogram, and predict the emotion category of the audio clip.

[0097] The pre-trained emotion recognition model is a CNN-Transformer hybrid model with the following structure:

[0098] CNN: Convolutional layers extract local features from the mel-spectrogram using multiple convolutional layers. Each convolutional layer is followed by batch normalization and dropout layers to improve model robustness and prevent overfitting. Pooling layers use max pooling to reduce the size of feature maps while retaining important features.

[0099] Feature flattening is used to flatten the feature maps extracted by CNN into a sequence so that they can be input into the Transformer part.

[0100] Positional encoding is used to add positional encoding to preserve the position information of each feature in the sequence.

[0101] Transformer part: The multi-head attention layer is used to capture the global dependencies of features in the sequence using a multi-head attention mechanism. Feedforward neural network: Each Transformer encoder layer contains a feedforward neural network for further feature processing.

[0102] Global average pooling is used to perform global average pooling on the Transformer output to aggregate sequence features into a single feature vector.

[0103] The classification layer is used to perform sentiment classification using the Dense layer and output the probability distribution of sentiment categories.

[0104] Specifically, the advantages of the emotion recognition model are:

[0105] Strong feature extraction capability: The CNN part can effectively extract local features in the Mel-spectrogram and capture the emotional details in the speech. The formula for the convolution operation is:

[0106] F = ELU(Conv(M,K)+b).

[0107] Among them, K is the convolution kernel, b is the bias term, and ELU is the activation function.

[0108] Global context modeling: The Transformer part captures long-range dependencies through the self-attention mechanism, which can understand the semantic and emotional changes in speech. The formula of the self-attention mechanism of the Transformer part in the CNN-Transformer hybrid model is:

[0109]

[0110] Among them, Q, K, V are query, key and value matrices respectively, d k is the dimension of the key.

[0111] Robustness and generalization: The model is highly robust to noise and background interference, maintaining high recognition accuracy in complex environments. Pre-training on multiple datasets ensures good generalization performance.

[0112] Parallel computing advantages: The Transformer's parallel computing capabilities enable the sentiment analysis module to process speech data in real time, improving the system's responsiveness. In contrast, RNN-type models require sequential computation when processing sequential data, making efficient parallel processing difficult.

[0113] Multi-task adaptability: The model can not only be used for sentiment analysis, but can also be extended to other speech processing tasks such as speech recognition, speech synthesis, etc. This multi-task adaptability makes the model more widely applicable in practical applications.

[0114] Regularization and prevention of overfitting: The model uses L2 regularization and Dropout technology to effectively prevent overfitting and improve the generalization ability of the model. The formula for L2 regularization is:

[0115] Loss=CategoricalCrossentropy+λ∑ i ||θ i || 2 .

[0116] Where λ is the regularization strength, θ i are the weights of the model.

[0117] By combining the advantages of CNN and Transformer, the pre-trained emotion recognition model performs well in handling complex speech emotion recognition tasks and can accurately predict the emotion category of audio clips. Figure 2 shown.

[0118] The system further determines whether there is bullying behavior or a serious threat based on the combination of emotion categories and keywords. If the emotion category is "anger," "fear," or "disgust," and the text contains bullying keywords or the large language model detects bullying content, the system triggers an additional severe alert.

[0119] In addition, in some embodiments, the method further includes: alarm triggering and audio storage, including alarm triggering and audio storage, specifically including:

[0120] When keywords or bullying content are detected, an alarm sound is played to alert the user. The alarm sound file path is "alarm.wav". If the file is not found or fails to play, the system uses a backup beep sound.

[0121] Save the audio clip that triggered the alarm to a temporary file for later analysis.

[0122] In addition, in some embodiments, the main loop and system operation are also included, including continuous monitoring, pause mechanism and safe exit, specifically including:

[0123] The system continuously monitors microphone input and processes audio data in real time.

[0124] Supports safe exit from the system via KeyboardInterrupt (such as Ctrl+C).

[0125] Example 2

[0126] like Figure 3 As shown, this embodiment provides a school bullying risk detection system based on a large language model and sentiment analysis, including:

[0127] The data acquisition module 301 is used to acquire pre-processed audio data; the pre-processing includes noise reduction processing;

[0128] The speech recognition and text generation module 302 is used to input the pre-processed audio data into a speech recognition model to generate a recognition result text of the audio data; the speech recognition model is a Faster-Whisper-based recognition model;

[0129] A keyword detection module 303 is configured to perform keyword detection on the recognition result text based on pre-set campus bullying keywords to obtain a keyword detection result of the recognition result text;

[0130] A large language model bullying detection module 304 is configured to input the recognition result text into a large language model for bullying detection to obtain a probability of bullying content in the recognition result text;

[0131] The emotion analysis module 305 is used to convert the pre-processed audio data into a mel-spectrogram and analyze the mel-spectrogram based on an emotion recognition model to obtain the emotion category of the pre-processed audio data; the emotion recognition model adopts a CNN-Transformer hybrid model;

[0132] The result output module 306 is used to predict the school bullying risk in the audio data based on the recognition result text of the audio data, the keyword detection result, the probability of the bullying content, and the emotion category of the audio data.

[0133] The system also includes:

[0134] Real-time audio acquisition and preprocessing module, used to collect audio data in real time through a microphone and store the data in a queue; the audio data is sampled in float32 format with a sampling rate of 16000 Hz;

[0135] It is also used to use the reduce_noise function in the noisereduce library to perform noise reduction on the collected audio data to obtain preprocessed audio data.

[0136] The data acquisition and initialization module is used to load the Faster-Whisper-based speech recognition model, configure the keyword list and its cooldown time, set the path for the alarm sound effect file, and configure the audio input stream parameters. This module ensures that all necessary initialization tasks are completed at system startup, laying the foundation for subsequent speech processing tasks.

[0137] In summary, this application has the following technical effects:

[0138] 1. This application aims to address the problem that interference factors such as background noise and semantic complexity affect the accuracy of bullying content detection during speech recognition. This application integrates keyword detection, large language model semantic analysis, and sentiment analysis technology to significantly improve the accuracy of bullying content recognition.

[0139] 2. In view of the defect that traditional speech analysis technology has difficulty in capturing implicit semantic information, this application uses the powerful semantic understanding of large language models to deeply explore the potential bullying intentions in speech, breaking through the limitations of simple keyword matching.

[0140] 3. In order to overcome the shortcomings of the existing system in grasping the emotional dimension of speech, this application introduces a sentiment analysis mechanism to evaluate the speech emotion category in real time, providing a key basis for judging the urgency of speech.

[0141] 4. To meet the needs of real-time voice processing, this application optimizes the system architecture to ensure that it continuously monitors microphone input and processes audio data in real time to ensure rapid system response.

[0142] 5. In order to enhance the stability of speech recognition in complex environments, this application adopts noise reduction processing and context maintenance technology to effectively improve speech recognition accuracy and system robustness.

[0143] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0144] This document uses specific examples to illustrate the principles and implementation methods of this application. The description of the above examples is only intended to help understand the method and core concept of this application. At the same time, for those skilled in the art, based on the concept of this application, there may be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as limiting this application.

Claims

1. A campus bullying risk detection method based on large language model and sentiment analysis, characterized by: include: Acquiring pre-processed audio data; the pre-processing includes noise reduction processing; Inputting the preprocessed audio data into a speech recognition model to generate a recognition result text of the audio data; The speech recognition model is a Faster-Whisper-based recognition model; Based on pre-set campus bullying keywords, keyword detection is performed on the recognition result text to obtain a keyword detection result of the recognition result text; Inputting the recognition result text into a bullying detection language model to obtain the probability of bullying content in the recognition result text; Converting the preprocessed audio data into a mel-spectrogram, and analyzing the mel-spectrogram based on an emotion recognition model to obtain an emotion category of the preprocessed audio data; The emotion recognition model adopts a CNN-Transformer hybrid model; The school bullying risk in the audio data is predicted based on the recognition result text of the audio data, the keyword detection result, the probability of the bullying content, and the emotion category of the audio data.

2. A campus bullying risk detection method based on a large language model and sentiment analysis according to claim 1, characterized in that: Before obtaining the preprocessed audio data, it also includes: The audio data is collected in real time through the microphone and stored in a queue; the audio data is sampled in float32 format with a sampling rate of 16000 Hz; Use the reduce_noise function in the noisereduce library to perform noise reduction on the collected audio data to obtain preprocessed audio data.

3. The campus bullying risk detection method based on large language model and sentiment analysis according to claim 1 is characterized in that: The keyword detection includes: exact matching, context consistency checking and fuzzy matching.

4. The campus bullying risk detection method based on large language model and sentiment analysis according to claim 3 is characterized in that: The similarity calculation formula of the fuzzy matching is: Among them, Number of matching characters is the number of matching characters, and Total number of characters is the total number of characters.

5. The campus bullying risk detection method based on large language model and sentiment analysis according to claim 1 is characterized in that: Inputting the recognition result text into a large language model for bullying detection to obtain the probability of bullying content in the recognition result text specifically includes: Based on the word segmenter, the recognition result text is converted into a token sequence {t1, t2, ..., t n }; Through the embedding layer, the token sequence {t1,t2,...,t n }Convert to embedding vector; The Transformer encoder based on the large language model for bullying detection encodes the embedding vector and generates the context representation {h1,h2,...,h n }; According to the context, {h1,h2,...,h n }, determine the probability of bullying content in the recognition result text.

6. The campus bullying risk detection method based on large language model and sentiment analysis according to claim 5 is characterized in that: Embedding vector e i The calculation formula is: e i =Embed(t i )=W emb ·t i +b emb ; Among them, W emb is the embedding matrix, b emb is the bias term.

7. The campus bullying risk detection method based on large language model and sentiment analysis according to claim 5 is characterized in that: The self-attention mechanism calculation formula of the Transformer encoder of the large language model for bullying detection is: Among them, Q, K, V are query, key and value matrices respectively, d k is the dimension of the key.

8. The campus bullying risk detection method based on large language model and sentiment analysis according to claim 1 is characterized in that: According to the context, {h1,h2,...,h n }, determining the probability of bullying content in the recognition result text, specifically including: According to the formula P(bully|T)=σ(W·Pool(h1,h2,...,h n )+b), determining the probability of bullying content in the recognition result text; Among them, Pool represents the pooling operation (such as taking the average or maximum value), W and b are the trainable parameters of the model, and σ is the Sigmoid activation function.

9. A school bullying risk detection system based on large language model and sentiment analysis, characterized by: include: A data acquisition module, configured to acquire pre-processed audio data; the pre-processing includes noise reduction processing; The speech recognition and text generation module is used to input the pre-processed audio data into the speech recognition model and generate the recognition result text of the audio data; The speech recognition model is a Faster-Whisper-based recognition model; A keyword detection module, configured to perform keyword detection on the recognition result text based on pre-set campus bullying keywords to obtain a keyword detection result of the recognition result text; A large language model bullying detection module, configured to input the recognition result text into a large language model for bullying detection to obtain a probability of bullying content in the recognition result text; An emotion analysis module is used to convert the preprocessed audio data into a mel-spectrogram and analyze the mel-spectrogram based on an emotion recognition model to obtain an emotion category of the preprocessed audio data; The emotion recognition model adopts a CNN-Transformer hybrid model; A result output module is used to predict the school bullying risk in the audio data based on the recognition result text of the audio data, the keyword detection result, the probability of the bullying content, and the emotional category of the audio data.

10. A campus bullying risk detection system based on large language model and sentiment analysis according to claim 9, characterized in that: Also includes: Real-time audio acquisition and preprocessing module, used to collect audio data in real time through a microphone and store the data in a queue; the audio data is sampled in float32 format with a sampling rate of 16000 Hz; It is also used to use the reduce_noise function in the noisereduce library to perform noise reduction on the collected audio data to obtain preprocessed audio data.

Citation Information

Patent Citations

  • Speech feature recognition method and system based on improved visual Transform model

    CN116778912A

  • Acoustic event recognition and emotion recognition-based bullying event detection method and system

    CN118918926A

  • AI voice anti-bulley cloud platform application system fused with intelligent algorithm

    CN119132288A

  • A campus restroom bullying warning method, system, device and medium

    CN119763270A

  • Systems and methods for improved accuracy of bullying or altercation detection or identification of excessive machine noise

    US20210327438A1

Cited By

  • Method and device for detecting and judging bullying behavior based on audio and behavior feature recognition

    CN120954452A