input: Write a function to classify text documents into two classes: positive and negative using the Naive Bayes classifier from the nltk library. The function should first train the classifier using provided positive and negative text examples. Then, it should classify new text input as either positive or negative.
  
  def classify_text(train_data, new_text):
      classifier = NaiveBayesClassifier.train(train_data)
      new_tokens = nltk.word_tokenize(new_text)
      return classifier.classify(label_words(new_tokens))
  
  positiveText = "This is a great movie!"
  negativeText = "This movie was terrible"
  
  positive_tokens = nltk.word_tokenize(positiveText) 
  negative_tokens = nltk.word_tokenize(negativeText)
  
  positive_data = [(label_words(positive_tokens), 'positive')] 
  negative_data = [(label_words(negative_tokens), 'negative')]
   
  train_data = positive_data + negative_data 
  
  assert classify_text(train_data, "This movie was ok") == "positive"
  assert classify_text(train_data, "I hated this movie") == "negative"
output: def classify_text(train_data, new_text):
      classifier = NaiveBayesClassifier.train(train_data)
      new_tokens = nltk.word_tokenize(new_text)
      return classifier.classify(label_words(new_tokens))