def formatnSortByChar(dic,text,common):
  """This function returns a formated string of the words each character has said in common with the text
   
  Args:
      dic (dictionary): a dictionary of each characters said words in dialogue with word counter.
                        dictionary is formated as such {character : {word : 2 , anotherword : 4} }

      text (string): a corpus of only dialogue 

      common (list): a list of tuples that include the word and amount of times frequently said.
                     list is formated as such: [(word,2),(anotherword,4),(newword,3)]

  Returns:
      text (string): a string that is formated to show only the words that each character said that is commonly said throughout the text 
                     Example: 
                            Character1
                            word 4
                            newword 3

                            Character2 
                            word 2

  """
  #remove any character that is not a letter or ' from text 
  # text = re.sub(r"[^\w\s'-]", ' ', text) 

  text = ''

  for character in dic:
    boolean = False
    # characterDic = removeStopwordsDic(dic[character],stopwords)
    sort_orders = sorted(dic[character].items(), key=lambda x: x[1], reverse=True)
    
    for i in sort_orders:
      #only show the words that are in common throughout the text
      #character may have said more words but we're only showing those that are most common throughout the film
      if i[0] in [lis[0] for lis in common]:
        if not boolean:
          text +="\n\n"+ character
          boolean = True
        text+="\n"+ str(i[0])+ " "+ str(i[1])
  return text