"""
A word frequency program.  Determines the ten most common words in a text
document.
"""

def get_filename():
  """
  Prompts the user for a filename and returns the result.
  """
  # TODO: Retrieve a filename from the user.
  return "gbaddress.txt"

def get_file_contents(filename):
  """
  Retrieves the contents of a file.  The filename parameter is the name of
  that file.  This function returns its contents.
  """
  # TODO: read file contents
  return "Here is a pretend file.\nThese are its contents.\n"

def get_words_from_text(text):
  """
  Breaks a string into its words.  The string is the parameter named text.
  The result is a list of the individual words, as strings.
  """
  # TODO: get the words out of the text parameter
  return ["here","are","some","words","and","some","more","words"]

def count_word_frequency(words):
  """
  Counts the frequency of some words in a list.  The parameter is the list of
  words to count.  The return value is a list of two elements.  The first
  element in the return list is a list of unique words appearing in the
  parameter.  The second element is a list of counts corresponding to the words
  in the same position as the unique words list.
  """
  # TODO: what it says up there
  return [ [ "the", "dog", "was" ], [ 2, 1, 1] ]

def find_top_ten_word_frequencies(frequency_result):
  """
  Given a frequency result (a list of two lists where the first identifies a
  word and the second tells how often it appears), produces a list of lists
  containing the top ten most frequent.
  """
  # TODO: find the top ten most frequent words
  return [ [ "the", "dog", "was" ], [ 2, 1, 1] ]

def display_word_frequencies(frequency_result):
  """
  Displays (in the order in which they appear) the words in the provided result
  and their frequencies.
  """
  # TODO: display the words
  return

def main():
  filename = get_filename()
  contents = get_file_contents(filename)
  words = get_words_from_text(contents)
  frequency_result = count_word_frequency(words)
  top_ten = find_top_ten_word_frequencies(frequency_result)
  display_word_frequencies(top_ten)

main()
