input: Write a function that creates a Python class to read in a text file and count the frequency of each word. The function should define the class and include methods to initialize the class with a filename, process the file to count the word frequencies, and 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("example.txt").get_word_counts() == {"example": 1, "text": 1, "file": 1}
  assert WordCounter("multiple_words.txt").get_word_counts() == {"multiple": 2, "words": 3, "in": 1, "this": 1, "file": 1}
  assert WordCounter("no_words.txt").get_word_counts() == {}
  assert WordCounter("complex.txt").get_word_counts() == {"complex": 1, "example": 1, "with": 1, "various": 1, "word": 1, "counts": 1}
  assert WordCounter("empty.txt").get_word_counts() == {}
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