input: Write a function to visually summarize Twitter data using Python. The function should take in a stream of tweets with data fields like tweet author, date of tweet, text, number of likes, and number of retweets. The function should generate three plots using matplotlib: one summarizing the number of tweets per author, another summarizing the number of likes per tweet, and the third summarizing the number of retweets per tweet. If the input data is empty, the function should not generate any plots.
  
  
  def summarize_twitter_data(twitter_data):
      import matplotlib.pyplot as plt
  
      if not twitter_data:
          return
  
      # Process the Twitter data to extract the relevant data fields
      authors = []
      num_tweets = []
      tweets = []
      num_likes = []
      num_retweets = []
  
      # Assuming twitter_data is a list of dictionaries
      for tweet in twitter_data:
          authors.append(tweet['author'])
          num_tweets.append(1)  # Each tweet counts as one
          tweets.append(tweet['text'])
          num_likes.append(tweet['likes'])
          num_retweets.append(tweet['retweets'])
  
      # Plot the tweet authors
      plt.figure(1)
      plt.xlabel('Tweet Authors')
      plt.ylabel('Number of tweets')
      plt.title('Tweet Author Summary')
      plt.bar(authors, num_tweets)
      plt.xticks(rotation=90)
      plt.tight_layout()
      plt.show()
  
      # Plot the number of likes
      plt.figure(2)
      plt.xlabel('Tweets')
      plt.ylabel('Number of Likes')
      plt.title('Number of Likes Summary')
      plt.bar(tweets, num_likes)
      plt.xticks(rotation=90)
      plt.tight_layout()
      plt.show()
  
      # Plot the number of retweets
      plt.figure(3)
      plt.xlabel('Tweets')
      plt.ylabel('Number of Retweets')
      plt.title('Number of Retweets Summary')
      plt.bar(tweets, num_retweets)
      plt.xticks(rotation=90)
      plt.tight_layout()
      plt.show()
  
  # Example usage:
  twitter_data = [
      {'author': 'User1', 'date': '2023-01-01', 'text': 'Hello World', 'likes': 5, 'retweets': 2},
      {'author': 'User2', 'date': '2023-01-02', 'text': 'Python is awesome', 'likes': 10, 'retweets': 3},
      {'author': 'User1', 'date': '2023-01-03', 'text': 'Machine Learning', 'likes': 7, 'retweets': 1},
  ]
  summarize_twitter_data(twitter_data)
  
output: def summarize_twitter_data(twitter_data):
      import matplotlib.pyplot as plt
  
      if not twitter_data:
          return
  
      authors = []
      num_tweets = []
      tweets = []
      num_likes = []
      num_retweets = []
  
      for tweet in twitter_data:
          authors.append(tweet['author'])
          num_tweets.append(1)
          tweets.append(tweet['text'])
          num_likes.append(tweet['likes'])
          num_retweets.append(tweet['retweets'])
  
      plt.figure(1)
      plt.xlabel('Tweet Authors')
      plt.ylabel('Number of tweets')
      plt.title('Tweet Author Summary')
      plt.bar(authors, num_tweets)
      plt.xticks(rotation=90)
      plt.tight_layout()
      plt.show()
  
      plt.figure(2)
      plt.xlabel('Tweets')
      plt.ylabel('Number of Likes')
      plt.title('Number of Likes Summary')
      plt.bar(tweets, num_likes)
      plt.xticks(rotation=90)
      plt.tight_layout()
      plt.show()
  
      plt.figure(3)
      plt.xlabel('Tweets')
      plt.ylabel('Number of Retweets')
      plt.title('Number of Retweets Summary')
      plt.bar(tweets, num_retweets)
      plt.xticks(rotation=90)
      plt.tight_layout()
      plt.show()