input: Write a python function to train a Naive Bayes classifier on text data and calculate its accuracy.
  assert train_naive_bayes_classifier([("text1", "label1"), ("text2", "label2")]) > 0.5
  assert train_naive_bayes_classifier([("sample1", "category1"), ("sample2", "category2"), ("sample3", "category1")]) > 0.3
output: def train_naive_bayes_classifier(data):
      from sklearn.feature_extraction.text import CountVectorizer
      from sklearn.naive_bayes import MultinomialNB
      from sklearn.model_selection import train_test_split
      from sklearn.metrics import accuracy_score
  
      texts, labels = zip(*data)
      vectorizer = CountVectorizer()
      X = vectorizer.fit_transform(texts)
      
      X_train, X_test, y_train, y_test = train_test_split(X, labels, test_size=0.2, random_state=42)
      
      model = MultinomialNB()
      model.fit(X_train, y_train)
      
      y_pred = model.predict(X_test)
      accuracy = accuracy_score(y_test, y_pred)
      
      return accuracy