input: Write a python function to classify a text document into predefined categories using Naive Bayes classifier.
  assert classify_document("This document is about the science of climate change.") in ['science', 'arts', 'politics']
  assert classify_document("The painting is a classic piece of art.") == 'arts'
  assert classify_document("The new policies were discussed in the recent political meeting.") == 'politics'
output: def classify_document(text):
      from sklearn.feature_extraction.text import CountVectorizer
      from sklearn.naive_bayes import MultinomialNB
  
      # Sample training data
      train_data = [
          "The study of climate change and its effects.",
          "Physics and chemistry are branches of science.",
          "The new discovery in biology.",
          "Art includes painting, sculpture, and music.",
          "The museum has a new art exhibition.",
          "This piece of art is from the Renaissance period.",
          "Politics is about the governance of a country.",
          "The election results were announced.",
          "The new policies were discussed in the political meeting."
      ]
  
      # Corresponding labels
      train_labels = [
          'science', 'science', 'science',
          'arts', 'arts', 'arts',
          'politics', 'politics', 'politics'
      ]
  
      # Create a CountVectorizer
      vectorizer = CountVectorizer()
      X_train = vectorizer.fit_transform(train_data)
  
      # Create a Naive Bayes classifier
      classifier = MultinomialNB()
      classifier.fit(X_train, train_labels)
  
      # Transform the input text
      X_test = vectorizer.transform([text])
  
      # Predict the category
      predicted_label = classifier.predict(X_test)[0]
      return predicted_label