input: Write a python function to perform K-means clustering on a set of text documents and return the top terms for each cluster.
  assert kmeans_clustering(["data science is fun", "machine learning is amazing", "deep learning is a subset of machine learning", "statistics is important for data science", "python is a popular programming language"], 2) == [['machine', 'learning', 'subset', 'deep', 'amazing'], ['science', 'data', 'important', 'statistics', 'fun']]
  assert kmeans_clustering(["apple orange banana", "cat dog mouse", "fish bird horse", "car truck bike", "red blue green"], 3) == [['orange', 'apple', 'banana'], ['dog', 'cat', 'mouse'], ['fish', 'bird', 'horse']]
output: def kmeans_clustering(documents, num_clusters):
      from sklearn.feature_extraction.text import TfidfVectorizer
      from sklearn.cluster import KMeans
      from collections import Counter
      
      # Convert the text documents to a matrix of TF-IDF features
      vectorizer = TfidfVectorizer(stop_words='english')
      X = vectorizer.fit_transform(documents)
      
      # Perform K-means clustering
      kmeans = KMeans(n_clusters=num_clusters, random_state=42)
      kmeans.fit(X)
      
      # Get the terms corresponding to the features
      terms = vectorizer.get_feature_names_out()
      
      # Identify the top terms for each cluster
      top_terms = []
      for i in range(num_clusters):
          cluster_center = kmeans.cluster_centers_[i]
          top_indices = cluster_center.argsort()[-5:][::-1]
          top_terms.append([terms[index] for index in top_indices])
      
      return top_terms