-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.py
27 lines (20 loc) · 769 Bytes
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
from pprint import pprint
from indexing_and_searching.loading import load_documents
from indexing_and_searching.indexing import Index
# indexing the corpus in the memory
def index_documents(documents, index):
for i, document in enumerate(documents):
index.index_document(document)
print(f'Indexed {i} documents', end='\r')
return index
if __name__ == '__main__':
def start():
index = index_documents(load_documents(), Index())
while index:
results = []
searching_keyword = input("Enter Your query or QUIT stop program running: ")
if searching_keyword.upper() == "QUIT":
index = False
p = index.search(searching_keyword)
pprint(p)
start()