except Exception as e: raise () if __name__ == "__main__": try: doc_basename = "docsnew" # the actual name of the folder containing the processed files doc_location = "../file_cache/processed/" + doc_basename dp = DPClass() #dp.runDocProc("../file_cache/unprocessed/" + doc_basename) iic = InvertedIndexClass() #iic.createInvertedIndex("../file_cache/processed/docsnew") #iic.createInvertedIndex("../file_cache/processed/testdoc") iic.loadInvertedIndex(doc_location) vsm = VSMClass(iic, doc_basename) vsm.createEntireModel() stemmer = PorterStemmer() continueLoop = True print("Welcome to the Search Engine\n") while continueLoop: fromUser = "" user_query = "" print( "\n\nSelect from the Following Options:\n\t1.) Search\n\t2.) Exit" ) from_user = input("Your Choice: ")
except Exception as e: raise() if __name__ == "__main__": output = {} try: doc_basename = "newly_crawled" # the actual name of the folder containing the processed files doc_location = "../file_cache/processed/" + doc_basename dp = DPClass() iic = InvertedIndexClass() iic.loadInvertedIndex("../file_cache/processed/" + doc_basename) stemmer = PorterStemmer() english_file = open("./nltk-3.3/nltk_data/corpora/stopwords/english", "r", encoding="UTF8") english_words = english_file.read().strip().split() english_file.close() if len(sys.argv) < 2: output = {"ERROR MESSAGE": "You Need to Give a Search Term"} else: arguments = "" query = [] # argument 0 is the file name for argi in sys.argv[1:]: