input: Write a python function to generate a haiku poem using words from a text file.
  assert len(generate_haiku().split('\n')[0].split()) == 5
  assert len(generate_haiku().split('\n')[1].split()) == 7
  assert len(generate_haiku().split('\n')[2].split()) == 5
output: import random
  
  def generate_haiku():
      def count_syllables(word):
          vowels = "aeiouAEIOU"
          count = 0
          prev_char_was_vowel = False
          for char in word:
              if char in vowels:
                  if not prev_char_was_vowel:
                      count += 1
                  prev_char_was_vowel = True
              else:
                  prev_char_was_vowel = False
          if word.endswith('e') and count > 1:
              count -= 1
          return count
  
      def get_words_from_file(file_path):
          with open(file_path, 'r') as file:
              text = file.read().lower()
          words = text.split()
          return words
  
      words = get_words_from_file('words.txt')
      words = [word.strip('.,!?;:()[]"') for word in words if word.isalpha()]
  
      def construct_line(syllable_count):
          line = []
          current_syllables = 0
          while current_syllables < syllable_count:
              word = random.choice(words)
              word_syllables = count_syllables(word)
              if current_syllables + word_syllables <= syllable_count:
                  line.append(word)
                  current_syllables += word_syllables
          return ' '.join(line)
  
      line1 = construct_line(5)
      line2 = construct_line(7)
      line3 = construct_line(5)
  
      return f"{line1}\n{line2}\n{line3}"