def set_index_dic(self, my_tweets_dic): for tweet_id in self.my_tweets_dic: tokens = Tokens() tokens.remove_stopwords(self.my_tweets_dic[tweet_id]) current_id = tweet_id for word in tokens.reduced_tokens: self.replace_in_dic(word, current_id) sorted_dic = dict(sorted(self.dic.items())) return sorted_dic