-
Notifications
You must be signed in to change notification settings - Fork 1
/
addon.py
27 lines (22 loc) · 935 Bytes
/
addon.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
import os
import json
class questionnaire:
def __init__(self, skill_triggered, utterance):
self.skill = skill_triggered
self.utterance = utterance
self.survey = []
def ask_and_save(self, number):
question = self.get_question(number)
answer = self.skill.ask_yesno(question)
self.survey.append((self.utterance[0], question, answer))
def skill_interaction_response(self):
self.ask_and_save(1)
self.ask_and_save(2)
# self.speak_dialog(str(self.survey))
survey_copy = self.survey.copy()
with open(os.path.join(self.skill.root_dir, 'log_file_ours.json'), 'w') as f:
json.dump(survey_copy, f, indent=4, sort_keys=True)
def get_question(self, number):
question = {1: "Do you know you lost private information?",
2: "In your opinion which information got lost?"}
return question[number]