def tfidf(self): print("Starting Baseline run...") tfidf = TfIdf() tfidf.index_folder_location = self.index_folder tfidf.loadIndex() tfidf.processQueries() tfidf.fetchInvertedList() tfidf.calculateDocumentLength() for query_id, query in tfidf.queries.items(): querylist = query.split() tfidf.computeScore(querylist) tfidf.saveResults(query_id, 'TfIdfModel') print("Baseline run completed successfully!") print("Starting run for stemmed corpus...") tfidf = TfIdf() tfidf.index_folder_location = self.stemmed_index_folder tfidf.loadIndex() tfidf.processStemmedQueries() tfidf.fetchInvertedList() tfidf.calculateDocumentLength() for query_id, query in tfidf.queries.items(): querylist = query.split() tfidf.computeScore(querylist) tfidf.saveResults(query_id, 'TfIdfModel_Stemmed') print("Run for stemmed corpus completed successfully!") print("Starting run for stopping with no stemming...") tfidf = TfIdf() tfidf.stopping_required = True tfidf.index_folder_location = self.stopped_index_folder tfidf.loadIndex() tfidf.processQueries() tfidf.fetchInvertedList() tfidf.calculateDocumentLength() for query_id, query in tfidf.queries.items(): querylist = query.split() tfidf.computeScore(querylist) tfidf.saveResults(query_id, 'TfIdfModel_Stopped') print("Run for stopping with no stemming completed successfully!")