This commit is contained in:
David Lawler 2022-03-01 08:56:24 +10:00
commit b0505cdd11
2 changed files with 29 additions and 0 deletions

19
main.py Normal file
View file

@ -0,0 +1,19 @@
import json
#print("Hello, I am a question answering bot.\n")
#Question = str(input("Please enter a question, and press the ENTER key:\n"))
#print ("I think that you asked " + (Question))
#def jaccard_similarity(list1, list2):
# s1 = set(list1)
# s2 = set(list2)
# return float(len(s1.intersection(s2)) / len(s1.union(s2)))
#list1 = ['dog', 'cat', 'cat', 'rat']
#list2 = ['dog', 'cat', 'mouse']
#jaccard_similarity(list1, list2)
with open('questionbank.json', 'r') as f:
questionBank = json.load(f)
# Output: {'name': 'Bob', 'languages': ['English', 'French']}
print(questionBank)

10
questionBank.json Normal file
View file

@ -0,0 +1,10 @@
[
{
"question": "What day is today?",
"answer": "Monday"
},
{
"question": "What is the weather like today?",
"answer": "Same as yesterday."
}
]