general updates
This commit is contained in:
parent
181859f007
commit
98c9444338
2 changed files with 19 additions and 11 deletions
|
|
@ -2,3 +2,9 @@ hi /nboo /n
|
||||||
|
|
||||||
test
|
test
|
||||||
test2
|
test2
|
||||||
|
test123
|
||||||
|
Testing exit code
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
22
main.py
22
main.py
|
|
@ -1,14 +1,10 @@
|
||||||
import json
|
import json
|
||||||
|
import sys
|
||||||
print("Hello, I am a question answering bot.\n")
|
print("Hello, I am a question answering bot.\n")
|
||||||
question = str(input("Please enter a question, and press the ENTER key:\n"))
|
question = str(input("Please enter a question, and press the ENTER key:\n"))
|
||||||
print ("I think that you asked " + (question))
|
if question.isalpha: (print ("I think that you asked " + (question))
|
||||||
|
# Open the file in append & read mode ('a+')
|
||||||
#Record question to asked question log file
|
with open("asked_questions_log.txt", "a+") as file_object:
|
||||||
#with open('asked_questions_log.txt', 'a') as f:
|
|
||||||
# f.write('{} {}'.format(question,"/n"))
|
|
||||||
|
|
||||||
# Open the file in append & read mode ('a+')
|
|
||||||
with open("asked_questions_log.txt", "a+") as file_object:
|
|
||||||
# Move read cursor to the start of file.
|
# Move read cursor to the start of file.
|
||||||
file_object.seek(0)
|
file_object.seek(0)
|
||||||
# If file is not empty then append '\n'
|
# If file is not empty then append '\n'
|
||||||
|
|
@ -16,7 +12,13 @@ with open("asked_questions_log.txt", "a+") as file_object:
|
||||||
if len(data) > 0 :
|
if len(data) > 0 :
|
||||||
file_object.write("\n")
|
file_object.write("\n")
|
||||||
# Append text at the end of file
|
# Append text at the end of file
|
||||||
file_object.write(question)
|
file_object.write(question))
|
||||||
|
|
||||||
|
|
||||||
|
#else:
|
||||||
|
# sys.exit()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#def jaccard_similarity(list1, list2):
|
#def jaccard_similarity(list1, list2):
|
||||||
# s1 = set(list1)
|
# s1 = set(list1)
|
||||||
|
|
@ -30,5 +32,5 @@ with open("asked_questions_log.txt", "a+") as file_object:
|
||||||
with open('faq.json', 'r') as f:
|
with open('faq.json', 'r') as f:
|
||||||
questionBank = json.load(f)
|
questionBank = json.load(f)
|
||||||
|
|
||||||
# Output: {'name': 'Bob', 'languages': ['English', 'French']}
|
# Output json file for testing
|
||||||
print(questionBank)
|
print(questionBank)
|
||||||
Loading…
Reference in a new issue