22 lines
354 B
Python
22 lines
354 B
Python
from sys import exit
|
|
|
|
from wordutils import clean
|
|
|
|
index = {}
|
|
|
|
try:
|
|
inf = open("indexdata.txt", "r")
|
|
except FileNotFoundError:
|
|
exit("File not found")
|
|
|
|
for line in inf:
|
|
fields = line.split(":")
|
|
key = fields[0].strip()
|
|
word = fields[1].strip()
|
|
|
|
if key not in index:
|
|
index[key] = set()
|
|
|
|
index[key].add(word)
|
|
|
|
print(index) |