question logging working
This commit is contained in:
parent
f5c7bbab00
commit
181859f007
2 changed files with 22 additions and 3 deletions
4
asked_questions_log.txt
Normal file
4
asked_questions_log.txt
Normal file
|
|
@ -0,0 +1,4 @@
|
||||||
|
hi /nboo /n
|
||||||
|
|
||||||
|
test
|
||||||
|
test2
|
||||||
21
main.py
21
main.py
|
|
@ -1,7 +1,22 @@
|
||||||
import json
|
import json
|
||||||
#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))
|
print ("I think that you asked " + (question))
|
||||||
|
|
||||||
|
#Record question to asked question log file
|
||||||
|
#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.
|
||||||
|
file_object.seek(0)
|
||||||
|
# If file is not empty then append '\n'
|
||||||
|
data = file_object.read(100)
|
||||||
|
if len(data) > 0 :
|
||||||
|
file_object.write("\n")
|
||||||
|
# Append text at the end of file
|
||||||
|
file_object.write(question)
|
||||||
|
|
||||||
#def jaccard_similarity(list1, list2):
|
#def jaccard_similarity(list1, list2):
|
||||||
# s1 = set(list1)
|
# s1 = set(list1)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue