input: Write a function to implement an autocomplete system that predicts words based on the input text. The function should generate word candidates, filter them, rank them, and return the top 5 predicted words. If the input text is empty then return an empty list.
  def autocomplete(input_text):
      if not input_text:
          return []
      word_candidates = generate_candidates(input_text)
      filtered_words = filter_candidates(word_candidates)
      sorted_words = rank_words(filtered_words)
      return sorted_words[:5]
  
  assert autocomplete("hello")==["hello","hello there","hello world","hello everyone","hello guys"]
  assert autocomplete("python")==["python","python programming","python tutorial","python language","python code"]
  assert autocomplete("java")==["java","java programming","java tutorial","java language","java code"]
  assert autocomplete("machine")==["machine learning","machine","machine vision","machine intelligence","machine translation"]
  assert autocomplete("")==[]
output: def autocomplete(input_text):
      if not input_text:
          return []
      word_candidates = ["hello", "hello there", "hello world", "hello everyone", "hello guys", "python", "python programming", "python tutorial", "python language", "python code", "java", "java programming", "java tutorial", "java language", "java code", "machine learning", "machine", "machine vision", "machine intelligence", "machine translation"]
      filtered_words = [word for word in word_candidates if word.startswith(input_text)]
      sorted_words = sorted(filtered_words, key=lambda x: (-len(x), x))
      return sorted_words[:5]