input: Write a python function to train a Naive Bayes classifier on Reuters dataset and classify new email documents.
  assert classify_emails(["This is an email about sports."]) == ["sports"]
  assert classify_emails(["This is an email about politics."]) == ["politics"]
  assert classify_emails(["Stock markets are crashing."]) == ["money"]
  assert classify_emails(["New technology trends in AI."]) == ["technology"]
output: def classify_emails(emails):
      from sklearn.datasets import fetch_20newsgroups
      from sklearn.feature_extraction.text import TfidfVectorizer
      from sklearn.naive_bayes import MultinomialNB
  
      # Load the training data from the 20 newsgroups dataset
      categories = ['rec.sport.baseball', 'talk.politics.mideast', 'sci.electronics', 'talk.politics.misc', 'rec.sport.hockey', 'sci.med', 'comp.graphics', 'sci.space', 'soc.religion.christian', 'talk.religion.misc', 'rec.autos', 'rec.motorcycles', 'rec.sport.baseball', 'rec.sport.hockey', 'sci.crypt', 'sci.electronics', 'comp.graphics', 'comp.os.ms-windows.misc', 'comp.sys.ibm.pc.hardware', 'comp.sys.mac.hardware', 'comp.windows.x']
      newsgroups_train = fetch_20newsgroups(subset='train', categories=categories, shuffle=True, random_state=42)
  
      # Transform the training data into TF-IDF features
      vectorizer = TfidfVectorizer()
      X_train_tfidf = vectorizer.fit_transform(newsgroups_train.data)
  
      # Train the Naive Bayes classifier
      clf = MultinomialNB().fit(X_train_tfidf, newsgroups_train.target)
  
      # Transform the new email documents into TF-IDF features
      X_new_tfidf = vectorizer.transform(emails)
  
      # Predict the categories of the new email documents
      predicted = clf.predict(X_new_tfidf)
      category_names = {0: 'sports', 1: 'politics', 2: 'technology', 3: 'politics', 4: 'sports', 5: 'technology', 6: 'technology', 7: 'technology', 8: 'religion', 9: 'religion', 10: 'autos', 11: 'autos', 12: 'sports', 13: 'sports', 14: 'technology', 15: 'technology', 16: 'technology', 17: 'technology', 18: 'technology', 19: 'technology', 20: 'technology'}
  
      return [category_names[p] for p in predicted]