input: Write a function to create a natural language processing application in Python that extracts the top 10 most frequent words from a given text. The function should return a list of tuples where each tuple contains a word and its frequency.
  assert word_frequency([])=="The input text or list of words should not be empty."
  assert word_frequency("Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")=="[('dolor', 1), ('Lorem', 1), ('ipsum', 1), ('amet', 1), ('consectetur', 1), ('adipiscing', 1), ('elit,', 1), ('sed', 1), ('do', 1), ('eiusmod', 1)]"
  assert word_frequency(["apple", "banana", "apple", "orange", "banana", "banana"])=="[('banana', 3), ('apple', 2), ('orange', 1)]"
  assert word_frequency("")=="The input text or list of words should not be empty."
  assert word_frequency(["a", "b", "c", "a", "b", "a"])=="[('a', 3), ('b', 2), ('c', 1)]"
output: def word_frequency(text):
      if not text:
          return "The input text or list of words should not be empty."
      
      if isinstance(text, str):
          words = text.split()
      else:
          words = text
      
      freq = {}
      for word in words:
          if word in freq:
              freq[word] += 1
          else:
              freq[word] = 1
      
      sorted_freq = sorted(freq.items(), key=lambda item: item[1], reverse=True)
      return sorted_freq[:10]