input: Write a Python class to read in a text file and count the frequency of each word. The class should have an initializer that takes the filename as an argument and a method to return the word counts.
  class WordCounter:
      def __init__(self, filename):
          self.word_counts = {}
          self.filename = filename
          self.process_file()
  
      def process_file(self):
          with open(self.filename) as f:
              for line in f:
                  words = line.split()
                  for word in words:
                      if word in self.word_counts:
                          self.word_counts[word] += 1
                      else:
                          self.word_counts[word] = 1
  
      def get_word_counts(self):
          return self.word_counts
  
  assert WordCounter("sample.txt").get_word_counts() == {'This': 1, 'is': 1, 'a': 1, 'sample': 1, 'text': 1, 'file.': 1}
  assert WordCounter("empty.txt").get_word_counts() == {}
  assert WordCounter("repeated.txt").get_word_counts() == {'the': 3, 'quick': 2, 'brown': 1, 'fox': 1, 'jumps': 1, 'over': 1}
output: class WordCounter:
      def __init__(self, filename):
          self.word_counts = {}
          self.filename = filename
          self.process_file()
  
      def process_file(self):
          with open(self.filename) as f:
              for line in f:
                  words = line.split()
                  for word in words:
                      if word in self.word_counts:
                          self.word_counts[word] += 1
                      else:
                          self.word_counts[word] = 1
  
      def get_word_counts(self):
          return self.word_counts