def get_character_dictionary_from_text(filename, name_position, dialogue_position, scenario_position):
  """
  This function converts a text file inot a character dictionary.

    Parameters:
      filename: string: The path of the file to read
      name_position: int: Number of spaces before the name
      dialogue_position: int: Number of spaces before the dialogues
      scenario_position: int: Number of spaces before the scenarios

    Returns:
      character_dialogues: dict: A dictionary with every character's dialogues,
                               : The sample format is "Name": list of dialogues
      scenarios: dict: A list of scenarios, with the key "scenarios". It is kept
                      as a dict because we can further classify it into different
                      kinds of scenarios if we want
  """
  # Filtering the empty lines
  lines = list(filter(lambda x: x!='', open(filename).read().split('\n')))
  character_dialogues = {}
  scenarios = {'scenarios': []} 
  dialogue = "" 
  dialogue_ready = False
  for line in lines:  # for every line
    line_arr = line.split(":") 
    if len(line_arr) == 1:
      scenarios['scenarios'].append(line_arr[0])
    elif len(line_arr) == 2:
      character = line_arr[0]
      dialogue = line_arr[1]
      # If some random line is classified as a dialogue, skip it; 
      if len(character) >= 30:
        continue
      if not character_dialogues.get(character):
          character_dialogues[character] = []
      character_dialogues[character].append(dialogue)
  return character_dialogues, scenarios