## 4 Main Algorithm
```  
**Algorithm**CyberbullismDetectionAndAnalysis  
```
import org.tensorflow.lite.Interpreter; import org.tensorflow.lite.gpu.GpuDelegate;
``` import org.tensorflow.lite.support.common.FileUtil; import org.tensorflow.lite.support.model.Model; import org.tensorflow.lite.support.model.Model.Options; import java.util.List; import org.apache.commons.io.FileUtils; import org.apache.commons.text.similarity.CosineDistance; import org.deeplearning4j.models.word2 vec.WordVectors; import org.deeplearning4j.text.tokenization.tokenizer.preprocessor.CommonPreprocessor; import org.deeplearning4j.text.tokenization.tokenizer.preprocessor.TokenPreProcess; import org.deeplearning4j.text.tokenization.tokenizerfactory.DefaultTokenizerFactory; import org.deeplearning4j.text.tokenization.tokenizerfactory.TokenizerFactory; import edu.stanford.nlp.util.Pair; import org.tensorflow.lite.support.tensorflow.TensorBuffer; public class CyberbullismDetectionAndAnalysis { private static final String BERT_MODEL_PATH = \"bert_model.tflite\"; private static final String GPT2_MODEL_PATH = \"gpt2_model.tflite\"; private static final String LSTM_MODEL_PATH = \"lstm_model.tflite\"; private static final String BILSTM_MODEL_PATH = \"bilst_model.tflite\"; private static final String LSTM_AUTOENCODER_MODEL_PATH = \"lstm_autoencoder_model.tflite\"; private static final String WORD2 Vec_MODEL_PATH = \"word2 vec_model.bin\"; private static final TokenPreProcess TOKEN_PRE_PROCESSOR = new CommonPreprocessor(); private static final TokenizerFactory TOKENIZER_FACTORY = new DefaultTokenizerFactory(); private static final CosineDistance COSINE_DISTANCE = new CosineDistance(); private static final float SIMILARITY_THRESHOLD = 0.5f; // Load the previously trained LSTM model private static Interpreter modelLSTM = new Interpreter(FileUtils.loadMappedFile(LSTM_MODEL_PATH)); // Load the previously trained BiLSTM model private static Interpreter modelBiLSTM = new Interpreter(FileUtils.loadMappedFile(BILSTM_MODEL_PATH)); // Load the previously trained LSTM-Autoencoder model private static Interpreter modelLSTMAutoencoder = new Interpreter(FileUtil.loadMappedFile(LSTM_AUTOENCODER_MODEL_PATH)); // Load the previously trained Word2 Vec model private static WordVectors modelWord2 Vec = WordVectorSerializer.readWord2 VecModel(WORD2 Vec_MODEL_PATH); // Class constructor public static CyberbullismDetectionAndAnalysis() {```
// Implementation of the system setup } // Function to label an aggressive comment using BERT public static int labelCommentBERT(String commentText) { // Implementation for BERT labelling return predictedLabel; } // Function to label an aggressive comment using GPT-2 public static int labelCommentGPT2(String commentText) { // Implementation for GPT-2 labeling return predictedLabel; } // Function to label an aggressive comment using LSTM public static int labelCommentLSTM(String commentText) { // Implementation for LSTM labelling return predictedLabel; } // Function to label an aggressive comment using BiLSTM public static int labelCommentBiLSTM(String commentText) { // Implementation for BiLSTM labelling return predictedLabel; } // Function to label an aggressive comment using LSTM-Autoencoder public static int labelCommentLSTMAutoencoder(String commentText) { // Implementation for LSTM-Autoencoder labelling return predictedLabel; } // Function to label an aggressive comment using Word2 Vec public static int labelCommentWord2 Vec(String commentText) { // Implementation for Word2 Vec labelling return predictedLabel; } // Function to evaluate a model returning accuracy, precision, recall, f1_score, roc_curve, confusion_matrix public static List<Float> evaluateModel(List<Integer> predictedLabel, List<Integer> realLabel) { // Implementation for model evaluation return evaluationMetrics; } }
```

**Algorithm 1**_Cont._

As shown by Algorithm 1, our technique exploits well-understood deep learning methods to magnify the process of detecting, preventing, and analyzing cyberbullying on social media.