text: from google.colab import drive
  drive.mount('/content/drive')
  
  import nltk
  nltk.download('stopwords')
  
  import numpy as np 
  import pandas as pd
  import matplotlib.pyplot as plt
  import seaborn as sns
  from keras.preprocessing.text import Tokenizer
  from keras.preprocessing.sequence import pad_sequences
  from keras.models import Sequential
  from keras.layers import Dense, Embedding, LSTM, SpatialDropout1D
  from sklearn.model_selection import train_test_split
  from keras.utils.np_utils import to_categorical
  from keras.callbacks import EarlyStopping
  from keras.layers import Dropout
  import re
  from nltk.corpus import stopwords
  from nltk import word_tokenize
  STOPWORDS = set(stopwords.words('english'))
  
  import numpy as np
  import tensorflow as tf
  from tensorflow.keras.layers import *
  from tensorflow.keras.models import *
  from tensorflow.keras import backend as K
  
  
  train_df = pd.read_csv("/train.csv",index_col=False)
  train_df.reset_index(drop=True, inplace=True)
  
  # The maximum number of words to be used. (most frequent)
  MAX_NB_WORDS = 50000
  # Max number of words in each text.
  MAX_SEQUENCE_LENGTH = 250
  # This is fixed.
  EMBEDDING_DIM = 100
  
  tokenizer = Tokenizer(num_words=MAX_NB_WORDS, filters='!"#$%&()*+,-./:;<=>?@[\]^_`{|}~', lower=True)
  tokenizer.fit_on_texts(train_df['text'].values)
  word_index = tokenizer.word_index
  print('Found %s unique tokens.' % len(word_index))
  
  X = tokenizer.texts_to_sequences(train_df['text'].values)
  X = pad_sequences(X, maxlen=MAX_SEQUENCE_LENGTH)
  print('Shape of data tensor:', X.shape)
  
  Y = pd.get_dummies(train_df['labels']).values
  print('Shape of label tensor:', Y.shape)
  
  
  X_train, X_test, Y_train, Y_test = train_test_split(X,Y, test_size = 0.10, random_state = 42)
  print(X_train.shape,Y_train.shape)
  print(X_test.shape,Y_test.shape)
  
  model = Sequential()
  model.add(Embedding(MAX_NB_WORDS, EMBEDDING_DIM, input_length=X.shape[1]))
  model.add(SpatialDropout1D(0.2))
  model.add(LSTM(100, dropout=0.2, recurrent_dropout=0.2))
  model.add(Dense(3, activation='softmax'))
  model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
  
  epochs = 5
  batch_size = 64
  
  history = model.fit(X_train, Y_train, epochs=epochs, batch_size=batch_size,validation_split=0.1,callbacks=[EarlyStopping(monitor='val_loss', patience=3, min_delta=0.0001)])
  
  accr = model.evaluate(X_test,Y_test)
  print('Test set\n  Loss: {:0.3f}\n  Accuracy: {:0.3f}'.format(accr[0],accr[1]))
  
  plt.title('Loss')
  plt.plot(history.history['loss'], label='train')
  plt.plot(history.history['val_loss'], label='test')
  plt.legend()
  plt.show();
  
  plt.title('Accuracy')
  plt.plot(history.history['accuracy'], label='train')
  plt.plot(history.history['val_accuracy'], label='test')
  plt.legend()
  plt.show();
  
  