-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLookup.py
46 lines (34 loc) · 1.49 KB
/
Lookup.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
import Utilities
import WolframPerson
class Lookup:
givenInfo = {}
results = {} # Based on the given, but will be built on as we go.
def __init__(self, infoDict): # Take in the info and initialize variables
self.givenInfo = infoDict
for key in infoDict:
self.results[key] = (infoDict[key],) # Store in tuples
print("infoDict:\t\t\t", infoDict)
def storeResult(self, key, value):
if key in self.givenInfo: # If a value was given, don't change it in the results
return "Result Ignored"
elif key in self.results: # If the value wasn't given, but we already have a result
self.results[key] += (value,)
return "Result Appended"
else:
self.results[key] = (value,)
return "Result Stored"
def getResult(self, key):
if key in self.results:
mostCommonResult = Utilities.most_common(self.results[key])
return mostCommonResult
else:
return ""
def getResults(self):
return self.results
def runLookup(self):
self.lookupByName()
def lookupByName(self):
name = self.getResult('name')
#wiki = net.getSrcCodeOf("https://en.wikipedia.org/wiki/" + fName + " " + mName + " " + lName + " (disambiguation)")
#duck = net.getSrcCodeOf("https://en.wikipedia.org/wiki/" + fName + " " + mName + " " + lName + " (disambiguation)")
wolframPerson = WolframPerson.WolframPerson(self, name)