input: Write a python function to calculate cosine similarity between two text documents, after preprocessing (tokenization, stop word removal, stemming, and vectorization).
  assert calculate_cosine_similarity("This is the first document", "This is the second document") == 0.7999999999999998
  assert calculate_cosine_similarity("Hello world!", "Hello there!") == 0.4999999999999999
  assert calculate_cosine_similarity("Data science is fun", "Data science is awesome") == 0.8
output: from sklearn.feature_extraction.text import TfidfVectorizer
  from sklearn.metrics.pairwise import cosine_similarity
  from nltk.corpus import stopwords
  from nltk.stem.porter import PorterStemmer
  import nltk
  import re
  
  nltk.download('stopwords')
  
  def preprocess_text(text):
      stop_words = set(stopwords.words('english'))
      stemmer = PorterStemmer()
      
      # Tokenization and lowercasing
      words = re.findall(r'\b\w+\b', text.lower())
      
      # Stop word removal and stemming
      processed_words = [stemmer.stem(word) for word in words if word not in stop_words]
      
      return ' '.join(processed_words)
  
  def calculate_cosine_similarity(doc1, doc2):
      doc1 = preprocess_text(doc1)
      doc2 = preprocess_text(doc2)
      
      vectorizer = TfidfVectorizer()
      tfidf_matrix = vectorizer.fit_transform([doc1, doc2])
      
      similarity_matrix = cosine_similarity(tfidf_matrix[0:1], tfidf_matrix[1:2])
      return similarity_matrix[0][0]