-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmainModule.py
95 lines (64 loc) · 1.84 KB
/
mainModule.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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# prediction algorithm
def predict(f1, f2):
for i in f1:
for j in f2:
if f1[i] == f2[j]:
print('pattern matched')
else:
print('not match')
# print the List
def printList(logList):
for i in range(len(logList)):
print(logList[i])
# read from file
def readFile(f1):
logList = []
with open('Log.txt') as f1:
logList = f1.readlines()
logList.append([x.strip() for x in logList])
printList(logList)
# predict the nxt
predict(f1, f2)
def readFile(f2):
iplog = []
with open('iplog.txt') as f2:
iplog = f2.readlines()
iplog = [x.strip() for x in iplog]
printList(iplog)
# main module
if __name__ == '__main__':
# FileHandling
# create a file & append
f1 = open('Log.txt', 'a+')
f2 = open('iplog.txt', 'a+')
# list for dataset
lst = []
symtomsList = ['Body-Pain', 'Cough & Cold', 'Fever', 'Headache', 'Inflamation', 'dizzing']
environmentList = ['Hot', 'Cold', 'Humitnity', 'Rainy', 'Snoozy']
medicineList = ['Paracetamol', 'Nemoslide', 'Dichlomo', 'Phenil']
# dataset from user
# for the symtoms
print(symtomsList)
symtoms = int(input())
# climate or whether
print(environmentList)
environment = int(input())
# medicine
# print(medicineList)
# medicine = int(input())
# appeding in the list
lst.append(symtoms)
lst.append(environment)
# lst.append(medicine)
# print
print(lst)
print(symtomsList[symtoms-1], environmentList[environment-1])
# data insert into the file
f1.write(str(lst))
f1.write('\n')
# read the file
readFile(f1)
readFile(f2)
# file close
f1.close()
f2.close()