general updates
This commit is contained in:
parent
181859f007
commit
98c9444338
2 changed files with 19 additions and 11 deletions
|
|
@ -1,4 +1,10 @@
|
|||
hi /nboo /n
|
||||
|
||||
test
|
||||
test2
|
||||
test2
|
||||
test123
|
||||
Testing exit code
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
22
main.py
22
main.py
|
|
@ -1,14 +1,10 @@
|
|||
import json
|
||||
import sys
|
||||
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))
|
||||
|
||||
#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:
|
||||
if question.isalpha: (print ("I think that you asked " + (question))
|
||||
# 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'
|
||||
|
|
@ -16,7 +12,13 @@ with open("asked_questions_log.txt", "a+") as file_object:
|
|||
if len(data) > 0 :
|
||||
file_object.write("\n")
|
||||
# Append text at the end of file
|
||||
file_object.write(question)
|
||||
file_object.write(question))
|
||||
|
||||
|
||||
#else:
|
||||
# sys.exit()
|
||||
|
||||
|
||||
|
||||
#def jaccard_similarity(list1, list2):
|
||||
# s1 = set(list1)
|
||||
|
|
@ -30,5 +32,5 @@ with open("asked_questions_log.txt", "a+") as file_object:
|
|||
with open('faq.json', 'r') as f:
|
||||
questionBank = json.load(f)
|
||||
|
||||
# Output: {'name': 'Bob', 'languages': ['English', 'French']}
|
||||
# Output json file for testing
|
||||
print(questionBank)
|
||||
Loading…
Reference in a new issue