def save_index(self, fn):
     """
     Saves a pre-computed index (or indices) so we can save our work.
     Input:
           fn - file name of pickled index.
     """
     utils.save_obj(obj=self.terms_index, name=fn, path='')
 def dump_tweet_postings_to_disc(self):
     """
     writes the postings to disc and empties the dictionary in memory.
     :return:
     """
     self.tweets_postings_counter += 1
     utils.save_obj(self.tweets_postings_file,
                    str(self.tweets_postings_counter),
                    self.config.get_tweets_postings_path())
     self.tweets_postings_file.clear()
    def update_tweets_postings(self):
        """

        :return:
        """
        for i in range(self.tweets_postings_counter):
            tweets_postings_file = utils.load_obj(
                str(i + 1), self.config.get_tweets_postings_path())
            for doc_id in tweets_postings_file.keys():
                tweet_posting = tweets_postings_file[doc_id]
                self.update_single_tweet_postings(tweet_posting)
            utils.save_obj(tweets_postings_file, str(i + 1),
                           self.config.get_tweets_postings_path())